From c24686258cfe9ddbc68386229a440f9d570ec012 Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 3 Jun 2026 17:40:25 +0200 Subject: [PATCH 001/268] added autocompletion for person search --- service/src/main/inse/logic.py | 90 +++++++++++++- service/src/main/inse/service.py | 16 +++ webapp/src/app/api/api/persons.service.ts | 66 ++++++++++ .../app/api/api/persons.serviceInterface.ts | 9 ++ .../app/modules/person/person.component.ts | 15 ++- .../ui/app-layout/app-layout.component.html | 12 +- .../ui/app-layout/app-layout.component.scss | 29 ----- .../ui/app-layout/app-layout.component.ts | 15 +-- .../app-searchbar.component.html | 23 ++++ .../app-searchbar.component.scss | 28 +++++ .../app-searchbar/app-searchbar.component.ts | 115 ++++++++++++++++++ 11 files changed, 361 insertions(+), 57 deletions(-) create mode 100644 webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.html create mode 100644 webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss create mode 100644 webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 5bd6d268..b47f9930 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -390,6 +390,94 @@ def search_persons_by_name(author_name: str, limit: Optional[int] = 10, include: return AuthorsListResponse(results=persons) + +def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, include: Optional[str] = None) -> AuthorsListResponse: + if not author_name: + raise HTTPException( + status_code=400, + detail="name must be provided" + ) + + search_query = { + "function_score": { + "query": { + "wildcard": { + "display_name.keyword": { + "value": author_name + "*", + "case_insensitive": True + } + } + }, + "functions": [ + { + "script_score": { + "script": { + "lang": "painless", + "source": "String name = doc['display_name.keyword'].value.toLowerCase(); String[] parts = name.splitOnToken(' '); Set unique = new HashSet(); for (String p : parts) { unique.add(p); } return unique.size() > 1 ? 1.0 : 0.3;" + } + } + } + ], + "boost_mode": "multiply" + } + } + script_fields ={ + "affiliations": { + "script": { + "lang": "painless", + "source": "def aff = params._source['affiliations']; if (aff != null && aff.size() > 0) { return aff[aff.size() - 1]; } return [];" + } + } + } + collapse ={ + "field":"display_name.keyword" + } + body = { + "size":limit, + "query":search_query, + "script_fields":script_fields, + "_source":include.split(",") if include else True, + "sort":[{"works_count": {"order": "desc"}}], + "collapse":collapse + } + try: + response = elasticsearch.search( + index="openalex-authors", + body=body + ) + + except Exception as e: + raise HTTPException( + status_code=500, + detail=f"Elasticsearch search failed: {str(e)}" + ) + + hits = response.get("hits", {}).get("hits", []) + + persons = [] + for hit in hits: + fields = hit.get("fields",{}) + source = hit.get("_source",{}) + source_copy = dict (source) + source_copy["id"] = hit.get("_id", "") or source_copy.get("id") + + # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) + ids = source_copy.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) + source_copy["ids"] = ids_copy + + for key,value in fields.items(): + source_copy[key] = value + author = Author.from_dict(source_copy) + persons.append(author) + + return AuthorsListResponse(results=persons) + def search_persons_by_institution( institution_name: str, limit: Optional[int] = 10, @@ -417,8 +505,8 @@ def search_persons_by_institution( "query":search_query, "_source":include.split(",") if include else True, "sort":[{"works_count": {"order": "desc"}}] + } - print(body) try: response = elasticsearch.search( index="openalex-authors", diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index 73c0fc65..522087ee 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -224,6 +224,22 @@ def search_persons_by_name( )]): return logic.search_persons_by_name(author_name=author_name,include=include) +@app.get('/persons/autocomplete', + operation_id='searchPersonsAutocomplete', + response_model=AuthorsListResponse, + summary='Searches for person by name.', + tags=[ 'Persons' ]) +def search_persons_autocomplete( + author_name: Annotated[str, Query(description="Authors name (e.g., Arman Arzani)")], + include : Annotated[Optional[str], Query( + description=( + "Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, " + "last_known_institutions, ..." + ), + example="topics_full,topic_share" + )]): + return logic.search_persons_autocomplete(author_name=author_name,include=include) + @app.get('/persons/searchByInstitution', operation_id='searchPersonsByInstitution', response_model=AuthorsListResponse, diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index aa9747cb..810bc2cd 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -234,6 +234,72 @@ export class PersonsOpenApiService extends BaseService implements PersonsOpenApi ); } + /** + * Searches for person by name. + * @endpoint get /persons/autocomplete + * @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, ... + * @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 searchPersonsAutocomplete(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsAutocomplete(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorName === null || authorName === undefined) { + throw new Error('Required parameter authorName was null or undefined when calling searchPersonsAutocomplete.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsAutocomplete.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorName, 'author_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + 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 = `/persons/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + /** * Searches for persons by institution name. * @endpoint get /persons/searchByInstitution diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts index 67b9a127..23fd7a08 100644 --- a/webapp/src/app/api/api/persons.serviceInterface.ts +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -52,6 +52,15 @@ export interface PersonsOpenApiServiceInterface { */ searchPersons(authorId?: string, query?: string, include?: string, extraHttpRequestParams?: any): Observable; + /** + * Searches for person by name. + * + * @endpoint get /persons/autocomplete + * @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, ... + */ + searchPersonsAutocomplete(authorName: string, include: string, extraHttpRequestParams?: any): Observable; + /** * Searches for persons by institution name. * diff --git a/webapp/src/app/modules/person/person.component.ts b/webapp/src/app/modules/person/person.component.ts index 06674875..55099c5a 100644 --- a/webapp/src/app/modules/person/person.component.ts +++ b/webapp/src/app/modules/person/person.component.ts @@ -7,7 +7,7 @@ import { MatTabsModule } from '@angular/material/tabs'; import { ActivatedRoute, RouterModule, RouterOutlet } from '@angular/router'; import { of, switchMap, finalize, map, catchError } from 'rxjs'; -import { Author, PersonsOpenApiService } from '../../api'; +import { Author, AuthorAffiliationsInner, PersonsOpenApiService } from '../../api'; import { PersonInterestingComponent } from '../person-interesting/person-interesting.component'; const PERSON_INCLUDE_TAGS = @@ -93,11 +93,20 @@ readonly personBio = toSignal( readonly primaryAffiliation = computed( () => this.person()?.affiliations?.[0] ?? null, ); + readonly lastAffiliation = computed( + ()=> { + let lastAffiliation: number | undefined = 0 + if (this.person()?.affiliations?.length != undefined){ + lastAffiliation = this.person()?.affiliations?.length + } + return (lastAffiliation ? this.person()?.affiliations?.[lastAffiliation - 1] : this.person()?.affiliations?.[0]) ?? null + } + ) readonly institution = computed( - () => this.primaryAffiliation()?.institution?.display_name ?? 'Unbekannte Institution', + () => this.lastAffiliation()?.institution?.display_name ?? 'Unbekannte Institution', ); readonly countryCode = computed( - () => this.primaryAffiliation()?.institution?.country_code ?? null, + () => this.lastAffiliation()?.institution?.country_code ?? null, ); readonly worksCount = computed(() => this.person()?.works_count ?? null); readonly citedByCount = computed(() => this.person()?.cited_by_count ?? null); diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.html b/webapp/src/app/shared/ui/app-layout/app-layout.component.html index b2fe1274..ef8b9baa 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.html +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.html @@ -34,17 +34,7 @@ Zurück zur Suche - - - +
diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.scss b/webapp/src/app/shared/ui/app-layout/app-layout.component.scss index 83fb51a9..2b4f48bb 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.scss +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.scss @@ -1,5 +1,4 @@ @use '@angular/material' as mat; -@import '../../../../m3-theme.scss'; .app-shell { height: 100svh; @@ -72,34 +71,6 @@ mat-toolbar.main { height: 20px; } -.search-box { - display: flex; - align-items: center; - gap: 12px; - height: 44px; - align-self: center; - padding: 0 18px; - background: var(--sg-surface-muted); - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - color: var(--sg-text-soft); - font-size: 13px; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8); -} - -.search-box input { - width: 100%; - min-width: 0; - border: 0; - outline: 0; - background: transparent; - color: var(--sg-text); -} - -.search-box input::placeholder { - color: var(--sg-text-muted); -} - .drawer { width: var(--sg-sidebar-width); background: var(--sg-surface); diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts index e246822d..d858400d 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts @@ -9,13 +9,12 @@ import { MediaMatcher } from '@angular/cdk/layout'; import { AppMenuComponent } from '../app-menu/app-menu.component'; import { MatTooltipModule } from '@angular/material/tooltip'; import { CredentialService } from '../../services/credential.service'; -import { FormControl,ReactiveFormsModule } from '@angular/forms'; -import { SharedStateService } from '../../services/shared-state.service'; import { Location } from '@angular/common'; +import { AppSearchbarComponent } from "../app-searchbar/app-searchbar.component"; @Component({ selector: 'app-layout', - imports: [CommonModule, MatToolbarModule, MatSidenavModule, MatButtonModule, MatIconModule, AppMenuComponent, MatTooltipModule,ReactiveFormsModule], + imports: [CommonModule, MatToolbarModule, MatSidenavModule, MatButtonModule, MatIconModule, AppMenuComponent, MatTooltipModule, AppSearchbarComponent], templateUrl: './app-layout.component.html', styleUrl: './app-layout.component.scss', standalone: true, @@ -30,10 +29,8 @@ export class AppLayoutComponent implements OnInit, OnDestroy { mediaQueryListener: () => void; sideNavOpen = false; - searchValue = new FormControl(''); constructor(public credentialService: CredentialService, public router: Router, private location:Location, - private state: SharedStateService, public changeDetector: ChangeDetectorRef, media: MediaMatcher) { this.mediaQuery = media.matchMedia('(max-width: 600px)'); this.mediaQueryListener = () => { @@ -61,14 +58,6 @@ export class AppLayoutComponent implements OnInit, OnDestroy { this.credentialService.logoutAcount(); 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); - } navigateBack(){ this.location.back() } diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.html b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.html new file mode 100644 index 00000000..145c976a --- /dev/null +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.html @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss new file mode 100644 index 00000000..3f1cae7d --- /dev/null +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss @@ -0,0 +1,28 @@ + +.search-box { + display: flex; + align-items: center; + gap: 12px; + height: 44px; + align-self: center; + padding: 0 18px; + background: var(--sg-surface-muted); + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + color: var(--sg-text-soft); + font-size: 13px; + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8); +} + +.search-box input { + width: 100%; + min-width: 0; + border: 0; + outline: 0; + background: transparent; + color: var(--sg-text); +} + +.search-box input::placeholder { + color: var(--sg-text-muted); +} diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts new file mode 100644 index 00000000..7a7c9628 --- /dev/null +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts @@ -0,0 +1,115 @@ +import { Component, signal, inject,ViewChild } from '@angular/core'; +import { MatIcon } from '@angular/material/icon'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; +import { Observable } from 'rxjs'; +import { Router } from '@angular/router'; +import { SharedStateService } from '../../services/shared-state.service'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatInputModule } from '@angular/material/input'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { map, switchMap, filter } from 'rxjs/operators'; +import { toObservable } from '@angular/core/rxjs-interop'; +import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; +import { PersonsOpenApiService } from '../../../api'; +import { AuthorsListResponse, Author } from '../../../api'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { DestroyRef } from '@angular/core'; +import { of } from 'rxjs'; +import { MatAutocompleteTrigger,MatAutocomplete } from '@angular/material/autocomplete'; +export interface State { + flag: string; + name: string; + population: string; +} + +@Component({ + selector: 'app-searchbar', + standalone: true, + imports: [ + MatIcon, + ReactiveFormsModule, + MatAutocompleteModule, + MatInputModule, + MatFormFieldModule, + ], + templateUrl: './app-searchbar.component.html', + styleUrl: './app-searchbar.component.scss', +}) +export class AppSearchbarComponent { + @ViewChild(MatAutocompleteTrigger) autocompleteTrigger!: MatAutocompleteTrigger; + @ViewChild(MatAutocomplete) autocomplete!: MatAutocomplete; + searchValue = new FormControl(''); + searchControl = new FormControl(''); + showAutocomplete = false; + + filteredPersons: AuthorsListResponse = { + meta: null, + results: [], + group_by: [], + }; + + private destroyRef = inject(DestroyRef); + constructor( + public router: Router, + private state: SharedStateService, + private personService: PersonsOpenApiService, + ) { + this.searchControl.valueChanges + .pipe( + debounceTime(100), + distinctUntilChanged(), + switchMap((v: any) => { + const value = v ?? ''; + + if (value.length < 2) { + return of(this.emptyPersons()); + } + + return this.personService.searchPersonsAutocomplete( + value, + 'display_name', + ); + }), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe((results) => { + this.filteredPersons = results; + }); + } + emptyPersons(): AuthorsListResponse { + return { + meta: null, + results: [], + group_by: [], + }; + } + selectPerson(personName: string | undefined | null) { + if (personName) { + this.searchControl.setValue(personName); + this.startSearch() + } + } + onKeydownTab(event: KeyboardEvent) { + event.preventDefault(); // stop focus jump + const first = this.filteredPersons?.results?.[0]; + if (first && first.display_name) { + this.searchControl.setValue(first.display_name); + } + } + onEnter() { + this.autocompleteTrigger.closePanel() + this.startSearch(); + } + onFocus() { + this.autocompleteTrigger.openPanel() + } + + startSearch() { + console.log('updated to', this.searchControl.value, this.router.url); + + if (this.router.url.startsWith('/persons')) { + this.router.navigate(['/persons']); + } + this.state.searchValue.set(this.searchControl.value); + } +} From a9822ca5ff0701e5513f1d7e6e539c9353b99843 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Thu, 4 Jun 2026 10:29:41 +0200 Subject: [PATCH 002/268] refactor(backend/persons): move person logic from logic.py to seperate folder --- service/src/main/inse/logic.py | 209 +-------------------- service/src/main/inse/persons/__init__.py | 0 service/src/main/inse/persons/logic.py | 216 ++++++++++++++++++++++ 3 files changed, 217 insertions(+), 208 deletions(-) create mode 100644 service/src/main/inse/persons/__init__.py create mode 100644 service/src/main/inse/persons/logic.py diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 688c81d9..22723fa2 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -12,23 +12,16 @@ from typing import Type from sqlalchemy.orm import Session from sqlalchemy import select from sqlalchemy import func -from fastapi import HTTPException import logging import httpx import json -import time from . import schema from . import model from . import config -from .integrations import elasticsearch from .integrations import llm -from . import util -from elasticsearch import Elasticsearch, helpers, NotFoundError, ApiError +from elasticsearch import Elasticsearch -from inse.models.author import Author -from inse.models.authors_list_response import AuthorsListResponse -from inse.models.meta import Meta from inse.models.topic import Topic from inse.models.topic_subfield import TopicSubfield from inse.models.topic_field import TopicField @@ -249,203 +242,3 @@ def count_topic_hierarchy(topic_names: List[str]) -> dict: counts["domains"][domain] = counts["domains"].get(domain, 0) + 1 return counts - - -### persons - - -def search_persons( - author_id: Optional[str] = None, - query: Optional[str] = None, - include: Optional[set[str]] = None, -) -> AuthorsListResponse: - if author_id: - query_field = "_id" - query_value = author_id - elif query: - query_field = "display_name" - query_value = query - else: - return AuthorsListResponse(results=[], meta=Meta(count=0)) - - data = elasticsearch.search( - index="openalex-authors", query_field=query_field, query_value=query_value - ) - - authors = [] - for hit in data.get("hits", {}).get("hits", []): - source = hit.get("_source", {}) - source_copy = dict(source) - source_copy["id"] = source_copy.get("id") or hit.get("_id", "") - - # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) - ids = source_copy.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) - source_copy["ids"] = ids_copy - - author = Author.from_dict(source_copy) - if author: - authors.append(author) - - return AuthorsListResponse(results=authors, meta=Meta(count=len(authors))) - - -def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str: - start_time = time.time() - search_result = search_persons(author_id=author_id) - if not search_result.results: - return "No person found." - if len(search_result.results) > 1: - return "Multiple persons found, cannot generate bio." - - person = search_result.results[0] - person_json = json.dumps(person.model_dump_json()) - - system_prompt = """\ - Erstelle auf Basis der bereitgestellten OpenAlex-Daten ein kurzes Porträt der Person in 3-5 Sätzen. Die Person selbst ist das Subjekt: Beginne mit ihrem Namen und beschreibe sie als Forschende:n (z. B. „{name} ist ein:e Forscher:in im Bereich …"). Schreibe nicht über „die Forschung" oder „die Arbeit" im Abstrakten, sondern durchgehend über die Person. - - Gehe dabei auf folgende drei Punkte ein: - - 1. Besonderheiten: Was hebt die Person im Vergleich zu anderen Forschenden ähnlicher Karrierephase und ähnlichen Feldes hervor? (z. B. überdurchschnittlicher Impact gemessen an der aktiven Zeit, hoher Erst-/Korrespondenzautor-Anteil, einzelnes Breakout-Paper, frühe Positionierung in einem später gewachsenen Thema) - 2. Wirtschaftliche Relevanz: Arbeitet die Person in einem grundsätzlich anwendungsnahen/kommerziell interessanten Themenfeld oder eher in der Grundlagenforschung? - 3. Dynamik: Entwickelt sich ihr Publikations-/Zitationsverlauf zuletzt steigend, konstant oder abflachend? - - Stütze jede Aussage auf konkrete Werte aus den Daten und formuliere nichts, was sich nicht belegen lässt. Wenn die Daten für einen Punkt keine klare Aussage zulassen, formuliere ihn entsprechend zurückhaltend oder lasse ihn weg, statt zu spekulieren. Gib nur das Porträt zurück, ohne Einleitung oder Schluss.\ - """ - - user_prompt = f"Daten zur Person:\n{person_json}" - - headers = { - "Authorization": f"Bearer {config.settings.llm_api_key}", - "Content-Type": "application/json", - } - payload = { - "model": config.settings.llm_model, - "prompt": f"{system_prompt}\n{user_prompt}", - "stream": False, - } - - with httpx.Client(timeout=30.0) as client: - response = client.post( - config.settings.llm_api_url, json=payload, headers=headers - ) - response.raise_for_status() - data = response.json() - bio = data.get("response", "") - - elapsed_time = time.time() - start_time - logger.info( - f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds" - ) - - return bio - -def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse: - body = { - "_source":include.split(",") if include else True, - } - - try: - hit = elasticsearch.get( - index="openalex-authors", - body=body, - doc_id=author_id - ) - except NotFoundError: - raise HTTPException( - status_code=404, detail=f"Person with id {author_id} not found" - ) - - except ApiError as e: - raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}") - persons = [util.get_persons_data(hit)] - - return AuthorsListResponse(results=persons) - - -def search_persons_by_name( - author_name: str, limit: Optional[int] = 10, include: Optional[str] = None -) -> AuthorsListResponse: - if not author_name: - raise HTTPException(status_code=400, detail="name must be provided") - - search_query = { - "bool": { - "should": [ - {"match_phrase": {"display_name": {"query": author_name, "boost": 5}}}, - { - "match_phrase_prefix": { - "display_name": {"query": author_name, "boost": 3} - } - }, - # { - # "match": { - # "display_name": { - # "query": author_name, - # "fuzziness": 1 - # } - # } - # } - ], - "minimum_should_match": 1, - } - } - try: - response = elasticsearch.search( - index="openalex-authors", - query=search_query, - source=include.split(",") if include else True, - size=limit, - ) - - except Exception as e: - raise HTTPException( - status_code=500, detail=f"Elasticsearch search failed: {str(e)}" - ) - - hits = response.get("hits", {}).get("hits", []) - - persons = [util.get_persons_data(hit) for hit in hits] - - return AuthorsListResponse(results=persons) - - -def search_persons_by_institution( - institution_name: str, limit: Optional[int] = 10, include: Optional[str] = None -) -> AuthorsListResponse: - - if not institution_name: - raise HTTPException(status_code=400, detail="institution_name must be provided") - - search_query = { - "nested": { - "path": "affiliations", - "query": { - "match_phrase": { - "affiliations.institution.display_name": institution_name - } - }, - } - } - try: - response = elasticsearch.search( - index="openalex-authors", - query=search_query, - source=include.split(",") if include else True, - size=limit, - sort=[{"works_count": {"order": "desc"}}], - ) - - except Exception as e: - raise HTTPException( - status_code=500, detail=f"Elasticsearch search failed: {str(e)}" - ) - - hits = response.get("hits", {}).get("hits", []) - persons = [util.get_persons_data(hit) for hit in hits] - return AuthorsListResponse(results=persons) diff --git a/service/src/main/inse/persons/__init__.py b/service/src/main/inse/persons/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py new file mode 100644 index 00000000..a93eb1bb --- /dev/null +++ b/service/src/main/inse/persons/logic.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Business logic for persons / authors. +""" + +import json +import logging +import time +from typing import Optional + +import httpx +from fastapi import HTTPException + +from .. import config +from .. import util +from ..integrations import elasticsearch + +from inse.models.author import Author +from inse.models.authors_list_response import AuthorsListResponse +from inse.models.meta import Meta + +logger = logging.getLogger(__name__) + + +def search_persons( + author_id: Optional[str] = None, + query: Optional[str] = None, + include: Optional[set[str]] = None, +) -> AuthorsListResponse: + if author_id: + query_field = "_id" + query_value = author_id + elif query: + query_field = "display_name" + query_value = query + else: + return AuthorsListResponse(results=[], meta=Meta(count=0)) + + data = elasticsearch.search( + index="openalex-authors", query_field=query_field, query_value=query_value + ) + + authors = [] + for hit in data.get("hits", {}).get("hits", []): + source = hit.get("_source", {}) + source_copy = dict(source) + source_copy["id"] = source_copy.get("id") or hit.get("_id", "") + + # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) + ids = source_copy.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) + source_copy["ids"] = ids_copy + + author = Author.from_dict(source_copy) + if author: + authors.append(author) + + return AuthorsListResponse(results=authors, meta=Meta(count=len(authors))) + + +def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str: + start_time = time.time() + search_result = search_persons(author_id=author_id) + if not search_result.results: + return "No person found." + if len(search_result.results) > 1: + return "Multiple persons found, cannot generate bio." + + person = search_result.results[0] + person_json = json.dumps(person.model_dump_json()) + + system_prompt = """\ + Erstelle auf Basis der bereitgestellten OpenAlex-Daten ein kurzes Porträt der Person in 3-5 Sätzen. Die Person selbst ist das Subjekt: Beginne mit ihrem Namen und beschreibe sie als Forschende:n (z. B. „{name} ist ein:e Forscher:in im Bereich …"). Schreibe nicht über „die Forschung" oder „die Arbeit" im Abstrakten, sondern durchgehend über die Person. + + Gehe dabei auf folgende drei Punkte ein: + + 1. Besonderheiten: Was hebt die Person im Vergleich zu anderen Forschenden ähnlicher Karrierephase und ähnlichen Feldes hervor? (z. B. überdurchschnittlicher Impact gemessen an der aktiven Zeit, hoher Erst-/Korrespondenzautor-Anteil, einzelnes Breakout-Paper, frühe Positionierung in einem später gewachsenen Thema) + 2. Wirtschaftliche Relevanz: Arbeitet die Person in einem grundsätzlich anwendungsnahen/kommerziell interessanten Themenfeld oder eher in der Grundlagenforschung? + 3. Dynamik: Entwickelt sich ihr Publikations-/Zitationsverlauf zuletzt steigend, konstant oder abflachend? + + Stütze jede Aussage auf konkrete Werte aus den Daten und formuliere nichts, was sich nicht belegen lässt. Wenn die Daten für einen Punkt keine klare Aussage zulassen, formuliere ihn entsprechend zurückhaltend oder lasse ihn weg, statt zu spekulieren. Gib nur das Porträt zurück, ohne Einleitung oder Schluss.\ + """ + + user_prompt = f"Daten zur Person:\n{person_json}" + + headers = { + "Authorization": f"Bearer {config.settings.llm_api_key}", + "Content-Type": "application/json", + } + payload = { + "model": config.settings.llm_model, + "prompt": f"{system_prompt}\n{user_prompt}", + "stream": False, + } + + with httpx.Client(timeout=30.0) as client: + response = client.post( + config.settings.llm_api_url, json=payload, headers=headers + ) + response.raise_for_status() + data = response.json() + bio = data.get("response", "") + + elapsed_time = time.time() - start_time + logger.info( + f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds" + ) + + return bio + + +def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse: + try: + hit = elasticsearch.get( + index="openalex-authors", + doc_id=author_id, + source=include.split(",") if include else None, + ) + except httpx.HTTPStatusError as e: + if e.response.status_code == 404: + raise HTTPException( + status_code=404, detail=f"Person with id {author_id} not found" + ) + raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}") + persons = [util.get_persons_data(hit)] + + return AuthorsListResponse(results=persons) + + +def search_persons_by_name( + author_name: str, limit: Optional[int] = 10, include: Optional[str] = None +) -> AuthorsListResponse: + if not author_name: + raise HTTPException(status_code=400, detail="name must be provided") + + search_query = { + "bool": { + "should": [ + {"match_phrase": {"display_name": {"query": author_name, "boost": 5}}}, + { + "match_phrase_prefix": { + "display_name": {"query": author_name, "boost": 3} + } + }, + # { + # "match": { + # "display_name": { + # "query": author_name, + # "fuzziness": 1 + # } + # } + # } + ], + "minimum_should_match": 1, + } + } + try: + response = elasticsearch.search( + index="openalex-authors", + query=search_query, + source=include.split(",") if include else True, + size=limit, + ) + + except Exception as e: + raise HTTPException( + status_code=500, detail=f"Elasticsearch search failed: {str(e)}" + ) + + hits = response.get("hits", {}).get("hits", []) + + persons = [util.get_persons_data(hit) for hit in hits] + + return AuthorsListResponse(results=persons) + + +def search_persons_by_institution( + institution_name: str, limit: Optional[int] = 10, include: Optional[str] = None +) -> AuthorsListResponse: + + if not institution_name: + raise HTTPException(status_code=400, detail="institution_name must be provided") + + search_query = { + "nested": { + "path": "affiliations", + "query": { + "match_phrase": { + "affiliations.institution.display_name": institution_name + } + }, + } + } + try: + response = elasticsearch.search( + index="openalex-authors", + query=search_query, + source=include.split(",") if include else True, + size=limit, + sort=[{"works_count": {"order": "desc"}}], + ) + + except Exception as e: + raise HTTPException( + status_code=500, detail=f"Elasticsearch search failed: {str(e)}" + ) + + hits = response.get("hits", {}).get("hits", []) + persons = [util.get_persons_data(hit) for hit in hits] + return AuthorsListResponse(results=persons) From 9f5835a5d30bad668ddcdd23a892d078ee1713d7 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Thu, 4 Jun 2026 10:31:21 +0200 Subject: [PATCH 003/268] refactor(backend/persons): update person logic references to use persons_logic module --- service/src/main/inse/service.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index 76f59946..c3ec0329 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -23,6 +23,7 @@ from fastapi import APIRouter from . import model from . import logic +from .persons import logic as persons_logic from . import schema from . import database from . import security @@ -248,7 +249,7 @@ def search_persons( if include else None ) - return logic.search_persons(author_id, query, include_set) + return persons_logic.search_persons(author_id, query, include_set) @router.get( @@ -275,7 +276,7 @@ def generate_person_bio( if include else None ) - bio = logic.generate_person_bio(author_id, include_set) + bio = persons_logic.generate_person_bio(author_id, include_set) return model.PersonBio(bio=bio) @@ -301,7 +302,7 @@ def get_person_by_id( ), ], ): - return logic.get_person_by_id(author_id=id, include=include) + return persons_logic.get_person_by_id(author_id=id, include=include) @router.get( @@ -324,7 +325,7 @@ def search_persons_by_name( ), ], ): - return logic.search_persons_by_name(author_name=author_name, include=include) + return persons_logic.search_persons_by_name(author_name=author_name, include=include) @router.get( @@ -349,4 +350,4 @@ def search_persons_by_institution( ), ], ): - return logic.search_persons_by_institution(institution_name, include=include) + return persons_logic.search_persons_by_institution(institution_name, include=include) From 75514b7f5781b35266aabe970c67575e654d8462 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Thu, 4 Jun 2026 10:32:47 +0200 Subject: [PATCH 004/268] fix(backend/elasticsearch): update get function to use query parameters instead of body --- .../src/main/inse/integrations/elasticsearch.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/service/src/main/inse/integrations/elasticsearch.py b/service/src/main/inse/integrations/elasticsearch.py index 3d744ad9..e045987c 100644 --- a/service/src/main/inse/integrations/elasticsearch.py +++ b/service/src/main/inse/integrations/elasticsearch.py @@ -49,22 +49,23 @@ def search( return response.json() def get( index: str, - doc_id:str, - body: dict = None, - + doc_id: str, + source: list = None, ) -> dict[str, Any]: headers = { "Authorization": f"ApiKey {config.settings.elasticsearch_api_key}", "Content-Type": "application/json" } - payload = body - - # get document directly + + params = {} + if source is not None: + params["_source_includes"] = ",".join(source) + with httpx.Client() as client: response = client.get( f"{config.settings.elasticsearch_url}/{index}/_doc/{doc_id}", - json=payload, + params=params, headers=headers ) response.raise_for_status() From ec2899fad96c88a15761f90294fc8a50549b51fd Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Thu, 4 Jun 2026 11:07:19 +0200 Subject: [PATCH 005/268] refactor(backend/persons): move person logic and endpoints to own package --- service/src/main/inse/main.py | 2 + service/src/main/inse/model.py | 3 - service/src/main/inse/persons/model.py | 12 ++ service/src/main/inse/persons/service.py | 153 +++++++++++++++++++++++ service/src/main/inse/service.py | 141 --------------------- 5 files changed, 167 insertions(+), 144 deletions(-) create mode 100644 service/src/main/inse/persons/model.py create mode 100644 service/src/main/inse/persons/service.py diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index 41d776c2..2b018c5d 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -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.persons.service import router as persons_service_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(persons_service_router) app.include_router(service_router) app.include_router(account_router) diff --git a/service/src/main/inse/model.py b/service/src/main/inse/model.py index aaac61b1..669f049f 100644 --- a/service/src/main/inse/model.py +++ b/service/src/main/inse/model.py @@ -36,8 +36,5 @@ class Page(BaseModel, Generic[T]): class ItemPage(Page[Item]): pass -class PersonBio(BaseModel): - bio: str = Field(description="The generated biography.") - diff --git a/service/src/main/inse/persons/model.py b/service/src/main/inse/persons/model.py new file mode 100644 index 00000000..4da3f5fe --- /dev/null +++ b/service/src/main/inse/persons/model.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Data models for persons / authors. +""" + +from pydantic import BaseModel +from pydantic import Field + + +class PersonBio(BaseModel): + bio: str = Field(description="The generated biography.") diff --git a/service/src/main/inse/persons/service.py b/service/src/main/inse/persons/service.py new file mode 100644 index 00000000..94fca980 --- /dev/null +++ b/service/src/main/inse/persons/service.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +REST API for persons / authors. +""" + +from typing import Annotated, Optional + +from fastapi import APIRouter +from fastapi import Path +from fastapi import Query + +from . import logic +from . import model +from inse.models.authors_list_response import AuthorsListResponse + + +router = APIRouter( + prefix="/api/inse-service", + tags=["Persons"], + responses={404: {"description": "Not found"}}, +) + + +@router.get( + "/persons/search", + operation_id="searchPersons", + response_model=AuthorsListResponse, + summary="Searches for persons by ID or name.", + response_model_exclude_none=True, +) +def search_persons( + author_id: Annotated[ + str, Query(description="OpenAlex author ID (e.g., A5093075883)") + ] = None, + query: Annotated[ + str, Query(description="Search query (e.g., Arman AND Arzani)") + ] = None, + include: Annotated[ + Optional[str], + Query( + description=( + "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" + ), + 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.search_persons(author_id, query, include_set) + + +@router.get( + "/persons/bio", + operation_id="generatePersonBio", + response_model=model.PersonBio, + summary="Generates a bio for a person by author ID.", +) +def generate_person_bio( + author_id: Annotated[ + str, Query(description="OpenAlex author ID (e.g., A5093075883)") + ], + include: Annotated[ + Optional[str], + Query( + description=("Comma-separated list to 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 + ) + bio = logic.generate_person_bio(author_id, include_set) + return model.PersonBio(bio=bio) + + +@router.get( + "/person/{id}", + operation_id="getPersonByID", + response_model=AuthorsListResponse, + summary="Searches for person by ID.", +) +def get_person_by_id( + id: Annotated[ + str, Path(description="OpenAlex author ID", examples=["A5093075883"]) + ], + include: Annotated[ + Optional[str], + Query( + description=( + "Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, " + "last_known_institutions, ..." + ), + example="topics_full,topic_share", + ), + ], +): + return logic.get_person_by_id(author_id=id, include=include) + + +@router.get( + "/persons/searchByName", + operation_id="searchPersonsByName", + response_model=AuthorsListResponse, + summary="Searches for person by name.", +) +def search_persons_by_name( + author_name: Annotated[str, Query(description="Authors name (e.g., Arman Arzani)")], + include: Annotated[ + Optional[str], + Query( + description=( + "Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, " + "last_known_institutions, ..." + ), + example="topics_full,topic_share", + ), + ], +): + return logic.search_persons_by_name(author_name=author_name, include=include) + + +@router.get( + "/persons/searchByInstitution", + operation_id="searchPersonsByInstitution", + response_model=AuthorsListResponse, + summary="Searches for persons by institution name.", +) +def search_persons_by_institution( + institution_name: Annotated[ + str, Query(description="Institution name (e.g., MIT, Oxford University)") + ], + include: Annotated[ + Optional[str], + Query( + description=( + "Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, " + "last_known_institutions, ..." + ), + example="topics_full,topic_share", + ), + ], +): + return logic.search_persons_by_institution(institution_name, include=include) diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index c3ec0329..92ac3e42 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -23,15 +23,12 @@ from fastapi import APIRouter from . import model from . import logic -from .persons import logic as persons_logic from . import schema from . import database from . import security from . import util from .works import service as works_service -from inse.models.authors_list_response import AuthorsListResponse - logger = logging.getLogger(__name__) @@ -213,141 +210,3 @@ def count_topic_hierarchy( ): return logic.count_topic_hierarchy(topic_names) - -### persons - - -@router.get( - "/persons/search", - operation_id="searchPersons", - response_model=AuthorsListResponse, - summary="Searches for persons by ID or name.", - response_model_exclude_none=True, - tags=["Persons"], -) -def search_persons( - author_id: Annotated[ - str, Query(description="OpenAlex author ID (e.g., A5093075883)") - ] = None, - query: Annotated[ - str, Query(description="Search query (e.g., Arman AND Arzani)") - ] = None, - include: Annotated[ - Optional[str], - Query( - description=( - "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" - ), - example="topics_full,topic_share", - ), - ] = None, -): - include_set = ( - {tag.strip().lower() for tag in include.split(",") if tag.strip()} - if include - else None - ) - return persons_logic.search_persons(author_id, query, include_set) - - -@router.get( - "/persons/bio", - operation_id="generatePersonBio", - response_model=model.PersonBio, - summary="Generates a bio for a person by author ID.", - tags=["Persons"], -) -def generate_person_bio( - author_id: Annotated[ - str, Query(description="OpenAlex author ID (e.g., A5093075883)") - ], - include: Annotated[ - Optional[str], - Query( - description=("Comma-separated list to 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 - ) - bio = persons_logic.generate_person_bio(author_id, include_set) - return model.PersonBio(bio=bio) - - -@router.get( - "/person/{id}", - operation_id="getPersonByID", - response_model=AuthorsListResponse, - summary="Searches for person by ID.", - tags=["Persons"], -) -def get_person_by_id( - id: Annotated[ - str, Path(description="OpenAlex author ID", examples=["A5093075883"]) - ], - include: Annotated[ - Optional[str], - Query( - description=( - "Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, " - "last_known_institutions, ..." - ), - example="topics_full,topic_share", - ), - ], -): - return persons_logic.get_person_by_id(author_id=id, include=include) - - -@router.get( - "/persons/searchByName", - operation_id="searchPersonsByName", - response_model=AuthorsListResponse, - summary="Searches for person by name.", - tags=["Persons"], -) -def search_persons_by_name( - author_name: Annotated[str, Query(description="Authors name (e.g., Arman Arzani)")], - include: Annotated[ - Optional[str], - Query( - description=( - "Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, " - "last_known_institutions, ..." - ), - example="topics_full,topic_share", - ), - ], -): - return persons_logic.search_persons_by_name(author_name=author_name, include=include) - - -@router.get( - "/persons/searchByInstitution", - operation_id="searchPersonsByInstitution", - response_model=AuthorsListResponse, - summary="Searches for persons by institution name.", - tags=["Persons"], -) -def search_persons_by_institution( - institution_name: Annotated[ - str, Query(description="Institution name (e.g., MIT, Oxford University)") - ], - include: Annotated[ - Optional[str], - Query( - description=( - "Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, " - "last_known_institutions, ..." - ), - example="topics_full,topic_share", - ), - ], -): - return persons_logic.search_persons_by_institution(institution_name, include=include) From 9a5c833b3a05c1384c704e9723d9648f3bbeda52 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 4 Jun 2026 13:44:06 +0200 Subject: [PATCH 006/268] refactored for functionality --- service/src/main/inse/logic.py | 4 +--- service/src/main/inse/service.py | 11 ++++++----- .../ui/app-searchbar/app-searchbar.component.ts | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 8a6c0f04..86a477ca 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -19,7 +19,7 @@ import json import time from . import schema from . import model -from . import configxs +from . import config from .integrations import elasticsearch from .integrations import llm from . import util @@ -421,7 +421,6 @@ def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, incl status_code=400, detail="name must be provided" ) - search_query = { "function_score": { "query": { @@ -469,7 +468,6 @@ def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, incl index="openalex-authors", body=body ) - except Exception as e: raise HTTPException( status_code=500, diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index 966ce80a..8d3802da 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -326,11 +326,12 @@ def search_persons_by_name( ): return logic.search_persons_by_name(author_name=author_name, include=include) -@router.get('/persons/autocomplete', - operation_id='searchPersonsAutocomplete', - response_model=AuthorsListResponse, - summary='Searches for person by name.', - tags=[ 'Persons' ]) +@router.get( + '/persons/autocomplete', + operation_id='searchPersonsAutocomplete', + response_model=AuthorsListResponse, + summary='Searches for person by name.', + tags=[ 'Persons' ]) def search_persons_autocomplete( author_name: Annotated[str, Query(description="Authors name (e.g., Arman Arzani)")], include : Annotated[Optional[str], Query( diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts index 7a7c9628..2725c668 100644 --- a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts @@ -10,7 +10,7 @@ import { MatFormFieldModule } from '@angular/material/form-field'; import { map, switchMap, filter } from 'rxjs/operators'; import { toObservable } from '@angular/core/rxjs-interop'; import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; -import { PersonsOpenApiService } from '../../../api'; +import { PersonsService } from '../../../api'; import { AuthorsListResponse, Author } from '../../../api'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { DestroyRef } from '@angular/core'; @@ -52,7 +52,7 @@ export class AppSearchbarComponent { constructor( public router: Router, private state: SharedStateService, - private personService: PersonsOpenApiService, + private personService: PersonsService, ) { this.searchControl.valueChanges .pipe( From 968b7a07234b1f7d48d758da0a1c338b44d71b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Thu, 4 Jun 2026 20:22:44 +0200 Subject: [PATCH 007/268] Added loading indicator while resolving --- .../person-network-graph.component.ts | 3 +- ...person-network-publications.component.html | 27 +-- .../person-network.component.html | 4 +- .../person-network.component.ts | 1 - .../app/modules/person/person.component.html | 162 ++++++++++-------- .../app/modules/person/person.component.scss | 49 +++++- .../app/modules/person/person.component.ts | 115 +++++++++---- .../collaboration-network.resolver.ts | 2 - webapp/src/styles.scss | 18 ++ 9 files changed, 254 insertions(+), 127 deletions(-) diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts index c31f74d2..f3e16580 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts @@ -112,7 +112,8 @@ export class PersonNetworkGraphComponent { roam: true, force: { repulsion: 10000, - edgeLength: 125, + friction: 0.9, + // edgeLength: 25, gravity: 0.2, }, links: item.links.map((e) => { diff --git a/webapp/src/app/modules/person-network-publications/person-network-publications.component.html b/webapp/src/app/modules/person-network-publications/person-network-publications.component.html index a8c4c24b..c9227bb8 100644 --- a/webapp/src/app/modules/person-network-publications/person-network-publications.component.html +++ b/webapp/src/app/modules/person-network-publications/person-network-publications.component.html @@ -41,17 +41,18 @@ -
-
    - @for (collaborator of element.collaborators; track $index) { -
  • - {{ collaborator.name }} - ({{ - collaborator.id - }}) -
  • - } -
-
+ + +
    + @for (collaborator of element.collaborators; track $index) { +
  • + {{ collaborator.name }} + ( + {{ collaborator.id }} ) +
  • + } +
+ +
diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html index 33475766..9bb58c92 100644 --- a/webapp/src/app/modules/person-network/person-network.component.html +++ b/webapp/src/app/modules/person-network/person-network.component.html @@ -1,5 +1,7 @@
- + @if (collaborationNetwork.nodes.length < 1000) { + + }
diff --git a/webapp/src/app/modules/person-network/person-network.component.ts b/webapp/src/app/modules/person-network/person-network.component.ts index 45986862..66c9c25d 100644 --- a/webapp/src/app/modules/person-network/person-network.component.ts +++ b/webapp/src/app/modules/person-network/person-network.component.ts @@ -84,7 +84,6 @@ export class PersonNetworkComponent implements OnInit { }); readonly searchTerm = computed(() => { - console.log('Search term computed:', this.debouncedFormValue()?.searchTerm); return this.debouncedFormValue()?.searchTerm || ''; }); diff --git a/webapp/src/app/modules/person/person.component.html b/webapp/src/app/modules/person/person.component.html index 04a4c7a9..5aa919c1 100644 --- a/webapp/src/app/modules/person/person.component.html +++ b/webapp/src/app/modules/person/person.component.html @@ -1,38 +1,36 @@ -@if (isPersonLoading()){ - - -
-
-
{{ initials() }}
-
-
- Person -

{{ displayName() }}

+@if (isPersonLoading()) { +
+
+
{{ initials() }}
+
+
+ Person +

{{ displayName() }}

+
+

{{ institution() }}

+ @if (countryCode()) { + {{ countryCode() }} + } + @if (worksCount() !== null || citedByCount() !== null) { + + @if (worksCount() !== null) { + {{ worksCount() }} Publikationen + } + @if (worksCount() !== null && citedByCount() !== null) { + · + } + @if (citedByCount() !== null) { + {{ citedByCount() }} Zitationen + } + + }
-

{{ institution() }}

- @if (countryCode()) { - {{ countryCode() }} - } - @if (worksCount() !== null || citedByCount() !== null) { - - @if (worksCount() !== null) { - {{ worksCount() }} Publikationen - } - @if (worksCount() !== null && citedByCount() !== null) { - · - } - @if (citedByCount() !== null) { - {{ citedByCount() }} Zitationen - } - - } -
-
-
- mail - uni-email@uni-due.de -
- +
+
+ mail + uni-email@uni-due.de +
+ @if (openAlexId()) {
person @@ -40,45 +38,67 @@
} - @if (orcid()) { -
- verified - {{ orcid() }} -
- } -
- language - - ude.de/anna-becker - + @if (orcid()) { +
+ verified + {{ + orcid() + }} +
+ } +
-
- - -
- + + +
+ } @else { -
- -
+
+ + Person wird geladen... + +
} - - \ No newline at end of file + @if (isNetworkResolving()) { +
+
+ + + graph_3 + +
+ Das Netzwerk wird gebaut, kleinen Moment... +
+ } @else { + + } + diff --git a/webapp/src/app/modules/person/person.component.scss b/webapp/src/app/modules/person/person.component.scss index fe73494e..1dfbf8d2 100644 --- a/webapp/src/app/modules/person/person.component.scss +++ b/webapp/src/app/modules/person/person.component.scss @@ -21,12 +21,16 @@ height: 112px; border-radius: 50%; background: - radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.78), transparent 34%), + radial-gradient( + circle at 50% 30%, + rgba(255, 255, 255, 0.78), + transparent 34% + ), linear-gradient(145deg, #c8d9ff, #f7faff 48%, #88a9ee); border: 1px solid var(--sg-border); box-shadow: var(--sg-shadow-sm); color: var(--sg-primary); - font-family: 'Montserrat', 'Open Sans', Arial, sans-serif; + font-family: "Montserrat", "Open Sans", Arial, sans-serif; font-size: 28px; font-weight: 700; } @@ -218,3 +222,44 @@ overflow-x: auto; } } + +.loading-container { + display: flex; + flex-direction: column; + align-items: center; + gap: 16px; + padding: 48px 0; +} + +.spinner-container { + --spinner-size: 60px; + + position: relative; + width: var(--spinner-size); + height: var(--spinner-size); +} + +.spinner-icon { + position: absolute; + inset: 0; + margin: auto; + + font-size: calc(var(--spinner-size) * 0.4); + width: calc(var(--spinner-size) * 0.4); + height: calc(var(--spinner-size) * 0.4); + + animation: pulse 1.2s ease-in-out infinite; +} + +@keyframes pulse { + 0%, + 100% { + transform: scale(1); + opacity: 1; + } + + 50% { + transform: scale(1.2); + opacity: 0.7; + } +} diff --git a/webapp/src/app/modules/person/person.component.ts b/webapp/src/app/modules/person/person.component.ts index 317a5782..529a7676 100644 --- a/webapp/src/app/modules/person/person.component.ts +++ b/webapp/src/app/modules/person/person.component.ts @@ -1,10 +1,21 @@ import { Component, computed, inject, signal, DestroyRef } from '@angular/core'; -import { toSignal, toObservable } from '@angular/core/rxjs-interop'; -import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { + toSignal, + toObservable, + takeUntilDestroyed, +} from '@angular/core/rxjs-interop'; import { MatIconModule } from '@angular/material/icon'; import { MatProgressSpinner } from '@angular/material/progress-spinner'; import { MatTabsModule } from '@angular/material/tabs'; -import { ActivatedRoute, RouterModule, RouterOutlet } from '@angular/router'; +import { + ActivatedRoute, + ResolveEnd, + ResolveStart, + Router, + RouterEvent, + RouterModule, + RouterOutlet, +} from '@angular/router'; import { of, switchMap, finalize, map, catchError } from 'rxjs'; import { PersonInterestingComponent } from '../person-interesting/person-interesting.component'; @@ -28,19 +39,51 @@ const PERSON_INCLUDE_TAGS = styleUrl: './person.component.scss', }) export class PersonComponent { - private route = inject(ActivatedRoute); + private readonly router = inject(Router); + private readonly activatedRoute = inject(ActivatedRoute); + private readonly personsApi = inject(PersonsService); private readonly destroyRef = inject(DestroyRef); - + readonly params = toSignal(this.activatedRoute.paramMap); + readonly routerEvents = toSignal(this.router.events); + + readonly currentUrl = computed(() => this.router.url); + // derive authorID directly from route private readonly authorId = toSignal( - this.route.paramMap.pipe( + this.activatedRoute.paramMap.pipe( map((params) => params.get('id') ?? null), - takeUntilDestroyed(this.destroyRef) - ) + takeUntilDestroyed(this.destroyRef), + ), ); + readonly isNetworkResolving = computed(() => { + const event = this.routerEvents(); + + if ( + !(event instanceof RouterEvent) || // not a router event + !this.isResolverEvent(event) || // not a resolver event + !this.isNetworkRouterEvent(event) // not navigating to network route + ) { + return false; + } + + if (event instanceof ResolveStart) { + return true; + } + + return false; + }); + + isResolverEvent(event: RouterEvent): boolean { + return event instanceof ResolveStart || event instanceof ResolveEnd; + } + + isNetworkRouterEvent(event: RouterEvent): boolean { + return event.url.startsWith(`/person/${this.authorId()}/network`); + } + // loading states readonly isPersonLoading = signal(false); readonly isBioLoading = signal(false); @@ -56,36 +99,36 @@ export class PersonComponent { console.error('Failed to load person:', err); return of(null); }), - finalize(() => this.isPersonLoading.set(false)) + finalize(() => this.isPersonLoading.set(false)), ); - }) + }), ), - { initialValue: null } + { initialValue: null }, ); // bio data -readonly personBio = toSignal( - toObservable(this.authorId).pipe( - switchMap((id) => { - if (!id) { - this.isBioLoading.set(false); - return of(null); - } - this.isBioLoading.set(true); - return this.personsApi.generatePersonBio(id).pipe( - map((result) => { - this.isBioLoading.set(false); - return result.bio ?? null; - }), - catchError((err) => { - console.error('Failed to load bio:', err); + readonly personBio = toSignal( + toObservable(this.authorId).pipe( + switchMap((id) => { + if (!id) { this.isBioLoading.set(false); return of(null); - }) - ); - }) - ), - { initialValue: null } -); + } + this.isBioLoading.set(true); + return this.personsApi.generatePersonBio(id).pipe( + map((result) => { + this.isBioLoading.set(false); + return result.bio ?? null; + }), + catchError((err) => { + console.error('Failed to load bio:', err); + this.isBioLoading.set(false); + return of(null); + }), + ); + }), + ), + { initialValue: null }, + ); readonly displayName = computed( () => this.person()?.display_name ?? 'Unbekannte Person', ); @@ -94,7 +137,9 @@ readonly personBio = toSignal( () => this.person()?.affiliations?.[0] ?? null, ); readonly institution = computed( - () => this.primaryAffiliation()?.institution?.display_name ?? 'Unbekannte Institution', + () => + this.primaryAffiliation()?.institution?.display_name ?? + 'Unbekannte Institution', ); readonly countryCode = computed( () => this.primaryAffiliation()?.institution?.country_code ?? null, @@ -114,9 +159,7 @@ readonly personBio = toSignal( readonly worksApiUrl = computed(() => this.person()?.works_api_url ?? null); readonly openAlexId = computed(() => this.person()?.id ?? null); - readonly topicsFull = computed( - () => this.person()?.topics ?? [], - ); + readonly topicsFull = computed(() => this.person()?.topics ?? []); links = [ { label: 'Übersicht', path: 'overview', disabled: false }, { label: 'Projekte', path: 'projects', disabled: true }, diff --git a/webapp/src/app/resolvers/collaboration-network.resolver.ts b/webapp/src/app/resolvers/collaboration-network.resolver.ts index e09b8747..b67074b2 100644 --- a/webapp/src/app/resolvers/collaboration-network.resolver.ts +++ b/webapp/src/app/resolvers/collaboration-network.resolver.ts @@ -27,7 +27,6 @@ export const collaborationNetworkResolver: ResolveFn = ( const institutions = route.queryParamMap.get('institutions'); const topics = route.queryParamMap.get('topics'); - console.log('Resolving collaboration network for author ID:', rawAuthorId); const filterProperties: FilterProperties = { start_year: startYear ? Number.parseInt(startYear, 10) : null, end_year: endYear ? Number.parseInt(endYear, 10) : null, @@ -46,7 +45,6 @@ export const collaborationNetworkResolver: ResolveFn = ( allowed_institutions: institutions ? institutions.split(',') : null, allowed_topics: topics ? topics.split(',') : null, }; - console.log('Using filter properties:', filterProperties); return inject(PersonNetworkService).getCollaborationNetwork( rawAuthorId, diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss index 17b951de..b938fc0f 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -6,6 +6,8 @@ @include mat.elevation-classes(); @include mat.app-background(); +@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,200..700,0..1,-50..200"); + @font-face { font-display: swap; font-family: "Montserrat"; @@ -58,6 +60,22 @@ -webkit-font-smoothing: antialiased; } +.material-symbols-outlined { + font-family: "Material Symbols Outlined"; + font-weight: normal; + font-style: normal; + font-size: 24px; + line-height: 1; + letter-spacing: normal; + text-transform: none; + display: inline-block; + white-space: nowrap; + word-wrap: normal; + direction: ltr; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; +} + html { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); From 736277d6ffcdd98115681bf35f3ebee4a95bf2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Thu, 4 Jun 2026 21:44:16 +0200 Subject: [PATCH 008/268] Moved network filter to dialog component --- .../person-network-graph.component.html | 26 +- .../person-network-graph.component.scss | 10 + .../person-network-graph.component.ts | 39 ++- .../person-network.component.html | 228 +++++------------- .../person-network.component.scss | 58 +++-- .../person-network.component.ts | 45 +++- ...erson-network-filter-dialog.component.html | 107 ++++++++ ...erson-network-filter-dialog.component.scss | 31 +++ .../person-network-filter-dialog.component.ts | 71 ++++++ 9 files changed, 404 insertions(+), 211 deletions(-) create mode 100644 webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html create mode 100644 webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss create mode 100644 webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html index 8a37053e..a80560d8 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html @@ -1,16 +1,18 @@ - - Kollaborations Netzwerk von {{ authorDisplayName }} - -
+ @if (!isValidGraph()) { +
+ warning +

Das Netzwerk ist zu groß für eine detaillierte Darstellung.

+
+ } @else { +
+ }
diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss b/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss index ebdd5e69..93a43f1b 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss @@ -13,6 +13,7 @@ mat-card { mat-card-content { flex: 1 1 auto; min-height: 0; + align-items: center; } .graph { @@ -24,3 +25,12 @@ mat-card-content { user-select: none; cursor: grab; } + +.warning-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 16px; + padding: 24px; +} diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts index f3e16580..018ee2be 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts @@ -1,4 +1,4 @@ -import { Component, effect, input } from '@angular/core'; +import { Component, computed, effect, input } from '@angular/core'; import { MatCardModule } from '@angular/material/card'; import { CollaborationNetwork } from '../../api'; import { NgxEchartsDirective } from 'ngx-echarts'; @@ -8,11 +8,12 @@ import * as echarts from 'echarts/core'; import { GridComponent, TitleComponent } from 'echarts/components'; import { CanvasRenderer } from 'echarts/renderers'; import { GraphChart } from 'echarts/charts'; +import { MatIconModule } from '@angular/material/icon'; echarts.use([GridComponent, CanvasRenderer, GraphChart, TitleComponent]); @Component({ selector: 'app-person-network-graph', - imports: [MatCardModule, NgxEchartsDirective], + imports: [MatCardModule, MatIconModule, NgxEchartsDirective], templateUrl: './person-network-graph.component.html', styleUrl: './person-network-graph.component.scss', }) @@ -23,6 +24,16 @@ export class PersonNetworkGraphComponent { options!: EChartsCoreOption; + readonly isValidGraph = computed(() => { + const network = this.collaborationNetwork(); + return ( + network !== undefined && + network.nodes.length > 0 && + network.nodes.length < 1000 && + network.edges.length > 0 + ); + }); + constructor() { effect(() => { const network = this.collaborationNetwork(); @@ -42,6 +53,12 @@ export class PersonNetworkGraphComponent { return; } + const frequencies = + this.calculateOccurenceFrequencies(collaborationNetwork); + + const minFrequency = Math.min(...Object.values(frequencies)); + const maxFrequency = Math.max(...Object.values(frequencies)); + const datas = [ { nodes: collaborationNetwork.nodes.map((node) => { @@ -73,6 +90,11 @@ export class PersonNetworkGraphComponent { label: { show: true, }, + symbolSize: + 25 + + (((frequencies[node.raw_id] || 0) - minFrequency) / + (maxFrequency - minFrequency)) * + 30, }; }), links: collaborationNetwork.edges.map((edge) => { @@ -134,4 +156,17 @@ export class PersonNetworkGraphComponent { }), }; } + + calculateOccurenceFrequencies( + netork: CollaborationNetwork, + ): Record { + const frequencies: Record = {}; + netork.edges.forEach((edge) => { + frequencies[edge.raw_source_id] = + (frequencies[edge.raw_source_id] || 0) + 1; + frequencies[edge.raw_target_id] = + (frequencies[edge.raw_target_id] || 0) + 1; + }); + return frequencies; + } } diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html index 9bb58c92..d68d7eee 100644 --- a/webapp/src/app/modules/person-network/person-network.component.html +++ b/webapp/src/app/modules/person-network/person-network.component.html @@ -1,172 +1,72 @@
- @if (collaborationNetwork.nodes.length < 1000) { - - } +
+
+
Netzwerk
+

Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.

+
+ +
-
- - - - Filter - -
- - Startjahr (inklusive) - - - - Endjahr (inklusive) - - -
-
- - Minimale Anzahl von Kollaborierenden (inklusiv) - - - - Maximale Anzahl von Kollaborierenden (exklusiv) - - -
-
- - Minimale Anzahl von Kollaborationen (inklusiv) - - - - Maximale Anzahl von Kollaborationen (inklusiv) - - -
+
+ -
- - Institutionen - - @for ( - institution of collaborationNetwork.filter_information - .institutions; - track institution.raw_id - ) { - - {{ institution.display_name }} - - } - - - - Themen - - @for ( - topic of collaborationNetwork.filter_information.topics; - track topic.raw_topic_id - ) { - - {{ topic.display_name }} - - } - - -
- - - - - Kollaborierende - - Publikationen + + - - - {{ - this.displayedTable() === "collaborators" - ? "Suche Kollaborierende nach Name oder ID" - : "Suche Publikationen nach Titel oder ID" - }} - - search - - + + Kollaborierende + + Publikationen + + + {{ + this.displayedTable() === "collaborators" + ? "Suche Kollaborierende nach Name oder ID" + : "Suche Publikationen nach Titel oder ID" + }} + + search + + -
- - -
- @if (this.displayedTable() === "collaborators") { - - } @else if (this.displayedTable() === "publications") { - - } -
-
-
+
+ + +
+ @if (this.displayedTable() === "collaborators") { + + } @else if (this.displayedTable() === "publications") { + + } +
+
+
+
diff --git a/webapp/src/app/modules/person-network/person-network.component.scss b/webapp/src/app/modules/person-network/person-network.component.scss index 234fc412..b51ee5be 100644 --- a/webapp/src/app/modules/person-network/person-network.component.scss +++ b/webapp/src/app/modules/person-network/person-network.component.scss @@ -1,47 +1,36 @@ .content { display: flex; - flex-direction: row; + flex-direction: column; padding: 40px; gap: 20px; align-items: stretch; } +.top-row { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: end; + gap: 20px; +} + +.description-container { + display: flex; + flex-direction: column; +} + +.cards { + display: flex; + flex-direction: row; + gap: 20px; +} + .content > app-person-network-graph, .right-card { flex: 1 1 0; min-width: 0; } -.table { - overflow: auto; - width: 100%; - max-height: 70vh; - height: 100%; -} - -.table table { - width: 100%; -} - -.table-area { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; -} - -.scroll-viewport-container { - width: 100%; - height: 100%; -} - -.form-controls { - display: flex; - flex-direction: row; - align-items: flex-start; - gap: 10px; -} - .form-field-full { width: 100%; } @@ -67,3 +56,10 @@ .pair-field > mat-form-field { width: 100%; } + +.top-row button { + height: 42px; + border-color: var(--sg-border); + border-radius: var(--sg-radius-sm); + color: var(--sg-text); +} \ No newline at end of file diff --git a/webapp/src/app/modules/person-network/person-network.component.ts b/webapp/src/app/modules/person-network/person-network.component.ts index 66c9c25d..0c192706 100644 --- a/webapp/src/app/modules/person-network/person-network.component.ts +++ b/webapp/src/app/modules/person-network/person-network.component.ts @@ -29,6 +29,8 @@ import { debounceTime } from 'rxjs'; import { PersonNetworkGraphComponent } from '../person-network-graph/person-network-graph.component'; import { MatSelectModule } from '@angular/material/select'; import { MatExpansionModule } from '@angular/material/expansion'; +import { MatDialog, MatDialogModule } from '@angular/material/dialog'; +import { PersonNetworkFilterDialogComponent } from '../../person-network-filter-dialog/person-network-filter-dialog.component'; @Component({ selector: 'app-person-network', @@ -53,6 +55,7 @@ import { MatExpansionModule } from '@angular/material/expansion'; PersonNetworkGraphComponent, MatSelectModule, MatExpansionModule, + MatDialogModule, ], templateUrl: './person-network.component.html', styleUrl: './person-network.component.scss', @@ -89,13 +92,51 @@ export class PersonNetworkComponent implements OnInit { readonly activatedRouteData = toSignal(this.activatedRoute.data); - formatYearLabel = (value: number) => `${value}`; - constructor( private readonly activatedRoute: ActivatedRoute, private readonly router: Router, + private readonly dialog: MatDialog, ) {} + openFilterDialog() { + const dialogRef = this.dialog.open(PersonNetworkFilterDialogComponent, { + data: { + collaborationNetwork: this.collaborationNetwork, + startYear: this.filterForm.get('startYear')?.value, + endYear: this.filterForm.get('endYear')?.value, + minimumCollaborators: this.filterForm.get('minimumCollaborators') + ?.value, + maximumCollaborators: this.filterForm.get('maximumCollaborators') + ?.value, + minimumCollaborations: this.filterForm.get('minimumCollaborations') + ?.value, + maximumCollaborations: this.filterForm.get('maximumCollaborations') + ?.value, + institutions: this.filterForm.get('institutions')?.value, + topics: this.filterForm.get('topics')?.value, + }, + }); + + dialogRef.afterClosed().subscribe((result) => { + console.log('Dialog result:', result); + if (result) { + this.filterForm.setValue({ + searchTerm: this.filterForm.get('searchTerm')?.value || '', + startYear: result.startYear, + endYear: result.endYear, + minimumCollaborators: result.minimumCollaborators, + maximumCollaborators: result.maximumCollaborators, + minimumCollaborations: result.minimumCollaborations, + maximumCollaborations: result.maximumCollaborations, + institutions: result.institutions, + topics: result.topics, + displayedTable: + this.filterForm.get('displayedTable')?.value || 'collaborators', + }); + } + }); + } + ngOnInit(): void { this.activatedRoute.data.subscribe(({ collaborationNetwork }) => { this.collaborationNetwork = collaborationNetwork; diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html b/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html new file mode 100644 index 00000000..c9bef5f4 --- /dev/null +++ b/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html @@ -0,0 +1,107 @@ +

Netzwerkfilter

+ + +
+
+ + Startjahr (inklusive) + + + + Endjahr (inklusive) + + +
+ + + Minimale Anzahl von Kollaborierenden (inklusiv) + + + + Maximale Anzahl von Kollaborierenden (exklusiv) + + + + + Minimale Anzahl von Kollaborationen (inklusiv) + + + + Maximale Anzahl von Kollaborationen (inklusiv) + + + + + Institutionen + + @for ( + institution of collaborationNetwork.filter_information.institutions; + track institution.raw_id + ) { + + {{ institution.display_name }} + + } + + + + Themen + + @for ( + topic of collaborationNetwork.filter_information.topics; + track topic.raw_topic_id + ) { + + {{ topic.display_name }} + + } + + +
+
+ + + + diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss b/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss new file mode 100644 index 00000000..8a9b4eb9 --- /dev/null +++ b/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss @@ -0,0 +1,31 @@ +form { + padding: 20px; + display: flex; + flex-direction: column; + gap: 20px; +} + + + +.form-field-full { + width: 100%; +} + + +.toggle-group { + margin-bottom: 20px; +} + +.toggle-group .mat-button-toggle { + text-transform: none; + width: 100%; +} + +.pair-field { + display: flex; + gap: 20px; +} + +.pair-field > mat-form-field { + width: 100%; +} diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts b/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts new file mode 100644 index 00000000..f452c4df --- /dev/null +++ b/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts @@ -0,0 +1,71 @@ +import { Component, inject } from '@angular/core'; +import { + FormControl, + FormGroup, + FormsModule, + ReactiveFormsModule, +} from '@angular/forms'; +import { + MAT_DIALOG_DATA, + MatDialogModule, + MatDialogRef, +} from '@angular/material/dialog'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { CollaborationNetwork } from '../api'; +import { MatSelectModule } from '@angular/material/select'; +import { MatInputModule } from '@angular/material/input'; +import { MatButtonModule } from '@angular/material/button'; + +export interface PersonNetworkFilterDialogData { + collaborationNetwork: CollaborationNetwork; + startYear: number; + endYear: number; + minimumCollaborators: number; + maximumCollaborators: number; + minimumCollaborations: number; + maximumCollaborations: number; + institutions: string[]; + topics: string[]; +} + +@Component({ + selector: 'app-person-network-filter-dialog', + imports: [ + FormsModule, + ReactiveFormsModule, + MatFormFieldModule, + MatSelectModule, + MatDialogModule, + MatInputModule, + MatButtonModule + ], + templateUrl: './person-network-filter-dialog.component.html', + styleUrl: './person-network-filter-dialog.component.scss', +}) +export class PersonNetworkFilterDialogComponent { + readonly dialogRef = inject(MatDialogRef); + readonly data = inject(MAT_DIALOG_DATA); + + readonly collaborationNetwork = this.data.collaborationNetwork; + + filterForm = new FormGroup({ + startYear: new FormControl(2000), + endYear: new FormControl(2025), + minimumCollaborators: new FormControl(2), + maximumCollaborators: new FormControl(10), + minimumCollaborations: new FormControl(1), + maximumCollaborations: new FormControl(100), + institutions: new FormControl([]), + topics: new FormControl([]), + }); + + onCancel() { + this.dialogRef.close(); + } + + onApply() { + if (this.filterForm.valid) { + this.dialogRef.close(this.filterForm.value); + } + } +} From ee991adf3af324a92abf5149021449b25f337e2e Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 4 Jun 2026 22:33:28 +0200 Subject: [PATCH 009/268] added page offset to person search --- service/src/main/inse/integrations/elasticsearch.py | 3 +++ service/src/main/inse/logic.py | 11 ++++++----- service/src/main/inse/service.py | 8 ++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/service/src/main/inse/integrations/elasticsearch.py b/service/src/main/inse/integrations/elasticsearch.py index 3d744ad9..e922cb54 100644 --- a/service/src/main/inse/integrations/elasticsearch.py +++ b/service/src/main/inse/integrations/elasticsearch.py @@ -10,6 +10,7 @@ def search( query: dict = None, source = None, size: int = None, + offset:int = None, sort: list = None, body: dict = None, ) -> dict[str, Any]: @@ -27,6 +28,8 @@ def search( payload["_source"] = source if size is not None: payload["size"] = size + if offset is not None: + payload["from"] = offset if sort is not None: payload["sort"] = sort else: diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 86a477ca..7a34c39b 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -369,11 +369,10 @@ def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsLi def search_persons_by_name( - author_name: str, limit: Optional[int] = 10, include: Optional[str] = None + author_name: str, limit: Optional[int] = 10, page_offset: Optional[int] = 0, include: Optional[str] = None ) -> AuthorsListResponse: if not author_name: raise HTTPException(status_code=400, detail="name must be provided") - search_query = { "bool": { "should": [ @@ -399,6 +398,7 @@ def search_persons_by_name( response = elasticsearch.search( index="openalex-authors", query=search_query, + offset=page_offset, source=include.split(",") if include else True, size=limit, ) @@ -407,12 +407,12 @@ def search_persons_by_name( raise HTTPException( status_code=500, detail=f"Elasticsearch search failed: {str(e)}" ) - + total_found = response.get("hits",{}).get("total",{}).get("value",0) hits = response.get("hits", {}).get("hits", []) persons = [util.get_persons_data(hit) for hit in hits] - return AuthorsListResponse(results=persons) + return AuthorsListResponse(results=persons,meta=Meta(count=total_found,page=page_offset)) def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, include: Optional[str] = None) -> AuthorsListResponse: @@ -501,7 +501,7 @@ def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, incl return AuthorsListResponse(results=persons) def search_persons_by_institution( - institution_name: str, limit: Optional[int] = 10, include: Optional[str] = None + institution_name: str, limit: Optional[int] = 10, page_offset: Optional[int] = 0, include: Optional[str] = None ) -> AuthorsListResponse: if not institution_name: @@ -523,6 +523,7 @@ def search_persons_by_institution( query=search_query, source=include.split(",") if include else True, size=limit, + offset=page_offset, sort=[{"works_count": {"order": "desc"}}], ) diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index 8d3802da..ca277540 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -323,8 +323,10 @@ def search_persons_by_name( example="topics_full,topic_share", ), ], + limit:Annotated[Optional[int], Query(description=("Limit of search page results"),example ="2")]= None, + page_offset : Annotated[Optional[int], Query(description=("Offset of the result page"),example="2")] = None, ): - return logic.search_persons_by_name(author_name=author_name, include=include) + return logic.search_persons_by_name(author_name=author_name, include=include,page_offset=page_offset,limit=limit) @router.get( '/persons/autocomplete', @@ -365,5 +367,7 @@ def search_persons_by_institution( example="topics_full,topic_share", ), ], + limit:Annotated[Optional[int], Query(description=("Limit of search page results"),example ="2")]= None, + page_offset : Annotated[Optional[int], Query(description=("Offset of the result page"),example="2")] = None, ): - return logic.search_persons_by_institution(institution_name, include=include) + return logic.search_persons_by_institution(institution_name, include=include,page_offset=page_offset,limit=limit) From fce1ad74b31eab83db8b4c4e59cfba6cff7e86bf Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 4 Jun 2026 22:54:38 +0200 Subject: [PATCH 010/268] search by institutions adjusted --- service/src/main/inse/logic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 7a34c39b..d6c92bdc 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -531,7 +531,7 @@ def search_persons_by_institution( raise HTTPException( status_code=500, detail=f"Elasticsearch search failed: {str(e)}" ) - + total_found = response.get("hits",{}).get("total",{}).get("value",0) hits = response.get("hits", {}).get("hits", []) persons = [util.get_persons_data(hit) for hit in hits] - return AuthorsListResponse(results=persons) + return AuthorsListResponse(results=persons,meta=Meta(count=total_found,page=page_offset)) From ff639ec74eb498d61862b36c5dbcf7720c337c83 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 4 Jun 2026 22:57:21 +0200 Subject: [PATCH 011/268] adjusted UI for persons list --- .../person-list/person-list.component.html | 127 +++---- .../person-list/person-list.component.scss | 311 +++++++++++++++--- .../person-list/person-list.component.ts | 192 +++++++---- 3 files changed, 466 insertions(+), 164 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 0b3fdf33..1ae258b0 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -1,65 +1,80 @@ -@let persons = state.persons(); -@let results = persons.results ?? []; -@if (!isPersonsLoading()) { - - -

{{ results.length }} Ergebnisse

-
-
- +
+ - @for (person of results; track person.id) { +
+ {{ resultRange() }} +
- - @if (person.id){ - +
+
+ {{ total() | number: "1.0-0" }} Personen gefunden + Sortiert nach Publikationen und Zitierungen +
-
+
diff --git a/webapp/src/app/modules/person-list/person-list.component.scss b/webapp/src/app/modules/person-list/person-list.component.scss index 10174b2e..ef1c22ac 100644 --- a/webapp/src/app/modules/person-list/person-list.component.scss +++ b/webapp/src/app/modules/person-list/person-list.component.scss @@ -1,78 +1,285 @@ +.person-list-page { + display: grid; + gap: 24px; + padding: 32px; + background: var(--sg-background); +} + +.page-header { + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); + gap: 32px; + align-items: center; +} + +.eyebrow { + margin: 0 0 8px; + color: var(--sg-primary); + font-size: 12px; + font-weight: 700; + text-transform: uppercase; +} + +.page-header h1 { + margin: 0; + font-size: 28px; + line-height: 1.2; +} + +.page-header p:not(.eyebrow) { + max-width: 720px; + margin: 10px 0 0; + color: var(--sg-text-muted); +} + +.selection-summary { + display: flex; + align-items: center; + justify-content: space-between; + min-height: 80px; + padding: 18px 20px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-surface); +} + +.selection-summary div { + display: grid; + gap: 5px; +} + +.selection-summary strong { + color: var(--sg-text); +} + +.selection-summary span { + color: var(--sg-text-muted); + font-size: 12px; +} + +.selection-summary mat-icon { + color: var(--sg-text-muted); +} + +.toolbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20px; +} + +.toolbar mat-form-field { + width: min(100%, 520px); +} + .result-count { - margin: 0 0 12px; - font-size: 14px; - color: #666; + color: var(--sg-text-muted); + font-size: 13px; + white-space: nowrap; +} + +.results-panel { + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-surface); + overflow: hidden; +} + +.results-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20px; + min-height: 64px; + padding: 0 22px; +} + +.results-head strong { + color: var(--sg-text); + font-size: 15px; +} + +.results-head span { + color: var(--sg-text-muted); + font-size: 13px; +} + +.person-grid { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 16px; + padding: 16px; } .person-card { - width: 100%; - height: 100%; - padding: 12px; - border-radius: 16px; + min-width: 0; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-surface); + box-shadow: var(--sg-shadow-sm); + transition: + border-color 160ms ease, + box-shadow 160ms ease, + transform 160ms ease; } -.card-content { - display: flex; - align-items: center; - gap: 16px; - height: 100%; +.person-card:hover { + border-color: var(--sg-border-strong); + box-shadow: var(--sg-shadow-md); + transform: translateY(-1px); } -.avatar { - display: flex; - justify-content: center; - align-items: center; +.card-link { + display: grid; + grid-template-rows: 1fr auto; + gap: 18px; + min-height: 236px; + padding: 20px; + color: inherit; + text-decoration: none; } -.avatar-icon { - font-size: 48px; - width: 48px; - height: 48px; - color: #9e9e9e; -} - -.info { +.person-main { display: flex; + min-width: 0; flex-direction: column; - gap: 4px; + justify-content: space-between; + gap: 18px; } -.name { - margin: 0; +.person-main h2 { + margin: 0 0 6px; + font-size: 17px; + line-height: 1.25; } -.person-id { - font-size: 11px; - color: #aaa; +.person-main p { + display: -webkit-box; margin: 0; + overflow: hidden; + color: var(--sg-text-muted); + font-size: 13px; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; } -.affiliation { - color: #666; - margin: 0; +.topic-row { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.topic-row span { + max-width: 100%; + padding: 5px 10px; + overflow: hidden; + border: 1px solid #bcd3ff; + border-radius: 6px; + background: #eff6ff; + color: #064fc4; + font-size: 12px; + font-weight: 600; + text-overflow: ellipsis; + white-space: nowrap; } .stats { - font-size: 12px; - color: #888; -} - -.topics { display: flex; - gap: 6px; - flex-wrap: wrap; -} - -.topic-chip { - font-size: 12px; -} -.loading { - display: flex; - justify-content: center; align-items: center; + justify-content: space-between; + gap: 12px; + padding-top: 14px; + border-top: 1px solid var(--sg-border); + color: var(--sg-text-muted); + font-size: 12px; +} - width: 100%; - min-height: 300px; +.stats span { + display: inline-flex; + align-items: center; + min-width: 0; + gap: 6px; +} - padding: 2rem; -} \ No newline at end of file +.stats mat-icon { + width: 18px; + height: 18px; + font-size: 18px; +} + +.loading-state, +.empty-state { + display: grid; + min-height: 320px; + place-items: center; + padding: 32px; + text-align: center; +} + +.empty-state { + align-content: center; + gap: 8px; + color: var(--sg-text-muted); +} + +.empty-state mat-icon { + width: 42px; + height: 42px; + color: var(--sg-text-soft); + font-size: 42px; +} + +.empty-state h2 { + margin: 0; + font-size: 18px; +} + +.empty-state p { + margin: 0; +} + +mat-paginator { + border-top: 1px solid var(--sg-border); +} + +@media (max-width: 1280px) { + .person-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} + +@media (max-width: 860px) { + .person-list-page { + padding: 24px 16px; + } + + .page-header { + grid-template-columns: 1fr; + } + + .toolbar, + .results-head { + align-items: stretch; + flex-direction: column; + } + + .results-head { + justify-content: center; + padding: 16px; + } + + .result-count { + white-space: normal; + } + + .person-grid { + grid-template-columns: 1fr; + } +} + +@media (max-width: 560px) { + .stats { + align-items: flex-start; + flex-direction: column; + } +} diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index ad002537..ccca7dba 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -1,51 +1,126 @@ -import { Component, computed, inject, signal, DestroyRef } from '@angular/core'; -import { Router } from '@angular/router'; -import { toObservable } from '@angular/core/rxjs-interop'; +import { Component, inject, DestroyRef, computed, signal } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { RouterLink, ActivatedRoute, Router } from '@angular/router'; +import { toObservable, toSignal } from '@angular/core/rxjs-interop'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { MatGridListModule } from '@angular/material/grid-list'; -import { MatCardModule } from '@angular/material/card'; 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, PageEvent } from '@angular/material/paginator'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; +import { + Author, + AuthorsListResponse, + DehydratedInstitution, + PersonsService, +} 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 { createLoadError } from '../../shared/utils/errorHandler'; +import { distinctUntilChanged, switchMap, tap, finalize, map } from 'rxjs'; +import { AuthorAffiliationsInner } from '../../api'; @Component({ selector: 'app-person-list', imports: [ - MatCardModule, - MatChipsModule, - MatGridListModule, + CommonModule, MatIconModule, - MatProgressSpinner, + MatPaginatorModule, + MatProgressSpinnerModule, + MatSnackBarModule, + RouterLink, ], templateUrl: './person-list.component.html', styleUrl: './person-list.component.scss', + standalone: true, }) export class PersonListComponent { - private readonly router = inject(Router); private readonly personsService = inject(PersonsService); private readonly destroyRef = inject(DestroyRef); + private readonly snackBar = inject(MatSnackBar); + private readonly route = inject(ActivatedRoute); + private readonly router = inject(Router); public readonly state = inject(SharedStateService); + public readonly paginationService = inject(PaginationService); private readonly defaultIncludes = - 'display_name,works_count,cited_by_count,topics,orcid'; + 'display_name,works_count,cited_by_count,topics,orcid,affiliations'; private readonly defaultInstitutionName = 'University of Duisburg-Essen'; - readonly isPersonsLoading = signal(false); + private readonly queryParams = toSignal( + this.route.queryParams.pipe( + map((params) => ({ + search: params['search'] as string | null, + page: Number(params['page'] ?? 0), + size: Number(params['size'] ?? this.paginationService.options[2]), + })), + ), + { + initialValue: { + search: null, + page: 0, + size: this.paginationService.options[2], + }, + }, + ); + + readonly searchValue = computed( + () => this.queryParams()['search'] ?? null, + ); + readonly pageIndex = computed(() => + Number(this.queryParams()['page'] ?? 0), + ); + readonly pageSize = computed( + () => + Number(this.queryParams()['size'] ?? this.paginationService.options[2]), // default 10 + ); + + loading = false; + + readonly persons = computed( + () => this.state.persons() ?? [], + ); + + readonly total = computed( + () => this.state.persons().meta?.count ?? this.persons().results?.length, + ); + + readonly resultRange = computed(() => { + const total = this.total(); + const persons = this.persons(); + if (!total || !persons.results?.length) return 'Keine Personen gefunden'; + const start = this.pageIndex() * this.pageSize() + 1; + const end = start + persons.results.length - 1; + return `${start}–${end} von ${total} Personen`; + }); + constructor() { - toObservable(this.state.searchValue) + toObservable(this.queryParams) .pipe( - distinctUntilChanged(), - tap(() => { + map(() => ({ + search: this.searchValue(), + page: this.pageIndex(), + pageSize: this.pageSize(), + })), + distinctUntilChanged( + (a, b) => + a.search === b.search && + a.page === b.page && + a.pageSize === b.pageSize, + ), + tap(({ search }) => { this.state.hasSearched.set(false); - this.isPersonsLoading.set(true); + this.loading = true; + if (!search) this.state.hasSearched.set(false); }), - switchMap((value) => - value + switchMap(({ search, page, pageSize }) => + search ? this.personsService - .searchPersonsByName(value, this.defaultIncludes) + .searchPersonsByName( + search, + this.defaultIncludes, + pageSize, + page, + ) .pipe( tap((result) => { this.state.persons.set(this.sortByRanking(result)); @@ -56,6 +131,8 @@ export class PersonListComponent { .searchPersonsByInstitution( this.defaultInstitutionName, this.defaultIncludes, + pageSize, + page, ) .pipe( tap((result) => { @@ -63,35 +140,55 @@ export class PersonListComponent { }), ), ), - finalize(() => this.isPersonsLoading.set(false)), + finalize(() => (this.loading = false)), takeUntilDestroyed(this.destroyRef), ) .subscribe({ - next: () => this.isPersonsLoading.set(false), + next: () => (this.loading = false), error: (err) => { - console.error('Error loading persons:', err); - this.isPersonsLoading.set(false); + this.loading = false; + createLoadError( + this.snackBar, + () => {}, + 'Personen konnten nicht geladen werden', + )(err); }, }); } - // navigation - navigateID(id: string): void { - this.router.navigate(['/person', id]); + onPage(event: PageEvent): void { + this.router.navigate([], { + relativeTo: this.route, + queryParams: { + page: event.pageIndex, + size: event.pageSize, + }, + queryParamsHandling: 'merge', // preserve search param + }); } - // sorting logic + institution(person: Author): DehydratedInstitution | null { + if (!person.affiliations?.length) null; + return person.affiliations?.at(-1)?.institution ?? null; + } + + topics(person: Author): string[] { + return ((person.topics ?? []) as any[]) + .slice(0, 3) + .map((t) => (typeof t === 'string' ? t : (t?.display_name ?? ''))) + .filter(Boolean); + } + + // 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; - } - return this.getWorksCount(personB) - this.getWorksCount(personA); + results: [...response.results].sort((a, b) => { + const rankDiff = this.getSortRank(a) - this.getSortRank(b); + return rankDiff !== 0 + ? rankDiff + : this.getWorksCount(b) - this.getWorksCount(a); }), }; } @@ -108,28 +205,11 @@ export class PersonListComponent { } hasInstitution(person: Author): boolean { - if (!person.affiliations) { - return false; - } - for (const affiliation of person.affiliations) { - if (affiliation.institution) { - return true; - } - } - return false; + return !!person.affiliations?.some((a) => a.institution); } hasOrcid(person: Author): boolean { const ids = person.ids as { orcid?: string } | null | undefined; return !!ids?.orcid; } - - getDistinguishingId(person: Author): string { - const ids = person.ids as { orcid?: string } | null | undefined; - const orcid = ids?.orcid; - - return orcid - ? 'ORCID: ' + orcid.replace('https://orcid.org/', '') - : 'OpenAlexID: ' + person.id; - } } From c08745c4b02771b261370c017789d91d2476c5fb Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 4 Jun 2026 22:59:02 +0200 Subject: [PATCH 012/268] adjusted search logic by adding search term to query params --- .../app-searchbar/app-searchbar.component.ts | 109 +++++++++--------- 1 file changed, 53 insertions(+), 56 deletions(-) diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts index 2725c668..acba158a 100644 --- a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts @@ -1,27 +1,18 @@ -import { Component, signal, inject,ViewChild } from '@angular/core'; +import { Component, inject, ViewChild, DestroyRef} from '@angular/core'; import { MatIcon } from '@angular/material/icon'; import { FormControl, ReactiveFormsModule } from '@angular/forms'; -import { Observable } from 'rxjs'; -import { Router } from '@angular/router'; -import { SharedStateService } from '../../services/shared-state.service'; -import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { Router, ActivatedRoute } from '@angular/router'; +import { + MatAutocompleteModule, + MatAutocompleteTrigger, + MatAutocomplete, +} from '@angular/material/autocomplete'; import { MatInputModule } from '@angular/material/input'; import { MatFormFieldModule } from '@angular/material/form-field'; -import { map, switchMap, filter } from 'rxjs/operators'; -import { toObservable } from '@angular/core/rxjs-interop'; -import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; -import { PersonsService } from '../../../api'; -import { AuthorsListResponse, Author } from '../../../api'; +import { switchMap, debounceTime, distinctUntilChanged } from 'rxjs/operators'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { DestroyRef } from '@angular/core'; import { of } from 'rxjs'; -import { MatAutocompleteTrigger,MatAutocomplete } from '@angular/material/autocomplete'; -export interface State { - flag: string; - name: string; - population: string; -} - +import { PersonsService, AuthorsListResponse } from '../../../api'; @Component({ selector: 'app-searchbar', standalone: true, @@ -36,35 +27,36 @@ export interface State { styleUrl: './app-searchbar.component.scss', }) export class AppSearchbarComponent { - @ViewChild(MatAutocompleteTrigger) autocompleteTrigger!: MatAutocompleteTrigger; + @ViewChild(MatAutocompleteTrigger) + autocompleteTrigger!: MatAutocompleteTrigger; @ViewChild(MatAutocomplete) autocomplete!: MatAutocomplete; - searchValue = new FormControl(''); + searchControl = new FormControl(''); - showAutocomplete = false; filteredPersons: AuthorsListResponse = { meta: null, results: [], group_by: [], }; - - private destroyRef = inject(DestroyRef); - constructor( - public router: Router, - private state: SharedStateService, - private personService: PersonsService, - ) { + + private readonly destroyRef = inject(DestroyRef); + private readonly router = inject(Router); + private readonly route = inject(ActivatedRoute); + private readonly personService = inject(PersonsService); + + constructor() { + const params = new URLSearchParams(window.location.search); + const currentSearch = params.get('search') ?? ''; + this.searchControl.setValue(currentSearch, { emitEvent: false }); + + // Autocomplete suggestions this.searchControl.valueChanges .pipe( debounceTime(100), distinctUntilChanged(), - switchMap((v: any) => { + switchMap((v) => { const value = v ?? ''; - - if (value.length < 2) { - return of(this.emptyPersons()); - } - + if (value.length < 2) return of(this.emptyPersons()); return this.personService.searchPersonsAutocomplete( value, 'display_name', @@ -76,40 +68,45 @@ export class AppSearchbarComponent { this.filteredPersons = results; }); } - emptyPersons(): AuthorsListResponse { - return { - meta: null, - results: [], - group_by: [], - }; - } - selectPerson(personName: string | undefined | null) { + + selectPerson(personName: string | undefined | null): void { if (personName) { this.searchControl.setValue(personName); - this.startSearch() + this.startSearch(); } } - onKeydownTab(event: KeyboardEvent) { - event.preventDefault(); // stop focus jump + + onKeydownTab(event: KeyboardEvent): void { + event.preventDefault(); const first = this.filteredPersons?.results?.[0]; - if (first && first.display_name) { + if (first?.display_name) { this.searchControl.setValue(first.display_name); } } - onEnter() { - this.autocompleteTrigger.closePanel() + + onEnter(): void { + this.autocompleteTrigger.closePanel(); this.startSearch(); } - onFocus() { - this.autocompleteTrigger.openPanel() + + onFocus(): void { + this.autocompleteTrigger.openPanel(); } - startSearch() { - console.log('updated to', this.searchControl.value, this.router.url); + startSearch(): void { + const search = this.searchControl.value ?? ''; - if (this.router.url.startsWith('/persons')) { - this.router.navigate(['/persons']); - } - this.state.searchValue.set(this.searchControl.value); + this.router.navigate( + this.router.url.startsWith('/persons') ? [] : ['/persons'], + { + relativeTo: this.route, + queryParams: { search: search || null, page: 0 }, + queryParamsHandling: 'merge', + }, + ); + } + + private emptyPersons(): AuthorsListResponse { + return { meta: null, results: [], group_by: [] }; } } From b168378b111fcbdd02a82c13d1444a3a2896dc21 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 4 Jun 2026 23:17:14 +0200 Subject: [PATCH 013/268] fixed merging issues. --- service/src/main/inse/logic.py | 97 +--------------------------------- 1 file changed, 1 insertion(+), 96 deletions(-) diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 7ec65367..d32ad400 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -241,99 +241,4 @@ def count_topic_hierarchy(topic_names: List[str]) -> dict: if domain: counts["domains"][domain] = counts["domains"].get(domain, 0) + 1 - return counts - - -### persons - - -def search_persons( - author_id: Optional[str] = None, - query: Optional[str] = None, - include: Optional[set[str]] = None, -) -> AuthorsListResponse: - if author_id: - query_field = "_id" - query_value = author_id - elif query: - query_field = "display_name" - query_value = query - else: - return AuthorsListResponse(results=[], meta=Meta(count=0)) - - data = elasticsearch.search( - index="openalex-authors", query_field=query_field, query_value=query_value - ) - - authors = [] - for hit in data.get("hits", {}).get("hits", []): - source = hit.get("_source", {}) - source_copy = dict(source) - source_copy["id"] = source_copy.get("id") or hit.get("_id", "") - - # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) - ids = source_copy.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) - source_copy["ids"] = ids_copy - - author = Author.from_dict(source_copy) - if author: - authors.append(author) - - return AuthorsListResponse(results=authors, meta=Meta(count=len(authors))) - - -def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str: - start_time = time.time() - search_result = search_persons(author_id=author_id) - if not search_result.results: - return "No person found." - if len(search_result.results) > 1: - return "Multiple persons found, cannot generate bio." - - person = search_result.results[0] - person_json = json.dumps(person.model_dump_json()) - - system_prompt = """\ - Erstelle auf Basis der bereitgestellten OpenAlex-Daten ein kurzes Porträt der Person in 3-5 Sätzen. Die Person selbst ist das Subjekt: Beginne mit ihrem Namen und beschreibe sie als Forschende:n (z. B. „{name} ist ein:e Forscher:in im Bereich …"). Schreibe nicht über „die Forschung" oder „die Arbeit" im Abstrakten, sondern durchgehend über die Person. - - Gehe dabei auf folgende drei Punkte ein: - - 1. Besonderheiten: Was hebt die Person im Vergleich zu anderen Forschenden ähnlicher Karrierephase und ähnlichen Feldes hervor? (z. B. überdurchschnittlicher Impact gemessen an der aktiven Zeit, hoher Erst-/Korrespondenzautor-Anteil, einzelnes Breakout-Paper, frühe Positionierung in einem später gewachsenen Thema) - 2. Wirtschaftliche Relevanz: Arbeitet die Person in einem grundsätzlich anwendungsnahen/kommerziell interessanten Themenfeld oder eher in der Grundlagenforschung? - 3. Dynamik: Entwickelt sich ihr Publikations-/Zitationsverlauf zuletzt steigend, konstant oder abflachend? - - Stütze jede Aussage auf konkrete Werte aus den Daten und formuliere nichts, was sich nicht belegen lässt. Wenn die Daten für einen Punkt keine klare Aussage zulassen, formuliere ihn entsprechend zurückhaltend oder lasse ihn weg, statt zu spekulieren. Gib nur das Porträt zurück, ohne Einleitung oder Schluss.\ - """ - - user_prompt = f"Daten zur Person:\n{person_json}" - - headers = { - "Authorization": f"Bearer {config.settings.llm_api_key}", - "Content-Type": "application/json", - } - payload = { - "model": config.settings.llm_model, - "prompt": f"{system_prompt}\n{user_prompt}", - "stream": False, - } - - with httpx.Client(timeout=30.0) as client: - response = client.post( - config.settings.llm_api_url, json=payload, headers=headers - ) - response.raise_for_status() - data = response.json() - bio = data.get("response", "") - - elapsed_time = time.time() - start_time - logger.info( - f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds" - ) - - return bio \ No newline at end of file + return counts \ No newline at end of file From 4c33a3e41622855b783e0de85f94f2c7fa4d17c9 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 4 Jun 2026 23:18:09 +0200 Subject: [PATCH 014/268] updated openApi config + generated endpoints --- webapp/openapitools.json | 2 +- webapp/src/app/api/.openapi-generator/FILES | 108 ++-- webapp/src/app/api/api/api.ts | 19 +- .../api/api/inse-account-service.service.ts | 216 ++++++++ .../inse-account-service.serviceInterface.ts | 46 ++ .../src/app/api/api/inse-service.service.ts | 490 ++++++++++++++++++ .../api/api/inse-service.serviceInterface.ts | 87 ++++ webapp/src/app/api/api/items.service.ts | 11 +- .../src/app/api/api/items.serviceInterface.ts | 70 +++ .../src/app/api/api/person-network.service.ts | 112 ++++ .../api/person-network.serviceInterface.ts | 36 ++ webapp/src/app/api/api/persons.service.ts | 317 ++++++++++- .../app/api/api/persons.serviceInterface.ts | 126 +++++ webapp/src/app/api/api/topics.service.ts | 7 +- .../app/api/api/topics.serviceInterface.ts | 42 ++ webapp/src/app/api/api/works.service.ts | 11 +- .../src/app/api/api/works.serviceInterface.ts | 48 ++ webapp/src/app/api/model/access-grant.ts | 20 + webapp/src/app/api/model/auth-account.ts | 17 + webapp/src/app/api/model/auth-scope.ts | 19 + .../api/model/author-affiliations-inner.ts | 20 + .../api/model/author-counts-by-year-inner.ts | 20 + webapp/src/app/api/model/author-ids.ts | 20 + .../api/model/author-parsed-longest-name.ts | 22 + .../src/app/api/model/author-summary-stats.ts | 21 + webapp/src/app/api/model/author.ts | 14 +- .../app/api/model/authors-list-response.ts | 23 + webapp/src/app/api/model/authorship.ts | 4 +- .../api/model/collaboration-network-edge.ts | 22 + .../model/collaboration-network-node-type.ts | 18 + .../api/model/collaboration-network-node.ts | 30 ++ .../app/api/model/collaboration-network.ts | 33 ++ webapp/src/app/api/model/cost-usd.ts | 17 + webapp/src/app/api/model/dehydrated-author.ts | 20 + webapp/src/app/api/model/dehydrated-funder.ts | 20 + .../app/api/model/dehydrated-institution.ts | 23 + webapp/src/app/api/model/dehydrated-source.ts | 28 + .../src/app/api/model/filter-information.ts | 32 ++ webapp/src/app/api/model/filter-properties.ts | 22 + webapp/src/app/api/model/group-by-result.ts | 20 + .../app/api/model/http-validation-error.ts | 16 + webapp/src/app/api/model/identity-grant.ts | 19 + .../app/api/model/institution-information.ts | 22 + webapp/src/app/api/model/item-create.ts | 22 + webapp/src/app/api/model/item-page.ts | 31 ++ webapp/src/app/api/model/location.ts | 2 +- webapp/src/app/api/model/meta.ts | 2 +- .../app/api/model/model2-yr-mean-citedness.ts | 14 + webapp/src/app/api/model/models.ts | 94 ++-- webapp/src/app/api/model/open-access.ts | 21 + webapp/src/app/api/model/person-bio.ts | 18 + .../api/model/validation-error-loc-inner.ts | 14 + webapp/src/app/api/model/validation-error.ts | 18 + webapp/src/app/api/model/work-biblio.ts | 21 + .../work-citation-normalized-percentile.ts | 21 + .../model/work-cited-by-percentile-year.ts | 19 + .../api/model/work-counts-by-year-inner.ts | 19 + webapp/src/app/api/model/work-has-content.ts | 19 + webapp/src/app/api/model/work-ids.ts | 22 + webapp/src/app/api/model/work-keyword.ts | 21 + webapp/src/app/api/model/work-mesh-inner.ts | 22 + webapp/src/app/api/model/work-page.ts | 35 ++ ...ork-sustainable-development-goals-inner.ts | 21 + webapp/src/app/api/model/work-topic-domain.ts | 19 + webapp/src/app/api/model/work-topic-field.ts | 19 + .../app/api/model/work-topic-information.ts | 22 + .../src/app/api/model/work-topic-subfield.ts | 19 + webapp/src/app/api/model/work-topic.ts | 27 + webapp/src/app/api/model/work.ts | 24 +- .../src/app/api/model/works-list-response.ts | 23 + 70 files changed, 2747 insertions(+), 152 deletions(-) create mode 100644 webapp/src/app/api/api/inse-account-service.service.ts create mode 100644 webapp/src/app/api/api/inse-account-service.serviceInterface.ts create mode 100644 webapp/src/app/api/api/inse-service.service.ts create mode 100644 webapp/src/app/api/api/inse-service.serviceInterface.ts create mode 100644 webapp/src/app/api/api/items.serviceInterface.ts create mode 100644 webapp/src/app/api/api/person-network.service.ts create mode 100644 webapp/src/app/api/api/person-network.serviceInterface.ts create mode 100644 webapp/src/app/api/api/persons.serviceInterface.ts create mode 100644 webapp/src/app/api/api/topics.serviceInterface.ts create mode 100644 webapp/src/app/api/api/works.serviceInterface.ts create mode 100644 webapp/src/app/api/model/access-grant.ts create mode 100644 webapp/src/app/api/model/auth-account.ts create mode 100644 webapp/src/app/api/model/auth-scope.ts create mode 100644 webapp/src/app/api/model/author-affiliations-inner.ts create mode 100644 webapp/src/app/api/model/author-counts-by-year-inner.ts create mode 100644 webapp/src/app/api/model/author-ids.ts create mode 100644 webapp/src/app/api/model/author-parsed-longest-name.ts create mode 100644 webapp/src/app/api/model/author-summary-stats.ts create mode 100644 webapp/src/app/api/model/authors-list-response.ts create mode 100644 webapp/src/app/api/model/collaboration-network-edge.ts create mode 100644 webapp/src/app/api/model/collaboration-network-node-type.ts create mode 100644 webapp/src/app/api/model/collaboration-network-node.ts create mode 100644 webapp/src/app/api/model/collaboration-network.ts create mode 100644 webapp/src/app/api/model/cost-usd.ts create mode 100644 webapp/src/app/api/model/dehydrated-author.ts create mode 100644 webapp/src/app/api/model/dehydrated-funder.ts create mode 100644 webapp/src/app/api/model/dehydrated-institution.ts create mode 100644 webapp/src/app/api/model/dehydrated-source.ts create mode 100644 webapp/src/app/api/model/filter-information.ts create mode 100644 webapp/src/app/api/model/filter-properties.ts create mode 100644 webapp/src/app/api/model/group-by-result.ts create mode 100644 webapp/src/app/api/model/http-validation-error.ts create mode 100644 webapp/src/app/api/model/identity-grant.ts create mode 100644 webapp/src/app/api/model/institution-information.ts create mode 100644 webapp/src/app/api/model/item-create.ts create mode 100644 webapp/src/app/api/model/item-page.ts create mode 100644 webapp/src/app/api/model/model2-yr-mean-citedness.ts create mode 100644 webapp/src/app/api/model/open-access.ts create mode 100644 webapp/src/app/api/model/person-bio.ts create mode 100644 webapp/src/app/api/model/validation-error-loc-inner.ts create mode 100644 webapp/src/app/api/model/validation-error.ts create mode 100644 webapp/src/app/api/model/work-biblio.ts create mode 100644 webapp/src/app/api/model/work-citation-normalized-percentile.ts create mode 100644 webapp/src/app/api/model/work-cited-by-percentile-year.ts create mode 100644 webapp/src/app/api/model/work-counts-by-year-inner.ts create mode 100644 webapp/src/app/api/model/work-has-content.ts create mode 100644 webapp/src/app/api/model/work-ids.ts create mode 100644 webapp/src/app/api/model/work-keyword.ts create mode 100644 webapp/src/app/api/model/work-mesh-inner.ts create mode 100644 webapp/src/app/api/model/work-page.ts create mode 100644 webapp/src/app/api/model/work-sustainable-development-goals-inner.ts create mode 100644 webapp/src/app/api/model/work-topic-domain.ts create mode 100644 webapp/src/app/api/model/work-topic-field.ts create mode 100644 webapp/src/app/api/model/work-topic-information.ts create mode 100644 webapp/src/app/api/model/work-topic-subfield.ts create mode 100644 webapp/src/app/api/model/work-topic.ts create mode 100644 webapp/src/app/api/model/works-list-response.ts diff --git a/webapp/openapitools.json b/webapp/openapitools.json index 061602d3..7af6e36f 100644 --- a/webapp/openapitools.json +++ b/webapp/openapitools.json @@ -11,7 +11,7 @@ "additionalProperties": { "ngVersion": "21.2.14", "providedInRoot": true, - "serviceSuffix": "OpenApiService", + "serviceSuffix": "Service", "withInterfaces": true, "enumPropertyNaming": "original", "fileNaming": "kebab-case" diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 0fa5c409..90cfa5e3 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -1,78 +1,84 @@ .gitignore -.openapi-generator-ignore 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.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/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/validationError.ts -model/validationErrorLocInner.ts +model/validation-error-loc-inner.ts +model/validation-error.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 diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index d9409cee..e7502847 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -1,15 +1,22 @@ -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 './topics.service'; import { TopicsService } from './topics.service'; +export * from './topics.serviceInterface'; export * from './works.service'; import { WorksService } from './works.service'; +export * from './works.serviceInterface'; export const APIS = [INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, TopicsService, WorksService]; diff --git a/webapp/src/app/api/api/inse-account-service.service.ts b/webapp/src/app/api/api/inse-account-service.service.ts new file mode 100644 index 00000000..ef79eace --- /dev/null +++ b/webapp/src/app/api/api/inse-account-service.service.ts @@ -0,0 +1,216 @@ +/** + * 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 { AccessGrant } from '../model/access-grant'; +// @ts-ignore +import { HTTPValidationError } from '../model/http-validation-error'; +// @ts-ignore +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 implements INSEAccountServiceServiceInterface { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Get Access Grant + * @endpoint post /inse-account/auth/access + * @param secret + * @param account + * @param organization + * @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 getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (secret === null || secret === undefined) { + throw new Error('Required parameter secret was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.'); + } + if (account === null || account === undefined) { + throw new Error('Required parameter account was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.'); + } + if (organization === null || organization === undefined) { + throw new Error('Required parameter organization was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.'); + } + + 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; + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/x-www-form-urlencoded' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let localVarFormParams: { append(param: string, value: any): any; }; + let localVarUseForm = false; + let localVarConvertFormParamsToString = false; + if (localVarUseForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new HttpParams({encoder: this.encoder}); + } + + if (secret !== undefined) { + localVarFormParams = localVarFormParams.append('secret', secret) as any || localVarFormParams; + } + if (account !== undefined) { + localVarFormParams = localVarFormParams.append('account', account) as any || localVarFormParams; + } + if (organization !== undefined) { + localVarFormParams = localVarFormParams.append('organization', organization) as any || localVarFormParams; + } + + 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 = `/inse-account/auth/access`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get Identity Grant + * @endpoint post /inse-account/auth/id + * @param username + * @param password + * @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 getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getIdentityGrantInseAccountAuthIdPost.'); + } + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling getIdentityGrantInseAccountAuthIdPost.'); + } + + 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; + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/x-www-form-urlencoded' + ]; + + const canConsumeForm = this.canConsumeForm(consumes); + + let localVarFormParams: { append(param: string, value: any): any; }; + let localVarUseForm = false; + let localVarConvertFormParamsToString = false; + if (localVarUseForm) { + localVarFormParams = new FormData(); + } else { + localVarFormParams = new HttpParams({encoder: this.encoder}); + } + + if (username !== undefined) { + localVarFormParams = localVarFormParams.append('username', username) as any || localVarFormParams; + } + if (password !== undefined) { + localVarFormParams = localVarFormParams.append('password', password) as any || localVarFormParams; + } + + 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 = `/inse-account/auth/id`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/webapp/src/app/api/api/inse-account-service.serviceInterface.ts b/webapp/src/app/api/api/inse-account-service.serviceInterface.ts new file mode 100644 index 00000000..2cb6b360 --- /dev/null +++ b/webapp/src/app/api/api/inse-account-service.serviceInterface.ts @@ -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; + + /** + * Get Identity Grant + * + * @endpoint post /inse-account/auth/id + * @param username + * @param password + */ + getIdentityGrantInseAccountAuthIdPost(username: string, password: string, extraHttpRequestParams?: any): Observable; + +} diff --git a/webapp/src/app/api/api/inse-service.service.ts b/webapp/src/app/api/api/inse-service.service.ts new file mode 100644 index 00000000..4e3d5637 --- /dev/null +++ b/webapp/src/app/api/api/inse-service.service.ts @@ -0,0 +1,490 @@ +/** + * 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 { HTTPValidationError } from '../model/http-validation-error'; +// @ts-ignore +import { Item } from '../model/item'; +// @ts-ignore +import { ItemCreate } from '../model/item-create'; +// @ts-ignore +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 { + INSEServiceServiceInterface +} from './inse-service.serviceInterface'; + + + +@Injectable({ + providedIn: 'root' +}) +export class INSEServiceService extends BaseService implements INSEServiceServiceInterface { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Adds a new item. + * @endpoint post /api/inse-service/items + * @param itemCreate + * @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 addItem(itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (itemCreate === null || itemCreate === undefined) { + throw new Error('Required parameter itemCreate was null or undefined when calling addItem.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + 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; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + 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/items`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: itemCreate, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * 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. + * @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 buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + saveJson, 'save_json'); + + 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/topics/cache`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Counts topic hierarchy occurrences from cache. + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + * @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 countTopicHierarchy(topic: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public countTopicHierarchy(topic: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public countTopicHierarchy(topic: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (topic === null || topic === undefined) { + throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } + + 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/topics/count`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Deletes the item with the id. + * @endpoint delete /api/inse-service/items/{id} + * @param id The item id. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public deleteItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling deleteItem.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + 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/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('delete', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Returns the item with the id. + * @endpoint get /api/inse-service/items/{id} + * @param id The item id. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getItem.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + 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/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Returns a page of items. + * @endpoint get /api/inse-service/items + * @param pageOffset The page offset. + * @param pageSize The page size. + * @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 getItems(pageOffset?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getItems(pageOffset?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'pageOffset'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + 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/items`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Updates the item with the id. + * @endpoint put /api/inse-service/items/{id} + * @param id The item id. + * @param itemCreate + * @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 updateItem(id: number, itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling updateItem.'); + } + if (itemCreate === null || itemCreate === undefined) { + throw new Error('Required parameter itemCreate was null or undefined when calling updateItem.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + 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; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + 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/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: itemCreate, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/webapp/src/app/api/api/inse-service.serviceInterface.ts b/webapp/src/app/api/api/inse-service.serviceInterface.ts new file mode 100644 index 00000000..6739063e --- /dev/null +++ b/webapp/src/app/api/api/inse-service.serviceInterface.ts @@ -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 { 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 INSEServiceServiceInterface { + defaultHeaders: HttpHeaders; + configuration: Configuration; + + /** + * Adds a new item. + * + * @endpoint post /api/inse-service/items + * @param itemCreate + */ + addItem(itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable; + + /** + * 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; + + /** + * Counts topic hierarchy occurrences from cache. + * + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + */ + countTopicHierarchy(topic: Array, extraHttpRequestParams?: any): Observable; + + /** + * Deletes the item with the id. + * + * @endpoint delete /api/inse-service/items/{id} + * @param id The item id. + */ + deleteItem(id: number, extraHttpRequestParams?: any): Observable; + + /** + * Returns the item with the id. + * + * @endpoint get /api/inse-service/items/{id} + * @param id The item id. + */ + getItem(id: number, extraHttpRequestParams?: any): Observable; + + /** + * 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; + + /** + * 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; + +} diff --git a/webapp/src/app/api/api/items.service.ts b/webapp/src/app/api/api/items.service.ts index 69cd8e54..1d00c8c8 100644 --- a/webapp/src/app/api/api/items.service.ts +++ b/webapp/src/app/api/api/items.service.ts @@ -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); diff --git a/webapp/src/app/api/api/items.serviceInterface.ts b/webapp/src/app/api/api/items.serviceInterface.ts new file mode 100644 index 00000000..140cbec0 --- /dev/null +++ b/webapp/src/app/api/api/items.serviceInterface.ts @@ -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; + + /** + * Deletes the item with the id. + * + * @endpoint delete /api/inse-service/items/{id} + * @param id The item id. + */ + deleteItem(id: number, extraHttpRequestParams?: any): Observable; + + /** + * Returns the item with the id. + * + * @endpoint get /api/inse-service/items/{id} + * @param id The item id. + */ + getItem(id: number, extraHttpRequestParams?: any): Observable; + + /** + * 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; + + /** + * 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; + +} diff --git a/webapp/src/app/api/api/person-network.service.ts b/webapp/src/app/api/api/person-network.service.ts new file mode 100644 index 00000000..135a20d8 --- /dev/null +++ b/webapp/src/app/api/api/person-network.service.ts @@ -0,0 +1,112 @@ +/** + * 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 { CollaborationNetwork } from '../model/collaboration-network'; +// @ts-ignore +import { FilterProperties } from '../model/filter-properties'; +// @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 { + PersonNetworkServiceInterface +} from './person-network.serviceInterface'; + + + +@Injectable({ + providedIn: 'root' +}) +export class PersonNetworkService extends BaseService implements PersonNetworkServiceInterface { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Get a person\'s collaboration network. + * Returns a person\'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 + * @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 getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawUserId === null || rawUserId === undefined) { + throw new Error('Required parameter rawUserId was null or undefined when calling getCollaborationNetwork.'); + } + + 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; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + 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/person/network/${this.configuration.encodeParam({name: "rawUserId", value: rawUserId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: filterProperties, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/webapp/src/app/api/api/person-network.serviceInterface.ts b/webapp/src/app/api/api/person-network.serviceInterface.ts new file mode 100644 index 00000000..58e7a1fb --- /dev/null +++ b/webapp/src/app/api/api/person-network.serviceInterface.ts @@ -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\'s collaboration network. + * Returns a person\'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; + +} diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index 03c031d5..ec63157c 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -17,23 +17,26 @@ 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 { 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 { + 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); @@ -166,6 +169,70 @@ export class PersonsService extends BaseService { ); } + /** + * 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, ... + * @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 getPersonByID_1(id: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPersonByID_1(id: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID_1(id: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID_1(id: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getPersonByID_1.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling getPersonByID_1.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + 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/person/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + /** * Searches for persons by ID or name. * @endpoint get /api/inse-service/persons/search @@ -231,7 +298,7 @@ export class PersonsService extends BaseService { /** * Searches for person by name. - * @endpoint get /persons/autocomplete + * @endpoint get /api/inse-service/persons/autocomplete * @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, ... * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. @@ -279,7 +346,73 @@ export class PersonsService extends BaseService { } } - let localVarPath = `/persons/autocomplete`; + let localVarPath = `/api/inse-service/persons/autocomplete`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for person by name. + * @endpoint get /api/inse-service/persons/autocomplete + * @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, ... + * @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 searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsAutocomplete_2(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorName === null || authorName === undefined) { + throw new Error('Required parameter authorName was null or undefined when calling searchPersonsAutocomplete_2.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsAutocomplete_2.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorName, 'author_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + 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/autocomplete`; const { basePath, withCredentials } = this.configuration; return this.httpClient.request('get', `${basePath}${localVarPath}`, { @@ -300,13 +433,15 @@ export class PersonsService extends BaseService { * @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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByInstitution(institutionName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (institutionName === null || institutionName === undefined) { throw new Error('Required parameter institutionName was null or undefined when calling searchPersonsByInstitution.'); } @@ -319,6 +454,82 @@ export class PersonsService extends BaseService { institutionName, 'institution_name'); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); + + 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/searchByInstitution`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * 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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (institutionName === null || institutionName === undefined) { + throw new Error('Required parameter institutionName was null or undefined when calling searchPersonsByInstitution_3.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByInstitution_3.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institution_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); let localVarHeaders = this.defaultHeaders; @@ -366,13 +577,15 @@ export class PersonsService extends BaseService { * @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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public searchPersonsByName(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsByName(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByName(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByName(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (authorName === null || authorName === undefined) { throw new Error('Required parameter authorName was null or undefined when calling searchPersonsByName.'); } @@ -385,6 +598,82 @@ export class PersonsService extends BaseService { authorName, 'author_name'); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); + + 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/searchByName`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * 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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorName === null || authorName === undefined) { + throw new Error('Required parameter authorName was null or undefined when calling searchPersonsByName_4.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByName_4.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorName, 'author_name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'page_offset'); let localVarHeaders = this.defaultHeaders; diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts new file mode 100644 index 00000000..6d4405bd --- /dev/null +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -0,0 +1,126 @@ +/** + * 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 { 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; + + /** + * 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; + + /** + * 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_1(id: string, include: string, extraHttpRequestParams?: any): Observable; + + /** + * 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; + + /** + * Searches for person by name. + * + * @endpoint get /api/inse-service/persons/autocomplete + * @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, ... + */ + searchPersonsAutocomplete(authorName: string, include: string, extraHttpRequestParams?: any): Observable; + + /** + * Searches for person by name. + * + * @endpoint get /api/inse-service/persons/autocomplete + * @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, ... + */ + searchPersonsAutocomplete_2(authorName: string, include: string, extraHttpRequestParams?: any): Observable; + + /** + * 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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + */ + searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable; + + /** + * 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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + */ + searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable; + + /** + * 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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + */ + searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable; + + /** + * 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, ... + * @param limit Limit of search page results + * @param pageOffset Offset of the result page + */ + searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable; + +} diff --git a/webapp/src/app/api/api/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 68afe965..193a1b1f 100644 --- a/webapp/src/app/api/api/topics.service.ts +++ b/webapp/src/app/api/api/topics.service.ts @@ -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); diff --git a/webapp/src/app/api/api/topics.serviceInterface.ts b/webapp/src/app/api/api/topics.serviceInterface.ts new file mode 100644 index 00000000..6a60f441 --- /dev/null +++ b/webapp/src/app/api/api/topics.serviceInterface.ts @@ -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; + + /** + * Counts topic hierarchy occurrences from cache. + * + * @endpoint get /api/inse-service/topics/count + * @param topic Topic names (repeat parameter). + */ + countTopicHierarchy(topic: Array, extraHttpRequestParams?: any): Observable; + +} diff --git a/webapp/src/app/api/api/works.service.ts b/webapp/src/app/api/api/works.service.ts index 56e33449..228548cb 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -17,23 +17,26 @@ 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 { WorkPage } from '../model/workPage'; +import { WorkPage } from '../model/work-page'; // @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 { BaseService } from '../api.base.service'; +import { + WorksServiceInterface +} from './works.serviceInterface'; @Injectable({ 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) { super(basePath, configuration); diff --git a/webapp/src/app/api/api/works.serviceInterface.ts b/webapp/src/app/api/api/works.serviceInterface.ts new file mode 100644 index 00000000..887bb9c3 --- /dev/null +++ b/webapp/src/app/api/api/works.serviceInterface.ts @@ -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; + + /** + * 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, type?: Array, language?: Array, extraHttpRequestParams?: any): Observable; + +} diff --git a/webapp/src/app/api/model/access-grant.ts b/webapp/src/app/api/model/access-grant.ts new file mode 100644 index 00000000..9de129ac --- /dev/null +++ b/webapp/src/app/api/model/access-grant.ts @@ -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 { AuthScope } from './auth-scope'; + + +export interface AccessGrant { + token_type: string; + access_token: string; + expires_in: number; + scope: AuthScope; + refresh_token: string; +} + diff --git a/webapp/src/app/api/model/auth-account.ts b/webapp/src/app/api/model/auth-account.ts new file mode 100644 index 00000000..0c76d8dc --- /dev/null +++ b/webapp/src/app/api/model/auth-account.ts @@ -0,0 +1,17 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface AuthAccount { + i: number; + l: string; + o: number; +} + diff --git a/webapp/src/app/api/model/auth-scope.ts b/webapp/src/app/api/model/auth-scope.ts new file mode 100644 index 00000000..0d9d325d --- /dev/null +++ b/webapp/src/app/api/model/auth-scope.ts @@ -0,0 +1,19 @@ +/** + * 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 { AuthAccount } from './auth-account'; + + +export interface AuthScope { + t: string; + a: AuthAccount; + d?: number | null; + r?: Array; +} + diff --git a/webapp/src/app/api/model/author-affiliations-inner.ts b/webapp/src/app/api/model/author-affiliations-inner.ts new file mode 100644 index 00000000..7d3ee92b --- /dev/null +++ b/webapp/src/app/api/model/author-affiliations-inner.ts @@ -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 { DehydratedInstitution } from './dehydrated-institution'; + + +/** + * AuthorAffiliationsInner + */ +export interface AuthorAffiliationsInner { + institution?: DehydratedInstitution | null; + years?: Array | null; +} + diff --git a/webapp/src/app/api/model/author-counts-by-year-inner.ts b/webapp/src/app/api/model/author-counts-by-year-inner.ts new file mode 100644 index 00000000..d16c7c21 --- /dev/null +++ b/webapp/src/app/api/model/author-counts-by-year-inner.ts @@ -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. + */ + + +/** + * AuthorCountsByYearInner + */ +export interface AuthorCountsByYearInner { + year?: number | null; + works_count?: number | null; + cited_by_count?: number | null; +} + diff --git a/webapp/src/app/api/model/author-ids.ts b/webapp/src/app/api/model/author-ids.ts new file mode 100644 index 00000000..9235a207 --- /dev/null +++ b/webapp/src/app/api/model/author-ids.ts @@ -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. + */ + + +/** + * External identifiers: + */ +export interface AuthorIds { + openalex?: string | null; + orcid?: string | null; + scopus?: string | null; +} + diff --git a/webapp/src/app/api/model/author-parsed-longest-name.ts b/webapp/src/app/api/model/author-parsed-longest-name.ts new file mode 100644 index 00000000..f49e04be --- /dev/null +++ b/webapp/src/app/api/model/author-parsed-longest-name.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * The longest name parsed into its component parts. + */ +export interface AuthorParsedLongestName { + first?: string | null; + middle?: string | null; + last?: string | null; + suffix?: string | null; + nickname?: string | null; +} + diff --git a/webapp/src/app/api/model/author-summary-stats.ts b/webapp/src/app/api/model/author-summary-stats.ts new file mode 100644 index 00000000..9bdb23e8 --- /dev/null +++ b/webapp/src/app/api/model/author-summary-stats.ts @@ -0,0 +1,21 @@ +/** + * 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 { Model2YrMeanCitedness } from './model2-yr-mean-citedness'; + + +/** + * Citation metrics: + */ +export interface AuthorSummaryStats { + '2yr_mean_citedness'?: Model2YrMeanCitedness | null; + h_index?: number | null; + i10_index?: number | null; +} + diff --git a/webapp/src/app/api/model/author.ts b/webapp/src/app/api/model/author.ts index 9ba12273..8d91fe5d 100644 --- a/webapp/src/app/api/model/author.ts +++ b/webapp/src/app/api/model/author.ts @@ -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'; /** diff --git a/webapp/src/app/api/model/authors-list-response.ts b/webapp/src/app/api/model/authors-list-response.ts new file mode 100644 index 00000000..37a9fc2c --- /dev/null +++ b/webapp/src/app/api/model/authors-list-response.ts @@ -0,0 +1,23 @@ +/** + * 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 { Author } from './author'; +import { GroupByResult } from './group-by-result'; + + +/** + * AuthorsListResponse + */ +export interface AuthorsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; +} + diff --git a/webapp/src/app/api/model/authorship.ts b/webapp/src/app/api/model/authorship.ts index db3a0bf0..cd95a07b 100644 --- a/webapp/src/app/api/model/authorship.ts +++ b/webapp/src/app/api/model/authorship.ts @@ -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'; /** diff --git a/webapp/src/app/api/model/collaboration-network-edge.ts b/webapp/src/app/api/model/collaboration-network-edge.ts new file mode 100644 index 00000000..16fb5fc6 --- /dev/null +++ b/webapp/src/app/api/model/collaboration-network-edge.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface CollaborationNetworkEdge { + /** + * The raw ID of the source node. + */ + raw_source_id: string; + /** + * The raw ID of the target node. + */ + raw_target_id: string; +} + diff --git a/webapp/src/app/api/model/collaboration-network-node-type.ts b/webapp/src/app/api/model/collaboration-network-node-type.ts new file mode 100644 index 00000000..1b3c0d84 --- /dev/null +++ b/webapp/src/app/api/model/collaboration-network-node-type.ts @@ -0,0 +1,18 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export const CollaborationNetworkNodeType = { + author: 'author', + institution: 'institution', + work: 'work' +} as const; +export type CollaborationNetworkNodeType = typeof CollaborationNetworkNodeType[keyof typeof CollaborationNetworkNodeType]; + diff --git a/webapp/src/app/api/model/collaboration-network-node.ts b/webapp/src/app/api/model/collaboration-network-node.ts new file mode 100644 index 00000000..3a4542d3 --- /dev/null +++ b/webapp/src/app/api/model/collaboration-network-node.ts @@ -0,0 +1,30 @@ +/** + * 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 { CollaborationNetworkNodeType } from './collaboration-network-node-type'; + + +export interface CollaborationNetworkNode { + /** + * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. + */ + raw_id: string; + /** + * The display name of the node. + */ + display_name: string; + /** + * The category of the node, either \'author\', \'institution\', or \'work\'. + */ + category: CollaborationNetworkNodeType; +} +export namespace CollaborationNetworkNode { +} + + diff --git a/webapp/src/app/api/model/collaboration-network.ts b/webapp/src/app/api/model/collaboration-network.ts new file mode 100644 index 00000000..9956ae19 --- /dev/null +++ b/webapp/src/app/api/model/collaboration-network.ts @@ -0,0 +1,33 @@ +/** + * 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 { FilterInformation } from './filter-information'; +import { CollaborationNetworkEdge } from './collaboration-network-edge'; +import { CollaborationNetworkNode } from './collaboration-network-node'; + + +export interface CollaborationNetwork { + /** + * The raw person ID of the person whose collaboration network this is. + */ + raw_person_id: string; + /** + * The nodes in the collaboration network. + */ + nodes: Array; + /** + * The edges in the collaboration network. + */ + edges: Array; + /** + * The filter information for the collaboration network, including the minimum and maximum publication years of the works in the collaboration network. + */ + filter_information: FilterInformation; +} + diff --git a/webapp/src/app/api/model/cost-usd.ts b/webapp/src/app/api/model/cost-usd.ts new file mode 100644 index 00000000..c7bcbee8 --- /dev/null +++ b/webapp/src/app/api/model/cost-usd.ts @@ -0,0 +1,17 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Cost of this request in USD + */ +export interface CostUsd { +} + diff --git a/webapp/src/app/api/model/dehydrated-author.ts b/webapp/src/app/api/model/dehydrated-author.ts new file mode 100644 index 00000000..4d3817f1 --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-author.ts @@ -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. + */ + + +/** + * [Dehydrated Author](/api-reference/authors#the-dehydratedauthor-object) — reduced-field version used in nested contexts + */ +export interface DehydratedAuthor { + id?: string | null; + display_name?: string | null; + orcid?: string | null; +} + diff --git a/webapp/src/app/api/model/dehydrated-funder.ts b/webapp/src/app/api/model/dehydrated-funder.ts new file mode 100644 index 00000000..b134bbb1 --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-funder.ts @@ -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. + */ + + +/** + * [Dehydrated Funder](/api-reference/funders) — reduced-field version used in nested contexts + */ +export interface DehydratedFunder { + id?: string | null; + display_name?: string | null; + ror?: string | null; +} + diff --git a/webapp/src/app/api/model/dehydrated-institution.ts b/webapp/src/app/api/model/dehydrated-institution.ts new file mode 100644 index 00000000..7b6c9824 --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-institution.ts @@ -0,0 +1,23 @@ +/** + * 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. + */ + + +/** + * [Dehydrated Institution](/api-reference/institutions#the-dehydratedinstitution-object) — reduced-field version used in nested contexts + */ +export interface DehydratedInstitution { + id?: string | null; + display_name?: string | null; + ror?: string | null; + country_code?: string | null; + type?: string | null; + lineage?: Array | null; +} + diff --git a/webapp/src/app/api/model/dehydrated-source.ts b/webapp/src/app/api/model/dehydrated-source.ts new file mode 100644 index 00000000..ae714846 --- /dev/null +++ b/webapp/src/app/api/model/dehydrated-source.ts @@ -0,0 +1,28 @@ +/** + * 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. + */ + + +/** + * [Dehydrated Source](/api-reference/sources#the-dehydratedsource-object) — reduced-field version used in nested contexts + */ +export interface DehydratedSource { + id?: string | null; + display_name?: string | null; + issn_l?: string | null; + issn?: Array | null; + is_oa?: boolean | null; + is_in_doaj?: boolean | null; + is_core?: boolean | null; + host_organization?: string | null; + host_organization_name?: string | null; + host_organization_lineage?: Array | null; + type?: string | null; +} + diff --git a/webapp/src/app/api/model/filter-information.ts b/webapp/src/app/api/model/filter-information.ts new file mode 100644 index 00000000..a8e9d5dd --- /dev/null +++ b/webapp/src/app/api/model/filter-information.ts @@ -0,0 +1,32 @@ +/** + * 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 { InstitutionInformation } from './institution-information'; +import { WorkTopicInformation } from './work-topic-information'; + + +export interface FilterInformation { + /** + * The minimum publication year of the works in the collaboration network. + */ + min_possible_year: number; + /** + * The maximum publication year of the works in the collaboration network. + */ + max_possible_year: number; + /** + * The list of institutions associated with the works in the collaboration network. + */ + institutions: Array; + /** + * The list of topics associated with the works in the collaboration network. + */ + topics: Array; +} + diff --git a/webapp/src/app/api/model/filter-properties.ts b/webapp/src/app/api/model/filter-properties.ts new file mode 100644 index 00000000..daeb08ee --- /dev/null +++ b/webapp/src/app/api/model/filter-properties.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface FilterProperties { + start_year: number | null; + end_year: number | null; + allowed_institutions: Array | null; + allowed_topics: Array | null; + min_collaborators: number | null; + max_collaborators: number | null; + min_collaborations: number | null; + max_collaborations: number | null; +} + diff --git a/webapp/src/app/api/model/group-by-result.ts b/webapp/src/app/api/model/group-by-result.ts new file mode 100644 index 00000000..68c51855 --- /dev/null +++ b/webapp/src/app/api/model/group-by-result.ts @@ -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. + */ + + +/** + * GroupByResult + */ +export interface GroupByResult { + key?: string | null; + key_display_name?: string | null; + count?: number | null; +} + diff --git a/webapp/src/app/api/model/http-validation-error.ts b/webapp/src/app/api/model/http-validation-error.ts new file mode 100644 index 00000000..a82a8f71 --- /dev/null +++ b/webapp/src/app/api/model/http-validation-error.ts @@ -0,0 +1,16 @@ +/** + * 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 { ValidationError } from './validation-error'; + + +export interface HTTPValidationError { + detail?: Array; +} + diff --git a/webapp/src/app/api/model/identity-grant.ts b/webapp/src/app/api/model/identity-grant.ts new file mode 100644 index 00000000..fd48137c --- /dev/null +++ b/webapp/src/app/api/model/identity-grant.ts @@ -0,0 +1,19 @@ +/** + * 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 { AuthScope } from './auth-scope'; + + +export interface IdentityGrant { + token_type: string; + access_token: string; + expires_in: number; + scope: AuthScope; +} + diff --git a/webapp/src/app/api/model/institution-information.ts b/webapp/src/app/api/model/institution-information.ts new file mode 100644 index 00000000..e287b0fa --- /dev/null +++ b/webapp/src/app/api/model/institution-information.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface InstitutionInformation { + /** + * The raw institution ID of the institution. + */ + raw_id: string; + /** + * The display name of the institution. + */ + display_name: string; +} + diff --git a/webapp/src/app/api/model/item-create.ts b/webapp/src/app/api/model/item-create.ts new file mode 100644 index 00000000..608d6910 --- /dev/null +++ b/webapp/src/app/api/model/item-create.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ItemCreate { + /** + * The name of the item. + */ + name: string; + /** + * The description of the item. + */ + description: string; +} + diff --git a/webapp/src/app/api/model/item-page.ts b/webapp/src/app/api/model/item-page.ts new file mode 100644 index 00000000..56595b8a --- /dev/null +++ b/webapp/src/app/api/model/item-page.ts @@ -0,0 +1,31 @@ +/** + * 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 { Item } from './item'; + + +export interface ItemPage { + /** + * The elements of the page. + */ + elements?: Array; + /** + * The page offset in elements. + */ + offset?: number; + /** + * The total number of elements. + */ + total?: number; + /** + * The page size in elements. + */ + size?: number; +} + diff --git a/webapp/src/app/api/model/location.ts b/webapp/src/app/api/model/location.ts index f207d751..ed2aa1e2 100644 --- a/webapp/src/app/api/model/location.ts +++ b/webapp/src/app/api/model/location.ts @@ -7,7 +7,7 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { DehydratedSource } from './dehydratedSource'; +import { DehydratedSource } from './dehydrated-source'; /** diff --git a/webapp/src/app/api/model/meta.ts b/webapp/src/app/api/model/meta.ts index 8481062a..cf47d6d3 100644 --- a/webapp/src/app/api/model/meta.ts +++ b/webapp/src/app/api/model/meta.ts @@ -7,7 +7,7 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { CostUsd } from './costUsd'; +import { CostUsd } from './cost-usd'; /** diff --git a/webapp/src/app/api/model/model2-yr-mean-citedness.ts b/webapp/src/app/api/model/model2-yr-mean-citedness.ts new file mode 100644 index 00000000..67ec623c --- /dev/null +++ b/webapp/src/app/api/model/model2-yr-mean-citedness.ts @@ -0,0 +1,14 @@ +/** + * 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. + */ + + +export interface Model2YrMeanCitedness { +} + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 7a7099b5..a8200126 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -1,57 +1,57 @@ -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 './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 './validationError'; -export * from './validationErrorLocInner'; +export * from './validation-error'; +export * from './validation-error-loc-inner'; 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'; diff --git a/webapp/src/app/api/model/open-access.ts b/webapp/src/app/api/model/open-access.ts new file mode 100644 index 00000000..32a4ddd9 --- /dev/null +++ b/webapp/src/app/api/model/open-access.ts @@ -0,0 +1,21 @@ +/** + * 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. + */ + + +/** + * Open access information + */ +export interface OpenAccess { + is_oa?: boolean | null; + oa_status?: string | null; + oa_url?: string | null; + any_repository_has_fulltext?: boolean | null; +} + diff --git a/webapp/src/app/api/model/person-bio.ts b/webapp/src/app/api/model/person-bio.ts new file mode 100644 index 00000000..f7291e6f --- /dev/null +++ b/webapp/src/app/api/model/person-bio.ts @@ -0,0 +1,18 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface PersonBio { + /** + * The generated biography. + */ + bio: string; +} + diff --git a/webapp/src/app/api/model/validation-error-loc-inner.ts b/webapp/src/app/api/model/validation-error-loc-inner.ts new file mode 100644 index 00000000..d248a9b7 --- /dev/null +++ b/webapp/src/app/api/model/validation-error-loc-inner.ts @@ -0,0 +1,14 @@ +/** + * 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. + */ + + +export interface ValidationErrorLocInner { +} + diff --git a/webapp/src/app/api/model/validation-error.ts b/webapp/src/app/api/model/validation-error.ts new file mode 100644 index 00000000..c71e7bfa --- /dev/null +++ b/webapp/src/app/api/model/validation-error.ts @@ -0,0 +1,18 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { ValidationErrorLocInner } from './validation-error-loc-inner'; + + +export interface ValidationError { + loc: Array; + msg: string; + type: string; +} + diff --git a/webapp/src/app/api/model/work-biblio.ts b/webapp/src/app/api/model/work-biblio.ts new file mode 100644 index 00000000..f6d7079b --- /dev/null +++ b/webapp/src/app/api/model/work-biblio.ts @@ -0,0 +1,21 @@ +/** + * 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. + */ + + +/** + * Bibliographic info: `volume`, `issue`, `first_page`, `last_page`. + */ +export interface WorkBiblio { + volume?: string | null; + issue?: string | null; + first_page?: string | null; + last_page?: string | null; +} + diff --git a/webapp/src/app/api/model/work-citation-normalized-percentile.ts b/webapp/src/app/api/model/work-citation-normalized-percentile.ts new file mode 100644 index 00000000..a587ddf6 --- /dev/null +++ b/webapp/src/app/api/model/work-citation-normalized-percentile.ts @@ -0,0 +1,21 @@ +/** + * 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 { Value } from './value'; + + +/** + * Percentile of citation count normalized by work type, year, and subfield. Includes `value`, `is_in_top_1_percent`, `is_in_top_10_percent`. + */ +export interface WorkCitationNormalizedPercentile { + value?: Value | null; + is_in_top_1_percent?: boolean | null; + is_in_top_10_percent?: boolean | null; +} + diff --git a/webapp/src/app/api/model/work-cited-by-percentile-year.ts b/webapp/src/app/api/model/work-cited-by-percentile-year.ts new file mode 100644 index 00000000..5257eb3b --- /dev/null +++ b/webapp/src/app/api/model/work-cited-by-percentile-year.ts @@ -0,0 +1,19 @@ +/** + * 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. + */ + + +/** + * Percentile rank compared to other works published in the same year. Contains `min` and `max`. + */ +export interface WorkCitedByPercentileYear { + min?: number | null; + max?: number | null; +} + diff --git a/webapp/src/app/api/model/work-counts-by-year-inner.ts b/webapp/src/app/api/model/work-counts-by-year-inner.ts new file mode 100644 index 00000000..76d97d77 --- /dev/null +++ b/webapp/src/app/api/model/work-counts-by-year-inner.ts @@ -0,0 +1,19 @@ +/** + * 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. + */ + + +/** + * WorkCountsByYearInner + */ +export interface WorkCountsByYearInner { + year?: number | null; + cited_by_count?: number | null; +} + diff --git a/webapp/src/app/api/model/work-has-content.ts b/webapp/src/app/api/model/work-has-content.ts new file mode 100644 index 00000000..44fbe446 --- /dev/null +++ b/webapp/src/app/api/model/work-has-content.ts @@ -0,0 +1,19 @@ +/** + * 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. + */ + + +/** + * Information about downloadable full-text content: + */ +export interface WorkHasContent { + pdf?: boolean | null; + grobid_xml?: boolean | null; +} + diff --git a/webapp/src/app/api/model/work-ids.ts b/webapp/src/app/api/model/work-ids.ts new file mode 100644 index 00000000..e8315250 --- /dev/null +++ b/webapp/src/app/api/model/work-ids.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * External identifiers: `openalex`, `doi`, `mag`, `pmid`, `pmcid`. + */ +export interface WorkIds { + openalex?: string | null; + doi?: string | null; + mag?: number | null; + pmid?: string | null; + pmcid?: string | null; +} + diff --git a/webapp/src/app/api/model/work-keyword.ts b/webapp/src/app/api/model/work-keyword.ts new file mode 100644 index 00000000..c9c99afb --- /dev/null +++ b/webapp/src/app/api/model/work-keyword.ts @@ -0,0 +1,21 @@ +/** + * 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 { Score } from './score'; + + +/** + * WorkKeyword + */ +export interface WorkKeyword { + id?: string | null; + display_name?: string | null; + score?: Score | null; +} + diff --git a/webapp/src/app/api/model/work-mesh-inner.ts b/webapp/src/app/api/model/work-mesh-inner.ts new file mode 100644 index 00000000..40633524 --- /dev/null +++ b/webapp/src/app/api/model/work-mesh-inner.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * WorkMeshInner + */ +export interface WorkMeshInner { + descriptor_ui?: string | null; + descriptor_name?: string | null; + qualifier_ui?: string | null; + qualifier_name?: string | null; + is_major_topic?: boolean | null; +} + diff --git a/webapp/src/app/api/model/work-page.ts b/webapp/src/app/api/model/work-page.ts new file mode 100644 index 00000000..8490c3ab --- /dev/null +++ b/webapp/src/app/api/model/work-page.ts @@ -0,0 +1,35 @@ +/** + * 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 { Work } from './work'; + + +export interface WorkPage { + /** + * Total number of works matching the query + */ + total: number; + /** + * List of works on the current page + */ + elements: Array; + /** + * Offset of the current page + */ + offset: number; + /** + * Size of the current page + */ + size: number; + /** + * Indicates if the current page is the last page + */ + last_page: boolean; +} + diff --git a/webapp/src/app/api/model/work-sustainable-development-goals-inner.ts b/webapp/src/app/api/model/work-sustainable-development-goals-inner.ts new file mode 100644 index 00000000..c9ecd00f --- /dev/null +++ b/webapp/src/app/api/model/work-sustainable-development-goals-inner.ts @@ -0,0 +1,21 @@ +/** + * 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 { Score } from './score'; + + +/** + * WorkSustainableDevelopmentGoalsInner + */ +export interface WorkSustainableDevelopmentGoalsInner { + id?: string | null; + display_name?: string | null; + score?: Score | null; +} + diff --git a/webapp/src/app/api/model/work-topic-domain.ts b/webapp/src/app/api/model/work-topic-domain.ts new file mode 100644 index 00000000..1a9879d4 --- /dev/null +++ b/webapp/src/app/api/model/work-topic-domain.ts @@ -0,0 +1,19 @@ +/** + * 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. + */ + + +/** + * The parent [domain](/api-reference/domains) + */ +export interface WorkTopicDomain { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/work-topic-field.ts b/webapp/src/app/api/model/work-topic-field.ts new file mode 100644 index 00000000..1807cfc1 --- /dev/null +++ b/webapp/src/app/api/model/work-topic-field.ts @@ -0,0 +1,19 @@ +/** + * 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. + */ + + +/** + * The parent [field](/api-reference/fields) + */ +export interface WorkTopicField { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/work-topic-information.ts b/webapp/src/app/api/model/work-topic-information.ts new file mode 100644 index 00000000..ca3b9454 --- /dev/null +++ b/webapp/src/app/api/model/work-topic-information.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface WorkTopicInformation { + /** + * The ID of the topic. + */ + raw_topic_id: string; + /** + * The name of the topic. + */ + display_name: string; +} + diff --git a/webapp/src/app/api/model/work-topic-subfield.ts b/webapp/src/app/api/model/work-topic-subfield.ts new file mode 100644 index 00000000..b6e7278a --- /dev/null +++ b/webapp/src/app/api/model/work-topic-subfield.ts @@ -0,0 +1,19 @@ +/** + * 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. + */ + + +/** + * The parent [subfield](/api-reference/subfields) + */ +export interface WorkTopicSubfield { + id?: string | null; + display_name?: string | null; +} + diff --git a/webapp/src/app/api/model/work-topic.ts b/webapp/src/app/api/model/work-topic.ts new file mode 100644 index 00000000..87f829f2 --- /dev/null +++ b/webapp/src/app/api/model/work-topic.ts @@ -0,0 +1,27 @@ +/** + * 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 { Score } from './score'; +import { WorkTopicDomain } from './work-topic-domain'; +import { WorkTopicSubfield } from './work-topic-subfield'; +import { WorkTopicField } from './work-topic-field'; + + +/** + * WorkTopic + */ +export interface WorkTopic { + id?: string | null; + display_name?: string | null; + score?: Score | null; + subfield?: WorkTopicSubfield | null; + field?: WorkTopicField | null; + domain?: WorkTopicDomain | null; +} + diff --git a/webapp/src/app/api/model/work.ts b/webapp/src/app/api/model/work.ts index 07d94a1c..b84cc7b6 100644 --- a/webapp/src/app/api/model/work.ts +++ b/webapp/src/app/api/model/work.ts @@ -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'; /** diff --git a/webapp/src/app/api/model/works-list-response.ts b/webapp/src/app/api/model/works-list-response.ts new file mode 100644 index 00000000..cf03bd2e --- /dev/null +++ b/webapp/src/app/api/model/works-list-response.ts @@ -0,0 +1,23 @@ +/** + * 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 { Work } from './work'; +import { GroupByResult } from './group-by-result'; + + +/** + * WorksListResponse + */ +export interface WorksListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; +} + From fe6f64cc8c833656effdfb3dd564c290bf760ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Thu, 4 Jun 2026 23:42:39 +0200 Subject: [PATCH 015/268] Added summary cards for network --- ...erson-network-collaborators.component.scss | 58 +----------- ...erson-network-filter-dialog.component.html | 0 ...erson-network-filter-dialog.component.scss | 0 .../person-network-filter-dialog.component.ts | 25 ++++-- .../person-network-graph.component.html | 7 +- .../person-network-graph.component.scss | 5 +- .../person-network-graph.component.ts | 9 ++ .../person-network-info-card.component.html | 9 ++ .../person-network-info-card.component.scss | 34 +++++++ .../person-network-info-card.component.ts | 15 ++++ ...person-network-publications.component.scss | 55 +----------- .../person-network.component.html | 90 ++++++++++--------- .../person-network.component.scss | 60 ++++++------- .../person-network.component.ts | 53 ++++++++++- webapp/src/styles.scss | 3 + 15 files changed, 232 insertions(+), 191 deletions(-) rename webapp/src/app/{ => modules}/person-network-filter-dialog/person-network-filter-dialog.component.html (100%) rename webapp/src/app/{ => modules}/person-network-filter-dialog/person-network-filter-dialog.component.scss (100%) rename webapp/src/app/{ => modules}/person-network-filter-dialog/person-network-filter-dialog.component.ts (70%) create mode 100644 webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html create mode 100644 webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss create mode 100644 webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts diff --git a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss index efec585e..57d2cbf4 100644 --- a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss +++ b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.scss @@ -1,60 +1,11 @@ -.content { - display: flex; - flex-direction: row; - padding: 40px; - gap: 20px; - max-height: 1000px; -} - -.graph { - width: 75vh; - height: 75vh; -} - .table { overflow: auto; width: 100%; - max-height: 1000px; - height: 1200px; + max-height: 100%; } -.table table { - width: 100%; -} - -.table-area { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; -} - -.scroll-viewport-container { - width: 100%; - height: 100%; -} - -.form-controls { - display: flex; - flex-direction: row; - align-items: flex-start; - gap: 10px; -} - -.form-field-full { - width: 100%; -} - -.right-card { - width: 100%; -} - -.toggle-group { - margin-bottom: 20px; -} - -.toggle-group .mat-button-toggle { - text-transform: none; +.mat-mdc-table { + background-color: var(--sg-background); } .element-row { @@ -75,5 +26,4 @@ .detail-row { width: 100%; - -} \ No newline at end of file +} diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.html similarity index 100% rename from webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.html rename to webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.html diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.scss similarity index 100% rename from webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.scss rename to webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.scss diff --git a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.ts similarity index 70% rename from webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts rename to webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.ts index f452c4df..d69c6570 100644 --- a/webapp/src/app/person-network-filter-dialog/person-network-filter-dialog.component.ts +++ b/webapp/src/app/modules/person-network-filter-dialog/person-network-filter-dialog.component.ts @@ -1,4 +1,4 @@ -import { Component, inject } from '@angular/core'; +import { Component, inject, OnInit } from '@angular/core'; import { FormControl, FormGroup, @@ -11,7 +11,7 @@ import { MatDialogRef, } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; -import { CollaborationNetwork } from '../api'; +import { CollaborationNetwork } from '../../api'; import { MatSelectModule } from '@angular/material/select'; import { MatInputModule } from '@angular/material/input'; import { MatButtonModule } from '@angular/material/button'; @@ -37,12 +37,12 @@ export interface PersonNetworkFilterDialogData { MatSelectModule, MatDialogModule, MatInputModule, - MatButtonModule + MatButtonModule, ], templateUrl: './person-network-filter-dialog.component.html', styleUrl: './person-network-filter-dialog.component.scss', }) -export class PersonNetworkFilterDialogComponent { +export class PersonNetworkFilterDialogComponent implements OnInit { readonly dialogRef = inject(MatDialogRef); readonly data = inject(MAT_DIALOG_DATA); @@ -55,10 +55,23 @@ export class PersonNetworkFilterDialogComponent { maximumCollaborators: new FormControl(10), minimumCollaborations: new FormControl(1), maximumCollaborations: new FormControl(100), - institutions: new FormControl([]), - topics: new FormControl([]), + institutions: new FormControl([]), + topics: new FormControl([]), }); + ngOnInit() { + this.filterForm.patchValue({ + startYear: this.data.startYear, + endYear: this.data.endYear, + minimumCollaborators: this.data.minimumCollaborators, + maximumCollaborators: this.data.maximumCollaborators, + minimumCollaborations: this.data.minimumCollaborations, + maximumCollaborations: this.data.maximumCollaborations, + institutions: this.data.institutions, + topics: this.data.topics, + }); + } + onCancel() { this.dialogRef.close(); } diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html index a80560d8..ce985536 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html @@ -1,6 +1,11 @@ - @if (!isValidGraph()) { + @if (isEmptyGraph()) { +
+ warning +

Das Netzwerk ist leer.

+
+ } @else if (!isValidGraph()) {
warning

Das Netzwerk ist zu groß für eine detaillierte Darstellung.

diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss b/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss index 93a43f1b..f1ae7054 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.scss @@ -7,13 +7,14 @@ mat-card { display: flex; flex-direction: column; width: 100%; - background: transparent; + background-color: var(--sg-background); } -mat-card-content { +mat-card > mat-card-content { flex: 1 1 auto; min-height: 0; align-items: center; + padding: 0px; } .graph { diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts index 018ee2be..3b7b8d31 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts @@ -24,6 +24,15 @@ export class PersonNetworkGraphComponent { options!: EChartsCoreOption; + readonly isEmptyGraph = computed(() => { + const network = this.collaborationNetwork(); + return ( + network === undefined || + network.nodes.length === 0 || + network.edges.length === 0 + ); + }); + readonly isValidGraph = computed(() => { const network = this.collaborationNetwork(); return ( diff --git a/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html new file mode 100644 index 00000000..29c0ea8b --- /dev/null +++ b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.html @@ -0,0 +1,9 @@ + + + {{ icon() }} +
+ {{ value() }} + {{ description() }} +
+
+
diff --git a/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss new file mode 100644 index 00000000..13a84cc6 --- /dev/null +++ b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.scss @@ -0,0 +1,34 @@ +.info-card { + --info-card-icon-size: 40px; + + background-color: var(--sg-background); + padding: 10px 20px; +} +.info-card mat-card-content { + display: flex; + align-items: start; + gap: 10px; +} + +.info-card mat-icon { + width: var(--info-card-icon-size); + height: var(--info-card-icon-size); + font-size: var(--info-card-icon-size); + color: var(--sg-blue-highlight); +} + +.info-card div { + display: flex; + flex-direction: column; + gap: 4px; +} + +.info-card .number { + font-weight: var(--sg-default-bold-weight); + font-size: 1.5em; +} + +.info-card .description { + color: var(--sg-text-muted); + font-size: 0.9em; +} diff --git a/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts new file mode 100644 index 00000000..fe5c3913 --- /dev/null +++ b/webapp/src/app/modules/person-network-info-card/person-network-info-card.component.ts @@ -0,0 +1,15 @@ +import { Component, input } from '@angular/core'; +import { MatCardModule } from '@angular/material/card'; +import { MatIconModule } from '@angular/material/icon'; + +@Component({ + selector: 'app-person-network-info-card', + imports: [MatIconModule, MatCardModule], + templateUrl: './person-network-info-card.component.html', + styleUrl: './person-network-info-card.component.scss', +}) +export class PersonNetworkInfoCardComponent { + readonly icon = input(); + readonly value = input(); + readonly description = input(); +} diff --git a/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss b/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss index b6462c61..57d2cbf4 100644 --- a/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss +++ b/webapp/src/app/modules/person-network-publications/person-network-publications.component.scss @@ -1,60 +1,11 @@ -.content { - display: flex; - flex-direction: row; - padding: 40px; - gap: 20px; - max-height: 1000px; -} - -.graph { - width: 75vh; - height: 75vh; -} - .table { overflow: auto; width: 100%; - max-height: 1000px; - height: 1200px; + max-height: 100%; } -.table table { - width: 100%; -} - -.table-area { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; -} - -.scroll-viewport-container { - width: 100%; - height: 100%; -} - -.form-controls { - display: flex; - flex-direction: row; - align-items: flex-start; - gap: 10px; -} - -.form-field-full { - width: 100%; -} - -.right-card { - width: 100%; -} - -.toggle-group { - margin-bottom: 20px; -} - -.toggle-group .mat-button-toggle { - text-transform: none; +.mat-mdc-table { + background-color: var(--sg-background); } .element-row { diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html index d68d7eee..9cd6ab62 100644 --- a/webapp/src/app/modules/person-network/person-network.component.html +++ b/webapp/src/app/modules/person-network/person-network.component.html @@ -1,13 +1,7 @@
-
-
-
Netzwerk
-

Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.

-
- +
+
Netzwerk
+

Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.

@@ -18,21 +12,27 @@
- - - Kollaborierende - - Publikationen + - - + + Kollaborierende + + Publikationen + + +
+ {{ this.displayedTable() === "collaborators" ? "Suche Kollaborierende nach Name oder ID" @@ -48,25 +48,31 @@ -
- - -
- @if (this.displayedTable() === "collaborators") { - - } @else if (this.displayedTable() === "publications") { - - } -
-
-
-
+ + + @if (this.displayedTable() === "collaborators") { + + } @else if (this.displayedTable() === "publications") { + + } + +
+ +
+ @for (summary of this.summaryCards(); track $index) { + + } +
diff --git a/webapp/src/app/modules/person-network/person-network.component.scss b/webapp/src/app/modules/person-network/person-network.component.scss index b51ee5be..36506868 100644 --- a/webapp/src/app/modules/person-network/person-network.component.scss +++ b/webapp/src/app/modules/person-network/person-network.component.scss @@ -1,16 +1,7 @@ .content { display: flex; flex-direction: column; - padding: 40px; - gap: 20px; - align-items: stretch; -} - -.top-row { - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: end; + padding: 30px; gap: 20px; } @@ -23,24 +14,26 @@ display: flex; flex-direction: row; gap: 20px; + max-height: 80vh; +} + +form > div { + display: flex; + flex-direction: row; + gap: 20px; +} + +form > div > button, +form > div > mat-button-toggle-group { + margin-top: 20px; + margin-bottom: 20px; + border-radius: var(--sg-radius-sm); + color: var(--sg-text); } .content > app-person-network-graph, .right-card { flex: 1 1 0; - min-width: 0; -} - -.form-field-full { - width: 100%; -} - -.right-card { - width: 100%; -} - -.toggle-group { - margin-bottom: 20px; } .toggle-group .mat-button-toggle { @@ -48,18 +41,21 @@ width: 100%; } -.pair-field { +.summary-container { display: flex; + flex-direction: row; gap: 20px; } -.pair-field > mat-form-field { - width: 100%; +.summary-container app-person-network-info-card { + flex: 1 1 0; } -.top-row button { - height: 42px; - border-color: var(--sg-border); - border-radius: var(--sg-radius-sm); - color: var(--sg-text); -} \ No newline at end of file +.scroll-viewport-container { + height: 50vh; + max-height: 50vh; +} + +mat-card { + background-color: var(--sg-background); +} diff --git a/webapp/src/app/modules/person-network/person-network.component.ts b/webapp/src/app/modules/person-network/person-network.component.ts index 0c192706..f405bad9 100644 --- a/webapp/src/app/modules/person-network/person-network.component.ts +++ b/webapp/src/app/modules/person-network/person-network.component.ts @@ -1,6 +1,6 @@ import { toSignal } from '@angular/core/rxjs-interop'; -import { Component, computed, OnInit } from '@angular/core'; +import { Component, computed, OnInit, signal } from '@angular/core'; import { ActivatedRoute, Router, RouterModule } from '@angular/router'; import { MatCardModule } from '@angular/material/card'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; @@ -30,7 +30,8 @@ import { PersonNetworkGraphComponent } from '../person-network-graph/person-netw import { MatSelectModule } from '@angular/material/select'; import { MatExpansionModule } from '@angular/material/expansion'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; -import { PersonNetworkFilterDialogComponent } from '../../person-network-filter-dialog/person-network-filter-dialog.component'; +import { PersonNetworkFilterDialogComponent } from '../person-network-filter-dialog/person-network-filter-dialog.component'; +import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component'; @Component({ selector: 'app-person-network', @@ -56,6 +57,7 @@ import { PersonNetworkFilterDialogComponent } from '../../person-network-filter- MatSelectModule, MatExpansionModule, MatDialogModule, + PersonNetworkInfoCardComponent, ], templateUrl: './person-network.component.html', styleUrl: './person-network.component.scss', @@ -77,6 +79,34 @@ export class PersonNetworkComponent implements OnInit { displayedTable: new FormControl('collaborators'), }); + persons = signal(0); + institutions = signal(0); + publications = signal(0); + connections = signal(0); + + readonly summaryCards = computed(() => [ + { + icon: 'person', + value: this.persons(), + description: 'Personen', + }, + { + icon: 'apartment', + value: this.institutions(), + description: 'Institutionen', + }, + { + icon: 'menu_book', + value: this.publications(), + description: 'Gemeinsame Publikationen', + }, + { + icon: 'share', + value: this.connections(), + description: 'Verbindungen im Netzwerk', + }, + ]); + readonly formValue = toSignal(this.filterForm.valueChanges); readonly debouncedFormValue = toSignal( this.filterForm.valueChanges.pipe(debounceTime(300)), @@ -137,10 +167,29 @@ export class PersonNetworkComponent implements OnInit { }); } + calculateSummary(collaborationNetwork: CollaborationNetwork) { + this.persons.set( + collaborationNetwork.nodes.filter((node) => node.category === 'author') + .length, + ); + this.institutions.set( + collaborationNetwork.nodes.filter( + (node) => node.category === 'institution', + ).length, + ); + this.publications.set( + collaborationNetwork.nodes.filter((node) => node.category === 'work') + .length, + ); + this.connections.set(collaborationNetwork.edges.length); + } + ngOnInit(): void { this.activatedRoute.data.subscribe(({ collaborationNetwork }) => { this.collaborationNetwork = collaborationNetwork; + this.calculateSummary(collaborationNetwork); + const currentParams = this.activatedRoute.snapshot.queryParams; const initialStartYear = Number(currentParams['start_year']) || diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss index b938fc0f..271f28ac 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -118,6 +118,9 @@ body { --sg-radius-sm: 8px; --sg-radius-md: 12px; --sg-radius-lg: 18px; + + --sg-blue-highlight: #3d7cff; + --sg-default-bold-weight: 900; } * { From e107657318969824e8ab7a40907c1996884976be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Fri, 5 Jun 2026 10:52:08 +0200 Subject: [PATCH 016/268] Added legend and clickable nodes to graph --- .../person-network-graph.component.html | 1 + .../person-network-graph.component.ts | 107 +++++++++++++----- .../person-network.component.html | 1 + .../person-network.component.ts | 29 ++++- 4 files changed, 107 insertions(+), 31 deletions(-) diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html index ce985536..d3452f05 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.html +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.html @@ -17,6 +17,7 @@ [options]="options" [autoResize]="true" (wheel)="onGraphWheel($event)" + (chartClick)="onChartEvent($event, 'chartClick')" >
}
diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts index 3b7b8d31..7362cb6a 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts @@ -1,25 +1,46 @@ -import { Component, computed, effect, input } from '@angular/core'; +import { Component, computed, effect, input, output } from '@angular/core'; import { MatCardModule } from '@angular/material/card'; import { CollaborationNetwork } from '../../api'; import { NgxEchartsDirective } from 'ngx-echarts'; import { EChartsCoreOption } from 'echarts/types/dist/core'; import * as echarts from 'echarts/core'; -import { GridComponent, TitleComponent } from 'echarts/components'; +import { + GridComponent, + LegendComponent, + TitleComponent, +} from 'echarts/components'; import { CanvasRenderer } from 'echarts/renderers'; import { GraphChart } from 'echarts/charts'; import { MatIconModule } from '@angular/material/icon'; -echarts.use([GridComponent, CanvasRenderer, GraphChart, TitleComponent]); +import { ActivatedRoute, Router } from '@angular/router'; +echarts.use([ + GridComponent, + CanvasRenderer, + GraphChart, + TitleComponent, + LegendComponent, +]); + +export type NodeCategory = 'author' | 'collaborator' | 'work'; + +export interface NodeClickEvent { + id: string; + name: string; + category: NodeCategory; +} @Component({ selector: 'app-person-network-graph', imports: [MatCardModule, MatIconModule, NgxEchartsDirective], templateUrl: './person-network-graph.component.html', - styleUrl: './person-network-graph.component.scss', + styleUrls: ['./person-network-graph.component.scss'], }) export class PersonNetworkGraphComponent { collaborationNetwork = input(); + handleNodeClick = output(); + authorDisplayName: string = ''; options!: EChartsCoreOption; @@ -57,6 +78,26 @@ export class PersonNetworkGraphComponent { event.preventDefault(); } + categoryLabels: Record = { + author: 'Autor', + collaborator: 'Kollaborierender', + institution: 'Institution', + work: 'Arbeit', + }; + + onChartEvent(event: any, type: string) { + if (type !== 'chartClick') { + return; + } + const id = event?.data?.id; + const name = event?.data?.name; + const category = event?.data?.category; + if (!id || !name || !category) { + return; + } + this.handleNodeClick.emit({ id, name, category }); + } + private updateGraphOptions(collaborationNetwork: CollaborationNetwork): void { if (!collaborationNetwork) { return; @@ -65,8 +106,11 @@ export class PersonNetworkGraphComponent { const frequencies = this.calculateOccurenceFrequencies(collaborationNetwork); - const minFrequency = Math.min(...Object.values(frequencies)); - const maxFrequency = Math.max(...Object.values(frequencies)); + const freqValues = Object.values(frequencies); + const minFrequency = freqValues.length ? Math.min(...freqValues) : 0; + const maxFrequency = freqValues.length ? Math.max(...freqValues) : 0; + const freqDenominator = + maxFrequency === minFrequency ? 1 : maxFrequency - minFrequency; const datas = [ { @@ -84,26 +128,26 @@ export class PersonNetworkGraphComponent { return 'collaborator'; })(); - if (node.category === 'work') { - return { - id: node.raw_id + '', - name: node.display_name, - category, - }; - } + const baseId = node.raw_id + ''; + const nodeFreq = frequencies[node.raw_id] || 0; + const computedSymbolSize = + 25 + ((nodeFreq - minFrequency) / freqDenominator) * 30; return { - id: node.raw_id + '', + id: baseId, name: node.display_name, category, label: { - show: true, + show: node.category !== 'work', + formatter: '{b}', }, - symbolSize: - 25 + - (((frequencies[node.raw_id] || 0) - minFrequency) / - (maxFrequency - minFrequency)) * - 30, + emphasis: { + label: { + show: true, + formatter: '{b}', + }, + }, + symbolSize: node.category === 'work' ? 15 : computedSymbolSize, }; }), links: collaborationNetwork.edges.map((edge) => { @@ -126,25 +170,29 @@ export class PersonNetworkGraphComponent { }, ]; - this.authorDisplayName = - collaborationNetwork.nodes.find( - (node) => node.raw_id === collaborationNetwork.raw_person_id, - )?.display_name || 'Unknown Author'; + const legendData = datas.length + ? datas[0].categories.map((c) => c.name) + : []; this.options = { + legend: { + data: legendData, + bottom: 0, + orient: 'horizontal', + formatter: (name: string) => this.categoryLabels[name] || name, + itemGap: 20, + }, series: datas.map((item) => { return { - name: this.authorDisplayName, type: 'graph', layout: 'force', - symbolSize: 20, + symbolSize: 15, animation: false, data: item.nodes, roam: true, force: { repulsion: 10000, friction: 0.9, - // edgeLength: 25, gravity: 0.2, }, links: item.links.map((e) => { @@ -165,12 +213,11 @@ export class PersonNetworkGraphComponent { }), }; } - calculateOccurenceFrequencies( - netork: CollaborationNetwork, + network: CollaborationNetwork, ): Record { const frequencies: Record = {}; - netork.edges.forEach((edge) => { + network.edges.forEach((edge) => { frequencies[edge.raw_source_id] = (frequencies[edge.raw_source_id] || 0) + 1; frequencies[edge.raw_target_id] = diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html index 9cd6ab62..6ed2bd00 100644 --- a/webapp/src/app/modules/person-network/person-network.component.html +++ b/webapp/src/app/modules/person-network/person-network.component.html @@ -7,6 +7,7 @@
diff --git a/webapp/src/app/modules/person-network/person-network.component.ts b/webapp/src/app/modules/person-network/person-network.component.ts index f405bad9..5dc7902b 100644 --- a/webapp/src/app/modules/person-network/person-network.component.ts +++ b/webapp/src/app/modules/person-network/person-network.component.ts @@ -26,7 +26,11 @@ import { CollaborationNetwork } from '../../api'; import { PersonNetworkCollaboratorsComponent } from '../person-network-collaborators/person-network-collaborators.component'; import { PersonNetworkPublicationsComponent } from '../person-network-publications/person-network-publications.component'; import { debounceTime } from 'rxjs'; -import { PersonNetworkGraphComponent } from '../person-network-graph/person-network-graph.component'; +import { + NodeCategory, + NodeClickEvent, + PersonNetworkGraphComponent, +} from '../person-network-graph/person-network-graph.component'; import { MatSelectModule } from '@angular/material/select'; import { MatExpansionModule } from '@angular/material/expansion'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; @@ -84,6 +88,29 @@ export class PersonNetworkComponent implements OnInit { publications = signal(0); connections = signal(0); + private readonly categoryTableMap: Record = { + author: 'collaborators', + collaborator: 'collaborators', + work: 'publications', + }; + + latestNodeId = signal(null); + + handleNodeClick = ({ id, name, category }: NodeClickEvent): void => { + if (this.latestNodeId() === id) { + this.latestNodeId.set(null); + this.filterForm.patchValue({ searchTerm: '' }); + return; + } + + this.latestNodeId.set(id); + + this.filterForm.patchValue({ + displayedTable: this.categoryTableMap[category], + searchTerm: name, + }); + }; + readonly summaryCards = computed(() => [ { icon: 'person', From 4aad221543c61da6d8b031a13696beb101f0d7bd Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 11:49:03 +0200 Subject: [PATCH 017/268] added track_total_hits field to elastic wrapper --- service/src/main/inse/integrations/elasticsearch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/service/src/main/inse/integrations/elasticsearch.py b/service/src/main/inse/integrations/elasticsearch.py index 0f4793b2..2bb78629 100644 --- a/service/src/main/inse/integrations/elasticsearch.py +++ b/service/src/main/inse/integrations/elasticsearch.py @@ -13,6 +13,7 @@ def search( offset:int = None, sort: list = None, body: dict = None, + track_total_hits = False ) -> dict[str, Any]: headers = { @@ -32,6 +33,8 @@ def search( payload["from"] = offset if sort is not None: payload["sort"] = sort + if track_total_hits: + payload["track_total_hits"] = True else: payload = { "query": { From 26940fd92d717a08297be45acf723a5e14deb98a Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 13:59:38 +0200 Subject: [PATCH 018/268] added personSeachWithFilters and + filter services --- service/src/main/inse/persons/logic.py | 99 ++++++++++--- service/src/main/inse/persons/model.py | 13 ++ service/src/main/inse/persons/service.py | 11 +- webapp/src/app/api/api/persons.service.ts | 132 ++++++++++++++++++ .../app/api/api/persons.serviceInterface.ts | 17 +++ webapp/src/app/api/model/models.ts | 2 + webapp/src/app/api/model/person-filters.ts | 16 +++ .../app/api/model/person-search-request.ts | 20 +++ webapp/src/app/shared/utils/filters.ts | 19 +++ 9 files changed, 311 insertions(+), 18 deletions(-) create mode 100644 webapp/src/app/api/model/person-filters.ts create mode 100644 webapp/src/app/api/model/person-search-request.ts create mode 100644 webapp/src/app/shared/utils/filters.ts diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index eada10d2..db1f699e 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -19,6 +19,8 @@ from ..integrations import elasticsearch from inse.models.author import Author from inse.models.authors_list_response import AuthorsListResponse from inse.models.meta import Meta +from typing import Callable, Any +from . import model logger = logging.getLogger(__name__) @@ -171,18 +173,19 @@ def search_persons_by_name( offset=page_offset, source=include.split(",") if include else True, size=limit, + track_total_hits=True ) except Exception as e: raise HTTPException( status_code=500, detail=f"Elasticsearch search failed: {str(e)}" ) - total_found = response.get("hits",{}).get("total",{}).get("value",0) + total_count = response.get("hits",{}).get("total",{}).get("value",0) hits = response.get("hits", {}).get("hits", []) persons = [util.get_persons_data(hit) for hit in hits] - return AuthorsListResponse(results=persons,meta=Meta(count=total_found,page=page_offset)) + return AuthorsListResponse(results=persons,meta=Meta(count=total_count,page=page_offset)) def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, include: Optional[str] = None) -> AuthorsListResponse: @@ -214,21 +217,12 @@ def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, incl "boost_mode": "multiply" } } - script_fields ={ - "affiliations": { - "script": { - "lang": "painless", - "source": "def aff = params._source['affiliations']; if (aff != null && aff.size() > 0) { return aff[aff.size() - 1]; } return [];" - } - } - } collapse ={ "field":"display_name.keyword" } body = { "size":limit, "query":search_query, - "script_fields":script_fields, "_source":include.split(",") if include else True, "sort":[{"works_count": {"order": "desc"}}], "collapse":collapse @@ -279,12 +273,18 @@ def search_persons_by_institution( search_query = { "nested": { - "path": "affiliations", + "path": "last_known_institutions", "query": { - "match_phrase": { - "affiliations.institution.display_name": institution_name + "bool": { + "must": [ + { + "match_phrase": { + "last_known_institutions.display_name": institution_name + } + } + ] } - }, + } } } try: @@ -295,13 +295,78 @@ def search_persons_by_institution( size=limit, offset=page_offset, sort=[{"works_count": {"order": "desc"}}], + track_total_hits=True ) except Exception as e: raise HTTPException( status_code=500, detail=f"Elasticsearch search failed: {str(e)}" ) - total_found = response.get("hits",{}).get("total",{}).get("value",0) + total_count = response.get("hits",{}).get("total",{}).get("value",0) hits = response.get("hits", {}).get("hits", []) persons = [util.get_persons_data(hit) for hit in hits] - return AuthorsListResponse(results=persons,meta=Meta(count=total_found,page=page_offset)) + return AuthorsListResponse(results=persons,meta=Meta(count=total_count,page=page_offset)) + +FILTER_BUILDERS: dict[str, Callable[[Any], dict]] = { + "institution": lambda v: { + "nested": { + "path": "last_known_institutions", + "query": { + "bool": { + "must": [ + { + "match_phrase": { + "last_known_institutions.display_name": v + } + } + ] + } + } + } + }, + # "cited_by_count": lambda v: {"range": {"cited_by_count": {"gte": v}}}, +} + +def search_persons_with_filters(req: model.PersonSearchRequest) -> AuthorsListResponse: + should_clauses = [] + must_clauses = [] + + if req.name: + should_clauses = [ + {"match_phrase": {"display_name": {"query": req.name, "boost": 5}}}, + {"match_phrase_prefix": {"display_name": {"query": req.name, "boost": 3}}}, + ] + + for field, value in req.filters.model_dump(exclude_none=True).items(): + builder = FILTER_BUILDERS.get(field) + if builder: + must_clauses.append(builder(value)) + + if should_clauses or must_clauses: + query = { + "bool": { + **({"should": should_clauses, "minimum_should_match": 1} if should_clauses else {}), + **({"must": must_clauses} if must_clauses else {}), + } + } + else: + query = {"match_all": {}} + try: + response = elasticsearch.search( + index="openalex-authors", + query=query, + offset=req.page_offset, + source=req.include.split(",") if req.include else True, + size=req.limit, + track_total_hits=True, + ) + except Exception as e: + raise HTTPException(status_code=500, detail=f"Elasticsearch search failed: {str(e)}") + + total_count = response.get("hits", {}).get("total", {}).get("value", 0) + hits = response.get("hits", {}).get("hits", []) + + return AuthorsListResponse( + results=[util.get_persons_data(hit) for hit in hits], + meta=Meta(count=total_count, page=req.page_offset), + ) \ No newline at end of file diff --git a/service/src/main/inse/persons/model.py b/service/src/main/inse/persons/model.py index 4da3f5fe..c7b9f20e 100644 --- a/service/src/main/inse/persons/model.py +++ b/service/src/main/inse/persons/model.py @@ -5,8 +5,21 @@ Data models for persons / authors. """ from pydantic import BaseModel +from typing import Optional from pydantic import Field class PersonBio(BaseModel): bio: str = Field(description="The generated biography.") + +class PersonFilters(BaseModel): + institution: Optional[str] = None + cited_by_count: Optional[int] = None + # more filters + +class PersonSearchRequest(BaseModel): + name: Optional[str] = None + filters: PersonFilters = PersonFilters() + include: Optional[str] = None + limit: Optional[int] = 10 + page_offset: Optional[int] = 0 \ No newline at end of file diff --git a/service/src/main/inse/persons/service.py b/service/src/main/inse/persons/service.py index 203db3bc..81cb96a0 100644 --- a/service/src/main/inse/persons/service.py +++ b/service/src/main/inse/persons/service.py @@ -9,7 +9,6 @@ from typing import Annotated, Optional from fastapi import APIRouter from fastapi import Path from fastapi import Query - from . import logic from . import model from inse.models.authors_list_response import AuthorsListResponse @@ -174,3 +173,13 @@ def search_persons_by_institution( page_offset : Annotated[Optional[int], Query(description=("Offset of the result page"),example="2")] = None, ): return logic.search_persons_by_institution(institution_name, include=include,page_offset=page_offset,limit=limit) + +@router.post( + "/persons/searchWithFilters", + operation_id="searchPersonsWithFilters", + response_model=AuthorsListResponse, + summary="Search for persons with optional name and filters.", + tags=["Persons"], +) +def search_persons_with_filters(body: model.PersonSearchRequest): + return logic.search_persons_with_filters(body) \ No newline at end of file diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index ec63157c..7d50d272 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -22,6 +22,8 @@ import { AuthorsListResponse } from '../model/authors-list-response'; import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore import { PersonBio } from '../model/person-bio'; +// @ts-ignore +import { PersonSearchRequest } from '../model/person-search-request'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -716,4 +718,134 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa ); } + /** + * Search for persons with optional name and filters. + * @endpoint post /api/inse-service/persons/searchWithFilters + * @param personSearchRequest + * @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 searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (personSearchRequest === null || personSearchRequest === undefined) { + throw new Error('Required parameter personSearchRequest was null or undefined when calling searchPersonsWithFilters.'); + } + + 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; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + 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/searchWithFilters`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: personSearchRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Search for persons with optional name and filters. + * @endpoint post /api/inse-service/persons/searchWithFilters + * @param personSearchRequest + * @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 searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (personSearchRequest === null || personSearchRequest === undefined) { + throw new Error('Required parameter personSearchRequest was null or undefined when calling searchPersonsWithFilters_5.'); + } + + 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; + + + // to determine the Content-Type header + const consumes: string[] = [ + 'application/json' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); + } + + 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/searchWithFilters`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: personSearchRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + } diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts index 6d4405bd..ced4dd2b 100644 --- a/webapp/src/app/api/api/persons.serviceInterface.ts +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -14,6 +14,7 @@ import { Observable } from 'rxjs'; import { AuthorsListResponse } from '../model/models'; import { HTTPValidationError } from '../model/models'; import { PersonBio } from '../model/models'; +import { PersonSearchRequest } from '../model/models'; import { Configuration } from '../configuration'; @@ -123,4 +124,20 @@ export interface PersonsServiceInterface { */ searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable; + /** + * Search for persons with optional name and filters. + * + * @endpoint post /api/inse-service/persons/searchWithFilters + * @param personSearchRequest + */ + searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, extraHttpRequestParams?: any): Observable; + + /** + * Search for persons with optional name and filters. + * + * @endpoint post /api/inse-service/persons/searchWithFilters + * @param personSearchRequest + */ + searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, extraHttpRequestParams?: any): Observable; + } diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index a8200126..7c5c8f43 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -34,6 +34,8 @@ export * from './meta'; export * from './model2-yr-mean-citedness'; export * from './open-access'; export * from './person-bio'; +export * from './person-filters'; +export * from './person-search-request'; export * from './score'; export * from './validation-error'; export * from './validation-error-loc-inner'; diff --git a/webapp/src/app/api/model/person-filters.ts b/webapp/src/app/api/model/person-filters.ts new file mode 100644 index 00000000..625bc459 --- /dev/null +++ b/webapp/src/app/api/model/person-filters.ts @@ -0,0 +1,16 @@ +/** + * 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. + */ + + +export interface PersonFilters { + institution?: string | null; + cited_by_count?: number | null; +} + diff --git a/webapp/src/app/api/model/person-search-request.ts b/webapp/src/app/api/model/person-search-request.ts new file mode 100644 index 00000000..9ed6e5bc --- /dev/null +++ b/webapp/src/app/api/model/person-search-request.ts @@ -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 { PersonFilters } from './person-filters'; + + +export interface PersonSearchRequest { + name?: string | null; + filters?: PersonFilters; + include?: string | null; + limit?: number | null; + page_offset?: number | null; +} + diff --git a/webapp/src/app/shared/utils/filters.ts b/webapp/src/app/shared/utils/filters.ts new file mode 100644 index 00000000..e89dc6d9 --- /dev/null +++ b/webapp/src/app/shared/utils/filters.ts @@ -0,0 +1,19 @@ +export interface PersonFilters { + institution?: string; + //... +} +export function encodeFilters(filters: PersonFilters): string | null { + const clean = Object.fromEntries( + Object.entries(filters).filter(([, v]) => v != null && v !== '') + ); + return Object.keys(clean).length ? JSON.stringify(clean) : null; +} + +export function decodeFilters(raw: string | null): PersonFilters { + if (!raw) return {}; + try { + return JSON.parse(raw) as PersonFilters; + } catch { + return {}; + } +} \ No newline at end of file From e524d3d96c26f9a5e64b886eb875b5bdd8258a46 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 14:00:39 +0200 Subject: [PATCH 019/268] added first institutions filter --- .../person-list/person-list.component.html | 6 +- .../person-list/person-list.component.ts | 161 ++++++++++-------- 2 files changed, 93 insertions(+), 74 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 1ae258b0..60f62a13 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -9,7 +9,11 @@

- + + @for (opt of institutionOptions; track opt.value) { + {{ opt.label }} + } +
{{ resultRange() }}
diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index ccca7dba..40bea7e3 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -1,4 +1,9 @@ -import { Component, inject, DestroyRef, computed, signal } from '@angular/core'; +import { + Component, + inject, + DestroyRef, + computed, +} from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterLink, ActivatedRoute, Router } from '@angular/router'; import { toObservable, toSignal } from '@angular/core/rxjs-interop'; @@ -7,6 +12,8 @@ import { MatIconModule } from '@angular/material/icon'; import { MatPaginatorModule, PageEvent } from '@angular/material/paginator'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { Params } from '@angular/router'; import { Author, AuthorsListResponse, @@ -16,8 +23,26 @@ import { import { SharedStateService } from '../../shared/services/shared-state.service'; import { PaginationService } from '../../shared/services/pagination.service'; import { createLoadError } from '../../shared/utils/errorHandler'; -import { distinctUntilChanged, switchMap, tap, finalize, map } from 'rxjs'; -import { AuthorAffiliationsInner } from '../../api'; +import { distinctUntilChanged, switchMap, tap, finalize, map, filter } from 'rxjs'; +import { encodeFilters, PersonFilters, decodeFilters } from '../../shared/utils/filters'; +import { PersonSearchRequest } from '../../api'; +export interface InstitutionOption { + label: string; + value: string; +} + +export const INSTITUTION_OPTIONS: InstitutionOption[] = [ + { + label: 'Universität Duisburg-Essen', + value: 'University of Duisburg-Essen', + }, + { label: 'Ruhr-Universität Bochum', value: 'Ruhr University Bochum' }, + { label: 'TU Dortmund', value: 'TU Dortmund University' }, + { label: 'Universität Münster', value: 'University of Münster' }, + { label: 'RWTH Aachen', value: 'RWTH Aachen University' }, +]; + +export const DEFAULT_INSTITUTION = INSTITUTION_OPTIONS[0]; @Component({ selector: 'app-person-list', @@ -27,13 +52,14 @@ import { AuthorAffiliationsInner } from '../../api'; MatPaginatorModule, MatProgressSpinnerModule, MatSnackBarModule, + MatSelectModule, RouterLink, ], templateUrl: './person-list.component.html', styleUrl: './person-list.component.scss', standalone: true, }) -export class PersonListComponent { +export class PersonListComponent { private readonly personsService = inject(PersonsService); private readonly destroyRef = inject(DestroyRef); private readonly snackBar = inject(MatSnackBar); @@ -42,43 +68,38 @@ export class PersonListComponent { public readonly state = inject(SharedStateService); public readonly paginationService = inject(PaginationService); + //expose to template + readonly institutionOptions = INSTITUTION_OPTIONS; + private readonly defaultIncludes = - 'display_name,works_count,cited_by_count,topics,orcid,affiliations'; - private readonly defaultInstitutionName = 'University of Duisburg-Essen'; + 'display_name,works_count,cited_by_count,topics,orcid,last_known_institutions'; private readonly queryParams = toSignal( this.route.queryParams.pipe( map((params) => ({ - search: params['search'] as string | null, + name: params['search'] as string | null, + filters: decodeFilters(params['filters'] as string | null), page: Number(params['page'] ?? 0), size: Number(params['size'] ?? this.paginationService.options[2]), })), ), { initialValue: { - search: null, + name: null, + filters: { institution: DEFAULT_INSTITUTION.value } as PersonFilters, page: 0, size: this.paginationService.options[2], }, }, ); - - readonly searchValue = computed( - () => this.queryParams()['search'] ?? null, - ); - readonly pageIndex = computed(() => - Number(this.queryParams()['page'] ?? 0), - ); - readonly pageSize = computed( - () => - Number(this.queryParams()['size'] ?? this.paginationService.options[2]), // default 10 - ); + readonly activeFilters = computed(() => this.queryParams().filters); + readonly searchValue = computed(() => this.queryParams().name); + readonly pageIndex = computed(() => this.queryParams().page); + readonly pageSize = computed(() => this.queryParams().size); loading = false; - readonly persons = computed( - () => this.state.persons() ?? [], - ); + readonly persons = computed(() => this.state.persons()); readonly total = computed( () => this.state.persons().meta?.count ?? this.persons().results?.length, @@ -96,50 +117,35 @@ export class PersonListComponent { constructor() { toObservable(this.queryParams) .pipe( - map(() => ({ - search: this.searchValue(), - page: this.pageIndex(), - pageSize: this.pageSize(), - })), - distinctUntilChanged( - (a, b) => - a.search === b.search && - a.page === b.page && - a.pageSize === b.pageSize, - ), - tap(({ search }) => { + distinctUntilChanged( + (a, b) => + a.name === b.name && + a.page === b.page && + a.size === b.size && + JSON.stringify(a.filters) === JSON.stringify(b.filters), + ), + tap(() => { this.state.hasSearched.set(false); this.loading = true; - if (!search) this.state.hasSearched.set(false); }), - switchMap(({ search, page, pageSize }) => - search - ? this.personsService - .searchPersonsByName( - search, - this.defaultIncludes, - pageSize, - page, - ) - .pipe( - tap((result) => { - this.state.persons.set(this.sortByRanking(result)); - this.state.hasSearched.set(true); - }), - ) - : this.personsService - .searchPersonsByInstitution( - this.defaultInstitutionName, - this.defaultIncludes, - pageSize, - page, - ) - .pipe( - tap((result) => { - this.state.persons.set(this.sortByRanking(result)); - }), - ), - ), + switchMap(({ name, filters, page, size }) => { + const pageOffset = page * size + const body: PersonSearchRequest = { + name: name ?? undefined, + filters, + limit: size, + page_offset: pageOffset, + include: this.defaultIncludes, + }; + return this.personsService + .searchPersonsWithFilters(body) + .pipe( + tap((result) => { + this.state.persons.set(this.sortByRanking(result)); + this.state.hasSearched.set(!!name); + }), + ); + }), finalize(() => (this.loading = false)), takeUntilDestroyed(this.destroyRef), ) @@ -156,20 +162,30 @@ export class PersonListComponent { }); } - onPage(event: PageEvent): void { + navigateRouter(params: Params): void { this.router.navigate([], { relativeTo: this.route, - queryParams: { - page: event.pageIndex, - size: event.pageSize, - }, - queryParamsHandling: 'merge', // preserve search param + queryParams: params, + queryParamsHandling: 'merge', + }); + } + + onPage(event: PageEvent): void { + this.navigateRouter({ page: event.pageIndex, size: event.pageSize }); + } + + //encode filters + onFilterChange(patch: Partial): void { + const updated = { ...this.activeFilters(), ...patch }; + this.navigateRouter({ + filters: encodeFilters(updated), + page: 0 }); } institution(person: Author): DehydratedInstitution | null { - if (!person.affiliations?.length) null; - return person.affiliations?.at(-1)?.institution ?? null; + if (!person.last_known_institutions?.length) return null; + return person.last_known_institutions?.at(-1) ?? null; } topics(person: Author): string[] { @@ -179,7 +195,6 @@ export class PersonListComponent { .filter(Boolean); } - // Sorting logic sortByRanking(response: AuthorsListResponse): AuthorsListResponse { if (!response.results) return response; return { @@ -205,7 +220,7 @@ export class PersonListComponent { } hasInstitution(person: Author): boolean { - return !!person.affiliations?.some((a) => a.institution); + return !!person.last_known_institutions?.some((a) => a.display_name); } hasOrcid(person: Author): boolean { From f76d63a76c35bdef8d3336c809a4f7ce05ec1634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mats=20Paul=20Ton=C4=8Dik?= Date: Fri, 5 Jun 2026 14:23:55 +0200 Subject: [PATCH 020/268] Added network table for institutions --- .../person-network-collaborators.component.ts | 4 + .../person-network-graph.component.ts | 3 +- ...person-network-institutions.component.html | 45 +++++++ ...person-network-institutions.component.scss | 29 ++++ .../person-network-institutions.component.ts | 126 ++++++++++++++++++ ...person-network-publications.component.html | 12 -- .../person-network-publications.component.ts | 6 +- .../person-network.component.html | 19 ++- .../person-network.component.ts | 26 +++- 9 files changed, 246 insertions(+), 24 deletions(-) create mode 100644 webapp/src/app/modules/person-network-institutions/person-network-institutions.component.html create mode 100644 webapp/src/app/modules/person-network-institutions/person-network-institutions.component.scss create mode 100644 webapp/src/app/modules/person-network-institutions/person-network-institutions.component.ts diff --git a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.ts b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.ts index 6138705f..0860dec1 100644 --- a/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.ts +++ b/webapp/src/app/modules/person-network-collaborators/person-network-collaborators.component.ts @@ -142,6 +142,10 @@ export class PersonNetworkCollaboratorsComponent implements AfterViewInit { } }); + Object.values(allAuthors).forEach((author) => { + author.works.sort((a, b) => a.title.localeCompare(b.title)); + }); + return new MatTableDataSource( Object.values(allAuthors).filter( (author) => diff --git a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts index 7362cb6a..8c6235de 100644 --- a/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts +++ b/webapp/src/app/modules/person-network-graph/person-network-graph.component.ts @@ -13,7 +13,6 @@ import { import { CanvasRenderer } from 'echarts/renderers'; import { GraphChart } from 'echarts/charts'; import { MatIconModule } from '@angular/material/icon'; -import { ActivatedRoute, Router } from '@angular/router'; echarts.use([ GridComponent, CanvasRenderer, @@ -22,7 +21,7 @@ echarts.use([ LegendComponent, ]); -export type NodeCategory = 'author' | 'collaborator' | 'work'; +export type NodeCategory = 'author' | 'collaborator' | 'work' | 'institution'; export interface NodeClickEvent { id: string; diff --git a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.html b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.html new file mode 100644 index 00000000..052d4d06 --- /dev/null +++ b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.html @@ -0,0 +1,45 @@ +
+ + + + + + + + + + + + + + + + +
ID{{ element.id }}Titel + {{ element.name }} + Mitwirkende + {{ element.collaborators.length }} +
+
+ + + + +
    + @for (collaborator of element.collaborators; track $index) { +
  • + {{ collaborator.name }} + ({{ collaborator.id }}) +
  • + } +
+ + +
diff --git a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.scss b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.scss new file mode 100644 index 00000000..57d2cbf4 --- /dev/null +++ b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.scss @@ -0,0 +1,29 @@ +.table { + overflow: auto; + width: 100%; + max-height: 100%; +} + +.mat-mdc-table { + background-color: var(--sg-background); +} + +.element-row { + position: relative; +} + +.element-row:not(.expanded) { + cursor: pointer; +} + +.element-row:not(.expanded):hover { + background: #f5f5f5; +} + +.element-row.expanded { + border-bottom-color: transparent; +} + +.detail-row { + width: 100%; +} diff --git a/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.ts b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.ts new file mode 100644 index 00000000..38df3cbe --- /dev/null +++ b/webapp/src/app/modules/person-network-institutions/person-network-institutions.component.ts @@ -0,0 +1,126 @@ +import { + AfterViewInit, + Component, + effect, + input, + ViewChild, +} from '@angular/core'; +import { CollaborationNetwork } from '../../api'; +import { MatTableDataSource, MatTableModule } from '@angular/material/table'; +import { MatSort, MatSortModule } from '@angular/material/sort'; +import { MatIconModule } from '@angular/material/icon'; +import { RouterModule } from '@angular/router'; +import { CdkDetailRowDirective } from '../../directives/cdk-detail-row.directive'; +import { MatButtonModule } from '@angular/material/button'; + +type Collaborator = { + id: string; + name: string; +}; + +type Institution = { + id: string; + name: string; + collaborators: Collaborator[]; +}; + +@Component({ + selector: 'app-person-network-institutions', + imports: [ + MatTableModule, + MatIconModule, + MatSortModule, + RouterModule, + CdkDetailRowDirective, + MatButtonModule, + ], + templateUrl: './person-network-institutions.component.html', + styleUrl: './person-network-institutions.component.scss', +}) +export class PersonNetworkInstitutionsComponent implements AfterViewInit { + collaborationNetwork = input.required(); + searchTerm = input.required(); + + displayedColumns: string[] = ['id', 'name', 'collaborators']; + + dataSource = new MatTableDataSource(); + + trackBy = (index: number, item: Institution) => item.id; + + @ViewChild(MatSort) sort!: MatSort; + + constructor() { + effect(() => { + const collaborationNetwork = this.collaborationNetwork(); + if (!collaborationNetwork) { + return; + } + + this.dataSource = this.buildInstitutionsDataSource(collaborationNetwork); + this.dataSource.sortingDataAccessor = (item, property) => { + if (property === 'collaborators') { + return item.collaborators.length; + } + return (item as any)[property]; + }; + if (this.sort) { + this.dataSource.sort = this.sort; + this.setDefaultSort(); + } + }); + + effect(() => { + const searchTerm = this.searchTerm().toLowerCase(); + this.dataSource.filter = searchTerm; + }); + } + + ngAfterViewInit() { + if (this.sort) { + this.dataSource.sort = this.sort; + } + } + + private setDefaultSort(): void { + this.sort.active = 'name'; + this.sort.direction = 'asc'; + this.sort.sortChange.emit({ active: 'name', direction: 'asc' }); + } + + buildInstitutionsDataSource( + collaborationNetwork: CollaborationNetwork, + ): MatTableDataSource { + const institutionsMap: Record = {}; + + for (const node of collaborationNetwork.nodes) { + if (node.category === 'institution') { + institutionsMap[node.raw_id] = { + id: node.raw_id, + name: node.display_name, + collaborators: [], + }; + } + } + + for (const edge of collaborationNetwork.edges) { + if (edge.raw_target_id in institutionsMap) { + const institution = institutionsMap[edge.raw_target_id]; + institution.collaborators.push({ + id: edge.raw_source_id, + name: + collaborationNetwork.nodes.find( + (node) => node.raw_id === edge.raw_source_id, + )?.display_name || 'Unbekannt', + }); + } + } + + for (const institution of Object.values(institutionsMap)) { + institution.collaborators.sort((a, b) => + a.name.localeCompare(b.name, 'de', { sensitivity: 'base' }), + ); + } + + return new MatTableDataSource(Object.values(institutionsMap)); + } +} diff --git a/webapp/src/app/modules/person-network-publications/person-network-publications.component.html b/webapp/src/app/modules/person-network-publications/person-network-publications.component.html index c9227bb8..9206482a 100644 --- a/webapp/src/app/modules/person-network-publications/person-network-publications.component.html +++ b/webapp/src/app/modules/person-network-publications/person-network-publications.component.html @@ -16,18 +16,6 @@ {{ element.collaborators.length }} - - - - - - (); searchTerm = input.required(); - displayedColumns: string[] = ['id', 'title', 'contributors', 'actions']; + displayedColumns: string[] = ['id', 'title', 'contributors']; dataSource = new MatTableDataSource(); @@ -134,6 +134,10 @@ export class PersonNetworkPublicationsComponent implements AfterViewInit { } }); + Object.values(allWorks).forEach((work) => { + work.collaborators.sort((a, b) => a.name.localeCompare(b.name)); + }); + return new MatTableDataSource( Object.values(allWorks).filter((work) => work.collaborators.length > 0), ); diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html index 6ed2bd00..6883dce7 100644 --- a/webapp/src/app/modules/person-network/person-network.component.html +++ b/webapp/src/app/modules/person-network/person-network.component.html @@ -27,6 +27,9 @@ Publikationen + + Institutionen + - {{ - this.displayedTable() === "collaborators" - ? "Suche Kollaborierende nach Name oder ID" - : "Suche Publikationen nach Titel oder ID" - }} + {{ this.searchTermLabel() }} - search + search + @@ -61,6 +63,11 @@ [collaborationNetwork]="collaborationNetwork" [searchTerm]="searchTerm()" /> + } @else if (this.displayedTable() === "institutions") { + }
diff --git a/webapp/src/app/modules/person-network/person-network.component.ts b/webapp/src/app/modules/person-network/person-network.component.ts index 5dc7902b..e91df9fb 100644 --- a/webapp/src/app/modules/person-network/person-network.component.ts +++ b/webapp/src/app/modules/person-network/person-network.component.ts @@ -36,6 +36,7 @@ import { MatExpansionModule } from '@angular/material/expansion'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; import { PersonNetworkFilterDialogComponent } from '../person-network-filter-dialog/person-network-filter-dialog.component'; import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component'; +import { PersonNetworkInstitutionsComponent } from '../person-network-institutions/person-network-institutions.component'; @Component({ selector: 'app-person-network', @@ -62,6 +63,7 @@ import { PersonNetworkInfoCardComponent } from '../person-network-info-card/pers MatExpansionModule, MatDialogModule, PersonNetworkInfoCardComponent, + PersonNetworkInstitutionsComponent, ], templateUrl: './person-network.component.html', styleUrl: './person-network.component.scss', @@ -88,18 +90,32 @@ export class PersonNetworkComponent implements OnInit { publications = signal(0); connections = signal(0); + searchTermLabel = computed(() => { + const displayedTable = this.displayedTable(); + switch (displayedTable) { + case 'collaborators': + return 'Suche Kollaborierende nach Name oder ID'; + case 'publications': + return 'Suche Publikationen nach Titel oder ID'; + case 'institutions': + return 'Suche Institutionen nach Name oder ID'; + default: + return 'Suchbegriff'; + } + }); + private readonly categoryTableMap: Record = { author: 'collaborators', collaborator: 'collaborators', work: 'publications', + institution: 'institutions', }; latestNodeId = signal(null); handleNodeClick = ({ id, name, category }: NodeClickEvent): void => { if (this.latestNodeId() === id) { - this.latestNodeId.set(null); - this.filterForm.patchValue({ searchTerm: '' }); + this.clearSearch(); return; } @@ -111,6 +127,11 @@ export class PersonNetworkComponent implements OnInit { }); }; + clearSearch() { + this.latestNodeId.set(null); + this.filterForm.patchValue({ searchTerm: '' }); + } + readonly summaryCards = computed(() => [ { icon: 'person', @@ -175,7 +196,6 @@ export class PersonNetworkComponent implements OnInit { }); dialogRef.afterClosed().subscribe((result) => { - console.log('Dialog result:', result); if (result) { this.filterForm.setValue({ searchTerm: this.filterForm.get('searchTerm')?.value || '', From 44bd8c6ce514100367cf43e833f30c6225c10011 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 17:22:19 +0200 Subject: [PATCH 021/268] added persons filtering --- .../person-list/person-list.component.html | 6 +- .../person-list/person-list.component.ts | 161 ++++++++++-------- 2 files changed, 93 insertions(+), 74 deletions(-) diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 1ae258b0..60f62a13 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -9,7 +9,11 @@

- + + @for (opt of institutionOptions; track opt.value) { + {{ opt.label }} + } +
{{ resultRange() }}
diff --git a/webapp/src/app/modules/person-list/person-list.component.ts b/webapp/src/app/modules/person-list/person-list.component.ts index ccca7dba..40bea7e3 100644 --- a/webapp/src/app/modules/person-list/person-list.component.ts +++ b/webapp/src/app/modules/person-list/person-list.component.ts @@ -1,4 +1,9 @@ -import { Component, inject, DestroyRef, computed, signal } from '@angular/core'; +import { + Component, + inject, + DestroyRef, + computed, +} from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterLink, ActivatedRoute, Router } from '@angular/router'; import { toObservable, toSignal } from '@angular/core/rxjs-interop'; @@ -7,6 +12,8 @@ import { MatIconModule } from '@angular/material/icon'; import { MatPaginatorModule, PageEvent } from '@angular/material/paginator'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { Params } from '@angular/router'; import { Author, AuthorsListResponse, @@ -16,8 +23,26 @@ import { import { SharedStateService } from '../../shared/services/shared-state.service'; import { PaginationService } from '../../shared/services/pagination.service'; import { createLoadError } from '../../shared/utils/errorHandler'; -import { distinctUntilChanged, switchMap, tap, finalize, map } from 'rxjs'; -import { AuthorAffiliationsInner } from '../../api'; +import { distinctUntilChanged, switchMap, tap, finalize, map, filter } from 'rxjs'; +import { encodeFilters, PersonFilters, decodeFilters } from '../../shared/utils/filters'; +import { PersonSearchRequest } from '../../api'; +export interface InstitutionOption { + label: string; + value: string; +} + +export const INSTITUTION_OPTIONS: InstitutionOption[] = [ + { + label: 'Universität Duisburg-Essen', + value: 'University of Duisburg-Essen', + }, + { label: 'Ruhr-Universität Bochum', value: 'Ruhr University Bochum' }, + { label: 'TU Dortmund', value: 'TU Dortmund University' }, + { label: 'Universität Münster', value: 'University of Münster' }, + { label: 'RWTH Aachen', value: 'RWTH Aachen University' }, +]; + +export const DEFAULT_INSTITUTION = INSTITUTION_OPTIONS[0]; @Component({ selector: 'app-person-list', @@ -27,13 +52,14 @@ import { AuthorAffiliationsInner } from '../../api'; MatPaginatorModule, MatProgressSpinnerModule, MatSnackBarModule, + MatSelectModule, RouterLink, ], templateUrl: './person-list.component.html', styleUrl: './person-list.component.scss', standalone: true, }) -export class PersonListComponent { +export class PersonListComponent { private readonly personsService = inject(PersonsService); private readonly destroyRef = inject(DestroyRef); private readonly snackBar = inject(MatSnackBar); @@ -42,43 +68,38 @@ export class PersonListComponent { public readonly state = inject(SharedStateService); public readonly paginationService = inject(PaginationService); + //expose to template + readonly institutionOptions = INSTITUTION_OPTIONS; + private readonly defaultIncludes = - 'display_name,works_count,cited_by_count,topics,orcid,affiliations'; - private readonly defaultInstitutionName = 'University of Duisburg-Essen'; + 'display_name,works_count,cited_by_count,topics,orcid,last_known_institutions'; private readonly queryParams = toSignal( this.route.queryParams.pipe( map((params) => ({ - search: params['search'] as string | null, + name: params['search'] as string | null, + filters: decodeFilters(params['filters'] as string | null), page: Number(params['page'] ?? 0), size: Number(params['size'] ?? this.paginationService.options[2]), })), ), { initialValue: { - search: null, + name: null, + filters: { institution: DEFAULT_INSTITUTION.value } as PersonFilters, page: 0, size: this.paginationService.options[2], }, }, ); - - readonly searchValue = computed( - () => this.queryParams()['search'] ?? null, - ); - readonly pageIndex = computed(() => - Number(this.queryParams()['page'] ?? 0), - ); - readonly pageSize = computed( - () => - Number(this.queryParams()['size'] ?? this.paginationService.options[2]), // default 10 - ); + readonly activeFilters = computed(() => this.queryParams().filters); + readonly searchValue = computed(() => this.queryParams().name); + readonly pageIndex = computed(() => this.queryParams().page); + readonly pageSize = computed(() => this.queryParams().size); loading = false; - readonly persons = computed( - () => this.state.persons() ?? [], - ); + readonly persons = computed(() => this.state.persons()); readonly total = computed( () => this.state.persons().meta?.count ?? this.persons().results?.length, @@ -96,50 +117,35 @@ export class PersonListComponent { constructor() { toObservable(this.queryParams) .pipe( - map(() => ({ - search: this.searchValue(), - page: this.pageIndex(), - pageSize: this.pageSize(), - })), - distinctUntilChanged( - (a, b) => - a.search === b.search && - a.page === b.page && - a.pageSize === b.pageSize, - ), - tap(({ search }) => { + distinctUntilChanged( + (a, b) => + a.name === b.name && + a.page === b.page && + a.size === b.size && + JSON.stringify(a.filters) === JSON.stringify(b.filters), + ), + tap(() => { this.state.hasSearched.set(false); this.loading = true; - if (!search) this.state.hasSearched.set(false); }), - switchMap(({ search, page, pageSize }) => - search - ? this.personsService - .searchPersonsByName( - search, - this.defaultIncludes, - pageSize, - page, - ) - .pipe( - tap((result) => { - this.state.persons.set(this.sortByRanking(result)); - this.state.hasSearched.set(true); - }), - ) - : this.personsService - .searchPersonsByInstitution( - this.defaultInstitutionName, - this.defaultIncludes, - pageSize, - page, - ) - .pipe( - tap((result) => { - this.state.persons.set(this.sortByRanking(result)); - }), - ), - ), + switchMap(({ name, filters, page, size }) => { + const pageOffset = page * size + const body: PersonSearchRequest = { + name: name ?? undefined, + filters, + limit: size, + page_offset: pageOffset, + include: this.defaultIncludes, + }; + return this.personsService + .searchPersonsWithFilters(body) + .pipe( + tap((result) => { + this.state.persons.set(this.sortByRanking(result)); + this.state.hasSearched.set(!!name); + }), + ); + }), finalize(() => (this.loading = false)), takeUntilDestroyed(this.destroyRef), ) @@ -156,20 +162,30 @@ export class PersonListComponent { }); } - onPage(event: PageEvent): void { + navigateRouter(params: Params): void { this.router.navigate([], { relativeTo: this.route, - queryParams: { - page: event.pageIndex, - size: event.pageSize, - }, - queryParamsHandling: 'merge', // preserve search param + queryParams: params, + queryParamsHandling: 'merge', + }); + } + + onPage(event: PageEvent): void { + this.navigateRouter({ page: event.pageIndex, size: event.pageSize }); + } + + //encode filters + onFilterChange(patch: Partial): void { + const updated = { ...this.activeFilters(), ...patch }; + this.navigateRouter({ + filters: encodeFilters(updated), + page: 0 }); } institution(person: Author): DehydratedInstitution | null { - if (!person.affiliations?.length) null; - return person.affiliations?.at(-1)?.institution ?? null; + if (!person.last_known_institutions?.length) return null; + return person.last_known_institutions?.at(-1) ?? null; } topics(person: Author): string[] { @@ -179,7 +195,6 @@ export class PersonListComponent { .filter(Boolean); } - // Sorting logic sortByRanking(response: AuthorsListResponse): AuthorsListResponse { if (!response.results) return response; return { @@ -205,7 +220,7 @@ export class PersonListComponent { } hasInstitution(person: Author): boolean { - return !!person.affiliations?.some((a) => a.institution); + return !!person.last_known_institutions?.some((a) => a.display_name); } hasOrcid(person: Author): boolean { From 1a1bd0226ced26f6db834a06b434d3009ee5710a Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 18:49:00 +0200 Subject: [PATCH 022/268] regenerated openApi endpoints --- webapp/src/app/api/.openapi-generator/FILES | 16 +- webapp/src/app/api/api/api.ts | 5 +- webapp/src/app/api/api/funding.service.ts | 164 ++++++++++++++++++ .../app/api/api/funding.serviceInterface.ts | 45 +++++ .../src/app/api/api/inse-service.service.ts | 123 +++++++++++++ .../api/api/inse-service.serviceInterface.ts | 20 +++ .../src/app/api/api/persons-search.service.ts | 1 + .../api/persons-search.serviceInterface.ts | 2 +- webapp/src/app/api/api/persons.service.ts | 37 +--- .../app/api/api/persons.serviceInterface.ts | 3 +- webapp/src/app/api/api/works.service.ts | 71 ++++---- .../src/app/api/api/works.serviceInterface.ts | 10 ++ .../app/api/model/author-position-count.ts | 18 ++ webapp/src/app/api/model/funder-by-author.ts | 22 +++ .../api/model/funders-by-author-response.ts | 19 ++ webapp/src/app/api/model/models.ts | 11 +- .../publication-ids-by-author-position.ts | 18 ++ .../model/publications-by-author-response.ts | 21 +++ webapp/src/app/api/model/topic-count.ts | 23 +++ webapp/src/app/api/model/topics-by-time.ts | 23 +++ webapp/src/app/api/model/topics-by-year.ts | 31 ++++ .../person-funding.component.ts | 6 +- 22 files changed, 610 insertions(+), 79 deletions(-) create mode 100644 webapp/src/app/api/api/funding.service.ts create mode 100644 webapp/src/app/api/api/funding.serviceInterface.ts create mode 100644 webapp/src/app/api/model/author-position-count.ts create mode 100644 webapp/src/app/api/model/funder-by-author.ts create mode 100644 webapp/src/app/api/model/funders-by-author-response.ts create mode 100644 webapp/src/app/api/model/publication-ids-by-author-position.ts create mode 100644 webapp/src/app/api/model/publications-by-author-response.ts create mode 100644 webapp/src/app/api/model/topic-count.ts create mode 100644 webapp/src/app/api/model/topics-by-time.ts create mode 100644 webapp/src/app/api/model/topics-by-year.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 87266ecf..68623388 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -1,9 +1,10 @@ .gitignore -.openapi-generator-ignore README.md api.base.service.ts api.module.ts api/api.ts +api/funding.service.ts +api/funding.serviceInterface.ts api/inse-account-service.service.ts api/inse-account-service.serviceInterface.ts api/inse-service.service.ts @@ -31,6 +32,7 @@ model/author-affiliations-inner.ts model/author-counts-by-year-inner.ts model/author-ids.ts model/author-parsed-longest-name.ts +model/author-position-count.ts model/author-summary-stats.ts model/author.ts model/authors-list-response.ts @@ -49,6 +51,8 @@ model/dehydrated-institution.ts model/dehydrated-source.ts model/filter-information.ts model/filter-properties.ts +model/funder-by-author.ts +model/funders-by-author-response.ts model/fwci.ts model/group-by-result.ts model/http-validation-error.ts @@ -63,14 +67,14 @@ model/model2-yr-mean-citedness.ts model/models.ts model/open-access.ts model/person-bio.ts +model/publication-ids-by-author-position.ts +model/publications-by-author-response.ts model/score.ts +model/topic-count.ts +model/topics-by-time.ts +model/topics-by-year.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 diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 18f669bf..7a97fdae 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -1,3 +1,6 @@ +export * from './funding.service'; +import { FundingService } from './funding.service'; +export * from './funding.serviceInterface'; export * from './inse-account-service.service'; import { INSEAccountServiceService } from './inse-account-service.service'; export * from './inse-account-service.serviceInterface'; @@ -22,4 +25,4 @@ export * from './topics.serviceInterface'; export * from './works.service'; import { WorksService } from './works.service'; export * from './works.serviceInterface'; -export const APIS = [INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, PersonsSearchService, TopicsService, WorksService]; +export const APIS = [FundingService, INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, PersonsSearchService, TopicsService, WorksService]; diff --git a/webapp/src/app/api/api/funding.service.ts b/webapp/src/app/api/api/funding.service.ts new file mode 100644 index 00000000..17619786 --- /dev/null +++ b/webapp/src/app/api/api/funding.service.ts @@ -0,0 +1,164 @@ +/** + * 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 { FundersByAuthorResponse } from '../model/funders-by-author-response'; +// @ts-ignore +import { HTTPValidationError } from '../model/http-validation-error'; +// @ts-ignore +import { PublicationsByAuthorResponse } from '../model/publications-by-author-response'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; +import { + FundingServiceInterface +} from './funding.serviceInterface'; + + + +@Injectable({ + providedIn: 'root' +}) +export class FundingService extends BaseService implements FundingServiceInterface { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Get funding organizations by author. + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getFundersByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/funders`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get funded publications by author. + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + * @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 getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPublicationsByAuthor.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/publications`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/webapp/src/app/api/api/funding.serviceInterface.ts b/webapp/src/app/api/api/funding.serviceInterface.ts new file mode 100644 index 00000000..86b8b171 --- /dev/null +++ b/webapp/src/app/api/api/funding.serviceInterface.ts @@ -0,0 +1,45 @@ +/** + * 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 { FundersByAuthorResponse } from '../model/models'; +import { HTTPValidationError } from '../model/models'; +import { PublicationsByAuthorResponse } from '../model/models'; + + +import { Configuration } from '../configuration'; + + + +export interface FundingServiceInterface { + defaultHeaders: HttpHeaders; + configuration: Configuration; + + /** + * Get funding organizations by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + */ + getFundersByAuthor(authorId: string, extraHttpRequestParams?: any): Observable; + + /** + * Get funded publications by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + */ + getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, extraHttpRequestParams?: any): Observable; + +} diff --git a/webapp/src/app/api/api/inse-service.service.ts b/webapp/src/app/api/api/inse-service.service.ts index 80543705..b2058459 100644 --- a/webapp/src/app/api/api/inse-service.service.ts +++ b/webapp/src/app/api/api/inse-service.service.ts @@ -19,6 +19,8 @@ import { Observable } from 'rxjs'; // @ts-ignore import { AuthorsListResponse } from '../model/authors-list-response'; // @ts-ignore +import { FundersByAuthorResponse } from '../model/funders-by-author-response'; +// @ts-ignore import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore import { Item } from '../model/item'; @@ -28,6 +30,8 @@ import { ItemCreate } from '../model/item-create'; import { ItemPage } from '../model/item-page'; // @ts-ignore import { PersonBio } from '../model/person-bio'; +// @ts-ignore +import { PublicationsByAuthorResponse } from '../model/publications-by-author-response'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -361,6 +365,61 @@ export class INSEServiceService extends BaseService implements INSEServiceServic ); } + /** + * Get funding organizations by author. + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getFundersByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/funders`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + /** * Returns the item with the id. * @endpoint get /api/inse-service/items/{id} @@ -546,6 +605,70 @@ export class INSEServiceService extends BaseService implements INSEServiceServic ); } + /** + * Get funded publications by author. + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + * @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 getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPublicationsByAuthor.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/publications`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + /** * Searches for persons by ID or name. * @endpoint get /api/inse-service/persons/search diff --git a/webapp/src/app/api/api/inse-service.serviceInterface.ts b/webapp/src/app/api/api/inse-service.serviceInterface.ts index 1326e650..e7f18df1 100644 --- a/webapp/src/app/api/api/inse-service.serviceInterface.ts +++ b/webapp/src/app/api/api/inse-service.serviceInterface.ts @@ -12,11 +12,13 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; import { AuthorsListResponse } from '../model/models'; +import { FundersByAuthorResponse } 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 { PublicationsByAuthorResponse } from '../model/models'; import { Configuration } from '../configuration'; @@ -69,6 +71,14 @@ export interface INSEServiceServiceInterface { */ generatePersonBio(authorId: string, include?: string, extraHttpRequestParams?: any): Observable; + /** + * Get funding organizations by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + */ + getFundersByAuthor(authorId: string, extraHttpRequestParams?: any): Observable; + /** * Returns the item with the id. * @@ -95,6 +105,16 @@ export interface INSEServiceServiceInterface { */ getPersonByID(id: string, include: string, extraHttpRequestParams?: any): Observable; + /** + * Get funded publications by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + */ + getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, extraHttpRequestParams?: any): Observable; + /** * Searches for persons by ID or name. * diff --git a/webapp/src/app/api/api/persons-search.service.ts b/webapp/src/app/api/api/persons-search.service.ts index 27a75280..a92a1b26 100644 --- a/webapp/src/app/api/api/persons-search.service.ts +++ b/webapp/src/app/api/api/persons-search.service.ts @@ -49,6 +49,7 @@ export class PersonsSearchService extends BaseService implements PersonsSearchSe * @param page Page number (1-indexed) * @param pageSize Results per page * @param include Comma-separated include tags + * @param strict Strict institution search by target year * @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. */ diff --git a/webapp/src/app/api/api/persons-search.serviceInterface.ts b/webapp/src/app/api/api/persons-search.serviceInterface.ts index 57bd6eee..8221785d 100644 --- a/webapp/src/app/api/api/persons-search.serviceInterface.ts +++ b/webapp/src/app/api/api/persons-search.serviceInterface.ts @@ -33,7 +33,7 @@ export interface PersonsSearchServiceInterface { * @param page Page number (1-indexed) * @param pageSize Results per page * @param include Comma-separated include tags - * @param strict Strict search parameter + * @param strict Strict institution search by target year */ searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, extraHttpRequestParams?: any): Observable; diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index 42f22d04..a2d22321 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -1,7 +1,7 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,7 +11,7 @@ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext } from '@angular/common/http'; import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; @@ -375,13 +375,14 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa * @param page Page number (1-indexed) * @param pageSize Results per page * @param include Comma-separated include tags + * @param strict Strict institution search by target year * @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, page?: number, pageSize?: number, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { let localVarQueryParameters = new HttpParams({encoder: this.encoder}); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, @@ -400,6 +401,8 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa pageSize, 'pageSize'); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + strict, 'strict'); let localVarHeaders = this.defaultHeaders; @@ -442,26 +445,4 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa ); } - public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (authorId === null || authorId === undefined) { - throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - let localVarPath = `/api/inse-service/authors/${encodeURIComponent(authorId)}/funders`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: 'json', - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - reportProgress: reportProgress - } - ); - } - } diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts index e7235d9c..7ee1d04a 100644 --- a/webapp/src/app/api/api/persons.serviceInterface.ts +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -81,7 +81,8 @@ export interface PersonsServiceInterface { * @param page Page number (1-indexed) * @param pageSize Results per page * @param include Comma-separated include tags + * @param strict Strict institution search by target year */ - searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, extraHttpRequestParams?: any): Observable; + searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, extraHttpRequestParams?: any): Observable; } diff --git a/webapp/src/app/api/api/works.service.ts b/webapp/src/app/api/api/works.service.ts index 2a156323..f135cbfb 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -9,26 +9,25 @@ */ /* 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/http-validation-error'; // @ts-ignore -import { TopicsByTime } from '../model/topicsByTime'; +import { TopicsByTime } from '../model/topics-by-time'; // @ts-ignore -import { WorkPage } from '../model/workPage'; +import { WorkPage } from '../model/work-page'; // @ts-ignore 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 @@ -37,11 +36,11 @@ import { @Injectable({ - providedIn: 'root' + providedIn: 'root' }) 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); } @@ -52,10 +51,10 @@ export class WorksService extends BaseService implements WorksServiceInterface { * @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; - public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable>; - public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable>; - public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable { + public getAllAuthorWorks(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { if (authorId === null || authorId === undefined) { throw new Error('Required parameter authorId was null or undefined when calling getAllAuthorWorks.'); } @@ -88,7 +87,7 @@ export class WorksService extends BaseService implements WorksServiceInterface { } } - 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('get', `${basePath}${localVarPath}`, { @@ -115,35 +114,35 @@ export class WorksService extends BaseService implements WorksServiceInterface { * @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, type?: Array, language?: Array, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable; - public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable>; - public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable>; - public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable { + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { 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, - page, 'page'); + page, 'page'); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - size, 'size'); + size, 'size'); if (publicationYear) { publicationYear.forEach((element) => { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - element, 'publication_year'); + element, 'publication_year'); }) } if (type) { type.forEach((element) => { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - element, 'type'); + element, 'type'); }) } if (language) { language.forEach((element) => { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - element, 'language'); + element, 'language'); }) } @@ -175,7 +174,7 @@ export class WorksService extends BaseService implements WorksServiceInterface { } } - 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('get', `${basePath}${localVarPath}`, { @@ -199,17 +198,17 @@ export class WorksService extends BaseService implements WorksServiceInterface { * @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; - public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable>; - public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable>; - public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable { + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { 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, - maxTopicsPerYear, 'max_topics_per_year'); + maxTopicsPerYear, 'max_topics_per_year'); let localVarHeaders = this.defaultHeaders; @@ -239,7 +238,7 @@ export class WorksService extends BaseService implements WorksServiceInterface { } } - 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('get', `${basePath}${localVarPath}`, { diff --git a/webapp/src/app/api/api/works.serviceInterface.ts b/webapp/src/app/api/api/works.serviceInterface.ts index 887bb9c3..de55b160 100644 --- a/webapp/src/app/api/api/works.serviceInterface.ts +++ b/webapp/src/app/api/api/works.serviceInterface.ts @@ -12,6 +12,7 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; import { HTTPValidationError } from '../model/models'; +import { TopicsByTime } from '../model/models'; import { WorkPage } from '../model/models'; import { WorksListResponse } from '../model/models'; @@ -45,4 +46,13 @@ export interface WorksServiceInterface { */ getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, extraHttpRequestParams?: any): Observable; + /** + * Returns topics grouped by publication year for an author. + * + * @endpoint get /api/works/{author_id}/topics-by-time + * @param authorId The author id, for example A5023888391. + * @param maxTopicsPerYear The maximum number of topics per year. + */ + getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, extraHttpRequestParams?: any): Observable; + } diff --git a/webapp/src/app/api/model/author-position-count.ts b/webapp/src/app/api/model/author-position-count.ts new file mode 100644 index 00000000..a02e3749 --- /dev/null +++ b/webapp/src/app/api/model/author-position-count.ts @@ -0,0 +1,18 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface AuthorPositionCount { + first?: number; + middle?: number; + last?: number; + unknown?: number; +} + diff --git a/webapp/src/app/api/model/funder-by-author.ts b/webapp/src/app/api/model/funder-by-author.ts new file mode 100644 index 00000000..06fa85f0 --- /dev/null +++ b/webapp/src/app/api/model/funder-by-author.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { PublicationIdsByAuthorPosition } from './publication-ids-by-author-position'; +import { AuthorPositionCount } from './author-position-count'; + + +export interface FunderByAuthor { + funder_id?: string | null; + funder_name?: string | null; + publication_count: number; + author_position_count: AuthorPositionCount; + publication_ids: PublicationIdsByAuthorPosition; + publication_urls?: { [key: string]: string; }; +} + diff --git a/webapp/src/app/api/model/funders-by-author-response.ts b/webapp/src/app/api/model/funders-by-author-response.ts new file mode 100644 index 00000000..6949ed4b --- /dev/null +++ b/webapp/src/app/api/model/funders-by-author-response.ts @@ -0,0 +1,19 @@ +/** + * 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 { FunderByAuthor } from './funder-by-author'; + + +export interface FundersByAuthorResponse { + author_id: string; + author_name?: string | null; + funder_count: number; + funders: Array; +} + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 7010515c..c9938757 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -6,6 +6,7 @@ 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-position-count'; export * from './author-summary-stats'; export * from './authors-list-response'; export * from './authorship'; @@ -23,6 +24,8 @@ export * from './dehydrated-institution'; export * from './dehydrated-source'; export * from './filter-information'; export * from './filter-properties'; +export * from './funder-by-author'; +export * from './funders-by-author-response'; export * from './fwci'; export * from './group-by-result'; export * from './http-validation-error'; @@ -36,12 +39,14 @@ export * from './meta'; export * from './model2-yr-mean-citedness'; export * from './open-access'; export * from './person-bio'; +export * from './publication-ids-by-author-position'; +export * from './publications-by-author-response'; export * from './score'; +export * from './topic-count'; +export * from './topics-by-time'; +export * from './topics-by-year'; export * from './validation-error'; export * from './validation-error-loc-inner'; -export * from './topicCount'; -export * from './topicsByTime'; -export * from './topicsByYear'; export * from './value'; export * from './work'; export * from './work-biblio'; diff --git a/webapp/src/app/api/model/publication-ids-by-author-position.ts b/webapp/src/app/api/model/publication-ids-by-author-position.ts new file mode 100644 index 00000000..c35050ef --- /dev/null +++ b/webapp/src/app/api/model/publication-ids-by-author-position.ts @@ -0,0 +1,18 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface PublicationIdsByAuthorPosition { + first?: Array; + middle?: Array; + last?: Array; + unknown?: Array; +} + diff --git a/webapp/src/app/api/model/publications-by-author-response.ts b/webapp/src/app/api/model/publications-by-author-response.ts new file mode 100644 index 00000000..5176fe39 --- /dev/null +++ b/webapp/src/app/api/model/publications-by-author-response.ts @@ -0,0 +1,21 @@ +/** + * 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. + */ + + +export interface PublicationsByAuthorResponse { + author_id: string; + page: number; + page_size: number; + total_works: number; + total: number; + results_count: number; + results: Array; +} + diff --git a/webapp/src/app/api/model/topic-count.ts b/webapp/src/app/api/model/topic-count.ts new file mode 100644 index 00000000..c4e4ef18 --- /dev/null +++ b/webapp/src/app/api/model/topic-count.ts @@ -0,0 +1,23 @@ +/** + * 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. + */ + + +export interface TopicCount { + id?: string | null; + /** + * The topic display name. + */ + name: string; + /** + * The number of occurrences. + */ + count?: number; +} + diff --git a/webapp/src/app/api/model/topics-by-time.ts b/webapp/src/app/api/model/topics-by-time.ts new file mode 100644 index 00000000..d2ecf101 --- /dev/null +++ b/webapp/src/app/api/model/topics-by-time.ts @@ -0,0 +1,23 @@ +/** + * 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 { TopicsByYear } from './topics-by-year'; + + +export interface TopicsByTime { + /** + * Topics grouped by year. + */ + elements?: Array; + /** + * The number of years. + */ + total?: number; +} + diff --git a/webapp/src/app/api/model/topics-by-year.ts b/webapp/src/app/api/model/topics-by-year.ts new file mode 100644 index 00000000..707cda16 --- /dev/null +++ b/webapp/src/app/api/model/topics-by-year.ts @@ -0,0 +1,31 @@ +/** + * 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 { TopicCount } from './topic-count'; + + +export interface TopicsByYear { + /** + * The publication year. + */ + year: number; + /** + * The number of works in this year. + */ + publication_count?: number; + /** + * The topics in this year. + */ + topics?: Array; + /** + * The primary topics in this year. + */ + primary_topics?: Array; +} + diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index 9f7c464c..4e0a074d 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common'; import { ActivatedRoute } from '@angular/router'; import { Router } from '@angular/router'; import { PersonsService } from '../../api'; - +import { FundingService } from '../../api'; @Component({ selector: 'app-person-funding', imports: [CommonModule], @@ -13,7 +13,7 @@ import { PersonsService } from '../../api'; export class PersonFundingComponent implements OnInit { private route = inject(ActivatedRoute); private router = inject(Router); - private personsApi = inject(PersonsService); + private fundingApi = inject(FundingService); private initialSelectedFunderKey: string | null = null; private initialPublicationPage = 1; private initialFunderListPage = 1; @@ -43,7 +43,7 @@ export class PersonFundingComponent implements OnInit { } if (authorId) { - this.personsApi.getFundersByAuthor(authorId).subscribe({ + this.fundingApi.getFundersByAuthor(authorId).subscribe({ next: (result: any) => { this.funders = result.funders ?? []; this.applyFilter(); From bf0cac329931b80e46db20ffe74eccb6ca14bd65 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 21:02:36 +0200 Subject: [PATCH 023/268] fixed merging issues --- service/src/main/inse/persons/logic.py | 156 ++++++++++++++++-- service/src/main/inse/persons/model.py | 14 +- .../inse/{search => persons}/query_builder.py | 3 + service/src/main/inse/persons/service.py | 54 +++++- service/src/main/inse/search/__init__.py | 1 - service/src/main/inse/search/logic.py | 134 --------------- service/src/main/inse/search/model.py | 14 -- service/src/main/inse/search/service.py | 66 -------- .../api/persons-search.serviceInterface.ts | 2 +- webapp/src/app/api/model/topicCount.ts | 22 --- webapp/src/app/api/model/topicsByTime.ts | 23 --- webapp/src/app/api/model/topicsByYear.ts | 31 ---- .../person-overview.component.ts | 3 +- .../app-searchbar/app-searchbar.component.ts | 4 +- 14 files changed, 220 insertions(+), 307 deletions(-) rename service/src/main/inse/{search => persons}/query_builder.py (97%) delete mode 100644 service/src/main/inse/search/__init__.py delete mode 100644 service/src/main/inse/search/logic.py delete mode 100644 service/src/main/inse/search/model.py delete mode 100644 service/src/main/inse/search/service.py delete mode 100644 webapp/src/app/api/model/topicCount.ts delete mode 100644 webapp/src/app/api/model/topicsByTime.ts delete mode 100644 webapp/src/app/api/model/topicsByYear.ts diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index db1f699e..2f9362e3 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -7,23 +7,23 @@ Business logic for persons / authors. import json import logging import time -from typing import Optional - +from typing import Optional, Callable, Any, List +import hashlib import httpx from fastapi import HTTPException from .. import config from .. import util -from ..integrations import elasticsearch from inse.models.author import Author from inse.models.authors_list_response import AuthorsListResponse +from inse import util +from inse.integrations import elasticsearch from inse.models.meta import Meta -from typing import Callable, Any -from . import model - +from inse.persons.query_builder import build_authors_search +from inse.persons.model import CustomAuthor, CustomAuthorsListResponse, PersonSearchRequest logger = logging.getLogger(__name__) - +INDEX_NAME="openalex-authors" def search_persons( author_id: Optional[str] = None, @@ -324,10 +324,26 @@ FILTER_BUILDERS: dict[str, Callable[[Any], dict]] = { } } }, - # "cited_by_count": lambda v: {"range": {"cited_by_count": {"gte": v}}}, + + "topic": lambda v: { + "nested": { + "path": "topics", + "query": { + "bool": { + "must": [ + { + "match_phrase": { + "topics.display_name": v + } + } + ] + } + } + } + }, } -def search_persons_with_filters(req: model.PersonSearchRequest) -> AuthorsListResponse: +def search_persons_with_filters(req: PersonSearchRequest) -> AuthorsListResponse: should_clauses = [] must_clauses = [] @@ -369,4 +385,124 @@ def search_persons_with_filters(req: model.PersonSearchRequest) -> AuthorsListRe return AuthorsListResponse( results=[util.get_persons_data(hit) for hit in hits], meta=Meta(count=total_count, page=req.page_offset), - ) \ No newline at end of file + ) + + +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) TODO: multiple code occurrences (e.g. in util.py) => refactor into seperate utility function (if required, after all merges) + 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, + strict: Optional[bool] = False, +) -> CustomAuthorsListResponse: + try: + query_body = build_authors_search( + query=query, + institution_name=institution_name, + topics=topics, + page=page, + page_size=page_size, + include=include, + strict=strict, + track_total_hits = True + ) + response_dict = elasticsearch.search( + index=INDEX_NAME, + body=query_body, + ) + except httpx.HTTPStatusError as e: + if e.response.status_code == 404: + logger.warning(f"Elasticsearch index '{INDEX_NAME}' not found.") + return CustomAuthorsListResponse( + results=[], + meta=Meta( + count=0, + page=page, + per_page=page_size + ) + ) + elif e.response.status_code == 400: + logger.error(f"Elasticsearch request error: {str(e)}") + raise HTTPException( + status_code=400, detail=f"Elasticsearch request error: {str(e)}" + ) + else: + logger.error(f"Elasticsearch API error: {str(e)}") + raise HTTPException( + status_code=500, detail=f"Elasticsearch API error: {str(e)}" + ) + except httpx.RequestError as e: + logger.error(f"Elasticsearch connection/request error: {str(e)}") + raise HTTPException( + status_code=500, detail=f"Elasticsearch connection/request error: {str(e)}" + ) + except Exception as e: + logger.error(f"Elasticsearch search failed: {str(e)}") + raise HTTPException( + status_code=500, detail=f"Elasticsearch search failed: {str(e)}" + ) + total_count = response_dict.get("hits",{}).get("total",{}).get("value",0) + hits = response_dict.get("hits", {}).get("hits", []) + total_count = response_dict.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 + ) + ) diff --git a/service/src/main/inse/persons/model.py b/service/src/main/inse/persons/model.py index c7b9f20e..77497957 100644 --- a/service/src/main/inse/persons/model.py +++ b/service/src/main/inse/persons/model.py @@ -5,8 +5,20 @@ Data models for persons / authors. """ from pydantic import BaseModel -from typing import Optional from pydantic import 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 class PersonBio(BaseModel): diff --git a/service/src/main/inse/search/query_builder.py b/service/src/main/inse/persons/query_builder.py similarity index 97% rename from service/src/main/inse/search/query_builder.py rename to service/src/main/inse/persons/query_builder.py index e882abcd..21a0e39f 100644 --- a/service/src/main/inse/search/query_builder.py +++ b/service/src/main/inse/persons/query_builder.py @@ -11,6 +11,8 @@ def build_authors_search( page_size: int = 10, include: Optional[Set[str]] = None, strict: Optional[bool] = False, + track_total_hits: Optional[bool] = False + ) -> dict: """ Builds an Elasticsearch search request query body for authors as a dictionary. @@ -142,6 +144,7 @@ def build_authors_search( es_from = (page - 1) * page_size body["from"] = es_from body["size"] = es_size + body["track_total_hits"] = track_total_hits # 5. Sorting if not query: diff --git a/service/src/main/inse/persons/service.py b/service/src/main/inse/persons/service.py index 81cb96a0..e9221f5a 100644 --- a/service/src/main/inse/persons/service.py +++ b/service/src/main/inse/persons/service.py @@ -9,6 +9,7 @@ from typing import Annotated, Optional from fastapi import APIRouter from fastapi import Path from fastapi import Query +from typing import List from . import logic from . import model from inse.models.authors_list_response import AuthorsListResponse @@ -182,4 +183,55 @@ def search_persons_by_institution( tags=["Persons"], ) def search_persons_with_filters(body: model.PersonSearchRequest): - return logic.search_persons_with_filters(body) \ No newline at end of file + return logic.search_persons_with_filters(body) + + +@router.get( + "/persons/search-list", + operation_id="searchPersonsList", + response_model=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, + strict: Annotated[ + Optional[bool], Query(description="Strict institution search by target year") + ] = False, +): + 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, + strict=strict, + ) diff --git a/service/src/main/inse/search/__init__.py b/service/src/main/inse/search/__init__.py deleted file mode 100644 index 40a96afc..00000000 --- a/service/src/main/inse/search/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*- diff --git a/service/src/main/inse/search/logic.py b/service/src/main/inse/search/logic.py deleted file mode 100644 index 536efb1b..00000000 --- a/service/src/main/inse/search/logic.py +++ /dev/null @@ -1,134 +0,0 @@ -# -*- coding: utf-8 -*- -import logging -import hashlib -from typing import List, Optional -import httpx -from fastapi import HTTPException -from inse.search.query_builder import build_authors_search - -from inse import util -from inse.integrations import elasticsearch as es_integration -from inse.models.author import Author -from inse.models.meta import Meta -from inse.search.model import CustomAuthor, CustomAuthorsListResponse - -logger = logging.getLogger(__name__) -INDEX_NAME = "openalex-authors" - -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) TODO: multiple code occurrences (e.g. in util.py) => refactor into seperate utility function (if required, after all merges) - 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, - strict: Optional[bool] = False, -) -> CustomAuthorsListResponse: - try: - query_body = build_authors_search( - query=query, - institution_name=institution_name, - topics=topics, - page=page, - page_size=page_size, - include=include, - strict=strict, - ) - response_dict = es_integration.search( - index=INDEX_NAME, - body=query_body, - ) - except httpx.HTTPStatusError as e: - if e.response.status_code == 404: - logger.warning(f"Elasticsearch index '{INDEX_NAME}' not found.") - return CustomAuthorsListResponse( - results=[], - meta=Meta( - count=0, - page=page, - per_page=page_size - ) - ) - elif e.response.status_code == 400: - logger.error(f"Elasticsearch request error: {str(e)}") - raise HTTPException( - status_code=400, detail=f"Elasticsearch request error: {str(e)}" - ) - else: - logger.error(f"Elasticsearch API error: {str(e)}") - raise HTTPException( - status_code=500, detail=f"Elasticsearch API error: {str(e)}" - ) - except httpx.RequestError as e: - logger.error(f"Elasticsearch connection/request error: {str(e)}") - raise HTTPException( - status_code=500, detail=f"Elasticsearch connection/request error: {str(e)}" - ) - 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_dict.get("hits", {}).get("hits", []) - total_count = response_dict.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 - ) - ) diff --git a/service/src/main/inse/search/model.py b/service/src/main/inse/search/model.py deleted file mode 100644 index 6d04a644..00000000 --- a/service/src/main/inse/search/model.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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 diff --git a/service/src/main/inse/search/service.py b/service/src/main/inse/search/service.py deleted file mode 100644 index 8d6227ce..00000000 --- a/service/src/main/inse/search/service.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- 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, - strict: Annotated[ - Optional[bool], Query(description="Strict institution search by target year") - ] = False, -): - 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, - strict=strict, - ) diff --git a/webapp/src/app/api/api/persons-search.serviceInterface.ts b/webapp/src/app/api/api/persons-search.serviceInterface.ts index 8221785d..23155580 100644 --- a/webapp/src/app/api/api/persons-search.serviceInterface.ts +++ b/webapp/src/app/api/api/persons-search.serviceInterface.ts @@ -11,7 +11,7 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; -import { CustomAuthorsListResponse } from '../model/models'; +import { CustomAuthorsListResponse } from '../model/custom-authors-list-response'; import { HTTPValidationError } from '../model/models'; diff --git a/webapp/src/app/api/model/topicCount.ts b/webapp/src/app/api/model/topicCount.ts deleted file mode 100644 index d6c3c481..00000000 --- a/webapp/src/app/api/model/topicCount.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface TopicCount { - /** - * The topic display name. - */ - name: string; - /** - * The number of occurrences. - */ - count?: number; -} - diff --git a/webapp/src/app/api/model/topicsByTime.ts b/webapp/src/app/api/model/topicsByTime.ts deleted file mode 100644 index 0dac04a7..00000000 --- a/webapp/src/app/api/model/topicsByTime.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { TopicsByYear } from './topicsByYear'; - - -export interface TopicsByTime { - /** - * Topics grouped by year. - */ - elements?: Array; - /** - * The number of years. - */ - total?: number; -} - diff --git a/webapp/src/app/api/model/topicsByYear.ts b/webapp/src/app/api/model/topicsByYear.ts deleted file mode 100644 index fded8da0..00000000 --- a/webapp/src/app/api/model/topicsByYear.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { TopicCount } from './topicCount'; - - -export interface TopicsByYear { - /** - * The publication year. - */ - year: number; - /** - * The number of works in this year. - */ - publication_count?: number; - /** - * The topics in this year. - */ - topics?: Array; - /** - * The primary topics in this year. - */ - primary_topics?: Array; -} - diff --git a/webapp/src/app/modules/person-overview/person-overview.component.ts b/webapp/src/app/modules/person-overview/person-overview.component.ts index 883d017d..e3c31b4a 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -4,7 +4,8 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { ActivatedRoute, ParamMap, Router } from '@angular/router'; import { combineLatest, distinctUntilChanged, map } from 'rxjs'; -import { TopicCount, TopicsByYear, WorksService } from '../../api'; +import { TopicCount,TopicsByYear } from '../../api'; +import { WorksService } from '../../api'; import { ResearchTimelineComponent, TimelineViewMode, diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts index acba158a..711c0211 100644 --- a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.ts @@ -46,7 +46,7 @@ export class AppSearchbarComponent { constructor() { const params = new URLSearchParams(window.location.search); - const currentSearch = params.get('search') ?? ''; + const currentSearch = params.get('query') ?? ''; this.searchControl.setValue(currentSearch, { emitEvent: false }); // Autocomplete suggestions @@ -100,7 +100,7 @@ export class AppSearchbarComponent { this.router.url.startsWith('/persons') ? [] : ['/persons'], { relativeTo: this.route, - queryParams: { search: search || null, page: 0 }, + queryParams: { query: search || null, page: 1 }, queryParamsHandling: 'merge', }, ); From 247d81381f1e6c20f8c51c34ce7f31f11b110249 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 21:03:06 +0200 Subject: [PATCH 024/268] endpoints directories fixed --- service/src/main/inse/funders/logic.py | 2 +- service/src/main/inse/main.py | 2 ++ service/src/main/inse/persons/logic.py | 44 +++++++++++++++----------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/service/src/main/inse/funders/logic.py b/service/src/main/inse/funders/logic.py index 74078444..a04eb6fd 100644 --- a/service/src/main/inse/funders/logic.py +++ b/service/src/main/inse/funders/logic.py @@ -12,7 +12,7 @@ from pydantic import ValidationError from starlette.status import HTTP_502_BAD_GATEWAY from starlette.status import HTTP_503_SERVICE_UNAVAILABLE -from .. import logic as person_logic +from ..persons import logic as person_logic from . import model from .elastic_search_client import FundedPublicationsSearchClient from .elastic_search_client import MissingApiKeyError diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index 2b018c5d..4e0e62d2 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -13,6 +13,7 @@ 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.persons.service import router as persons_service_router +from inse.funders.service import router as funders_service_router from . import config from .service import router as service_router @@ -34,6 +35,7 @@ app = FastAPI( app.include_router(collaboration_network_router) app.include_router(works_service_router) app.include_router(persons_service_router) +app.include_router(funders_service_router) app.include_router(service_router) app.include_router(account_router) diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index 2f9362e3..c1a5a3a3 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -14,7 +14,7 @@ from fastapi import HTTPException from .. import config from .. import util - +from ..integrations import llm from inse.models.author import Author from inse.models.authors_list_response import AuthorsListResponse from inse import util @@ -66,6 +66,7 @@ def search_persons( return AuthorsListResponse(results=authors, meta=Meta(count=len(authors))) + def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str: start_time = time.time() search_result = search_persons(author_id=author_id) @@ -91,23 +92,7 @@ def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> s user_prompt = f"Daten zur Person:\n{person_json}" - headers = { - "Authorization": f"Bearer {config.settings.llm_api_key}", - "Content-Type": "application/json", - } - payload = { - "model": config.settings.llm_model, - "prompt": f"{system_prompt}\n{user_prompt}", - "stream": False, - } - - with httpx.Client(timeout=30.0) as client: - response = client.post( - config.settings.llm_api_url, json=payload, headers=headers - ) - response.raise_for_status() - data = response.json() - bio = data.get("response", "") + bio = llm.call(system_prompt, user_prompt) elapsed_time = time.time() - start_time logger.info( @@ -116,6 +101,29 @@ def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> s return bio +def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse: + body = { + "_source":include.split(",") if include else True, + } + + try: + hit = elasticsearch.get( + index="openalex-authors", + body=body, + doc_id=author_id + ) + except NotFoundError: + raise HTTPException( + status_code=404, detail=f"Person with id {author_id} not found" + ) + + except ApiError as e: + raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}") + persons = [util.get_persons_data(hit)] + + return AuthorsListResponse(results=persons) + + def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse: body = { From eab00773479894f6c9dfc4452989dfc3a842b9ca Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 21:55:49 +0200 Subject: [PATCH 025/268] little ui adjustment --- webapp/src/app/modules/person-list/person-list.component.scss | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp/src/app/modules/person-list/person-list.component.scss b/webapp/src/app/modules/person-list/person-list.component.scss index cc579b6e..c37d656b 100644 --- a/webapp/src/app/modules/person-list/person-list.component.scss +++ b/webapp/src/app/modules/person-list/person-list.component.scss @@ -270,6 +270,7 @@ .institution { display: flex; + align-items: center; gap:15px; margin: 0; font-size: 12px; @@ -280,6 +281,7 @@ } .flag-img{ border: 1px solid; + vertical-align: -10px; } .person-id { margin: 2px 0 0; From 5cfda2e5d678160dce7b2dbc267a589c5822d94e Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 21:56:30 +0200 Subject: [PATCH 026/268] fixed backed endpoints --- service/src/main/inse/funders/service.py | 2 +- service/src/main/inse/logic.py | 1 - service/src/main/inse/persons/logic.py | 82 --------------------- service/src/main/inse/persons/service.py | 11 --- service/src/main/inse/service.py | 4 - webapp/src/app/api/.openapi-generator/FILES | 2 - 6 files changed, 1 insertion(+), 101 deletions(-) diff --git a/service/src/main/inse/funders/service.py b/service/src/main/inse/funders/service.py index a99b661e..b6c8c05f 100644 --- a/service/src/main/inse/funders/service.py +++ b/service/src/main/inse/funders/service.py @@ -12,7 +12,7 @@ from . import logic from . import model -router = APIRouter(prefix="/authors", tags=["Funding"]) +router = APIRouter(prefix="/api/inse-service/authors", tags=["Funding"]) @router.get( diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 3e0b0421..141e558e 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -18,7 +18,6 @@ import json from . import schema from . import model from . import config -from .integrations import llm from inse.models.topic import Topic diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index c1a5a3a3..cbaea001 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -11,7 +11,6 @@ from typing import Optional, Callable, Any, List import hashlib import httpx from fastapi import HTTPException - from .. import config from .. import util from ..integrations import llm @@ -315,87 +314,6 @@ def search_persons_by_institution( persons = [util.get_persons_data(hit) for hit in hits] return AuthorsListResponse(results=persons,meta=Meta(count=total_count,page=page_offset)) -FILTER_BUILDERS: dict[str, Callable[[Any], dict]] = { - "institution": lambda v: { - "nested": { - "path": "last_known_institutions", - "query": { - "bool": { - "must": [ - { - "match_phrase": { - "last_known_institutions.display_name": v - } - } - ] - } - } - } - }, - - "topic": lambda v: { - "nested": { - "path": "topics", - "query": { - "bool": { - "must": [ - { - "match_phrase": { - "topics.display_name": v - } - } - ] - } - } - } - }, -} - -def search_persons_with_filters(req: PersonSearchRequest) -> AuthorsListResponse: - should_clauses = [] - must_clauses = [] - - if req.name: - should_clauses = [ - {"match_phrase": {"display_name": {"query": req.name, "boost": 5}}}, - {"match_phrase_prefix": {"display_name": {"query": req.name, "boost": 3}}}, - ] - - for field, value in req.filters.model_dump(exclude_none=True).items(): - builder = FILTER_BUILDERS.get(field) - if builder: - must_clauses.append(builder(value)) - - if should_clauses or must_clauses: - query = { - "bool": { - **({"should": should_clauses, "minimum_should_match": 1} if should_clauses else {}), - **({"must": must_clauses} if must_clauses else {}), - } - } - else: - query = {"match_all": {}} - try: - response = elasticsearch.search( - index="openalex-authors", - query=query, - offset=req.page_offset, - source=req.include.split(",") if req.include else True, - size=req.limit, - track_total_hits=True, - ) - except Exception as e: - raise HTTPException(status_code=500, detail=f"Elasticsearch search failed: {str(e)}") - - total_count = response.get("hits", {}).get("total", {}).get("value", 0) - hits = response.get("hits", {}).get("hits", []) - - return AuthorsListResponse( - results=[util.get_persons_data(hit) for hit in hits], - meta=Meta(count=total_count, page=req.page_offset), - ) - - def _enrich_author_data(author_data) -> Optional[CustomAuthor]: if not author_data: return None diff --git a/service/src/main/inse/persons/service.py b/service/src/main/inse/persons/service.py index e9221f5a..903b4d3d 100644 --- a/service/src/main/inse/persons/service.py +++ b/service/src/main/inse/persons/service.py @@ -175,17 +175,6 @@ def search_persons_by_institution( ): return logic.search_persons_by_institution(institution_name, include=include,page_offset=page_offset,limit=limit) -@router.post( - "/persons/searchWithFilters", - operation_id="searchPersonsWithFilters", - response_model=AuthorsListResponse, - summary="Search for persons with optional name and filters.", - tags=["Persons"], -) -def search_persons_with_filters(body: model.PersonSearchRequest): - return logic.search_persons_with_filters(body) - - @router.get( "/persons/search-list", operation_id="searchPersonsList", diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index dfdd0129..d4258e98 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -27,8 +27,6 @@ from . import schema from . import database from . import security from . import util -from .works import service as works_service -from .funders import service as funders_service @@ -44,8 +42,6 @@ router = APIRouter( responses={404: {"description": "Not found"}}, ) -router.include_router(funders_service.router) - # @app.get("/", include_in_schema=False) # async def show_api(): # return RedirectResponse("api") diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 9157ca00..13d8ad8b 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -65,8 +65,6 @@ model/model2-yr-mean-citedness.ts model/models.ts model/open-access.ts model/person-bio.ts -model/person-filters.ts -model/person-search-request.ts model/publication-ids-by-author-position.ts model/publications-by-author-response.ts model/score.ts From 765c5c9509ea38ea6355bc7faf87a8833dc9bc0f Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 5 Jun 2026 21:56:49 +0200 Subject: [PATCH 027/268] regenerated openApi endpoints --- .../src/app/api/api/inse-service.service.ts | 123 ---------------- .../api/api/inse-service.serviceInterface.ts | 20 --- webapp/src/app/api/api/persons.service.ts | 132 ------------------ .../app/api/api/persons.serviceInterface.ts | 17 --- webapp/src/app/api/model/models.ts | 2 - 5 files changed, 294 deletions(-) diff --git a/webapp/src/app/api/api/inse-service.service.ts b/webapp/src/app/api/api/inse-service.service.ts index 37e0095b..4e3d5637 100644 --- a/webapp/src/app/api/api/inse-service.service.ts +++ b/webapp/src/app/api/api/inse-service.service.ts @@ -16,8 +16,6 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; -// @ts-ignore -import { FundersByAuthorResponse } from '../model/funders-by-author-response'; // @ts-ignore import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore @@ -26,8 +24,6 @@ import { Item } from '../model/item'; import { ItemCreate } from '../model/item-create'; // @ts-ignore import { ItemPage } from '../model/item-page'; -// @ts-ignore -import { PublicationsByAuthorResponse } from '../model/publications-by-author-response'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -298,61 +294,6 @@ export class INSEServiceService extends BaseService implements INSEServiceServic ); } - /** - * Get funding organizations by author. - * @endpoint get /api/inse-service/authors/{author_id}/funders - * @param authorId - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getFundersByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (authorId === null || authorId === undefined) { - throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/funders`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - /** * Returns the item with the id. * @endpoint get /api/inse-service/items/{id} @@ -474,70 +415,6 @@ export class INSEServiceService extends BaseService implements INSEServiceServic ); } - /** - * Get funded publications by author. - * @endpoint get /api/inse-service/authors/{author_id}/publications - * @param authorId - * @param page - * @param pageSize - * @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 getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (authorId === null || authorId === undefined) { - throw new Error('Required parameter authorId was null or undefined when calling getPublicationsByAuthor.'); - } - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - page, 'page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - pageSize, 'page_size'); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/publications`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - /** * Updates the item with the id. * @endpoint put /api/inse-service/items/{id} diff --git a/webapp/src/app/api/api/inse-service.serviceInterface.ts b/webapp/src/app/api/api/inse-service.serviceInterface.ts index 35eeb671..6739063e 100644 --- a/webapp/src/app/api/api/inse-service.serviceInterface.ts +++ b/webapp/src/app/api/api/inse-service.serviceInterface.ts @@ -11,12 +11,10 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; -import { FundersByAuthorResponse } from '../model/models'; import { HTTPValidationError } from '../model/models'; import { Item } from '../model/models'; import { ItemCreate } from '../model/models'; import { ItemPage } from '../model/models'; -import { PublicationsByAuthorResponse } from '../model/models'; import { Configuration } from '../configuration'; @@ -60,14 +58,6 @@ export interface INSEServiceServiceInterface { */ deleteItem(id: number, extraHttpRequestParams?: any): Observable; - /** - * Get funding organizations by author. - * - * @endpoint get /api/inse-service/authors/{author_id}/funders - * @param authorId - */ - getFundersByAuthor(authorId: string, extraHttpRequestParams?: any): Observable; - /** * Returns the item with the id. * @@ -85,16 +75,6 @@ export interface INSEServiceServiceInterface { */ getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable; - /** - * Get funded publications by author. - * - * @endpoint get /api/inse-service/authors/{author_id}/publications - * @param authorId - * @param page - * @param pageSize - */ - getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, extraHttpRequestParams?: any): Observable; - /** * Updates the item with the id. * diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index 949ce59c..0bf05d2a 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -24,8 +24,6 @@ import { CustomAuthorsListResponse } from '../model/custom-authors-list-response import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore import { PersonBio } from '../model/person-bio'; -// @ts-ignore -import { PersonSearchRequest } from '../model/person-search-request'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -878,134 +876,4 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa ); } - /** - * Search for persons with optional name and filters. - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest - * @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 searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (personSearchRequest === null || personSearchRequest === undefined) { - throw new Error('Required parameter personSearchRequest was null or undefined when calling searchPersonsWithFilters.'); - } - - 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; - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - 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/searchWithFilters`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: personSearchRequest, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * Search for persons with optional name and filters. - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest - * @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 searchPersonsWithFilters_6(personSearchRequest: PersonSearchRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsWithFilters_6(personSearchRequest: PersonSearchRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters_6(personSearchRequest: PersonSearchRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters_6(personSearchRequest: PersonSearchRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (personSearchRequest === null || personSearchRequest === undefined) { - throw new Error('Required parameter personSearchRequest was null or undefined when calling searchPersonsWithFilters_6.'); - } - - 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; - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - 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/searchWithFilters`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: personSearchRequest, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - } diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts index 8a14d17a..6511e771 100644 --- a/webapp/src/app/api/api/persons.serviceInterface.ts +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -15,7 +15,6 @@ import { AuthorsListResponse } from '../model/models'; import { CustomAuthorsListResponse } from '../model/models'; import { HTTPValidationError } from '../model/models'; import { PersonBio } from '../model/models'; -import { PersonSearchRequest } from '../model/models'; import { Configuration } from '../configuration'; @@ -153,20 +152,4 @@ export interface PersonsServiceInterface { */ searchPersonsList_5(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, extraHttpRequestParams?: any): Observable; - /** - * Search for persons with optional name and filters. - * - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest - */ - searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, extraHttpRequestParams?: any): Observable; - - /** - * Search for persons with optional name and filters. - * - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest - */ - searchPersonsWithFilters_6(personSearchRequest: PersonSearchRequest, extraHttpRequestParams?: any): Observable; - } diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 7836eeab..c9938757 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -39,8 +39,6 @@ export * from './meta'; export * from './model2-yr-mean-citedness'; export * from './open-access'; export * from './person-bio'; -export * from './person-filters'; -export * from './person-search-request'; export * from './publication-ids-by-author-position'; export * from './publications-by-author-response'; export * from './score'; From 2a20e7bc336ce149ea1f05026dcebe63c85aa997 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 6 Jun 2026 08:11:32 +0200 Subject: [PATCH 028/268] update person to display scores in interest tags --- service/src/main/inse/logic.py | 6 ++++++ .../person-interesting/person-interesting.component.html | 2 +- webapp/src/app/modules/person/person.component.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 645df10b..e4d37cca 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -288,6 +288,12 @@ def search_persons( ids_copy[str_field] = str(val) source_copy["ids"] = ids_copy + topics = source_copy.get("topics") + if isinstance(topics, list): + for topic in topics: + if isinstance(topic, dict) and topic.get("score") is None: + topic["score"] = topic.get("count") + author = Author.from_dict(source_copy) if author: authors.append(author) diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.html b/webapp/src/app/modules/person-interesting/person-interesting.component.html index 7f79895c..27c9bd2b 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.html +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.html @@ -3,7 +3,7 @@
@if (tags().length > 0) { @for (tag of tags(); track tag.label) { - + } } @else { Keine Themen gefunden diff --git a/webapp/src/app/modules/person/person.component.ts b/webapp/src/app/modules/person/person.component.ts index f8b61e2c..accaf82e 100644 --- a/webapp/src/app/modules/person/person.component.ts +++ b/webapp/src/app/modules/person/person.component.ts @@ -50,7 +50,7 @@ export class PersonComponent { switchMap((id) => { if (!id) return of(null); this.isPersonLoading.set(true); - return this.personsApi.searchPersons(id, PERSON_INCLUDE_TAGS).pipe( + return this.personsApi.searchPersons(id, undefined, PERSON_INCLUDE_TAGS).pipe( map((result) => result.results?.[0] ?? null), catchError((err) => { console.error('Failed to load person:', err); From 39969fbaab23047a690a75be25e880db9fedc617 Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Sat, 6 Jun 2026 08:16:18 +0200 Subject: [PATCH 029/268] add footnote to interest card for publication count --- .../person-interesting.component.html | 7 ++++++- .../person-interesting.component.scss | 14 +++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.html b/webapp/src/app/modules/person-interesting/person-interesting.component.html index 27c9bd2b..f9b7f49e 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.html +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.html @@ -1,5 +1,10 @@