From e37de88cc8bd0ecc39429eb270cf09bd65f05ce8 Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Fri, 26 Jun 2026 11:27:11 +0200 Subject: [PATCH 01/43] feat(institutions): add patents view per institution with assignee-based search --- service/src/main/inse/institutions/router.py | 20 + .../inse/patents/elastic_search_client.py | 91 ++- service/src/main/inse/patents/logic.py | 121 +++- service/src/main/inse/patents/model.py | 8 + .../src/main/inse/patents/name_matching.py | 86 +++ .../patents/test_elastic_search_client.py | 18 + .../inse/patents/test_institution_matching.py | 82 +++ service/src/main/inse/patents/test_logic.py | 51 ++ webapp/src/app/api/api/patents.service.ts | 95 +++ .../api/model/patentsByInstitutionResponse.ts | 8 + webapp/src/app/app.routes.ts | 7 + .../institution-patents.component.html | 306 ++++++++++ .../institution-patents.component.scss | 564 ++++++++++++++++++ .../institution-patents.component.ts | 408 +++++++++++++ .../institution/institution.component.ts | 1 + .../institutions/institutions.component.html | 7 + 16 files changed, 1870 insertions(+), 3 deletions(-) create mode 100644 service/src/main/inse/patents/test_institution_matching.py create mode 100644 webapp/src/app/api/model/patentsByInstitutionResponse.ts create mode 100644 webapp/src/app/modules/institution-patents/institution-patents.component.html create mode 100644 webapp/src/app/modules/institution-patents/institution-patents.component.scss create mode 100644 webapp/src/app/modules/institution-patents/institution-patents.component.ts diff --git a/service/src/main/inse/institutions/router.py b/service/src/main/inse/institutions/router.py index 423281c0..658ed71e 100644 --- a/service/src/main/inse/institutions/router.py +++ b/service/src/main/inse/institutions/router.py @@ -16,6 +16,8 @@ from inse.models.openalex.institution import Institution from inse.institutions.model import InstitutionPage from . import logic from inse.institutions.institutions_search_client import InstitutionsSearchClient +from inse.patents import logic as patents_logic +from inse.patents.model import PatentsByInstitutionResponse router = APIRouter(prefix="/api/inse-service/institutions", tags=[Tags.INSTITUTIONS]) @@ -120,6 +122,24 @@ async def autocomplete_institutions( client=client, ) +@router.get( + "/{id}/patents", + operation_id="getPatentsByInstitution", + response_model=PatentsByInstitutionResponse, + summary="Get patents matched to an institution by assignee name.", +) +async def get_patents_by_institution( + id: str, + client: Annotated[ + InstitutionsSearchClient, Depends(get_institutions_search_client) + ], +) -> PatentsByInstitutionResponse: + return await patents_logic.get_patents_by_institution_id( + institution_id=id, + institutions_client=client, + ) + + @router.get( "/{id}", summary="Returns a single institution by ID.", diff --git a/service/src/main/inse/patents/elastic_search_client.py b/service/src/main/inse/patents/elastic_search_client.py index f10694e6..7b7da9b9 100644 --- a/service/src/main/inse/patents/elastic_search_client.py +++ b/service/src/main/inse/patents/elastic_search_client.py @@ -8,7 +8,7 @@ from typing import Any import httpx from .. import config -from .name_matching import search_name_variants +from .name_matching import institution_search_variants, search_name_variants EPO_INDEX = "epo_index_1.0" USPTO_INDEX = "uspto_patents_3.0" @@ -17,7 +17,7 @@ DEFAULT_SEARCH_SIZE = 100 def _match_name_field(field: str, name: str) -> dict[str, Any]: - """Match a name field, including transliterated variants (Müller/Mueller).""" + """Match a name field, including transliterated variants (M?ller/Mueller).""" variants = search_name_variants(name) if len(variants) <= 1: return {"match": {field: variants[0] if variants else name}} @@ -167,6 +167,93 @@ class PatentSearchClient: "query": query, } + def _match_organization_names(self, field: str, names: list[str]) -> dict[str, Any]: + clauses: list[dict[str, Any]] = [] + seen: set[str] = set() + + for name in names: + for variant in institution_search_variants(name): + key = variant.casefold() + if not variant or key in seen: + continue + seen.add(key) + clauses.append({"match_phrase": {field: {"query": variant}}}) + + if not clauses: + return {"match_none": {}} + + return { + "bool": { + "should": clauses, + "minimum_should_match": 1, + } + } + + def epo_query_by_applicant( + self, + institution_names: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"_score": {"order": "desc"}}, + {"date_publication": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": [ + "doc_number", + "country", + "kind", + "date_publication", + "date_publication_year", + "application_number", + "application_filing_date", + "title_en", + "title_de", + "abstract", + "inventors_name", + "applicants_name", + "ipc", + "cpc", + ], + "query": self._match_organization_names("applicants_name", institution_names), + } + + def uspto_query_by_assignee( + self, + institution_names: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"_score": {"order": "desc"}}, + {"publication_date": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": [ + "publication_number", + "country", + "publication_date", + "publication_year", + "application_number", + "application_date", + "application_type", + "title", + "abstract", + "inventors_names", + "assignees_orgs", + "ipcr", + "cpc", + "number_of_claims", + "status", + ], + "query": self._match_organization_names("assignees_orgs", institution_names), + } + async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]: return await self._search(EPO_INDEX, payload) diff --git a/service/src/main/inse/patents/logic.py b/service/src/main/inse/patents/logic.py index 76594b9a..36caf443 100644 --- a/service/src/main/inse/patents/logic.py +++ b/service/src/main/inse/patents/logic.py @@ -13,13 +13,20 @@ from starlette.status import HTTP_503_SERVICE_UNAVAILABLE from ..persons import logic as person_logic from ..models.openalex.author import Author +from ..models.openalex.institution import Institution +from inse.institutions.institutions_search_client import InstitutionsSearchClient from . import model from .elastic_search_client import MissingApiKeyError from .elastic_search_client import PatentSearchClient from .elastic_search_all_patents_client import AllPatentsSearchClient from .ipc_search_client import IpcSearchClient from .ipc_lookup import extract_ipc_symbol -from .name_matching import name_matches +from .name_matching import ( + MIN_INSTITUTION_ACRONYM_LEN, + assignee_matches_institution_name, + institution_search_variants, + name_matches, +) logger = logging.getLogger(__name__) @@ -81,6 +88,118 @@ async def get_patents_by_author_id( ) +async def get_patents_by_institution_id( + institution_id: str, + client: PatentSearchClient | None = None, + ipc_client: IpcSearchClient | None = None, + institutions_client: InstitutionsSearchClient | None = None, +) -> model.PatentsByInstitutionResponse: + search_client = client or PatentSearchClient() + ipc_search_client = ipc_client or IpcSearchClient() + institution_client = institutions_client or InstitutionsSearchClient() + + short_id = institution_id.replace("https://openalex.org/", "") + institution = institution_client.get_institution_by_id(short_id) + search_names = _institution_search_names(institution) + + if not search_names: + return model.PatentsByInstitutionResponse( + institution_id=short_id, + institution_name=institution.display_name, + patent_count=0, + patents=[], + ) + + try: + epo_data, uspto_data = await asyncio.gather( + search_client.search_epo( + search_client.epo_query_by_applicant(search_names) + ), + search_client.search_uspto( + search_client.uspto_query_by_assignee(search_names) + ), + ) + except MissingApiKeyError as exc: + raise HTTPException(status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="Patent search is not configured.") from exc + except httpx.HTTPError as exc: + raise HTTPException(status_code=HTTP_502_BAD_GATEWAY, + detail="Patent search request failed.") from exc + + all_patents = _parse_epo_hits(epo_data) + _parse_uspto_hits(uspto_data) + all_patents = _filter_patents_by_institution(all_patents, institution) + all_patents = _deduplicate_patents(all_patents) + + await _enrich_patents_classifications(all_patents, ipc_search_client) + + return model.PatentsByInstitutionResponse( + institution_id=short_id, + institution_name=institution.display_name, + patent_count=len(all_patents), + patents=all_patents, + ) + + +def _institution_search_names(institution: Institution) -> list[str]: + names: list[str] = [] + seen: set[str] = set() + + def _add(name: str | None) -> None: + if not name or not name.strip(): + return + for variant in institution_search_variants(name.strip()): + key = variant.casefold() + if key not in seen: + seen.add(key) + names.append(variant) + + _add(institution.display_name) + for alternative in institution.display_name_alternatives or []: + _add(alternative) + for acronym in institution.display_name_acronyms or []: + if acronym and len(acronym.strip()) >= MIN_INSTITUTION_ACRONYM_LEN: + _add(acronym) + + return names + + +def _institution_canonical_names(institution: Institution) -> list[str]: + names: list[str] = [] + seen: set[str] = set() + + def _add(name: str | None) -> None: + if not name or not name.strip(): + return + key = name.strip().casefold() + if key not in seen: + seen.add(key) + names.append(name.strip()) + + _add(institution.display_name) + for alternative in institution.display_name_alternatives or []: + _add(alternative) + for acronym in institution.display_name_acronyms or []: + if acronym and len(acronym.strip()) >= MIN_INSTITUTION_ACRONYM_LEN: + _add(acronym) + + return names + + +def _filter_patents_by_institution( + patents: list[model.PatentEntry], + institution: Institution, +) -> list[model.PatentEntry]: + canonical_names = _institution_canonical_names(institution) + return [ + patent for patent in patents + if any( + assignee_matches_institution_name(assignee, name) + for assignee in patent.assignees + for name in canonical_names + ) + ] + + async def _search_both_indices(client, last_name, first_name): epo_result, uspto_result = await asyncio.gather( client.search_epo(client.epo_query_by_inventor(last_name, first_name)), diff --git a/service/src/main/inse/patents/model.py b/service/src/main/inse/patents/model.py index ad26f939..830875bd 100644 --- a/service/src/main/inse/patents/model.py +++ b/service/src/main/inse/patents/model.py @@ -40,6 +40,14 @@ class PatentsByAuthorResponse(BaseModel): patent_count: int patents: list[PatentEntry] + +class PatentsByInstitutionResponse(BaseModel): + institution_id: str + institution_name: str | None = None + patent_count: int + patents: list[PatentEntry] + + class AllPatentsResponse(BaseModel): total: int page: int diff --git a/service/src/main/inse/patents/name_matching.py b/service/src/main/inse/patents/name_matching.py index 659b295c..e62dcab6 100644 --- a/service/src/main/inse/patents/name_matching.py +++ b/service/src/main/inse/patents/name_matching.py @@ -240,3 +240,89 @@ def name_matches(inventor_name: str, first_name: str, last_name: str) -> bool: and bool(first_name) and tokens_equal(parts[0], first_name) ) + + +_INSTITUTION_GENERIC_TOKENS = frozenset({ + "university", "universitat", "universitaet", "universiteit", "college", + "institute", "institut", "institution", "national", "sciences", "science", + "school", "center", "centre", "laboratory", "department", "academy", + "the", "of", "for", "and", "de", "la", "des", "der", "die", "das", "und", + "fur", "von", +}) + +MIN_INSTITUTION_SUBSTRING_LEN = 6 +MIN_INSTITUTION_VARIANT_LEN = 4 +MIN_INSTITUTION_ACRONYM_LEN = 3 + + +def institution_search_variants(value: str | None) -> list[str]: + if not value or not value.strip(): + return [] + + stripped = value.strip() + min_len = ( + MIN_INSTITUTION_ACRONYM_LEN + if stripped.isupper() and " " not in stripped + else MIN_INSTITUTION_VARIANT_LEN + ) + + seen: set[str] = set() + ordered: list[str] = [] + + def _add(candidate: str) -> None: + candidate = candidate.strip() + if len(candidate) < min_len: + return + key = candidate.casefold() + if key not in seen: + seen.add(key) + ordered.append(candidate) + + _add(stripped) + + normalized = normalize_name_part(value) + if normalized: + _add(normalized.title()) + + for variant in name_token_variants(value): + _add(variant.title()) + + for variant in _patent_transliteration_expansions(normalized): + _add(variant.title()) + + return ordered + + +def _significant_institution_tokens(text: str) -> set[str]: + return { + token + for token in normalize_name_part(text).split() + if len(token) >= MIN_INSTITUTION_VARIANT_LEN + and token not in _INSTITUTION_GENERIC_TOKENS + } + + +def assignee_matches_institution_name(assignee: str, institution_name: str) -> bool: + norm_assignee = normalize_name_part(assignee) + norm_name = normalize_name_part(institution_name) + if not norm_assignee or not norm_name: + return False + + original = institution_name.strip() + assignee_tokens = set(norm_assignee.split()) + + if len(original) <= 6 and " " not in original: + return norm_name in assignee_tokens + + if len(norm_name) >= MIN_INSTITUTION_SUBSTRING_LEN: + if norm_name in norm_assignee or norm_assignee in norm_name: + return True + + significant = _significant_institution_tokens(institution_name) + if not significant: + return False + + matched = significant & assignee_tokens + if len(significant) >= 2: + return len(matched) >= 2 + return bool(matched) diff --git a/service/src/main/inse/patents/test_elastic_search_client.py b/service/src/main/inse/patents/test_elastic_search_client.py index 08729ea6..2eb9ecb7 100644 --- a/service/src/main/inse/patents/test_elastic_search_client.py +++ b/service/src/main/inse/patents/test_elastic_search_client.py @@ -32,6 +32,24 @@ def test_uspto_index_is_3_0(): assert EPO_INDEX == "epo_index_1.0" +def test_epo_query_by_applicant_uses_applicants_name_field(): + client = PatentSearchClient(api_key="test-key") + payload = client.epo_query_by_applicant( + ["University of Duisburg-Essen", "Universität Duisburg-Essen"] + ) + + assert payload["size"] == DEFAULT_SEARCH_SIZE + assert "applicants_name" in str(payload["query"]) + assert payload["query"]["bool"]["minimum_should_match"] == 1 + + +def test_uspto_query_by_assignee_uses_assignees_orgs_field(): + client = PatentSearchClient(api_key="test-key") + payload = client.uspto_query_by_assignee(["Harvard University"]) + + assert "assignees_orgs" in str(payload["query"]) + + @pytest.mark.anyio async def test_search_epo_posts_to_correct_index(): requests: list[str] = [] diff --git a/service/src/main/inse/patents/test_institution_matching.py b/service/src/main/inse/patents/test_institution_matching.py new file mode 100644 index 00000000..2d5c6588 --- /dev/null +++ b/service/src/main/inse/patents/test_institution_matching.py @@ -0,0 +1,82 @@ +from inse.patents import logic, model +from inse.patents.name_matching import ( + assignee_matches_institution_name, + institution_search_variants, +) + + +def test_institution_search_variants_exclude_single_letter_initials() -> None: + variants = institution_search_variants("Harvard University") + + assert "H" not in variants + assert "U" not in variants + assert any("Harvard" in variant for variant in variants) + + +def test_assignee_matches_institution_name_accepts_valid_university() -> None: + assert assignee_matches_institution_name( + "Universitaet Duisburg-Essen", + "University of Duisburg-Essen", + ) + assert assignee_matches_institution_name( + "President and Fellows of Harvard College", + "Harvard University", + ) + + +def test_assignee_matches_institution_name_rejects_false_positives() -> None: + assert not assignee_matches_institution_name("u-blox AG", "Harvard University") + assert not assignee_matches_institution_name( + "LG H&H CO., LTD.", + "Harvard University", + ) + assert not assignee_matches_institution_name( + "K & N Engineering, Inc.", + "National Institute for Fusion Science", + ) + assert not assignee_matches_institution_name( + "K&K INC.", + "National Institute for Fusion Science", + ) + + +def test_filter_patents_by_institution_removes_unrelated_assignees() -> None: + institution = _institution( + display_name="Harvard University", + alternatives=["Universidad de Harvard"], + ) + patents = [ + model.PatentEntry( + patent_id="US1", + source="USPTO", + assignees=["President and Fellows of Harvard College"], + ), + model.PatentEntry( + patent_id="US2", + source="USPTO", + assignees=["u-blox AG"], + ), + model.PatentEntry( + patent_id="US3", + source="USPTO", + assignees=["LG H&H CO., LTD."], + ), + ] + + result = logic._filter_patents_by_institution(patents, institution) + + assert len(result) == 1 + assert result[0].patent_id == "US1" + + +def _institution( + display_name: str, + alternatives: list[str] | None = None, +): + from inse.models.openalex.institution import Institution + + return Institution( + id="https://openalex.org/I123", + display_name=display_name, + display_name_alternatives=alternatives, + ) diff --git a/service/src/main/inse/patents/test_logic.py b/service/src/main/inse/patents/test_logic.py index 6c81e218..a57f49c8 100644 --- a/service/src/main/inse/patents/test_logic.py +++ b/service/src/main/inse/patents/test_logic.py @@ -89,3 +89,54 @@ def test_deduplicate_patents_keeps_same_patent_number_with_different_uspto_types assert len(result) == 2 assert [patent.application_type for patent in result] == ["utility", "reissue"] + + +def test_assignee_matches_institution_name_accepts_alternative_names() -> None: + from inse.patents.name_matching import assignee_matches_institution_name + + assert assignee_matches_institution_name( + "Universitaet Duisburg-Essen", + "University of Duisburg-Essen", + ) + assert not assignee_matches_institution_name( + "Harvard University", + "University of Duisburg-Essen", + ) + + +def test_filter_patents_by_institution_keeps_matching_assignees() -> None: + institution = _institution( + display_name="University of Duisburg-Essen", + alternatives=["Universität Duisburg-Essen"], + ) + matching = model.PatentEntry( + patent_id="EP123", + source="EPO", + assignees=["University of Duisburg-Essen"], + ) + other = model.PatentEntry( + patent_id="EP456", + source="EPO", + assignees=["Harvard University"], + ) + + result = logic._filter_patents_by_institution( + [matching, other], + institution, + ) + + assert len(result) == 1 + assert result[0].patent_id == "EP123" + + +def _institution( + display_name: str, + alternatives: list[str] | None = None, +): + from inse.models.openalex.institution import Institution + + return Institution( + id="https://openalex.org/I123", + display_name=display_name, + display_name_alternatives=alternatives, + ) diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index 69026ffa..bc1be987 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -14,6 +14,7 @@ import { Configuration } from '../configuration'; import { BaseService } from '../api.base.service'; import { PatentEntry } from '../model/patentEntry'; import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; +import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; @@ -34,6 +35,12 @@ type GetPatentsByAuthorOptions = { transferCache?: boolean; }; +type GetPatentsByInstitutionOptions = { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; +}; + @Injectable({ providedIn: 'root', }) @@ -134,6 +141,94 @@ export class PatentsService extends BaseService { ); } + public getPatentsByInstitution( + institutionId: string, + observe?: 'body', + reportProgress?: boolean, + options?: GetPatentsByInstitutionOptions, + ): Observable; + public getPatentsByInstitution( + institutionId: string, + observe?: 'response', + reportProgress?: boolean, + options?: GetPatentsByInstitutionOptions, + ): Observable>; + public getPatentsByInstitution( + institutionId: string, + observe?: 'events', + reportProgress?: boolean, + options?: GetPatentsByInstitutionOptions, + ): Observable>; + public getPatentsByInstitution( + institutionId: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: GetPatentsByInstitutionOptions, + ): Observable { + if (institutionId === null || institutionId === undefined) { + throw new Error( + 'Required parameter institutionId was null or undefined when calling getPatentsByInstitution.', + ); + } + + let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam( + { + name: 'institutionId', + value: institutionId, + in: 'path', + style: 'simple', + explode: false, + dataType: 'string', + dataFormat: undefined, + }, + )}/patents`; + + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + public getAllPatents( page: number = 0, size: number = 10, diff --git a/webapp/src/app/api/model/patentsByInstitutionResponse.ts b/webapp/src/app/api/model/patentsByInstitutionResponse.ts new file mode 100644 index 00000000..9ecec0b8 --- /dev/null +++ b/webapp/src/app/api/model/patentsByInstitutionResponse.ts @@ -0,0 +1,8 @@ +import { PatentEntry } from './patentEntry'; + +export interface PatentsByInstitutionResponse { + institution_id: string; + institution_name?: string | null; + patent_count: number; + patents: Array; +} diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 9ade0a5e..b5cf097a 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -238,6 +238,13 @@ export const routes: Routes = [ ); }, }, + { + path: 'patents', + loadComponent: () => + import( + './modules/institution-patents/institution-patents.component' + ).then((mod) => mod.InstitutionPatentsComponent), + }, ], }, { diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.html b/webapp/src/app/modules/institution-patents/institution-patents.component.html new file mode 100644 index 00000000..d7a0d223 --- /dev/null +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -0,0 +1,306 @@ +@if (loading) { +

Lade Patente...

+} @else if (error) { +

Fehler beim Laden der Patente.

+} @else if (patents.length === 0) { +

Keine Patente gefunden.

+} @else { +
+ +
+ @if (showDetail && selectedPatent) { +
+ + +

{{ selectedPatent.title ?? selectedPatent.patent_id }}

+ + @if (hasPatentMetadata(selectedPatent)) { +
+
+ @for (row of getPatentMetadataRows(selectedPatent); track row.label) { +
+
{{ row.label }}
+
+ @if (row.variant === 'source') { + + {{ row.value }} + + } @else { + {{ row.value }} + } +
+
+ } +
+
+ } + + @if (selectedPatent.abstract) { +
+

Abstract

+

{{ selectedPatent.abstract }}

+
+ } + +
+

Erfinder

+
    + @for (inventor of selectedPatent.inventors; track inventor) { +
  • {{ inventor }}
  • + } +
+
+ + @if (selectedPatent.assignees.length > 0) { +
+

Anmelder

+
    + @for (assignee of selectedPatent.assignees; track assignee) { +
  • {{ assignee }}
  • + } +
+
+ } + + @if (selectedPatent.ipc_descriptions.length > 0) { +
+

Klassifikation (IPC)

+
+ @for (card of getClassificationCards(selectedPatent.ipc_descriptions, 'IPC'); track card.key) { +
+
+
+ @for (symbol of card.symbols; track symbol) { + {{ symbol }} + } +
+
+ {{ card.system }} + {{ card.levelLabel }} +
+
+ + @if (card.primaryDescription) { +

+ {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} +

+ @if (isLongDescription(card.primaryDescription)) { + + } + } + + @if (card.hierarchy.length > 0) { +
+ @for (row of card.hierarchy; track row.label) { +
+
{{ row.label }}
+
{{ row.value }}
+
+ } +
+ } +
+ } +
+
+ } @else if (selectedPatent.ipc.length > 0) { +
+

Klassifikation (IPC)

+
    + @for (ipc of selectedPatent.ipc; track ipc) { +
  • {{ ipc }}
  • + } +
+
+ } + + @if (selectedPatent.cpc_descriptions.length > 0) { +
+

Klassifikation (CPC)

+
+ @for (card of getClassificationCards(selectedPatent.cpc_descriptions, 'CPC'); track card.key) { +
+
+
+ @for (symbol of card.symbols; track symbol) { + {{ symbol }} + } +
+
+ {{ card.system }} + {{ card.levelLabel }} +
+
+ + @if (card.primaryDescription) { +

+ {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} +

+ @if (isLongDescription(card.primaryDescription)) { + + } + } + + @if (card.hierarchy.length > 0) { +
+ @for (row of card.hierarchy; track row.label) { +
+
{{ row.label }}
+
{{ row.value }}
+
+ } +
+ } +
+ } +
+
+ } @else if (selectedPatent.cpc.length > 0) { +
+

Klassifikation (CPC)

+
    + @for (cpc of selectedPatent.cpc; track cpc) { +
  • {{ cpc }}
  • + } +
+
+ } + +
+ } + +
+
+ + +
+ + + + + + + + + + + @for (patent of getPagedPatents(); track trackPatent($index, patent)) { + + + + + + } + +
PatentQuelleJahr
{{ patent.title ?? patent.patent_id }} + + {{ patent.source }} + + {{ patent.publication_year ?? '-' }}
+ + @if (hasPagination()) { + + } +
+ + @if (selectedPatent && !showDetail) { +
+

{{ selectedPatent.title ?? selectedPatent.patent_id }}

+
+
+ Quelle + + + {{ selectedPatent.source }} + + +
+
+ Patent-Nr. + {{ selectedPatent.patent_id }} +
+
+ Datum + {{ formatDate(selectedPatent.publication_date) }} +
+ @if (getPublicationStageLabel(selectedPatent); as stageLabel) { +
+ Publikationsstufe + {{ stageLabel }} +
+ } +
+ + @if (getAbstractPreview(selectedPatent.abstract); as abstractPreview) { +

{{ abstractPreview }}

+ } + + +

+ Abstract, Erfinder, Anmelder und IPC/CPC-Klassifikation +

+
+ } @else { +
+

Patentübersicht

+

+ @if (institutionName) { + Alle Patente von {{ institutionName }} im Überblick. + } @else { + Alle Patente dieser Institution im Überblick. + } +

+
+
+ {{ patents.length }} + Patente +
+
+ {{ getEpoCount() }} + EPO +
+
+ {{ getUsptoCount() }} + USPTO +
+
+

Wähle links ein Patent aus, um Kurzinfos und Details zu sehen.

+
+ } +
+
+} diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.scss b/webapp/src/app/modules/institution-patents/institution-patents.component.scss new file mode 100644 index 00000000..ff549276 --- /dev/null +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.scss @@ -0,0 +1,564 @@ +.message { + padding: 16px; + color: #666; +} + +.patents-container { + padding: 16px; + display: flex; + flex-direction: column; + gap: 16px; +} + +.sort-control { + display: inline-flex; + align-items: center; + gap: 6px; + width: fit-content; + padding: 10px 14px; + border-radius: 20px; + background: #f2f2f2; + color: #333; + font-size: 14px; + + span { + color: #555; + } + + select { + border: 0; + background: transparent; + color: #111827; + font: inherit; + cursor: pointer; + outline: none; + } +} + +.patents-content { + display: flex; + gap: 24px; + align-items: flex-start; +} + +.patents-list { + flex: 1; + + &.hidden { + display: none; + } + + .patents-list-toolbar { + display: flex; + align-items: center; + justify-content: space-between; + gap: 16px; + margin-bottom: 18px; + flex-wrap: wrap; + } + + table { + width: 100%; + border-collapse: collapse; + + th { + text-align: left; + padding: 10px 12px; + border-bottom: 2px solid #e0e0e0; + font-weight: 600; + color: #333; + } + + tr { + cursor: pointer; + + &:hover { + background: #f5f5f5; + } + + &.selected { + background: #f0f0f0; + } + } + + td { + padding: 10px 12px; + border-bottom: 1px solid #f0f0f0; + } + + .patent-title { + color: #333; + font-weight: 500; + max-width: 400px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + } +} + +.source-badge { + display: inline-flex; + align-items: center; + padding: 3px 10px; + border-radius: 999px; + font-size: 0.75rem; + font-weight: 700; + + &--epo { + background: #effaf3; + color: #24834f; + border: 1px solid #bdebcf; + } + + &--uspto { + background: #f0f6ff; + color: #0b63ce; + border: 1px solid #bdd4ff; + } +} + +.patent-detail { + width: 440px; + border: 1px solid #e0e0e0; + border-radius: 8px; + padding: 20px; + background: #fafafa; + + &.empty { + display: flex; + align-items: center; + justify-content: center; + color: #999; + min-height: 200px; + } + + &.overview { + display: flex; + flex-direction: column; + gap: 12px; + + .overview-title { + font-size: 15px; + font-weight: 600; + color: #333; + margin: 0; + } + + .overview-subtitle { + font-size: 13px; + color: #888; + margin: 0; + } + + .overview-stats { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: 10px; + margin-top: 4px; + } + + .overview-stat { + background: white; + border: 1px solid #e0e0e0; + border-radius: 8px; + padding: 12px 8px; + text-align: center; + + .overview-value { + display: block; + font-size: 22px; + font-weight: 700; + color: #333; + } + + .overview-label { + display: block; + font-size: 12px; + color: #888; + margin-top: 4px; + } + } + + .overview-hint { + font-size: 12px; + color: #aaa; + margin: 0; + } + } + + h3 { + margin: 0 0 16px 0; + font-size: 16px; + color: #333; + line-height: 1.4; + } +} + +.detail-stats { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px; + + .stat { + background: white; + border: 1px solid #e0e0e0; + border-radius: 8px; + padding: 10px; + text-align: center; + + .stat-label { + display: block; + font-size: 11px; + color: #666; + margin-bottom: 4px; + text-transform: uppercase; + letter-spacing: 0.03em; + } + + .stat-value { + display: block; + font-size: 15px; + font-weight: bold; + color: #333; + } + } +} + +.patent-detail-preview { + margin: 14px 0 0; + font-size: 13px; + line-height: 1.55; + color: #555; +} + +.patent-detail-action { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + width: 100%; + margin-top: 16px; + padding: 12px 14px; + border: 1px solid #bdd4ff; + border-radius: 10px; + background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%); + color: #0b63ce; + font-size: 14px; + font-weight: 600; + cursor: pointer; + transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; + + &:hover { + border-color: #0b63ce; + background: #f0f6ff; + box-shadow: 0 2px 8px rgba(11, 99, 206, 0.12); + } + + .material-icons { + font-size: 20px; + } +} + +.patent-detail-hint { + margin: 8px 0 0; + font-size: 12px; + line-height: 1.4; + color: #888; + text-align: center; +} + +.patent-full-detail { + flex: 1; + border: 1px solid #e0e0e0; + border-radius: 8px; + padding: 20px; + background: #fafafa; + + h3 { + margin: 0 0 4px 0; + font-size: 16px; + color: #333; + line-height: 1.4; + } + + h4 { + margin: 16px 0 8px 0; + font-size: 14px; + color: #555; + font-weight: 600; + } + + p { + font-size: 13px; + color: #444; + line-height: 1.6; + margin: 0; + } +} + +.back-btn { + display: inline-flex; + align-items: center; + gap: 0.4rem; + + width: auto; + margin-bottom: 1rem; + padding: 0.5rem 0.85rem; + + border: 1px solid #d6e3f8; + border-radius: 999px; + + background: #f8fbff; + color: #2563eb; + + font-size: 0.9rem; + font-weight: 600; + + cursor: pointer; + transition: + background-color 0.15s ease, + border-color 0.15s ease, + color 0.15s ease, + box-shadow 0.15s ease; + + &:hover { + background: #eef5ff; + border-color: #bcd3f7; + color: #1d4ed8; + box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12); + } + + &:focus-visible { + outline: 2px solid #93c5fd; + outline-offset: 2px; + } +} + +.detail-section { + margin-top: 12px; + padding-top: 12px; + border-top: 1px solid #eee; +} + +.patent-meta { + &--inline { + margin: 12px 0 20px; + } + + &__list { + margin: 0; + border: 1px solid #e2e8f4; + border-radius: 12px; + background: linear-gradient(180deg, #fff 0%, #f8faff 100%); + box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); + overflow: hidden; + } + + &__row { + display: grid; + grid-template-columns: minmax(130px, 38%) 1fr; + gap: 12px 16px; + align-items: center; + padding: 11px 16px; + border-top: 1px solid #eef2f8; + + &:first-child { + border-top: 0; + } + + dt { + margin: 0; + font-size: 12px; + font-weight: 500; + color: #64748b; + line-height: 1.35; + } + + dd { + margin: 0; + font-size: 14px; + font-weight: 600; + color: #1e293b; + line-height: 1.35; + word-break: break-word; + } + } +} + +.tag-list { + display: flex; + flex-wrap: wrap; + gap: 6px; + margin: 0; + padding: 0; + list-style: none; + + &--compact .tag { + font-size: 0.75rem; + padding: 3px 8px; + } +} + +.tag { + padding: 4px 10px; + border-radius: 999px; + background: #f0f6ff; + border: 1px solid #dbeafe; + color: #1e40af; + font-size: 0.8rem; + line-height: 1.3; +} + +.classification-section { + &--ipc .classification-card { + background: #f0f6ff; + border-color: #bfdbfe; + } + + &--ipc .classification-badge--system { + background: #dbeafe; + color: #1d4ed8; + } + + &--cpc .classification-card { + background: #f0fdf4; + border-color: #bbf7d0; + } + + &--cpc .classification-badge--system { + background: #dcfce7; + color: #15803d; + } +} + +.classification-cards { + display: flex; + flex-direction: column; + gap: 10px; +} + +.classification-card { + padding: 12px 14px; + border-radius: 10px; + border: 1px solid #dbeafe; +} + +.classification-card__header { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; + flex-wrap: wrap; +} + +.classification-card__codes { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +.classification-card__badges { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +.classification-code { + font-size: 0.9rem; + font-weight: 700; + color: #0f172a; +} + +.classification-badge { + display: inline-flex; + align-items: center; + padding: 2px 8px; + border-radius: 999px; + font-size: 0.68rem; + font-weight: 700; + letter-spacing: 0.02em; + text-transform: uppercase; +} + +.classification-badge--level { + background: #e2e8f0; + color: #475569; +} + +.classification-summary { + margin: 10px 0 0; + font-size: 0.84rem; + line-height: 1.5; + color: #334155; +} + +.classification-toggle { + margin-top: 6px; + padding: 0; + border: 0; + background: none; + color: #2563eb; + font-size: 0.78rem; + cursor: pointer; + + &:hover { + text-decoration: underline; + } +} + +.classification-hierarchy { + margin: 10px 0 0; + padding-top: 10px; + border-top: 1px solid rgba(15, 23, 42, 0.08); +} + +.classification-hierarchy__row { + display: grid; + grid-template-columns: 88px 1fr; + gap: 8px; + margin-bottom: 6px; + + dt { + margin: 0; + font-size: 0.72rem; + font-weight: 700; + color: #64748b; + text-transform: uppercase; + letter-spacing: 0.03em; + } + + dd { + margin: 0; + font-size: 0.8rem; + line-height: 1.45; + color: #334155; + } +} + +.pagination { + display: flex; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-top: 12px; + + button { + padding: 4px 10px; + border: 1px solid #d0d0d0; + border-radius: 6px; + background: white; + cursor: pointer; + font-size: 12px; + + &:disabled { + opacity: 0.5; + cursor: default; + } + } + + span { + font-size: 12px; + color: #666; + } +} diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.ts b/webapp/src/app/modules/institution-patents/institution-patents.component.ts new file mode 100644 index 00000000..68e813d0 --- /dev/null +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -0,0 +1,408 @@ +import { Component, OnInit, inject } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ActivatedRoute, Router } from '@angular/router'; +import { PatentsService } from '../../api/api/patents.service'; +import { PatentEntry, IpcClassification } from '../../api/model/patentEntry'; + +type SortMode = 'date' | 'title'; +type SourceFilter = 'all' | 'EPO' | 'USPTO'; +type ClassificationSystem = 'IPC' | 'CPC'; + +interface ClassificationCard { + key: string; + symbols: string[]; + system: ClassificationSystem; + levelLabel: string; + primaryDescription: string | null; + hierarchy: { label: string; value: string }[]; +} + +interface PatentMetadataRow { + label: string; + value: string; + variant?: 'source'; +} + +const DESCRIPTION_PREVIEW_LENGTH = 140; + +@Component({ + selector: 'app-institution-patents', + imports: [CommonModule], + templateUrl: './institution-patents.component.html', + styleUrl: './institution-patents.component.scss', +}) +export class InstitutionPatentsComponent implements OnInit { + private route = inject(ActivatedRoute); + private router = inject(Router); + private patentsApi = inject(PatentsService); + + patents: PatentEntry[] = []; + filteredPatents: PatentEntry[] = []; + institutionName: string | null = null; + selectedPatent: PatentEntry | null = null; + showDetail = false; + + loading = true; + error = false; + + activeFilter: SourceFilter = 'all'; + sortMode: SortMode = 'date'; + + selectedPage = 1; + readonly pageSize = 10; + private expandedClassificationKeys = new Set(); + + ngOnInit(): void { + this.route.parent?.paramMap.subscribe((params) => { + const institutionId = params.get('institutionId') ?? ''; + + const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); + const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy'); + + if (this.isValidFilter(filterFromUrl)) { + this.activeFilter = filterFromUrl; + } + if (this.isValidSortMode(sortFromUrl)) { + this.sortMode = sortFromUrl; + } + + if (institutionId) { + this.loading = true; + this.error = false; + this.patentsApi.getPatentsByInstitution(institutionId, 'body').subscribe({ + next: (result) => { + this.patents = result.patents ?? []; + this.institutionName = result.institution_name ?? null; + this.applyFilter(); + this.loading = false; + }, + error: () => { + this.error = true; + this.loading = false; + }, + }); + } + }); + } + + setFilter(filter: SourceFilter): void { + this.activeFilter = filter; + this.selectedPage = 1; + this.selectedPatent = null; + this.showDetail = false; + this.applyFilter(); + this.updateQueryParams(); + } + + setSortMode(sortMode: SortMode): void { + this.sortMode = sortMode; + this.applyFilter(); + this.updateQueryParams(); + } + + selectPatent(patent: PatentEntry): void { + this.selectedPatent = patent; + this.showDetail = false; + this.expandedClassificationKeys.clear(); + this.updateQueryParams(); + } + + openDetail(): void { + this.showDetail = true; + this.expandedClassificationKeys.clear(); + } + + closeDetail(): void { + this.showDetail = false; + this.expandedClassificationKeys.clear(); + } + + private applyFilter(): void { + let patents = this.patents; + + if (this.activeFilter !== 'all') { + patents = patents.filter((p) => p.source === this.activeFilter); + } + + this.filteredPatents = this.sortPatents(patents); + } + + private sortPatents(patents: PatentEntry[]): PatentEntry[] { + return [...patents].sort((a, b) => { + if (this.sortMode === 'date') { + return (b.publication_date ?? '').localeCompare(a.publication_date ?? ''); + } + return (a.title ?? '').localeCompare(b.title ?? '', 'de', { sensitivity: 'base' }); + }); + } + + private updateQueryParams(): void { + this.router.navigate([], { + relativeTo: this.route, + queryParams: { + filter: this.activeFilter, + sortBy: this.sortMode, + }, + queryParamsHandling: 'merge', + replaceUrl: true, + }); + } + + private isValidFilter(value: string | null): value is SourceFilter { + return value === 'all' || value === 'EPO' || value === 'USPTO'; + } + + private isValidSortMode(value: string | null): value is SortMode { + return value === 'date' || value === 'title'; + } + + getPagedPatents(): PatentEntry[] { + const start = (this.selectedPage - 1) * this.pageSize; + return this.filteredPatents.slice(start, start + this.pageSize); + } + + getPageCount(): number { + return Math.max(1, Math.ceil(this.filteredPatents.length / this.pageSize)); + } + + hasPagination(): boolean { + return this.getPageCount() > 1; + } + + setPage(page: number): void { + this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount()); + this.updateQueryParams(); + } + + formatDate(date: string | null): string { + if (!date) return '-'; + const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); + return new Intl.DateTimeFormat('de-DE').format(new Date(d)); + } + + getEpoCount(): number { + return this.patents.filter((p) => p.source === 'EPO').length; + } + + getUsptoCount(): number { + return this.patents.filter((p) => p.source === 'USPTO').length; + } + + trackPatent(_index: number, patent: PatentEntry): string { + return [ + patent.source, + patent.patent_id, + patent.publication_date ?? '', + patent.kind ?? patent.application_type ?? '', + ].join('|'); + } + + getAbstractPreview(abstract: string | null | undefined): string | null { + if (!abstract?.trim()) { + return null; + } + const text = abstract.trim(); + if (text.length <= 160) { + return text; + } + return `${text.slice(0, 160).trimEnd()}…`; + } + + getPublicationStageLabel(patent: PatentEntry): string | null { + if (patent.kind) { + return patent.kind; + } + if (patent.application_type) { + return patent.application_type; + } + return null; + } + + hasPatentMetadata(_patent: PatentEntry): boolean { + return true; + } + + getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] { + const rows: PatentMetadataRow[] = []; + + rows.push({ label: 'Quelle', value: patent.source, variant: 'source' }); + rows.push({ label: 'Patent-Nr.', value: patent.patent_id }); + + if (patent.publication_date) { + rows.push({ + label: 'Veröffentlichungsdatum', + value: this.formatDate(patent.publication_date), + }); + } + if (patent.application_number) { + rows.push({ label: 'Anmeldungsnummer', value: patent.application_number }); + } + if (patent.application_date) { + rows.push({ label: 'Anmeldedatum', value: this.formatDate(patent.application_date) }); + } + + const stageLabel = this.getPublicationStageLabel(patent); + if (stageLabel) { + rows.push({ + label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp', + value: patent.kind ? stageLabel : this.formatMetadataLabel(stageLabel), + }); + } + if (patent.number_of_claims != null) { + rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) }); + } + if (patent.status) { + rows.push({ label: 'Status', value: this.formatMetadataLabel(patent.status) }); + } + + return rows; + } + + private formatMetadataLabel(value: string): string { + return value + .replace(/_/g, ' ') + .toLowerCase() + .replace(/\b\w/g, (char) => char.toUpperCase()); + } + + getClassificationCards( + entries: IpcClassification[] | undefined, + system: ClassificationSystem, + ): ClassificationCard[] { + if (!entries?.length) { + return []; + } + + const merged = new Map(); + + for (const entry of entries) { + const card = this.buildClassificationCard(entry, system); + const mergeKey = + card.primaryDescription?.toLocaleLowerCase('en') ?? card.symbols[0] ?? card.key; + + const existing = merged.get(mergeKey); + if (existing) { + for (const symbol of card.symbols) { + if (!existing.symbols.includes(symbol)) { + existing.symbols.push(symbol); + } + } + continue; + } + + merged.set(mergeKey, card); + } + + return [...merged.values()]; + } + + toggleClassificationExpanded(key: string): void { + if (this.expandedClassificationKeys.has(key)) { + this.expandedClassificationKeys.delete(key); + return; + } + this.expandedClassificationKeys.add(key); + } + + isClassificationExpanded(key: string): boolean { + return this.expandedClassificationKeys.has(key); + } + + isLongDescription(text: string | null): boolean { + return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH; + } + + getDescriptionPreview(text: string | null): string { + if (!text) { + return ''; + } + if (text.length <= DESCRIPTION_PREVIEW_LENGTH) { + return text; + } + return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`; + } + + private buildClassificationCard( + entry: IpcClassification, + system: ClassificationSystem, + ): ClassificationCard { + const level = this.getClassificationLevel(entry); + const primaryDescription = this.extractDescriptionText(entry[level.field]); + + return { + key: `${system}-${entry.symbol}`, + symbols: [entry.symbol], + system, + levelLabel: level.label, + primaryDescription, + hierarchy: this.buildHierarchyRows(entry, primaryDescription), + }; + } + + private getClassificationLevel(entry: IpcClassification): { + label: string; + field: keyof IpcClassification; + } { + if (entry.subgroup) { + return { label: 'Untergruppe', field: 'subgroup' }; + } + if (entry.main_group) { + return { label: 'Hauptgruppe', field: 'main_group' }; + } + if (entry.subclass) { + return { label: 'Unterklasse', field: 'subclass' }; + } + if (entry.section) { + return { label: 'Sektion', field: 'section' }; + } + return { label: 'Code', field: 'symbol' }; + } + + private buildHierarchyRows( + entry: IpcClassification, + primaryDescription: string | null, + ): { label: string; value: string }[] { + const rows: { label: string; value: string }[] = []; + const seen = new Set(); + + const addRow = (label: string, raw: string | null) => { + const value = this.extractDescriptionText(raw); + if (!value) { + return; + } + const normalized = value.toLocaleLowerCase('en'); + if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) { + return; + } + seen.add(normalized); + rows.push({ label, value }); + }; + + addRow('Sektion', entry.section); + addRow('Klasse', entry.class); + addRow('Unterklasse', entry.subclass); + + return rows; + } + + private extractDescriptionText(value: string | null | undefined): string | null { + if (!value?.trim()) { + return null; + } + + const text = value.includes(' - ') ? value.split(' - ').slice(1).join(' - ').trim() : value.trim(); + if (!text) { + return null; + } + + const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text; + return this.normalizeDescriptionCase(firstSentence); + } + + private normalizeDescriptionCase(text: string): string { + if (text !== text.toUpperCase()) { + return text; + } + return text.charAt(0) + text.slice(1).toLowerCase(); + } +} diff --git a/webapp/src/app/modules/institution/institution.component.ts b/webapp/src/app/modules/institution/institution.component.ts index 03ffd347..61d0d938 100644 --- a/webapp/src/app/modules/institution/institution.component.ts +++ b/webapp/src/app/modules/institution/institution.component.ts @@ -40,6 +40,7 @@ export class InstitutionComponent implements OnInit { sort_direction: 'asc', }, }, + { label: 'Patente', path: 'patents', disabled: false }, ]; constructor(private readonly activatedRoute: ActivatedRoute) {} diff --git a/webapp/src/app/modules/institutions/institutions.component.html b/webapp/src/app/modules/institutions/institutions.component.html index ce12b7ed..0ec24397 100644 --- a/webapp/src/app/modules/institutions/institutions.component.html +++ b/webapp/src/app/modules/institutions/institutions.component.html @@ -78,6 +78,13 @@ work Projekte + + verified + Patente + -- 2.56.1 From 163fdfaa399a0a19d46cafabe2142d595096290d Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Fri, 26 Jun 2026 12:17:50 +0200 Subject: [PATCH 02/43] refactor(patents): decouple author and institution patent lookup into separate modules --- service/src/main/inse/institutions/router.py | 20 - service/src/main/inse/main.py | 9 +- service/src/main/inse/patents/all/__init__.py | 1 + service/src/main/inse/patents/all/logic.py | 83 ++++ service/src/main/inse/patents/all/service.py | 30 ++ .../src/main/inse/patents/authors/__init__.py | 1 + .../src/main/inse/patents/authors/logic.py | 122 +++++ .../inse/patents/authors/name_matching.py | 128 +++++ .../inse/patents/authors/search_queries.py | 130 ++++++ .../src/main/inse/patents/authors/service.py | 16 + .../src/main/inse/patents/common/__init__.py | 1 + .../patents/common/elastic_search_client.py | 56 +++ service/src/main/inse/patents/common/model.py | 55 +++ .../src/main/inse/patents/common/parsing.py | 138 ++++++ .../inse/patents/common/text_normalization.py | 79 ++++ .../inse/patents/elastic_search_client.py | 277 +---------- .../inse/patents/institutions/__init__.py | 1 + .../main/inse/patents/institutions/logic.py | 144 ++++++ .../patents/institutions/name_matching.py | 91 ++++ .../patents/institutions/search_queries.py | 94 ++++ .../main/inse/patents/institutions/service.py | 33 ++ service/src/main/inse/patents/logic.py | 439 +----------------- service/src/main/inse/patents/model.py | 57 +-- .../src/main/inse/patents/name_matching.py | 342 +------------- .../src/main/inse/patents/search_client.py | 27 ++ service/src/main/inse/patents/service.py | 47 +- .../inse/patents/test_institution_matching.py | 7 +- service/src/main/inse/patents/test_logic.py | 18 +- 28 files changed, 1291 insertions(+), 1155 deletions(-) create mode 100644 service/src/main/inse/patents/all/__init__.py create mode 100644 service/src/main/inse/patents/all/logic.py create mode 100644 service/src/main/inse/patents/all/service.py create mode 100644 service/src/main/inse/patents/authors/__init__.py create mode 100644 service/src/main/inse/patents/authors/logic.py create mode 100644 service/src/main/inse/patents/authors/name_matching.py create mode 100644 service/src/main/inse/patents/authors/search_queries.py create mode 100644 service/src/main/inse/patents/authors/service.py create mode 100644 service/src/main/inse/patents/common/__init__.py create mode 100644 service/src/main/inse/patents/common/elastic_search_client.py create mode 100644 service/src/main/inse/patents/common/model.py create mode 100644 service/src/main/inse/patents/common/parsing.py create mode 100644 service/src/main/inse/patents/common/text_normalization.py create mode 100644 service/src/main/inse/patents/institutions/__init__.py create mode 100644 service/src/main/inse/patents/institutions/logic.py create mode 100644 service/src/main/inse/patents/institutions/name_matching.py create mode 100644 service/src/main/inse/patents/institutions/search_queries.py create mode 100644 service/src/main/inse/patents/institutions/service.py create mode 100644 service/src/main/inse/patents/search_client.py diff --git a/service/src/main/inse/institutions/router.py b/service/src/main/inse/institutions/router.py index 658ed71e..423281c0 100644 --- a/service/src/main/inse/institutions/router.py +++ b/service/src/main/inse/institutions/router.py @@ -16,8 +16,6 @@ from inse.models.openalex.institution import Institution from inse.institutions.model import InstitutionPage from . import logic from inse.institutions.institutions_search_client import InstitutionsSearchClient -from inse.patents import logic as patents_logic -from inse.patents.model import PatentsByInstitutionResponse router = APIRouter(prefix="/api/inse-service/institutions", tags=[Tags.INSTITUTIONS]) @@ -122,24 +120,6 @@ async def autocomplete_institutions( client=client, ) -@router.get( - "/{id}/patents", - operation_id="getPatentsByInstitution", - response_model=PatentsByInstitutionResponse, - summary="Get patents matched to an institution by assignee name.", -) -async def get_patents_by_institution( - id: str, - client: Annotated[ - InstitutionsSearchClient, Depends(get_institutions_search_client) - ], -) -> PatentsByInstitutionResponse: - return await patents_logic.get_patents_by_institution_id( - institution_id=id, - institutions_client=client, - ) - - @router.get( "/{id}", summary="Returns a single institution by ID.", diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index e82349d9..ca69d84c 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -28,13 +28,15 @@ from inse.persons.service import router as persons_service_router from inse.funders.service import router as funders_service_router from inse.news.service import router as news_service_router from inse.projects.router import router as projects_router -from inse.patents.service import router as patents_service_router - from inse.institutions.router import router as institutions_router from . import config from .account.service import router as account_router from .service import router as service_router -from inse.patents.service import router as patents_service_router, patents_router as patents_all_router +from inse.patents.service import ( + institution_patents_router, + patents_router as patents_all_router, + router as patents_service_router, +) logger = logging.getLogger(__name__) @@ -50,6 +52,7 @@ app = FastAPI( servers=settings.servers, ) app.include_router(collaboration_network_router) +app.include_router(institution_patents_router) app.include_router(institutions_router) app.include_router(topics_service_router) app.include_router(works_service_router) diff --git a/service/src/main/inse/patents/all/__init__.py b/service/src/main/inse/patents/all/__init__.py new file mode 100644 index 00000000..9f21635b --- /dev/null +++ b/service/src/main/inse/patents/all/__init__.py @@ -0,0 +1 @@ +"""Global patent listing.""" diff --git a/service/src/main/inse/patents/all/logic.py b/service/src/main/inse/patents/all/logic.py new file mode 100644 index 00000000..88288c91 --- /dev/null +++ b/service/src/main/inse/patents/all/logic.py @@ -0,0 +1,83 @@ +"""Business logic for global patent listing.""" +import asyncio + +import httpx +from fastapi import HTTPException +from starlette.status import HTTP_502_BAD_GATEWAY +from starlette.status import HTTP_503_SERVICE_UNAVAILABLE + +from inse.patents.common import model +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.common.parsing import ( + enrich_patents_classifications, + parse_epo_hits, + parse_uspto_hits, +) +from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClient +from inse.patents.ipc_search_client import IpcSearchClient +from inse.patents.search_client import PatentSearchClient + + +async def get_all_patents( + page: int = 0, + size: int = 10, + search: str | None = None, + source: str | None = None, + sort_by: str = "date", + sort_direction: str = "desc", + client: PatentSearchClient | None = None, + ipc_client: IpcSearchClient | None = None, +) -> model.AllPatentsResponse: + all_patents_client = AllPatentsSearchClient() + ipc_search_client = ipc_client or IpcSearchClient() + + try: + if source == "EPO": + epo_data = await all_patents_client.search_epo( + all_patents_client.epo_query(page, size, search, sort_direction) + ) + patents = parse_epo_hits(epo_data) + total = epo_data.get("hits", {}).get("total", {}).get("value", 0) + + elif source == "USPTO": + uspto_data = await all_patents_client.search_uspto( + all_patents_client.uspto_query(page, size, search, sort_direction) + ) + patents = parse_uspto_hits(uspto_data) + total = uspto_data.get("hits", {}).get("total", {}).get("value", 0) + + else: + half = size // 2 + epo_data, uspto_data = await asyncio.gather( + all_patents_client.search_epo( + all_patents_client.epo_query(page, half, search, sort_direction) + ), + all_patents_client.search_uspto( + all_patents_client.uspto_query(page, half, search, sort_direction) + ), + ) + patents = parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) + total = ( + epo_data.get("hits", {}).get("total", {}).get("value", 0) + + uspto_data.get("hits", {}).get("total", {}).get("value", 0) + ) + + except MissingApiKeyError as exc: + raise HTTPException( + status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="Patent search is not configured.", + ) from exc + except httpx.HTTPError as exc: + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="Patent search request failed.", + ) from exc + + await enrich_patents_classifications(patents, ipc_search_client) + + return model.AllPatentsResponse( + total=total, + page=page, + size=size, + patents=patents, + ) diff --git a/service/src/main/inse/patents/all/service.py b/service/src/main/inse/patents/all/service.py new file mode 100644 index 00000000..394ab362 --- /dev/null +++ b/service/src/main/inse/patents/all/service.py @@ -0,0 +1,30 @@ +from fastapi import APIRouter + +from inse.patents.all import logic +from inse.patents.common import model + +router = APIRouter(prefix="/api/inse-service", tags=["Patents"]) + + +@router.get( + "/patents", + operation_id="getAllPatents", + response_model=model.AllPatentsResponse, + summary="Get all patents with pagination and search.", +) +async def get_all_patents( + page: int = 0, + size: int = 10, + search: str | None = None, + source: str | None = None, + sort_by: str = "date", + sort_direction: str = "desc", +): + return await logic.get_all_patents( + page=page, + size=size, + search=search, + source=source, + sort_by=sort_by, + sort_direction=sort_direction, + ) diff --git a/service/src/main/inse/patents/authors/__init__.py b/service/src/main/inse/patents/authors/__init__.py new file mode 100644 index 00000000..9fd61ab7 --- /dev/null +++ b/service/src/main/inse/patents/authors/__init__.py @@ -0,0 +1 @@ +"""Patent lookup by inventor.""" diff --git a/service/src/main/inse/patents/authors/logic.py b/service/src/main/inse/patents/authors/logic.py new file mode 100644 index 00000000..0dc34be1 --- /dev/null +++ b/service/src/main/inse/patents/authors/logic.py @@ -0,0 +1,122 @@ +"""Business logic for patent lookup by inventor.""" +import asyncio +import logging + +import httpx +from fastapi import HTTPException +from starlette.status import HTTP_502_BAD_GATEWAY +from starlette.status import HTTP_503_SERVICE_UNAVAILABLE + +from inse.patents.authors.name_matching import name_matches +from inse.patents.common import model +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.common.parsing import ( + deduplicate_patents, + enrich_patents_classifications, + parse_epo_hits, + parse_uspto_hits, +) +from inse.patents.ipc_search_client import IpcSearchClient +from inse.patents.search_client import PatentSearchClient +from inse.persons import logic as person_logic +from inse.models.openalex.author import Author + +logger = logging.getLogger(__name__) + + +async def get_patents_by_author_id( + author_id: str, + client: PatentSearchClient | None = None, + ipc_client: IpcSearchClient | None = None, +) -> model.PatentsByAuthorResponse: + search_client = client or PatentSearchClient() + ipc_search_client = ipc_client or IpcSearchClient() + + author = _get_author(author_id) + if not author: + return model.PatentsByAuthorResponse( + author_id=author_id, + author_name=None, + patent_count=0, + patents=[], + ) + + author_name = author.display_name + last_name = _extract_last_name(author_name) + first_name = _extract_first_name(author_name) + + if not last_name: + return model.PatentsByAuthorResponse( + author_id=author_id, + author_name=author_name, + patent_count=0, + patents=[], + ) + + try: + epo_data, uspto_data = await _search_both_indices( + search_client, last_name, first_name + ) + except MissingApiKeyError as exc: + raise HTTPException( + status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="Patent search is not configured.", + ) from exc + except httpx.HTTPError as exc: + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="Patent search request failed.", + ) from exc + + all_patents = parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) + + if first_name and last_name: + all_patents = _filter_patents_by_name(all_patents, first_name, last_name) + + all_patents = deduplicate_patents(all_patents) + await enrich_patents_classifications(all_patents, ipc_search_client) + + return model.PatentsByAuthorResponse( + author_id=author_id, + author_name=author_name, + patent_count=len(all_patents), + patents=all_patents, + ) + + +async def _search_both_indices(client, last_name, first_name): + return await asyncio.gather( + client.search_epo(client.epo_query_by_inventor(last_name, first_name)), + client.search_uspto(client.uspto_query_by_inventor(last_name, first_name)), + ) + + +def _filter_patents_by_name( + patents: list[model.PatentEntry], + first_name: str, + last_name: str, +) -> list[model.PatentEntry]: + return [ + patent for patent in patents + if any(name_matches(inventor, first_name, last_name) for inventor in patent.inventors) + ] + + +def _get_author(author_id: str) -> Author | None: + short_id = author_id.replace("https://openalex.org/", "") + result = person_logic.search_persons(author_id=short_id) + return result.results[0] if result.results else None + + +def _extract_last_name(name: str | None) -> str | None: + if not name: + return None + parts = name.strip().split() + return parts[-1] if parts else None + + +def _extract_first_name(name: str | None) -> str | None: + if not name: + return None + parts = name.strip().split() + return parts[0] if len(parts) > 1 else None diff --git a/service/src/main/inse/patents/authors/name_matching.py b/service/src/main/inse/patents/authors/name_matching.py new file mode 100644 index 00000000..369c44ab --- /dev/null +++ b/service/src/main/inse/patents/authors/name_matching.py @@ -0,0 +1,128 @@ +"""Inventor name normalization and matching.""" +import re + +from inse.patents.common.text_normalization import ( + name_token_variants, + normalize_name_part, + patent_transliteration_expansions, +) + + +def tokens_equal( + left: str | None, + right: str | None, + *, + allow_initial: bool = True, +) -> bool: + left_variants = name_token_variants(left) + right_variants = name_token_variants(right) + if not left_variants or not right_variants: + return False + if left_variants & right_variants: + return True + + if not allow_initial: + return False + + return _initial_tokens_match(left, right) + + +def _initial_letter(token: str | None) -> str | None: + normalized = normalize_name_part(token) + if len(normalized) == 1 and normalized.isalpha(): + return normalized + return None + + +def _initial_tokens_match(left: str | None, right: str | None) -> bool: + left_initial = _initial_letter(left) + right_initial = _initial_letter(right) + left_full = normalize_name_part(left) + right_full = normalize_name_part(right) + + if left_initial and right_full and len(right_full) > 1: + return right_full.startswith(left_initial) + if right_initial and left_full and len(left_full) > 1: + return left_full.startswith(right_initial) + if left_initial and right_initial: + return left_initial == right_initial + return False + + +def _inventor_first_token(inventor_name: str) -> str: + if "," in inventor_name: + _, first_part = [p.strip() for p in inventor_name.split(",", 1)] + return first_part.split()[0] if first_part else "" + parts = inventor_name.split() + return parts[0] if parts else "" + + +def first_name_match_kind( + inventor_name: str, + first_name: str, + last_name: str, +) -> str: + if not name_matches(inventor_name, first_name, last_name): + return "none" + + inventor_first = _inventor_first_token(inventor_name) + if tokens_equal(inventor_first, first_name, allow_initial=False): + return "full" + return "initial" + + +def search_name_variants(value: str | None) -> list[str]: + if not value or not value.strip(): + return [] + + seen: set[str] = set() + ordered: list[str] = [] + + def _add(candidate: str) -> None: + key = candidate.casefold() + if candidate.strip() and key not in seen: + seen.add(key) + ordered.append(candidate.strip()) + + _add(value.strip()) + + normalized = normalize_name_part(value) + if normalized: + _add(normalized.title()) + + for variant in name_token_variants(value): + _add(variant.title()) + + for variant in patent_transliteration_expansions(normalized): + _add(variant.title()) + + if normalized and len(normalized) > 1: + _add(normalized[0].upper()) + + return ordered + + +def name_matches(inventor_name: str, first_name: str, last_name: str) -> bool: + if not inventor_name or not last_name: + return False + + name = inventor_name.strip() + + if "," in name: + last_part, first_part = [p.strip() for p in name.split(",", 1)] + first_token = first_part.split()[0] if first_part else "" + return ( + tokens_equal(last_part, last_name, allow_initial=False) + and bool(first_name) + and tokens_equal(first_token, first_name) + ) + + parts = name.split() + if len(parts) < 2: + return False + + return ( + tokens_equal(parts[-1], last_name, allow_initial=False) + and bool(first_name) + and tokens_equal(parts[0], first_name) + ) diff --git a/service/src/main/inse/patents/authors/search_queries.py b/service/src/main/inse/patents/authors/search_queries.py new file mode 100644 index 00000000..2149fa98 --- /dev/null +++ b/service/src/main/inse/patents/authors/search_queries.py @@ -0,0 +1,130 @@ +"""Elasticsearch query builders for inventor-based patent search.""" +from typing import Any + +from inse.patents.authors.name_matching import search_name_variants +from inse.patents.common.elastic_search_client import DEFAULT_SEARCH_SIZE + + +def _match_name_field(field: str, name: str) -> dict[str, Any]: + variants = search_name_variants(name) + if len(variants) <= 1: + return {"match": {field: variants[0] if variants else name}} + return { + "bool": { + "should": [{"match": {field: variant}} for variant in variants], + "minimum_should_match": 1, + } + } + + +class InventorSearchQueries: + def epo_query_by_inventor( + self, + last_name: str, + first_name: str | None = None, + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + if first_name: + query = { + "nested": { + "path": "inventors_name_nested", + "query": { + "bool": { + "must": [ + _match_name_field("inventors_name_nested.inventor", last_name), + _match_name_field("inventors_name_nested.inventor", first_name), + ] + } + }, + } + } + else: + query = { + "nested": { + "path": "inventors_name_nested", + "query": _match_name_field("inventors_name_nested.inventor", last_name), + } + } + + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"_score": {"order": "desc"}}, + {"date_publication": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": [ + "doc_number", + "country", + "kind", + "date_publication", + "date_publication_year", + "application_number", + "application_filing_date", + "title_en", + "title_de", + "abstract", + "inventors_name", + "applicants_name", + "ipc", + "cpc", + ], + "query": query, + } + + def uspto_query_by_inventor( + self, + last_name: str, + first_name: str | None = None, + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + if first_name: + query = { + "nested": { + "path": "inventors", + "query": { + "bool": { + "must": [ + _match_name_field("inventors.name", last_name), + _match_name_field("inventors.name", first_name), + ] + } + }, + } + } + else: + query = { + "nested": { + "path": "inventors", + "query": _match_name_field("inventors.name", last_name), + } + } + + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"_score": {"order": "desc"}}, + {"publication_date": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": [ + "publication_number", + "country", + "publication_date", + "publication_year", + "application_number", + "application_date", + "application_type", + "title", + "abstract", + "inventors_names", + "assignees_orgs", + "ipcr", + "cpc", + "number_of_claims", + "status", + ], + "query": query, + } diff --git a/service/src/main/inse/patents/authors/service.py b/service/src/main/inse/patents/authors/service.py new file mode 100644 index 00000000..0872f669 --- /dev/null +++ b/service/src/main/inse/patents/authors/service.py @@ -0,0 +1,16 @@ +from fastapi import APIRouter + +from inse.patents.authors import logic +from inse.patents.common import model + +router = APIRouter(prefix="/api/inse-service/authors", tags=["Patents"]) + + +@router.get( + "/{author_id}/patents", + operation_id="getPatentsByAuthor", + response_model=model.PatentsByAuthorResponse, + summary="Get patents matched to an author by name.", +) +async def get_patents_by_author(author_id: str): + return await logic.get_patents_by_author_id(author_id) diff --git a/service/src/main/inse/patents/common/__init__.py b/service/src/main/inse/patents/common/__init__.py new file mode 100644 index 00000000..a9ef3c28 --- /dev/null +++ b/service/src/main/inse/patents/common/__init__.py @@ -0,0 +1 @@ +"""Shared patent infrastructure.""" diff --git a/service/src/main/inse/patents/common/elastic_search_client.py b/service/src/main/inse/patents/common/elastic_search_client.py new file mode 100644 index 00000000..ef20a25b --- /dev/null +++ b/service/src/main/inse/patents/common/elastic_search_client.py @@ -0,0 +1,56 @@ +"""Base HTTP client for patent Elasticsearch indices.""" +from typing import Any + +import httpx + +from ... import config + +EPO_INDEX = "epo_index_1.0" +USPTO_INDEX = "uspto_patents_3.0" +DEFAULT_SEARCH_SIZE = 100 + + +class MissingApiKeyError(Exception): + pass + + +class BasePatentSearchClient: + def __init__( + self, + base_url: str | None = None, + api_key: str | None = None, + timeout: float = 30.0, + transport: httpx.AsyncBaseTransport | None = None, + ): + self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/") + self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key + self.timeout = timeout + self.transport = transport + + def _headers(self) -> dict[str, str]: + if not self.api_key: + raise MissingApiKeyError("Patent Elasticsearch API key is not configured.") + return { + "Authorization": f"ApiKey {self.api_key}", + "Content-Type": "application/json", + } + + async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]: + return await self._search(EPO_INDEX, payload) + + async def search_uspto(self, payload: dict[str, Any]) -> dict[str, Any]: + return await self._search(USPTO_INDEX, payload) + + async def _search(self, index: str, payload: dict[str, Any]) -> dict[str, Any]: + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.post( + f"/{index}/_search", + headers=self._headers(), + json=payload, + ) + response.raise_for_status() + return response.json() diff --git a/service/src/main/inse/patents/common/model.py b/service/src/main/inse/patents/common/model.py new file mode 100644 index 00000000..b3cc97a4 --- /dev/null +++ b/service/src/main/inse/patents/common/model.py @@ -0,0 +1,55 @@ +from pydantic import BaseModel, ConfigDict, Field + + +class IpcClassification(BaseModel): + symbol: str + section: str | None = None + ipc_class: str | None = Field(default=None, serialization_alias="class") + subclass: str | None = None + main_group: str | None = None + subgroup: str | None = None + + model_config = ConfigDict(populate_by_name=True) + + +class PatentEntry(BaseModel): + patent_id: str + source: str + title: str | None = None + abstract: str | None = None + publication_date: str | None = None + publication_year: str | None = None + application_number: str | None = None + application_date: str | None = None + kind: str | None = None + application_type: str | None = None + number_of_claims: int | None = None + status: str | None = None + inventors: list[str] = Field(default_factory=list) + assignees: list[str] = Field(default_factory=list) + ipc: list[str] = Field(default_factory=list) + ipc_descriptions: list[IpcClassification] = Field(default_factory=list) + cpc: list[str] = Field(default_factory=list) + cpc_descriptions: list[IpcClassification] = Field(default_factory=list) + country: str | None = None + + +class PatentsByAuthorResponse(BaseModel): + author_id: str + author_name: str | None = None + patent_count: int + patents: list[PatentEntry] + + +class PatentsByInstitutionResponse(BaseModel): + institution_id: str + institution_name: str | None = None + patent_count: int + patents: list[PatentEntry] + + +class AllPatentsResponse(BaseModel): + total: int + page: int + size: int + patents: list[PatentEntry] diff --git a/service/src/main/inse/patents/common/parsing.py b/service/src/main/inse/patents/common/parsing.py new file mode 100644 index 00000000..0b3cdf3b --- /dev/null +++ b/service/src/main/inse/patents/common/parsing.py @@ -0,0 +1,138 @@ +"""Shared patent hit parsing, deduplication, and classification enrichment.""" +import logging + +import httpx + +from inse.patents.common import model +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.ipc_lookup import extract_ipc_symbol +from inse.patents.ipc_search_client import IpcSearchClient + +logger = logging.getLogger(__name__) + + +def parse_epo_hits(data: dict) -> list[model.PatentEntry]: + patents = [] + for hit in data.get("hits", {}).get("hits", []): + src = hit.get("_source", {}) + inventors = src.get("inventors_name") or [] + applicants = src.get("applicants_name") or [] + ipc = src.get("ipc") or [] + cpc = src.get("cpc") or [] + patents.append(model.PatentEntry( + patent_id=f"EP{src.get('doc_number', hit.get('_id', ''))}", + source="EPO", + title=src.get("title_en") or src.get("title_de"), + abstract=src.get("abstract"), + publication_date=str(src.get("date_publication")) if src.get("date_publication") else None, + publication_year=str(src.get("date_publication_year")) if src.get("date_publication_year") else None, + application_number=src.get("application_number"), + application_date=src.get("application_filing_date"), + kind=src.get("kind"), + inventors=[i for i in (inventors if isinstance(inventors, list) else [inventors]) if i is not None], + assignees=[a for a in (applicants if isinstance(applicants, list) else [applicants]) if a is not None], + ipc=_to_classification_strings(ipc), + cpc=_to_classification_strings(cpc), + country=src.get("country", "EP"), + )) + return patents + + +def parse_uspto_hits(data: dict) -> list[model.PatentEntry]: + patents = [] + for hit in data.get("hits", {}).get("hits", []): + src = hit.get("_source", {}) + inventors = src.get("inventors_names") or [] + assignees = src.get("assignees_orgs") or [] + ipc = src.get("ipcr") or [] + cpc = src.get("cpc") or [] + patents.append(model.PatentEntry( + patent_id=f"US{src.get('publication_number', hit.get('_id', ''))}", + source="USPTO", + title=src.get("title"), + abstract=src.get("abstract"), + publication_date=str(src.get("publication_date")) if src.get("publication_date") else None, + publication_year=str(src.get("publication_year")) if src.get("publication_year") else None, + application_number=src.get("application_number"), + application_date=str(src.get("application_date")) if src.get("application_date") else None, + application_type=src.get("application_type"), + number_of_claims=src.get("number_of_claims"), + status=src.get("status"), + inventors=[i for i in (inventors if isinstance(inventors, list) else [inventors]) if i is not None], + assignees=[a for a in (assignees if isinstance(assignees, list) else [assignees]) if a is not None], + ipc=_to_classification_strings(ipc), + cpc=_to_classification_strings(cpc), + country=src.get("country", "US"), + )) + return patents + + +def deduplicate_patents(patents: list[model.PatentEntry]) -> list[model.PatentEntry]: + seen: set[tuple[str, str, str, str]] = set() + deduplicated: list[model.PatentEntry] = [] + + for patent in patents: + key = patent_dedup_key(patent) + if key in seen: + continue + seen.add(key) + deduplicated.append(patent) + + return deduplicated + + +def patent_dedup_key(patent: model.PatentEntry) -> tuple[str, str, str, str]: + stage = patent.kind or patent.application_type or "" + return ( + patent.source, + patent.patent_id, + patent.publication_date or "", + stage, + ) + + +async def enrich_patents_classifications( + patents: list[model.PatentEntry], + ipc_client: IpcSearchClient, +) -> None: + symbols = list(dict.fromkeys( + extract_ipc_symbol(raw) + for patent in patents + for raw in (*patent.ipc, *patent.cpc) + )) + if not symbols: + return + + try: + resolved = await ipc_client.resolve_symbols(symbols) + except MissingApiKeyError: + logger.warning("Classification enrichment skipped: Elasticsearch API key not configured.") + return + except httpx.HTTPError as exc: + logger.warning("Classification enrichment failed: %s", exc) + return + except Exception as exc: + logger.exception("Classification enrichment failed unexpectedly: %s", exc) + return + + for patent in patents: + patent.ipc_descriptions = _descriptions_for_raw_codes(patent.ipc, resolved) + patent.cpc_descriptions = _descriptions_for_raw_codes(patent.cpc, resolved) + + +def _to_classification_strings(value) -> list[str]: + if not value: + return [] + items = value if isinstance(value, list) else [value] + return [str(item).strip() for item in items if item and str(item).strip()] + + +def _descriptions_for_raw_codes( + raw_codes: list[str], + resolved: dict[str, model.IpcClassification], +) -> list[model.IpcClassification]: + return [ + resolved[extract_ipc_symbol(raw)] + for raw in raw_codes + if extract_ipc_symbol(raw) in resolved + ] diff --git a/service/src/main/inse/patents/common/text_normalization.py b/service/src/main/inse/patents/common/text_normalization.py new file mode 100644 index 00000000..a5f3f22b --- /dev/null +++ b/service/src/main/inse/patents/common/text_normalization.py @@ -0,0 +1,79 @@ +"""Shared text normalization for patent name matching.""" +import re +import unicodedata + +_CHAR_REPLACEMENTS: dict[str, str] = { + "ß": "ss", + "ẞ": "ss", + "æ": "ae", + "Æ": "ae", + "œ": "oe", + "Œ": "oe", + "ø": "o", + "Ø": "o", + "đ": "d", + "Đ": "d", + "ð": "d", + "Ð": "d", + "þ": "th", + "Þ": "th", + "ł": "l", + "Ł": "l", + "ı": "i", + "ſ": "s", +} + +_DIGRAPH_COLLAPSES: tuple[tuple[str, str], ...] = ( + ("ae", "a"), + ("oe", "o"), + ("ue", "u"), +) + +_PATENT_VOWEL_EXPANSIONS: tuple[tuple[str, str], ...] = ( + (r"u([lmnrt])", r"ue\1"), + (r"o([lmnrt])", r"oe\1"), + (r"a([lmnrt])", r"ae\1"), +) + + +def normalize_name_part(value: str | None) -> str: + if not value: + return "" + + text = value.strip() + for src, dst in _CHAR_REPLACEMENTS.items(): + text = text.replace(src, dst) + + text = unicodedata.normalize("NFKD", text) + text = "".join(c for c in text if not unicodedata.combining(c)) + text = text.lower() + text = re.sub(r"[''`´]", "", text) + text = re.sub(r"[^\w\s-]", "", text) + text = re.sub(r"\s+", " ", text).strip() + return text + + +def name_token_variants(value: str | None) -> set[str]: + base = normalize_name_part(value) + if not base: + return set() + + variants = {base} + + for src, dst in _DIGRAPH_COLLAPSES: + if src in base: + variants.add(base.replace(src, dst)) + + if "-" in base: + variants.add(base.replace("-", "")) + variants.add(base.replace("-", " ")) + + return {v for v in variants if v} + + +def patent_transliteration_expansions(normalized: str) -> set[str]: + expanded = {normalized} + for pattern, repl in _PATENT_VOWEL_EXPANSIONS: + if re.search(pattern, normalized): + expanded.add(re.sub(pattern, repl, normalized)) + return expanded diff --git a/service/src/main/inse/patents/elastic_search_client.py b/service/src/main/inse/patents/elastic_search_client.py index 7b7da9b9..840ac21e 100644 --- a/service/src/main/inse/patents/elastic_search_client.py +++ b/service/src/main/inse/patents/elastic_search_client.py @@ -1,275 +1,2 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - HTTP client for patent searches in EPO and USPTO Elasticsearch indices. -""" -from typing import Any - -import httpx - -from .. import config -from .name_matching import institution_search_variants, search_name_variants - -EPO_INDEX = "epo_index_1.0" -USPTO_INDEX = "uspto_patents_3.0" - -DEFAULT_SEARCH_SIZE = 100 - - -def _match_name_field(field: str, name: str) -> dict[str, Any]: - """Match a name field, including transliterated variants (M?ller/Mueller).""" - variants = search_name_variants(name) - if len(variants) <= 1: - return {"match": {field: variants[0] if variants else name}} - return { - "bool": { - "should": [{"match": {field: variant}} for variant in variants], - "minimum_should_match": 1, - } - } - - -class MissingApiKeyError(Exception): - pass - - -class PatentSearchClient: - def __init__( - self, - base_url: str | None = None, - api_key: str | None = None, - timeout: float = 30.0, - transport: httpx.AsyncBaseTransport | None = None, - ): - self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/") - self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key - self.timeout = timeout - self.transport = transport - - def _headers(self) -> dict[str, str]: - if not self.api_key: - raise MissingApiKeyError("Patent Elasticsearch API key is not configured.") - return { - "Authorization": f"ApiKey {self.api_key}", - "Content-Type": "application/json", - } - - def epo_query_by_inventor( - self, - last_name: str, - first_name: str | None = None, - size: int = DEFAULT_SEARCH_SIZE, - ) -> dict[str, Any]: - """Search EPO index: first AND last name in the SAME inventor entry.""" - if first_name: - query = { - "nested": { - "path": "inventors_name_nested", - "query": { - "bool": { - "must": [ - _match_name_field("inventors_name_nested.inventor", last_name), - _match_name_field("inventors_name_nested.inventor", first_name), - ] - } - }, - } - } - else: - query = { - "nested": { - "path": "inventors_name_nested", - "query": _match_name_field("inventors_name_nested.inventor", last_name), - } - } - - return { - "size": size, - "track_total_hits": True, - "sort": [ - {"_score": {"order": "desc"}}, - {"date_publication": {"order": "desc", "missing": "_last"}}, - "_doc", - ], - "_source": [ - "doc_number", - "country", - "kind", - "date_publication", - "date_publication_year", - "application_number", - "application_filing_date", - "title_en", - "title_de", - "abstract", - "inventors_name", - "applicants_name", - "ipc", - "cpc", - ], - "query": query, - } - - def uspto_query_by_inventor( - self, - last_name: str, - first_name: str | None = None, - size: int = DEFAULT_SEARCH_SIZE, - ) -> dict[str, Any]: - """Search USPTO index: first AND last name in the SAME inventor entry.""" - if first_name: - query = { - "nested": { - "path": "inventors", - "query": { - "bool": { - "must": [ - _match_name_field("inventors.name", last_name), - _match_name_field("inventors.name", first_name), - ] - } - }, - } - } - else: - query = { - "nested": { - "path": "inventors", - "query": _match_name_field("inventors.name", last_name), - } - } - - return { - "size": size, - "track_total_hits": True, - "sort": [ - {"_score": {"order": "desc"}}, - {"publication_date": {"order": "desc", "missing": "_last"}}, - "_doc", - ], - "_source": [ - "publication_number", - "country", - "publication_date", - "publication_year", - "application_number", - "application_date", - "application_type", - "title", - "abstract", - "inventors_names", - "assignees_orgs", - "ipcr", - "cpc", - "number_of_claims", - "status", - ], - "query": query, - } - - def _match_organization_names(self, field: str, names: list[str]) -> dict[str, Any]: - clauses: list[dict[str, Any]] = [] - seen: set[str] = set() - - for name in names: - for variant in institution_search_variants(name): - key = variant.casefold() - if not variant or key in seen: - continue - seen.add(key) - clauses.append({"match_phrase": {field: {"query": variant}}}) - - if not clauses: - return {"match_none": {}} - - return { - "bool": { - "should": clauses, - "minimum_should_match": 1, - } - } - - def epo_query_by_applicant( - self, - institution_names: list[str], - size: int = DEFAULT_SEARCH_SIZE, - ) -> dict[str, Any]: - return { - "size": size, - "track_total_hits": True, - "sort": [ - {"_score": {"order": "desc"}}, - {"date_publication": {"order": "desc", "missing": "_last"}}, - "_doc", - ], - "_source": [ - "doc_number", - "country", - "kind", - "date_publication", - "date_publication_year", - "application_number", - "application_filing_date", - "title_en", - "title_de", - "abstract", - "inventors_name", - "applicants_name", - "ipc", - "cpc", - ], - "query": self._match_organization_names("applicants_name", institution_names), - } - - def uspto_query_by_assignee( - self, - institution_names: list[str], - size: int = DEFAULT_SEARCH_SIZE, - ) -> dict[str, Any]: - return { - "size": size, - "track_total_hits": True, - "sort": [ - {"_score": {"order": "desc"}}, - {"publication_date": {"order": "desc", "missing": "_last"}}, - "_doc", - ], - "_source": [ - "publication_number", - "country", - "publication_date", - "publication_year", - "application_number", - "application_date", - "application_type", - "title", - "abstract", - "inventors_names", - "assignees_orgs", - "ipcr", - "cpc", - "number_of_claims", - "status", - ], - "query": self._match_organization_names("assignees_orgs", institution_names), - } - - async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]: - return await self._search(EPO_INDEX, payload) - - async def search_uspto(self, payload: dict[str, Any]) -> dict[str, Any]: - return await self._search(USPTO_INDEX, payload) - - async def _search(self, index: str, payload: dict[str, Any]) -> dict[str, Any]: - async with httpx.AsyncClient( - base_url=self.base_url, - timeout=self.timeout, - transport=self.transport, - ) as client: - response = await client.post( - f"/{index}/_search", - headers=self._headers(), - json=payload, - ) - response.raise_for_status() - return response.json() \ No newline at end of file +"""Backward-compatible re-exports.""" +from inse.patents.search_client import * # noqa: F403 diff --git a/service/src/main/inse/patents/institutions/__init__.py b/service/src/main/inse/patents/institutions/__init__.py new file mode 100644 index 00000000..986cd033 --- /dev/null +++ b/service/src/main/inse/patents/institutions/__init__.py @@ -0,0 +1 @@ +"""Patent lookup by institution assignee.""" diff --git a/service/src/main/inse/patents/institutions/logic.py b/service/src/main/inse/patents/institutions/logic.py new file mode 100644 index 00000000..e01ed75f --- /dev/null +++ b/service/src/main/inse/patents/institutions/logic.py @@ -0,0 +1,144 @@ +"""Business logic for patent lookup by institution assignee.""" +import asyncio +import logging + +import httpx +from fastapi import HTTPException +from starlette.status import HTTP_502_BAD_GATEWAY +from starlette.status import HTTP_503_SERVICE_UNAVAILABLE + +from inse.institutions.institutions_search_client import InstitutionsSearchClient +from inse.models.openalex.institution import Institution +from inse.patents.common import model +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.common.parsing import ( + deduplicate_patents, + enrich_patents_classifications, + parse_epo_hits, + parse_uspto_hits, +) +from inse.patents.institutions.name_matching import ( + MIN_INSTITUTION_ACRONYM_LEN, + assignee_matches_institution_name, + institution_search_variants, +) +from inse.patents.ipc_search_client import IpcSearchClient +from inse.patents.search_client import PatentSearchClient + +logger = logging.getLogger(__name__) + + +async def get_patents_by_institution_id( + institution_id: str, + client: PatentSearchClient | None = None, + ipc_client: IpcSearchClient | None = None, + institutions_client: InstitutionsSearchClient | None = None, +) -> model.PatentsByInstitutionResponse: + search_client = client or PatentSearchClient() + ipc_search_client = ipc_client or IpcSearchClient() + institution_client = institutions_client or InstitutionsSearchClient() + + short_id = institution_id.replace("https://openalex.org/", "") + institution = institution_client.get_institution_by_id(short_id) + search_names = _institution_search_names(institution) + + if not search_names: + return model.PatentsByInstitutionResponse( + institution_id=short_id, + institution_name=institution.display_name, + patent_count=0, + patents=[], + ) + + try: + epo_data, uspto_data = await asyncio.gather( + search_client.search_epo( + search_client.epo_query_by_applicant(search_names) + ), + search_client.search_uspto( + search_client.uspto_query_by_assignee(search_names) + ), + ) + except MissingApiKeyError as exc: + raise HTTPException( + status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="Patent search is not configured.", + ) from exc + except httpx.HTTPError as exc: + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="Patent search request failed.", + ) from exc + + all_patents = parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) + all_patents = filter_patents_by_institution(all_patents, institution) + all_patents = deduplicate_patents(all_patents) + + await enrich_patents_classifications(all_patents, ipc_search_client) + + return model.PatentsByInstitutionResponse( + institution_id=short_id, + institution_name=institution.display_name, + patent_count=len(all_patents), + patents=all_patents, + ) + + +def _institution_search_names(institution: Institution) -> list[str]: + names: list[str] = [] + seen: set[str] = set() + + def _add(name: str | None) -> None: + if not name or not name.strip(): + return + for variant in institution_search_variants(name.strip()): + key = variant.casefold() + if key not in seen: + seen.add(key) + names.append(variant) + + _add(institution.display_name) + for alternative in institution.display_name_alternatives or []: + _add(alternative) + for acronym in institution.display_name_acronyms or []: + if acronym and len(acronym.strip()) >= MIN_INSTITUTION_ACRONYM_LEN: + _add(acronym) + + return names + + +def _institution_canonical_names(institution: Institution) -> list[str]: + names: list[str] = [] + seen: set[str] = set() + + def _add(name: str | None) -> None: + if not name or not name.strip(): + return + key = name.strip().casefold() + if key not in seen: + seen.add(key) + names.append(name.strip()) + + _add(institution.display_name) + for alternative in institution.display_name_alternatives or []: + _add(alternative) + for acronym in institution.display_name_acronyms or []: + if acronym and len(acronym.strip()) >= MIN_INSTITUTION_ACRONYM_LEN: + _add(acronym) + + return names + + +def filter_patents_by_institution( + patents: list[model.PatentEntry], + institution: Institution, +) -> list[model.PatentEntry]: + canonical_names = _institution_canonical_names(institution) + return [ + patent for patent in patents + if any( + assignee_matches_institution_name(assignee, name) + for assignee in patent.assignees + for name in canonical_names + ) + ] diff --git a/service/src/main/inse/patents/institutions/name_matching.py b/service/src/main/inse/patents/institutions/name_matching.py new file mode 100644 index 00000000..bb5f1aba --- /dev/null +++ b/service/src/main/inse/patents/institutions/name_matching.py @@ -0,0 +1,91 @@ +"""Institution assignee name normalization and matching.""" +from inse.patents.common.text_normalization import ( + name_token_variants, + normalize_name_part, + patent_transliteration_expansions, +) + +_INSTITUTION_GENERIC_TOKENS = frozenset({ + "university", "universitat", "universitaet", "universiteit", "college", + "institute", "institut", "institution", "national", "sciences", "science", + "school", "center", "centre", "laboratory", "department", "academy", + "the", "of", "for", "and", "de", "la", "des", "der", "die", "das", "und", + "fur", "von", +}) + +MIN_INSTITUTION_SUBSTRING_LEN = 6 +MIN_INSTITUTION_VARIANT_LEN = 4 +MIN_INSTITUTION_ACRONYM_LEN = 3 + + +def institution_search_variants(value: str | None) -> list[str]: + if not value or not value.strip(): + return [] + + stripped = value.strip() + min_len = ( + MIN_INSTITUTION_ACRONYM_LEN + if stripped.isupper() and " " not in stripped + else MIN_INSTITUTION_VARIANT_LEN + ) + + seen: set[str] = set() + ordered: list[str] = [] + + def _add(candidate: str) -> None: + candidate = candidate.strip() + if len(candidate) < min_len: + return + key = candidate.casefold() + if key not in seen: + seen.add(key) + ordered.append(candidate) + + _add(stripped) + + normalized = normalize_name_part(value) + if normalized: + _add(normalized.title()) + + for variant in name_token_variants(value): + _add(variant.title()) + + for variant in patent_transliteration_expansions(normalized): + _add(variant.title()) + + return ordered + + +def _significant_institution_tokens(text: str) -> set[str]: + return { + token + for token in normalize_name_part(text).split() + if len(token) >= MIN_INSTITUTION_VARIANT_LEN + and token not in _INSTITUTION_GENERIC_TOKENS + } + + +def assignee_matches_institution_name(assignee: str, institution_name: str) -> bool: + norm_assignee = normalize_name_part(assignee) + norm_name = normalize_name_part(institution_name) + if not norm_assignee or not norm_name: + return False + + original = institution_name.strip() + assignee_tokens = set(norm_assignee.split()) + + if len(original) <= 6 and " " not in original: + return norm_name in assignee_tokens + + if len(norm_name) >= MIN_INSTITUTION_SUBSTRING_LEN: + if norm_name in norm_assignee or norm_assignee in norm_name: + return True + + significant = _significant_institution_tokens(institution_name) + if not significant: + return False + + matched = significant & assignee_tokens + if len(significant) >= 2: + return len(matched) >= 2 + return bool(matched) diff --git a/service/src/main/inse/patents/institutions/search_queries.py b/service/src/main/inse/patents/institutions/search_queries.py new file mode 100644 index 00000000..1067ab16 --- /dev/null +++ b/service/src/main/inse/patents/institutions/search_queries.py @@ -0,0 +1,94 @@ +"""Elasticsearch query builders for institution assignee patent search.""" +from typing import Any + +from inse.patents.common.elastic_search_client import DEFAULT_SEARCH_SIZE +from inse.patents.institutions.name_matching import institution_search_variants + + +class AssigneeSearchQueries: + def _match_organization_names(self, field: str, names: list[str]) -> dict[str, Any]: + clauses: list[dict[str, Any]] = [] + seen: set[str] = set() + + for name in names: + for variant in institution_search_variants(name): + key = variant.casefold() + if not variant or key in seen: + continue + seen.add(key) + clauses.append({"match_phrase": {field: {"query": variant}}}) + + if not clauses: + return {"match_none": {}} + + return { + "bool": { + "should": clauses, + "minimum_should_match": 1, + } + } + + def epo_query_by_applicant( + self, + institution_names: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"_score": {"order": "desc"}}, + {"date_publication": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": [ + "doc_number", + "country", + "kind", + "date_publication", + "date_publication_year", + "application_number", + "application_filing_date", + "title_en", + "title_de", + "abstract", + "inventors_name", + "applicants_name", + "ipc", + "cpc", + ], + "query": self._match_organization_names("applicants_name", institution_names), + } + + def uspto_query_by_assignee( + self, + institution_names: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"_score": {"order": "desc"}}, + {"publication_date": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": [ + "publication_number", + "country", + "publication_date", + "publication_year", + "application_number", + "application_date", + "application_type", + "title", + "abstract", + "inventors_names", + "assignees_orgs", + "ipcr", + "cpc", + "number_of_claims", + "status", + ], + "query": self._match_organization_names("assignees_orgs", institution_names), + } diff --git a/service/src/main/inse/patents/institutions/service.py b/service/src/main/inse/patents/institutions/service.py new file mode 100644 index 00000000..4978d077 --- /dev/null +++ b/service/src/main/inse/patents/institutions/service.py @@ -0,0 +1,33 @@ +from functools import lru_cache +from typing import Annotated + +from fastapi import APIRouter, Depends + +from inse.institutions.institutions_search_client import InstitutionsSearchClient +from inse.patents.common import model +from inse.patents.institutions import logic + +router = APIRouter(prefix="/api/inse-service/institutions", tags=["Patents"]) + + +@lru_cache +def get_institutions_search_client() -> InstitutionsSearchClient: + return InstitutionsSearchClient() + + +@router.get( + "/{id}/patents", + operation_id="getPatentsByInstitution", + response_model=model.PatentsByInstitutionResponse, + summary="Get patents matched to an institution by assignee name.", +) +async def get_patents_by_institution( + id: str, + client: Annotated[ + InstitutionsSearchClient, Depends(get_institutions_search_client) + ], +) -> model.PatentsByInstitutionResponse: + return await logic.get_patents_by_institution_id( + institution_id=id, + institutions_client=client, + ) diff --git a/service/src/main/inse/patents/logic.py b/service/src/main/inse/patents/logic.py index 36caf443..766ed956 100644 --- a/service/src/main/inse/patents/logic.py +++ b/service/src/main/inse/patents/logic.py @@ -1,427 +1,16 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Business logic for patent matching by author name. -""" -import logging -import asyncio - -import httpx -from fastapi import HTTPException -from starlette.status import HTTP_502_BAD_GATEWAY -from starlette.status import HTTP_503_SERVICE_UNAVAILABLE - -from ..persons import logic as person_logic -from ..models.openalex.author import Author -from ..models.openalex.institution import Institution -from inse.institutions.institutions_search_client import InstitutionsSearchClient -from . import model -from .elastic_search_client import MissingApiKeyError -from .elastic_search_client import PatentSearchClient -from .elastic_search_all_patents_client import AllPatentsSearchClient -from .ipc_search_client import IpcSearchClient -from .ipc_lookup import extract_ipc_symbol -from .name_matching import ( - MIN_INSTITUTION_ACRONYM_LEN, - assignee_matches_institution_name, - institution_search_variants, - name_matches, +"""Backward-compatible re-exports.""" +from inse.patents.all.logic import get_all_patents +from inse.patents.authors.logic import get_patents_by_author_id +from inse.patents.common.parsing import deduplicate_patents as _deduplicate_patents +from inse.patents.institutions.logic import ( + filter_patents_by_institution as _filter_patents_by_institution, + get_patents_by_institution_id, ) -logger = logging.getLogger(__name__) - - -async def get_patents_by_author_id( - author_id: str, - client: PatentSearchClient | None = None, - ipc_client: IpcSearchClient | None = None, -) -> model.PatentsByAuthorResponse: - search_client = client or PatentSearchClient() - ipc_search_client = ipc_client or IpcSearchClient() - - author = _get_author(author_id) - if not author: - return model.PatentsByAuthorResponse( - author_id=author_id, - author_name=None, - patent_count=0, - patents=[], - ) - - author_name = author.display_name - last_name = _extract_last_name(author_name) - first_name = _extract_first_name(author_name) - - if not last_name: - return model.PatentsByAuthorResponse( - author_id=author_id, - author_name=author_name, - patent_count=0, - patents=[], - ) - - try: - epo_data, uspto_data = await _search_both_indices( - search_client, last_name, first_name - ) - except MissingApiKeyError as exc: - raise HTTPException(status_code=HTTP_503_SERVICE_UNAVAILABLE, - detail="Patent search is not configured.") from exc - except httpx.HTTPError as exc: - raise HTTPException(status_code=HTTP_502_BAD_GATEWAY, - detail="Patent search request failed.") from exc - - all_patents = _parse_epo_hits(epo_data) + _parse_uspto_hits(uspto_data) - - if first_name and last_name: - all_patents = _filter_patents_by_name(all_patents, first_name, last_name) - - all_patents = _deduplicate_patents(all_patents) - - await _enrich_patents_classifications(all_patents, ipc_search_client) - - return model.PatentsByAuthorResponse( - author_id=author_id, - author_name=author_name, - patent_count=len(all_patents), - patents=all_patents, - ) - - -async def get_patents_by_institution_id( - institution_id: str, - client: PatentSearchClient | None = None, - ipc_client: IpcSearchClient | None = None, - institutions_client: InstitutionsSearchClient | None = None, -) -> model.PatentsByInstitutionResponse: - search_client = client or PatentSearchClient() - ipc_search_client = ipc_client or IpcSearchClient() - institution_client = institutions_client or InstitutionsSearchClient() - - short_id = institution_id.replace("https://openalex.org/", "") - institution = institution_client.get_institution_by_id(short_id) - search_names = _institution_search_names(institution) - - if not search_names: - return model.PatentsByInstitutionResponse( - institution_id=short_id, - institution_name=institution.display_name, - patent_count=0, - patents=[], - ) - - try: - epo_data, uspto_data = await asyncio.gather( - search_client.search_epo( - search_client.epo_query_by_applicant(search_names) - ), - search_client.search_uspto( - search_client.uspto_query_by_assignee(search_names) - ), - ) - except MissingApiKeyError as exc: - raise HTTPException(status_code=HTTP_503_SERVICE_UNAVAILABLE, - detail="Patent search is not configured.") from exc - except httpx.HTTPError as exc: - raise HTTPException(status_code=HTTP_502_BAD_GATEWAY, - detail="Patent search request failed.") from exc - - all_patents = _parse_epo_hits(epo_data) + _parse_uspto_hits(uspto_data) - all_patents = _filter_patents_by_institution(all_patents, institution) - all_patents = _deduplicate_patents(all_patents) - - await _enrich_patents_classifications(all_patents, ipc_search_client) - - return model.PatentsByInstitutionResponse( - institution_id=short_id, - institution_name=institution.display_name, - patent_count=len(all_patents), - patents=all_patents, - ) - - -def _institution_search_names(institution: Institution) -> list[str]: - names: list[str] = [] - seen: set[str] = set() - - def _add(name: str | None) -> None: - if not name or not name.strip(): - return - for variant in institution_search_variants(name.strip()): - key = variant.casefold() - if key not in seen: - seen.add(key) - names.append(variant) - - _add(institution.display_name) - for alternative in institution.display_name_alternatives or []: - _add(alternative) - for acronym in institution.display_name_acronyms or []: - if acronym and len(acronym.strip()) >= MIN_INSTITUTION_ACRONYM_LEN: - _add(acronym) - - return names - - -def _institution_canonical_names(institution: Institution) -> list[str]: - names: list[str] = [] - seen: set[str] = set() - - def _add(name: str | None) -> None: - if not name or not name.strip(): - return - key = name.strip().casefold() - if key not in seen: - seen.add(key) - names.append(name.strip()) - - _add(institution.display_name) - for alternative in institution.display_name_alternatives or []: - _add(alternative) - for acronym in institution.display_name_acronyms or []: - if acronym and len(acronym.strip()) >= MIN_INSTITUTION_ACRONYM_LEN: - _add(acronym) - - return names - - -def _filter_patents_by_institution( - patents: list[model.PatentEntry], - institution: Institution, -) -> list[model.PatentEntry]: - canonical_names = _institution_canonical_names(institution) - return [ - patent for patent in patents - if any( - assignee_matches_institution_name(assignee, name) - for assignee in patent.assignees - for name in canonical_names - ) - ] - - -async def _search_both_indices(client, last_name, first_name): - epo_result, uspto_result = await asyncio.gather( - client.search_epo(client.epo_query_by_inventor(last_name, first_name)), - client.search_uspto(client.uspto_query_by_inventor(last_name, first_name)), - ) - return epo_result, uspto_result - - -def _parse_epo_hits(data: dict) -> list[model.PatentEntry]: - patents = [] - for hit in data.get("hits", {}).get("hits", []): - src = hit.get("_source", {}) - inventors = src.get("inventors_name") or [] - applicants = src.get("applicants_name") or [] - ipc = src.get("ipc") or [] - cpc = src.get("cpc") or [] - patents.append(model.PatentEntry( - patent_id=f"EP{src.get('doc_number', hit.get('_id', ''))}", - source="EPO", - title=src.get("title_en") or src.get("title_de"), - abstract=src.get("abstract"), - publication_date=str(src.get("date_publication")) if src.get("date_publication") else None, - publication_year=str(src.get("date_publication_year")) if src.get("date_publication_year") else None, - application_number=src.get("application_number"), - application_date=src.get("application_filing_date"), - kind=src.get("kind"), - inventors=[i for i in (inventors if isinstance(inventors, list) else [inventors]) if i is not None], - assignees=[a for a in (applicants if isinstance(applicants, list) else [applicants]) if a is not None], - ipc=_to_classification_strings(ipc), - cpc=_to_classification_strings(cpc), - country=src.get("country", "EP"), - )) - return patents - - -def _parse_uspto_hits(data: dict) -> list[model.PatentEntry]: - patents = [] - for hit in data.get("hits", {}).get("hits", []): - src = hit.get("_source", {}) - inventors = src.get("inventors_names") or [] - assignees = src.get("assignees_orgs") or [] - ipc = src.get("ipcr") or [] - cpc = src.get("cpc") or [] - patents.append(model.PatentEntry( - patent_id=f"US{src.get('publication_number', hit.get('_id', ''))}", - source="USPTO", - title=src.get("title"), - abstract=src.get("abstract"), - publication_date=str(src.get("publication_date")) if src.get("publication_date") else None, - publication_year=str(src.get("publication_year")) if src.get("publication_year") else None, - application_number=src.get("application_number"), - application_date=str(src.get("application_date")) if src.get("application_date") else None, - application_type=src.get("application_type"), - number_of_claims=src.get("number_of_claims"), - status=src.get("status"), - inventors=[i for i in (inventors if isinstance(inventors, list) else [inventors]) if i is not None], - assignees=[a for a in (assignees if isinstance(assignees, list) else [assignees]) if a is not None], - ipc=_to_classification_strings(ipc), - cpc=_to_classification_strings(cpc), - country=src.get("country", "US"), - )) - return patents - - -def _to_classification_strings(value) -> list[str]: - if not value: - return [] - items = value if isinstance(value, list) else [value] - return [str(item).strip() for item in items if item and str(item).strip()] - - -def _descriptions_for_raw_codes( - raw_codes: list[str], - resolved: dict[str, model.IpcClassification], -) -> list[model.IpcClassification]: - return [ - resolved[extract_ipc_symbol(raw)] - for raw in raw_codes - if extract_ipc_symbol(raw) in resolved - ] - - -async def _enrich_patents_classifications( - patents: list[model.PatentEntry], - ipc_client: IpcSearchClient, -) -> None: - symbols = list(dict.fromkeys( - extract_ipc_symbol(raw) - for patent in patents - for raw in (*patent.ipc, *patent.cpc) - )) - if not symbols: - return - - try: - resolved = await ipc_client.resolve_symbols(symbols) - except MissingApiKeyError: - logger.warning("Classification enrichment skipped: Elasticsearch API key not configured.") - return - except httpx.HTTPError as exc: - logger.warning("Classification enrichment failed: %s", exc) - return - except Exception as exc: - logger.exception("Classification enrichment failed unexpectedly: %s", exc) - return - - for patent in patents: - patent.ipc_descriptions = _descriptions_for_raw_codes(patent.ipc, resolved) - patent.cpc_descriptions = _descriptions_for_raw_codes(patent.cpc, resolved) - - -def _filter_patents_by_name( - patents: list[model.PatentEntry], - first_name: str, - last_name: str, -) -> list[model.PatentEntry]: - return [ - patent for patent in patents - if any(name_matches(inventor, first_name, last_name) for inventor in patent.inventors) - ] - - -def _deduplicate_patents(patents: list[model.PatentEntry]) -> list[model.PatentEntry]: - seen: set[tuple[str, str, str, str]] = set() - deduplicated: list[model.PatentEntry] = [] - - for patent in patents: - key = _patent_dedup_key(patent) - if key in seen: - continue - seen.add(key) - deduplicated.append(patent) - - return deduplicated - - -def _patent_dedup_key(patent: model.PatentEntry) -> tuple[str, str, str, str]: - stage = patent.kind or patent.application_type or "" - return ( - patent.source, - patent.patent_id, - patent.publication_date or "", - stage, - ) - - -def _get_author(author_id: str) -> Author | None: - short_id = author_id.replace("https://openalex.org/", "") - result = person_logic.search_persons(author_id=short_id) - return result.results[0] if result.results else None - - -def _extract_last_name(name: str | None) -> str | None: - if not name: - return None - parts = name.strip().split() - return parts[-1] if parts else None - - -def _extract_first_name(name: str | None) -> str | None: - if not name: - return None - parts = name.strip().split() - return parts[0] if len(parts) > 1 else None - - -async def get_all_patents( - page: int = 0, - size: int = 10, - search: str | None = None, - source: str | None = None, - sort_by: str = "date", - sort_direction: str = "desc", - client: PatentSearchClient | None = None, - ipc_client: IpcSearchClient | None = None, -) -> model.AllPatentsResponse: - all_patents_client = AllPatentsSearchClient() - ipc_search_client = ipc_client or IpcSearchClient() - - try: - if source == "EPO": - epo_data = await all_patents_client.search_epo( - all_patents_client.epo_query(page, size, search, sort_direction) - ) - patents = _parse_epo_hits(epo_data) - total = epo_data.get("hits", {}).get("total", {}).get("value", 0) - - elif source == "USPTO": - uspto_data = await all_patents_client.search_uspto( - all_patents_client.uspto_query(page, size, search, sort_direction) - ) - patents = _parse_uspto_hits(uspto_data) - total = uspto_data.get("hits", {}).get("total", {}).get("value", 0) - - else: - half = size // 2 - epo_data, uspto_data = await asyncio.gather( - all_patents_client.search_epo( - all_patents_client.epo_query(page, half, search, sort_direction) - ), - all_patents_client.search_uspto( - all_patents_client.uspto_query(page, half, search, sort_direction) - ), - ) - patents = _parse_epo_hits(epo_data) + _parse_uspto_hits(uspto_data) - total = ( - epo_data.get("hits", {}).get("total", {}).get("value", 0) + - uspto_data.get("hits", {}).get("total", {}).get("value", 0) - ) - - except MissingApiKeyError as exc: - raise HTTPException(status_code=HTTP_503_SERVICE_UNAVAILABLE, - detail="Patent search is not configured.") from exc - except httpx.HTTPError as exc: - raise HTTPException(status_code=HTTP_502_BAD_GATEWAY, - detail="Patent search request failed.") from exc - - await _enrich_patents_classifications(patents, ipc_search_client) - - return model.AllPatentsResponse( - total=total, - page=page, - size=size, - patents=patents, - ) \ No newline at end of file +__all__ = [ + "_deduplicate_patents", + "_filter_patents_by_institution", + "get_all_patents", + "get_patents_by_author_id", + "get_patents_by_institution_id", +] diff --git a/service/src/main/inse/patents/model.py b/service/src/main/inse/patents/model.py index 830875bd..fe8a1047 100644 --- a/service/src/main/inse/patents/model.py +++ b/service/src/main/inse/patents/model.py @@ -1,55 +1,2 @@ -from pydantic import BaseModel, ConfigDict, Field - - -class IpcClassification(BaseModel): - symbol: str - section: str | None = None - ipc_class: str | None = Field(default=None, serialization_alias="class") - subclass: str | None = None - main_group: str | None = None - subgroup: str | None = None - - model_config = ConfigDict(populate_by_name=True) - - -class PatentEntry(BaseModel): - patent_id: str - source: str # "EPO" or "USPTO" - title: str | None = None - abstract: str | None = None - publication_date: str | None = None - publication_year: str | None = None - application_number: str | None = None - application_date: str | None = None - kind: str | None = None # EPO only - application_type: str | None = None # USPTO only - number_of_claims: int | None = None # USPTO only - status: str | None = None # USPTO only - inventors: list[str] = Field(default_factory=list) - assignees: list[str] = Field(default_factory=list) - ipc: list[str] = Field(default_factory=list) - ipc_descriptions: list[IpcClassification] = Field(default_factory=list) - cpc: list[str] = Field(default_factory=list) - cpc_descriptions: list[IpcClassification] = Field(default_factory=list) - country: str | None = None - - -class PatentsByAuthorResponse(BaseModel): - author_id: str - author_name: str | None = None - patent_count: int - patents: list[PatentEntry] - - -class PatentsByInstitutionResponse(BaseModel): - institution_id: str - institution_name: str | None = None - patent_count: int - patents: list[PatentEntry] - - -class AllPatentsResponse(BaseModel): - total: int - page: int - size: int - patents: list[PatentEntry] \ No newline at end of file +"""Backward-compatible re-exports.""" +from inse.patents.common.model import * # noqa: F403 diff --git a/service/src/main/inse/patents/name_matching.py b/service/src/main/inse/patents/name_matching.py index e62dcab6..a1e45065 100644 --- a/service/src/main/inse/patents/name_matching.py +++ b/service/src/main/inse/patents/name_matching.py @@ -1,328 +1,18 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - Name normalization and matching for patent inventor lookup. - - Handles umlauts, diacritics, and common Latin transliterations so that - e.g. 'Müller' matches 'Mueller' and 'Muller'. -""" -import re -import unicodedata - -# Characters that NFKD does not map to ASCII-friendly forms. -_CHAR_REPLACEMENTS: dict[str, str] = { - "ß": "ss", - "ẞ": "ss", - "æ": "ae", - "Æ": "ae", - "œ": "oe", - "Œ": "oe", - "ø": "o", - "Ø": "o", - "đ": "d", - "Đ": "d", - "ð": "d", - "Ð": "d", - "þ": "th", - "Þ": "th", - "ł": "l", - "Ł": "l", - "ı": "i", - "ſ": "s", -} - -# German patent transliterations: ae/oe/ue often stand in for ä/ö/ü. -_DIGRAPH_COLLAPSES: tuple[tuple[str, str], ...] = ( - ("ae", "a"), - ("oe", "o"), - ("ue", "u"), +"""Backward-compatible re-exports.""" +from inse.patents.authors.name_matching import ( # noqa: F401 + first_name_match_kind, + name_matches, + search_name_variants, + tokens_equal, ) - -# Common ASCII spellings in patent records for umlaut-derived vowels. -_PATENT_VOWEL_EXPANSIONS: tuple[tuple[str, str], ...] = ( - (r"u([lmnrt])", r"ue\1"), - (r"o([lmnrt])", r"oe\1"), - (r"a([lmnrt])", r"ae\1"), +from inse.patents.common.text_normalization import ( # noqa: F401 + name_token_variants, + normalize_name_part, +) +from inse.patents.institutions.name_matching import ( # noqa: F401 + MIN_INSTITUTION_ACRONYM_LEN, + MIN_INSTITUTION_SUBSTRING_LEN, + MIN_INSTITUTION_VARIANT_LEN, + assignee_matches_institution_name, + institution_search_variants, ) - - -def normalize_name_part(value: str | None) -> str: - """ - Normalize a single name token for comparison. - - Steps: transliteration map -> NFKD -> strip diacritics -> lowercase - -> remove apostrophes/punctuation -> collapse whitespace. - """ - if not value: - return "" - - text = value.strip() - for src, dst in _CHAR_REPLACEMENTS.items(): - text = text.replace(src, dst) - - text = unicodedata.normalize("NFKD", text) - text = "".join(c for c in text if not unicodedata.combining(c)) - text = text.lower() - text = re.sub(r"[''`´]", "", text) - text = re.sub(r"[^\w\s-]", "", text) - text = re.sub(r"\s+", " ", text).strip() - return text - - -def name_token_variants(value: str | None) -> set[str]: - """ - Return equivalent forms of a name token. - - Includes the normalized base plus German digraph collapses - (Mueller -> muller) and hyphen Relaxed forms (Jean-Pierre -> jean pierre). - """ - base = normalize_name_part(value) - if not base: - return set() - - variants = {base} - - for src, dst in _DIGRAPH_COLLAPSES: - if src in base: - variants.add(base.replace(src, dst)) - - if "-" in base: - variants.add(base.replace("-", "")) - variants.add(base.replace("-", " ")) - - return {v for v in variants if v} - - -def _patent_transliteration_expansions(normalized: str) -> set[str]: - """ - ASCII spellings used in patent records (e.g. Müller indexed as Mueller). - - Used for Elasticsearch recall only; post-filter applies stricter matching. - """ - expanded = {normalized} - for pattern, repl in _PATENT_VOWEL_EXPANSIONS: - if re.search(pattern, normalized): - expanded.add(re.sub(pattern, repl, normalized)) - return expanded - - -def tokens_equal( - left: str | None, - right: str | None, - *, - allow_initial: bool = True, -) -> bool: - """True when two name tokens are equivalent after normalization.""" - left_variants = name_token_variants(left) - right_variants = name_token_variants(right) - if not left_variants or not right_variants: - return False - if left_variants & right_variants: - return True - - if not allow_initial: - return False - - return _initial_tokens_match(left, right) - - -def _initial_letter(token: str | None) -> str | None: - normalized = normalize_name_part(token) - if len(normalized) == 1 and normalized.isalpha(): - return normalized - return None - - -def _initial_tokens_match(left: str | None, right: str | None) -> bool: - """True when one token is a single-letter initial matching the other token.""" - left_initial = _initial_letter(left) - right_initial = _initial_letter(right) - left_full = normalize_name_part(left) - right_full = normalize_name_part(right) - - if left_initial and right_full and len(right_full) > 1: - return right_full.startswith(left_initial) - if right_initial and left_full and len(left_full) > 1: - return left_full.startswith(right_initial) - if left_initial and right_initial: - return left_initial == right_initial - return False - - -def _inventor_first_token(inventor_name: str) -> str: - if "," in inventor_name: - _, first_part = [p.strip() for p in inventor_name.split(",", 1)] - return first_part.split()[0] if first_part else "" - parts = inventor_name.split() - return parts[0] if parts else "" - - -def first_name_match_kind( - inventor_name: str, - first_name: str, - last_name: str, -) -> str: - """ - Match quality for the inventor first name: 'full', 'initial', or 'none'. - """ - if not name_matches(inventor_name, first_name, last_name): - return "none" - - inventor_first = _inventor_first_token(inventor_name) - if tokens_equal(inventor_first, first_name, allow_initial=False): - return "full" - return "initial" - - -def search_name_variants(value: str | None) -> list[str]: - """ - Distinct search strings for Elasticsearch, preserving original casing - where useful but including normalized and transliterated forms. - """ - if not value or not value.strip(): - return [] - - seen: set[str] = set() - ordered: list[str] = [] - - def _add(candidate: str) -> None: - key = candidate.casefold() - if candidate.strip() and key not in seen: - seen.add(key) - ordered.append(candidate.strip()) - - _add(value.strip()) - - normalized = normalize_name_part(value) - if normalized: - _add(normalized.title()) - - for variant in name_token_variants(value): - _add(variant.title()) - - for variant in _patent_transliteration_expansions(normalized): - _add(variant.title()) - - if normalized and len(normalized) > 1: - _add(normalized[0].upper()) - - return ordered - - -def name_matches(inventor_name: str, first_name: str, last_name: str) -> bool: - """ - True when an inventor entry matches first_name + last_name. - - Supports: - - USPTO: 'Christian Weber', 'Christian Hans Weber' - - EPO: 'Weber, Christian', 'Weber, Christian Hans' - """ - if not inventor_name or not last_name: - return False - - name = inventor_name.strip() - - if "," in name: - last_part, first_part = [p.strip() for p in name.split(",", 1)] - first_token = first_part.split()[0] if first_part else "" - return ( - tokens_equal(last_part, last_name, allow_initial=False) - and bool(first_name) - and tokens_equal(first_token, first_name) - ) - - parts = name.split() - if len(parts) < 2: - return False - - return ( - tokens_equal(parts[-1], last_name, allow_initial=False) - and bool(first_name) - and tokens_equal(parts[0], first_name) - ) - - -_INSTITUTION_GENERIC_TOKENS = frozenset({ - "university", "universitat", "universitaet", "universiteit", "college", - "institute", "institut", "institution", "national", "sciences", "science", - "school", "center", "centre", "laboratory", "department", "academy", - "the", "of", "for", "and", "de", "la", "des", "der", "die", "das", "und", - "fur", "von", -}) - -MIN_INSTITUTION_SUBSTRING_LEN = 6 -MIN_INSTITUTION_VARIANT_LEN = 4 -MIN_INSTITUTION_ACRONYM_LEN = 3 - - -def institution_search_variants(value: str | None) -> list[str]: - if not value or not value.strip(): - return [] - - stripped = value.strip() - min_len = ( - MIN_INSTITUTION_ACRONYM_LEN - if stripped.isupper() and " " not in stripped - else MIN_INSTITUTION_VARIANT_LEN - ) - - seen: set[str] = set() - ordered: list[str] = [] - - def _add(candidate: str) -> None: - candidate = candidate.strip() - if len(candidate) < min_len: - return - key = candidate.casefold() - if key not in seen: - seen.add(key) - ordered.append(candidate) - - _add(stripped) - - normalized = normalize_name_part(value) - if normalized: - _add(normalized.title()) - - for variant in name_token_variants(value): - _add(variant.title()) - - for variant in _patent_transliteration_expansions(normalized): - _add(variant.title()) - - return ordered - - -def _significant_institution_tokens(text: str) -> set[str]: - return { - token - for token in normalize_name_part(text).split() - if len(token) >= MIN_INSTITUTION_VARIANT_LEN - and token not in _INSTITUTION_GENERIC_TOKENS - } - - -def assignee_matches_institution_name(assignee: str, institution_name: str) -> bool: - norm_assignee = normalize_name_part(assignee) - norm_name = normalize_name_part(institution_name) - if not norm_assignee or not norm_name: - return False - - original = institution_name.strip() - assignee_tokens = set(norm_assignee.split()) - - if len(original) <= 6 and " " not in original: - return norm_name in assignee_tokens - - if len(norm_name) >= MIN_INSTITUTION_SUBSTRING_LEN: - if norm_name in norm_assignee or norm_assignee in norm_name: - return True - - significant = _significant_institution_tokens(institution_name) - if not significant: - return False - - matched = significant & assignee_tokens - if len(significant) >= 2: - return len(matched) >= 2 - return bool(matched) diff --git a/service/src/main/inse/patents/search_client.py b/service/src/main/inse/patents/search_client.py new file mode 100644 index 00000000..38feee9e --- /dev/null +++ b/service/src/main/inse/patents/search_client.py @@ -0,0 +1,27 @@ +"""Combined patent Elasticsearch client.""" +from inse.patents.authors.search_queries import InventorSearchQueries +from inse.patents.common.elastic_search_client import ( + DEFAULT_SEARCH_SIZE, + EPO_INDEX, + USPTO_INDEX, + BasePatentSearchClient, + MissingApiKeyError, +) +from inse.patents.institutions.search_queries import AssigneeSearchQueries + + +class PatentSearchClient( + InventorSearchQueries, + AssigneeSearchQueries, + BasePatentSearchClient, +): + pass + + +__all__ = [ + "DEFAULT_SEARCH_SIZE", + "EPO_INDEX", + "MissingApiKeyError", + "PatentSearchClient", + "USPTO_INDEX", +] diff --git a/service/src/main/inse/patents/service.py b/service/src/main/inse/patents/service.py index c2a8eb49..3cd2f6d8 100644 --- a/service/src/main/inse/patents/service.py +++ b/service/src/main/inse/patents/service.py @@ -1,43 +1,10 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- +"""Aggregates patent API routers.""" from fastapi import APIRouter -from . import logic -from . import model -router = APIRouter(prefix="/api/inse-service/authors", tags=["Patents"]) +from inse.patents.all.service import router as all_patents_router +from inse.patents.authors.service import router as author_patents_router +from inse.patents.institutions.service import router as institution_patents_router -patents_router = APIRouter(prefix="/api/inse-service", tags=["Patents"]) - - -@router.get( - "/{author_id}/patents", - operation_id="getPatentsByAuthor", - response_model=model.PatentsByAuthorResponse, - summary="Get patents matched to an author by name.", -) -async def get_patents_by_author(author_id: str): - return await logic.get_patents_by_author_id(author_id) - - -@patents_router.get( - "/patents", - operation_id="getAllPatents", - response_model=model.AllPatentsResponse, - summary="Get all patents with pagination and search.", -) -async def get_all_patents( - page: int = 0, - size: int = 10, - search: str | None = None, - source: str | None = None, - sort_by: str = "date", - sort_direction: str = "desc", -): - return await logic.get_all_patents( - page=page, - size=size, - search=search, - source=source, - sort_by=sort_by, - sort_direction=sort_direction, - ) \ No newline at end of file +router = author_patents_router +patents_router = all_patents_router +institution_patents_router = institution_patents_router diff --git a/service/src/main/inse/patents/test_institution_matching.py b/service/src/main/inse/patents/test_institution_matching.py index 2d5c6588..3dc109cd 100644 --- a/service/src/main/inse/patents/test_institution_matching.py +++ b/service/src/main/inse/patents/test_institution_matching.py @@ -1,5 +1,6 @@ -from inse.patents import logic, model -from inse.patents.name_matching import ( +from inse.patents import model +from inse.patents.institutions.logic import filter_patents_by_institution +from inse.patents.institutions.name_matching import ( assignee_matches_institution_name, institution_search_variants, ) @@ -63,7 +64,7 @@ def test_filter_patents_by_institution_removes_unrelated_assignees() -> None: ), ] - result = logic._filter_patents_by_institution(patents, institution) + result = filter_patents_by_institution(patents, institution) assert len(result) == 1 assert result[0].patent_id == "US1" diff --git a/service/src/main/inse/patents/test_logic.py b/service/src/main/inse/patents/test_logic.py index a57f49c8..5e60288d 100644 --- a/service/src/main/inse/patents/test_logic.py +++ b/service/src/main/inse/patents/test_logic.py @@ -1,4 +1,6 @@ -from inse.patents import logic, model +from inse.patents import model +from inse.patents.common.parsing import deduplicate_patents +from inse.patents.institutions.logic import filter_patents_by_institution def _uspto_patent( @@ -34,7 +36,7 @@ def _epo_patent( def test_deduplicate_patents_removes_exact_duplicates() -> None: patents = [_uspto_patent(), _uspto_patent(), _uspto_patent()] - result = logic._deduplicate_patents(patents) + result = deduplicate_patents(patents) assert len(result) == 1 assert result[0].patent_id == "US12508845" @@ -43,7 +45,7 @@ def test_deduplicate_patents_removes_exact_duplicates() -> None: def test_deduplicate_patents_keeps_distinct_publication_numbers() -> None: patents = [_uspto_patent("US12508845"), _uspto_patent("US12303461")] - result = logic._deduplicate_patents(patents) + result = deduplicate_patents(patents) assert len(result) == 2 assert [patent.patent_id for patent in result] == ["US12508845", "US12303461"] @@ -55,7 +57,7 @@ def test_deduplicate_patents_keeps_first_occurrence_of_exact_duplicate() -> None duplicate = _uspto_patent() duplicate.abstract = "Second abstract" - result = logic._deduplicate_patents([first, duplicate]) + result = deduplicate_patents([first, duplicate]) assert len(result) == 1 assert result[0].abstract == "First abstract" @@ -65,7 +67,7 @@ def test_deduplicate_patents_keeps_epo_application_and_grant_stages() -> None: application = _epo_patent(publication_date="20161005", kind="A1") grant = _epo_patent(publication_date="20180411", kind="B1") - result = logic._deduplicate_patents([application, grant]) + result = deduplicate_patents([application, grant]) assert len(result) == 2 assert [patent.kind for patent in result] == ["A1", "B1"] @@ -75,7 +77,7 @@ def test_deduplicate_patents_keeps_same_patent_number_with_different_dates() -> earlier = _uspto_patent(publication_date="20241230") later = _uspto_patent(publication_date="20251230") - result = logic._deduplicate_patents([earlier, later]) + result = deduplicate_patents([earlier, later]) assert len(result) == 2 assert [patent.publication_date for patent in result] == ["20241230", "20251230"] @@ -85,7 +87,7 @@ def test_deduplicate_patents_keeps_same_patent_number_with_different_uspto_types utility = _uspto_patent(application_type="utility") reissue = _uspto_patent(application_type="reissue") - result = logic._deduplicate_patents([utility, reissue]) + result = deduplicate_patents([utility, reissue]) assert len(result) == 2 assert [patent.application_type for patent in result] == ["utility", "reissue"] @@ -120,7 +122,7 @@ def test_filter_patents_by_institution_keeps_matching_assignees() -> None: assignees=["Harvard University"], ) - result = logic._filter_patents_by_institution( + result = filter_patents_by_institution( [matching, other], institution, ) -- 2.56.1 From 6fc491fd870f180dc1fe08fd9b96a3da35f33ea9 Mon Sep 17 00:00:00 2001 From: Khuder Khalti Date: Sat, 27 Jun 2026 11:30:09 +0200 Subject: [PATCH 03/43] feat(patents): add year range filter to global patents page --- service/src/main/inse/patents/all/logic.py | 12 +- service/src/main/inse/patents/all/service.py | 7 +- .../elastic_search_all_patents_client.py | 50 +++++- webapp/src/app/api/api/patents.service.ts | 11 +- .../modules/patents/patents.component.html | 161 +++++++++++++++--- .../modules/patents/patents.component.scss | 154 ++++++++++++++--- .../app/modules/patents/patents.component.ts | 70 +++++++- 7 files changed, 395 insertions(+), 70 deletions(-) diff --git a/service/src/main/inse/patents/all/logic.py b/service/src/main/inse/patents/all/logic.py index 88288c91..7206fe8a 100644 --- a/service/src/main/inse/patents/all/logic.py +++ b/service/src/main/inse/patents/all/logic.py @@ -25,6 +25,8 @@ async def get_all_patents( source: str | None = None, sort_by: str = "date", sort_direction: str = "desc", + year_from: int | None = None, + year_to: int | None = None, client: PatentSearchClient | None = None, ipc_client: IpcSearchClient | None = None, ) -> model.AllPatentsResponse: @@ -34,14 +36,14 @@ async def get_all_patents( try: if source == "EPO": epo_data = await all_patents_client.search_epo( - all_patents_client.epo_query(page, size, search, sort_direction) + all_patents_client.epo_query(page, size, search, sort_direction, year_from, year_to) ) patents = parse_epo_hits(epo_data) total = epo_data.get("hits", {}).get("total", {}).get("value", 0) elif source == "USPTO": uspto_data = await all_patents_client.search_uspto( - all_patents_client.uspto_query(page, size, search, sort_direction) + all_patents_client.uspto_query(page, size, search, sort_direction, year_from, year_to) ) patents = parse_uspto_hits(uspto_data) total = uspto_data.get("hits", {}).get("total", {}).get("value", 0) @@ -50,10 +52,10 @@ async def get_all_patents( half = size // 2 epo_data, uspto_data = await asyncio.gather( all_patents_client.search_epo( - all_patents_client.epo_query(page, half, search, sort_direction) + all_patents_client.epo_query(page, half, search, sort_direction, year_from, year_to) ), all_patents_client.search_uspto( - all_patents_client.uspto_query(page, half, search, sort_direction) + all_patents_client.uspto_query(page, half, search, sort_direction, year_from, year_to) ), ) patents = parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) @@ -80,4 +82,4 @@ async def get_all_patents( page=page, size=size, patents=patents, - ) + ) \ No newline at end of file diff --git a/service/src/main/inse/patents/all/service.py b/service/src/main/inse/patents/all/service.py index 394ab362..0d38bb5f 100644 --- a/service/src/main/inse/patents/all/service.py +++ b/service/src/main/inse/patents/all/service.py @@ -1,3 +1,4 @@ +"""Business logic for global patent listing.""" from fastapi import APIRouter from inse.patents.all import logic @@ -19,6 +20,8 @@ async def get_all_patents( source: str | None = None, sort_by: str = "date", sort_direction: str = "desc", + year_from: int | None = None, + year_to: int | None = None, ): return await logic.get_all_patents( page=page, @@ -27,4 +30,6 @@ async def get_all_patents( source=source, sort_by=sort_by, sort_direction=sort_direction, - ) + year_from=year_from, + year_to=year_to, + ) \ No newline at end of file diff --git a/service/src/main/inse/patents/elastic_search_all_patents_client.py b/service/src/main/inse/patents/elastic_search_all_patents_client.py index 4584f40b..fa67de96 100644 --- a/service/src/main/inse/patents/elastic_search_all_patents_client.py +++ b/service/src/main/inse/patents/elastic_search_all_patents_client.py @@ -41,13 +41,15 @@ class AllPatentsSearchClient: size: int = 10, search: str | None = None, sort_direction: str = "desc", + year_from: int | None = None, + year_to: int | None = None, ) -> dict[str, Any]: sort = [{"date_publication": {"order": sort_direction, "missing": "_last"}}, "_doc"] if search and search.strip(): term = search.strip() doc_number = term.upper().removeprefix("EP") - query: dict[str, Any] = { + search_query: dict[str, Any] = { "bool": { "should": [ {"match_phrase": {"title_en": {"query": term}}}, @@ -58,7 +60,26 @@ class AllPatentsSearchClient: } } else: - query = {"match_all": {}} + search_query = {"match_all": {}} + + filters = [] + if year_from or year_to: + date_range: dict[str, Any] = {} + if year_from: + date_range["gte"] = year_from * 10000 + if year_to: + date_range["lte"] = (year_to * 10000) + 9999 + filters.append({"range": {"date_publication": date_range}}) + + if filters: + query: dict[str, Any] = { + "bool": { + "must": search_query, + "filter": filters, + } + } + else: + query = search_query return { "from": page * size, @@ -80,13 +101,15 @@ class AllPatentsSearchClient: size: int = 10, search: str | None = None, sort_direction: str = "desc", + year_from: int | None = None, + year_to: int | None = None, ) -> dict[str, Any]: sort = [{"publication_date": {"order": sort_direction, "missing": "_last"}}, "_doc"] if search and search.strip(): term = search.strip() pub_number = term.upper().removeprefix("US") - query: dict[str, Any] = { + search_query: dict[str, Any] = { "bool": { "should": [ {"match_phrase": {"title": {"query": term}}}, @@ -96,7 +119,26 @@ class AllPatentsSearchClient: } } else: - query = {"match_all": {}} + search_query = {"match_all": {}} + + filters = [] + if year_from or year_to: + date_range: dict[str, Any] = {} + if year_from: + date_range["gte"] = year_from * 10000 + if year_to: + date_range["lte"] = (year_to * 10000) + 9999 + filters.append({"range": {"publication_date": date_range}}) + + if filters: + query: dict[str, Any] = { + "bool": { + "must": search_query, + "filter": filters, + } + } + else: + query = search_query return { "from": page * size, diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index bc1be987..9bcab67c 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -16,12 +16,6 @@ import { PatentEntry } from '../model/patentEntry'; import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; - - - - - - export interface AllPatentsResponse { total: number; page: number; @@ -236,6 +230,8 @@ export class PatentsService extends BaseService { source?: string, sortBy: string = 'date', sortDirection: string = 'desc', + yearFrom?: number, + yearTo?: number, ): Observable { let params = new HttpParams() .set('page', String(page)) @@ -245,6 +241,9 @@ export class PatentsService extends BaseService { if (search) params = params.set('search', search); if (source) params = params.set('source', source); + if (yearFrom !== undefined) + params = params.set('year_from', String(yearFrom)); + if (yearTo !== undefined) params = params.set('year_to', String(yearTo)); const localVarHeaders = this.defaultHeaders; const { basePath, withCredentials } = this.configuration; diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index 76c7df46..6ffe47bd 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -26,13 +26,52 @@ USPTO -
- +
+
+ Zeitraum + +
+ +
+ {{ selectedStartYear }} + bis + {{ selectedEndYear }} +
+ +
+
+ + +
+ +
+ {{ minYear }} + {{ maxYear }} +
@@ -60,7 +99,12 @@
{{ row.label }}
@if (row.variant === 'source') { - {{ row.value }} + {{ row.value }} } @else { {{ row.value }} } @@ -97,10 +141,17 @@ } @if (selectedPatent.ipc_descriptions.length > 0) { -
+

Klassifikation (IPC)

- @for (card of getClassificationCards(selectedPatent.ipc_descriptions, 'IPC'); track card.key) { + @for ( + card of getClassificationCards( + selectedPatent.ipc_descriptions, + 'IPC' + ); + track card.key + ) {
@@ -109,17 +160,34 @@ }
- {{ card.system }} - {{ card.levelLabel }} + {{ card.system }} + {{ card.levelLabel }}
@if (card.primaryDescription) {

- {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} + {{ + isClassificationExpanded(card.key) + ? card.primaryDescription + : getDescriptionPreview(card.primaryDescription) + }}

@if (isLongDescription(card.primaryDescription)) { - } } @@ -149,10 +217,17 @@ } @if (selectedPatent.cpc_descriptions.length > 0) { -
+

Klassifikation (CPC)

- @for (card of getClassificationCards(selectedPatent.cpc_descriptions, 'CPC'); track card.key) { + @for ( + card of getClassificationCards( + selectedPatent.cpc_descriptions, + 'CPC' + ); + track card.key + ) {
@@ -161,17 +236,34 @@ }
- {{ card.system }} - {{ card.levelLabel }} + {{ card.system }} + {{ card.levelLabel }}
@if (card.primaryDescription) {

- {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} + {{ + isClassificationExpanded(card.key) + ? card.primaryDescription + : getDescriptionPreview(card.primaryDescription) + }}

@if (isLongDescription(card.primaryDescription)) { - } } @@ -206,12 +298,25 @@
} @else {
- @for (patent of patents; track patent.patent_id + (patent.publication_date ?? '')) { - + @for ( + patent of patents; + track patent.patent_id + (patent.publication_date ?? '') + ) { + - {{ patent.title ?? patent.patent_id }} + {{ + patent.title ?? patent.patent_id + }} - {{ patent.source }} + {{ patent.source }} @@ -224,7 +329,9 @@ - diff --git a/webapp/src/app/modules/patents/patents.component.scss b/webapp/src/app/modules/patents/patents.component.scss index e19ca6e1..9c96ca64 100644 --- a/webapp/src/app/modules/patents/patents.component.scss +++ b/webapp/src/app/modules/patents/patents.component.scss @@ -12,20 +12,6 @@ h1 { padding: 1rem 0 0; } -.sorting { - display: flex; - justify-content: flex-end; - gap: 0.5rem; - - select { - padding: 0.75rem; - border: 1px solid var(--sg-border); - border-radius: var(--sg-radius-sm); - font-size: 1rem; - cursor: pointer; - } -} - .search-and-filter { padding: 0 1rem; display: flex; @@ -37,8 +23,140 @@ h1 { display: flex; justify-content: space-between; align-items: center; + flex-wrap: wrap; + gap: 1rem; } +.year-filter { + width: min(285px, 100%); + padding: 8px 10px; + border: 1px solid #dbe5f6; + border-radius: 10px; + background: #fbfdff; + box-sizing: border-box; +} + +.year-filter-top { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + margin-bottom: 4px; +} + +.year-filter-label { + color: #07163d; + font-size: 12px; + font-weight: 700; +} + +.reset-range-button { + border: 0; + background: transparent; + color: #0057ff; + font-size: 11px; + cursor: pointer; + padding: 0; + font-family: inherit; + + &:disabled { + color: #9aa5bc; + cursor: default; + } +} + +.year-filter-values { + display: flex; + align-items: center; + justify-content: center; + gap: 7px; + margin-bottom: 5px; + color: #40506f; + font-size: 12px; + font-weight: 600; +} + +.year-filter-bounds { + display: flex; + justify-content: space-between; + margin-top: 1px; + color: #7c88a3; + font-size: 10px; +} + +.year-range-slider { + --range-start: 0%; + --range-end: 100%; + --accent: #0057ff; + + position: relative; + height: 22px; +} + +.range-track { + position: absolute; + top: 50%; + left: 0; + right: 0; + height: 5px; + transform: translateY(-50%); + border-radius: 999px; + background: linear-gradient( + to right, + #d8e2f4 0%, + #d8e2f4 var(--range-start), + var(--accent) var(--range-start), + var(--accent) var(--range-end), + #d8e2f4 var(--range-end), + #d8e2f4 100% + ); +} + +.range-input { + position: absolute; + inset: 0; + width: 100%; + height: 22px; + margin: 0; + appearance: none; + background: transparent; + pointer-events: none; + + &::-webkit-slider-runnable-track, + &::-moz-range-track { + height: 5px; + background: transparent; + border: none; + } + + &::-webkit-slider-thumb { + appearance: none; + width: 15px; + height: 15px; + margin-top: -5px; + border: 2px solid #ffffff; + border-radius: 50%; + background: #0057ff; + box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22); + cursor: pointer; + pointer-events: auto; + } + + &::-moz-range-thumb { + width: 15px; + height: 15px; + border: 2px solid #ffffff; + border-radius: 50%; + background: #0057ff; + box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22); + cursor: pointer; + pointer-events: auto; + } +} + +.range-input-start { z-index: 2; } +.range-input-end { z-index: 3; } + .state-message { display: flex; align-items: center; @@ -58,15 +176,11 @@ h1 { } @media (max-width: 900px) { - .cards { - grid-template-columns: repeat(2, 1fr); - } + .cards { grid-template-columns: repeat(2, 1fr); } } @media (max-width: 600px) { - .cards { - grid-template-columns: 1fr; - } + .cards { grid-template-columns: 1fr; } } mat-paginator { diff --git a/webapp/src/app/modules/patents/patents.component.ts b/webapp/src/app/modules/patents/patents.component.ts index d946a0e5..c0d056f0 100644 --- a/webapp/src/app/modules/patents/patents.component.ts +++ b/webapp/src/app/modules/patents/patents.component.ts @@ -28,6 +28,7 @@ interface ClassificationCard { } const DESCRIPTION_PREVIEW_LENGTH = 140; +const MIN_YEAR = 1978; @Component({ selector: 'app-patents', @@ -62,12 +63,17 @@ export class PatentsComponent implements OnInit { searchTerm = ''; activeFilter: SourceFilter = 'all'; - sortDirection: string = 'desc'; + sortDirection: string = 'asc'; + + // Jahr-Slider + readonly minYear = MIN_YEAR; + readonly maxYear = new Date().getFullYear(); + selectedStartYear = MIN_YEAR; + selectedEndYear = new Date().getFullYear(); selectedPatent: PatentEntry | null = null; showDetail = false; private expandedClassificationKeys = new Set(); - private searchSubject = new Subject(); constructor() { @@ -92,17 +98,68 @@ export class PatentsComponent implements OnInit { if (f === 'EPO' || f === 'USPTO') this.activeFilter = f; const d = qp.get('sort_direction'); if (d === 'asc' || d === 'desc') this.sortDirection = d; + const sy = parseInt(qp.get('year_from') ?? '', 10); + const ey = parseInt(qp.get('year_to') ?? '', 10); + if (!isNaN(sy)) this.selectedStartYear = sy; + if (!isNaN(ey)) this.selectedEndYear = ey; this.loadPatents(); } + get rangeStartPercent(): string { + const total = this.maxYear - this.minYear; + return `${((this.selectedStartYear - this.minYear) / total) * 100}%`; + } + + get rangeEndPercent(): string { + const total = this.maxYear - this.minYear; + return `${((this.selectedEndYear - this.minYear) / total) * 100}%`; + } + + get canResetYearRange(): boolean { + return this.selectedStartYear !== this.minYear || this.selectedEndYear !== this.maxYear; + } + + onStartYearInput(event: Event): void { + const val = parseInt((event.target as HTMLInputElement).value, 10); + this.selectedStartYear = Math.min(val, this.selectedEndYear); + this.page = 0; + this.loadPatents(); + this.updateQueryParams(); + } + + onEndYearInput(event: Event): void { + const val = parseInt((event.target as HTMLInputElement).value, 10); + this.selectedEndYear = Math.max(val, this.selectedStartYear); + this.page = 0; + this.loadPatents(); + this.updateQueryParams(); + } + + resetYearRange(): void { + this.selectedStartYear = this.minYear; + this.selectedEndYear = this.maxYear; + this.page = 0; + this.loadPatents(); + this.updateQueryParams(); + } + private loadPatents(): void { this.loading = true; this.error = false; const source = this.activeFilter === 'all' ? undefined : this.activeFilter; this.patentsApi - .getAllPatents(this.page, this.pageSize, this.searchTerm || undefined, source, 'date', this.sortDirection) + .getAllPatents( + this.page, + this.pageSize, + this.searchTerm || undefined, + source, + 'date', + this.sortDirection, + this.selectedStartYear, + this.selectedEndYear, + ) .subscribe({ next: (res) => { this.patents = res.patents; @@ -175,6 +232,8 @@ export class PatentsComponent implements OnInit { size: this.pageSize, source: this.activeFilter === 'all' ? null : this.activeFilter, sort_direction: this.sortDirection, + year_from: this.selectedStartYear !== this.minYear ? this.selectedStartYear : null, + year_to: this.selectedEndYear !== this.maxYear ? this.selectedEndYear : null, }, queryParamsHandling: 'merge', replaceUrl: true, @@ -217,10 +276,7 @@ export class PatentsComponent implements OnInit { return value.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, (c) => c.toUpperCase()); } - getClassificationCards( - entries: IpcClassification[] | undefined, - system: ClassificationSystem, - ): ClassificationCard[] { + getClassificationCards(entries: IpcClassification[] | undefined, system: ClassificationSystem): ClassificationCard[] { if (!entries?.length) return []; const merged = new Map(); for (const entry of entries) { -- 2.56.1 From f5991ef66019edd2e41e5a543b689ab41ffb4de8 Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Sat, 27 Jun 2026 18:53:55 +0200 Subject: [PATCH 04/43] Add centralized patent detail page with backend lookup by ID Introduce /patent/:patentId and a dedicated detail view modeled after publications, backed by GET /api/inse-service/patents/{patent_id}. Route patent overview and detail actions from list, person, and institution views to the shared page instead of inline detail panels. --- service/src/main/inse/patents/all/logic.py | 55 ++- service/src/main/inse/patents/all/service.py | 12 +- .../elastic_search_all_patents_client.py | 24 + webapp/src/app/api/api/patents.service.ts | 21 + webapp/src/app/app.routes.ts | 8 + .../institution-patents.component.html | 178 +------ .../institution-patents.component.ts | 238 +-------- .../patent-detail.component.html | 319 ++++++++++++ .../patent-detail.component.scss | 462 ++++++++++++++++++ .../patent-detail/patent-detail.component.ts | 127 +++++ .../patent-detail/patent-detail.utils.ts | 205 ++++++++ .../modules/patents/patents.component.html | 215 +------- .../app/modules/patents/patents.component.ts | 149 +----- .../person-patents.component.html | 178 +------ .../person-patents.component.ts | 238 +-------- 15 files changed, 1259 insertions(+), 1170 deletions(-) create mode 100644 webapp/src/app/modules/patent-detail/patent-detail.component.html create mode 100644 webapp/src/app/modules/patent-detail/patent-detail.component.scss create mode 100644 webapp/src/app/modules/patent-detail/patent-detail.component.ts create mode 100644 webapp/src/app/modules/patent-detail/patent-detail.utils.ts diff --git a/service/src/main/inse/patents/all/logic.py b/service/src/main/inse/patents/all/logic.py index 7206fe8a..9cebaa9a 100644 --- a/service/src/main/inse/patents/all/logic.py +++ b/service/src/main/inse/patents/all/logic.py @@ -3,6 +3,7 @@ import asyncio import httpx from fastapi import HTTPException +from starlette.status import HTTP_404_NOT_FOUND from starlette.status import HTTP_502_BAD_GATEWAY from starlette.status import HTTP_503_SERVICE_UNAVAILABLE @@ -82,4 +83,56 @@ async def get_all_patents( page=page, size=size, patents=patents, - ) \ No newline at end of file + ) + + +def _parse_patent_id(patent_id: str) -> tuple[str, str]: + normalized = patent_id.strip().upper() + if normalized.startswith("EP"): + return "EPO", normalized.removeprefix("EP") + if normalized.startswith("US"): + return "USPTO", normalized.removeprefix("US") + raise HTTPException( + status_code=HTTP_404_NOT_FOUND, + detail="Patent not found.", + ) + + +async def get_patent_by_id( + patent_id: str, + ipc_client: IpcSearchClient | None = None, +) -> model.PatentEntry: + source, number = _parse_patent_id(patent_id) + all_patents_client = AllPatentsSearchClient() + ipc_search_client = ipc_client or IpcSearchClient() + + try: + if source == "EPO": + data = await all_patents_client.search_epo( + all_patents_client.epo_detail_query(number) + ) + patents = parse_epo_hits(data) + else: + data = await all_patents_client.search_uspto( + all_patents_client.uspto_detail_query(number) + ) + patents = parse_uspto_hits(data) + except MissingApiKeyError as exc: + raise HTTPException( + status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="Patent search is not configured.", + ) from exc + except httpx.HTTPError as exc: + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="Patent search request failed.", + ) from exc + + if not patents: + raise HTTPException( + status_code=HTTP_404_NOT_FOUND, + detail="Patent not found.", + ) + + await enrich_patents_classifications(patents, ipc_search_client) + return patents[0] \ No newline at end of file diff --git a/service/src/main/inse/patents/all/service.py b/service/src/main/inse/patents/all/service.py index 0d38bb5f..002cc94c 100644 --- a/service/src/main/inse/patents/all/service.py +++ b/service/src/main/inse/patents/all/service.py @@ -32,4 +32,14 @@ async def get_all_patents( sort_direction=sort_direction, year_from=year_from, year_to=year_to, - ) \ No newline at end of file + ) + + +@router.get( + "/patents/{patent_id}", + operation_id="getPatentById", + response_model=model.PatentEntry, + summary="Get a single patent by its identifier.", +) +async def get_patent_by_id(patent_id: str): + return await logic.get_patent_by_id(patent_id) \ No newline at end of file diff --git a/service/src/main/inse/patents/elastic_search_all_patents_client.py b/service/src/main/inse/patents/elastic_search_all_patents_client.py index fa67de96..85585ba4 100644 --- a/service/src/main/inse/patents/elastic_search_all_patents_client.py +++ b/service/src/main/inse/patents/elastic_search_all_patents_client.py @@ -154,6 +154,30 @@ class AllPatentsSearchClient: "query": query, } + def epo_detail_query(self, doc_number: str) -> dict[str, Any]: + return { + "size": 1, + "_source": [ + "doc_number", "country", "kind", "date_publication", + "date_publication_year", "application_number", + "application_filing_date", "title_en", "title_de", + "abstract", "inventors_name", "applicants_name", "ipc", "cpc", + ], + "query": {"term": {"doc_number": doc_number}}, + } + + def uspto_detail_query(self, publication_number: str) -> dict[str, Any]: + return { + "size": 1, + "_source": [ + "publication_number", "country", "publication_date", + "publication_year", "application_number", "application_date", + "application_type", "title", "abstract", "inventors_names", + "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", + ], + "query": {"term": {"publication_number": publication_number}}, + } + async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]: return await self._search(EPO_INDEX, payload) diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index 9bcab67c..73593583 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -257,4 +257,25 @@ export class PatentsService extends BaseService { }, ); } + + public getPatentById(patentId: string): Observable { + const localVarHeaders = this.defaultHeaders; + const { basePath, withCredentials } = this.configuration; + const localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam( + { + name: 'patentId', + value: patentId, + in: 'path', + style: 'simple', + explode: false, + dataType: 'string', + dataFormat: undefined, + }, + )}`; + + return this.httpClient.get(`${basePath}${localVarPath}`, { + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + }); + } } diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index b5cf097a..fd4ad62e 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -77,6 +77,14 @@ export const routes: Routes = [ (mod) => mod.PublicationDetailComponent, ), }, + { + path: 'patent/:patentId', + canActivate: [userGuard], + loadComponent: () => + import('./modules/patent-detail/patent-detail.component').then( + (mod) => mod.PatentDetailComponent, + ), + }, { path: 'projects/dfg/:id', canActivate: [userGuard], diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.html b/webapp/src/app/modules/institution-patents/institution-patents.component.html index d7a0d223..335eca55 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.html +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -6,182 +6,8 @@

Keine Patente gefunden.

} @else {
-
- @if (showDetail && selectedPatent) { -
- - -

{{ selectedPatent.title ?? selectedPatent.patent_id }}

- - @if (hasPatentMetadata(selectedPatent)) { -
-
- @for (row of getPatentMetadataRows(selectedPatent); track row.label) { -
-
{{ row.label }}
-
- @if (row.variant === 'source') { - - {{ row.value }} - - } @else { - {{ row.value }} - } -
-
- } -
-
- } - - @if (selectedPatent.abstract) { -
-

Abstract

-

{{ selectedPatent.abstract }}

-
- } - -
-

Erfinder

-
    - @for (inventor of selectedPatent.inventors; track inventor) { -
  • {{ inventor }}
  • - } -
-
- - @if (selectedPatent.assignees.length > 0) { -
-

Anmelder

-
    - @for (assignee of selectedPatent.assignees; track assignee) { -
  • {{ assignee }}
  • - } -
-
- } - - @if (selectedPatent.ipc_descriptions.length > 0) { -
-

Klassifikation (IPC)

-
- @for (card of getClassificationCards(selectedPatent.ipc_descriptions, 'IPC'); track card.key) { -
-
-
- @for (symbol of card.symbols; track symbol) { - {{ symbol }} - } -
-
- {{ card.system }} - {{ card.levelLabel }} -
-
- - @if (card.primaryDescription) { -

- {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} -

- @if (isLongDescription(card.primaryDescription)) { - - } - } - - @if (card.hierarchy.length > 0) { -
- @for (row of card.hierarchy; track row.label) { -
-
{{ row.label }}
-
{{ row.value }}
-
- } -
- } -
- } -
-
- } @else if (selectedPatent.ipc.length > 0) { -
-

Klassifikation (IPC)

-
    - @for (ipc of selectedPatent.ipc; track ipc) { -
  • {{ ipc }}
  • - } -
-
- } - - @if (selectedPatent.cpc_descriptions.length > 0) { -
-

Klassifikation (CPC)

-
- @for (card of getClassificationCards(selectedPatent.cpc_descriptions, 'CPC'); track card.key) { -
-
-
- @for (symbol of card.symbols; track symbol) { - {{ symbol }} - } -
-
- {{ card.system }} - {{ card.levelLabel }} -
-
- - @if (card.primaryDescription) { -

- {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} -

- @if (isLongDescription(card.primaryDescription)) { - - } - } - - @if (card.hierarchy.length > 0) { -
- @for (row of card.hierarchy; track row.label) { -
-
{{ row.label }}
-
{{ row.value }}
-
- } -
- } -
- } -
-
- } @else if (selectedPatent.cpc.length > 0) { -
-

Klassifikation (CPC)

-
    - @for (cpc of selectedPatent.cpc; track cpc) { -
  • {{ cpc }}
  • - } -
-
- } - -
- } - -
+
- @if (selectedPatent && !showDetail) { + @if (selectedPatent) {

{{ selectedPatent.title ?? selectedPatent.patent_id }}

diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.ts b/webapp/src/app/modules/institution-patents/institution-patents.component.ts index 68e813d0..93b91ac3 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.ts +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -2,28 +2,14 @@ import { Component, OnInit, inject } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ActivatedRoute, Router } from '@angular/router'; import { PatentsService } from '../../api/api/patents.service'; -import { PatentEntry, IpcClassification } from '../../api/model/patentEntry'; +import { PatentEntry } from '../../api/model/patentEntry'; +import { + formatPatentDate, + getPublicationStageLabel, +} from '../patent-detail/patent-detail.utils'; type SortMode = 'date' | 'title'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; -type ClassificationSystem = 'IPC' | 'CPC'; - -interface ClassificationCard { - key: string; - symbols: string[]; - system: ClassificationSystem; - levelLabel: string; - primaryDescription: string | null; - hierarchy: { label: string; value: string }[]; -} - -interface PatentMetadataRow { - label: string; - value: string; - variant?: 'source'; -} - -const DESCRIPTION_PREVIEW_LENGTH = 140; @Component({ selector: 'app-institution-patents', @@ -40,7 +26,6 @@ export class InstitutionPatentsComponent implements OnInit { filteredPatents: PatentEntry[] = []; institutionName: string | null = null; selectedPatent: PatentEntry | null = null; - showDetail = false; loading = true; error = false; @@ -50,7 +35,6 @@ export class InstitutionPatentsComponent implements OnInit { selectedPage = 1; readonly pageSize = 10; - private expandedClassificationKeys = new Set(); ngOnInit(): void { this.route.parent?.paramMap.subscribe((params) => { @@ -89,7 +73,6 @@ export class InstitutionPatentsComponent implements OnInit { this.activeFilter = filter; this.selectedPage = 1; this.selectedPatent = null; - this.showDetail = false; this.applyFilter(); this.updateQueryParams(); } @@ -102,19 +85,12 @@ export class InstitutionPatentsComponent implements OnInit { selectPatent(patent: PatentEntry): void { this.selectedPatent = patent; - this.showDetail = false; - this.expandedClassificationKeys.clear(); this.updateQueryParams(); } openDetail(): void { - this.showDetail = true; - this.expandedClassificationKeys.clear(); - } - - closeDetail(): void { - this.showDetail = false; - this.expandedClassificationKeys.clear(); + if (!this.selectedPatent) return; + this.router.navigate(['/patent', this.selectedPatent.patent_id]); } private applyFilter(): void { @@ -175,9 +151,7 @@ export class InstitutionPatentsComponent implements OnInit { } formatDate(date: string | null): string { - if (!date) return '-'; - const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); - return new Intl.DateTimeFormat('de-DE').format(new Date(d)); + return formatPatentDate(date); } getEpoCount(): number { @@ -209,200 +183,6 @@ export class InstitutionPatentsComponent implements OnInit { } getPublicationStageLabel(patent: PatentEntry): string | null { - if (patent.kind) { - return patent.kind; - } - if (patent.application_type) { - return patent.application_type; - } - return null; - } - - hasPatentMetadata(_patent: PatentEntry): boolean { - return true; - } - - getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] { - const rows: PatentMetadataRow[] = []; - - rows.push({ label: 'Quelle', value: patent.source, variant: 'source' }); - rows.push({ label: 'Patent-Nr.', value: patent.patent_id }); - - if (patent.publication_date) { - rows.push({ - label: 'Veröffentlichungsdatum', - value: this.formatDate(patent.publication_date), - }); - } - if (patent.application_number) { - rows.push({ label: 'Anmeldungsnummer', value: patent.application_number }); - } - if (patent.application_date) { - rows.push({ label: 'Anmeldedatum', value: this.formatDate(patent.application_date) }); - } - - const stageLabel = this.getPublicationStageLabel(patent); - if (stageLabel) { - rows.push({ - label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp', - value: patent.kind ? stageLabel : this.formatMetadataLabel(stageLabel), - }); - } - if (patent.number_of_claims != null) { - rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) }); - } - if (patent.status) { - rows.push({ label: 'Status', value: this.formatMetadataLabel(patent.status) }); - } - - return rows; - } - - private formatMetadataLabel(value: string): string { - return value - .replace(/_/g, ' ') - .toLowerCase() - .replace(/\b\w/g, (char) => char.toUpperCase()); - } - - getClassificationCards( - entries: IpcClassification[] | undefined, - system: ClassificationSystem, - ): ClassificationCard[] { - if (!entries?.length) { - return []; - } - - const merged = new Map(); - - for (const entry of entries) { - const card = this.buildClassificationCard(entry, system); - const mergeKey = - card.primaryDescription?.toLocaleLowerCase('en') ?? card.symbols[0] ?? card.key; - - const existing = merged.get(mergeKey); - if (existing) { - for (const symbol of card.symbols) { - if (!existing.symbols.includes(symbol)) { - existing.symbols.push(symbol); - } - } - continue; - } - - merged.set(mergeKey, card); - } - - return [...merged.values()]; - } - - toggleClassificationExpanded(key: string): void { - if (this.expandedClassificationKeys.has(key)) { - this.expandedClassificationKeys.delete(key); - return; - } - this.expandedClassificationKeys.add(key); - } - - isClassificationExpanded(key: string): boolean { - return this.expandedClassificationKeys.has(key); - } - - isLongDescription(text: string | null): boolean { - return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH; - } - - getDescriptionPreview(text: string | null): string { - if (!text) { - return ''; - } - if (text.length <= DESCRIPTION_PREVIEW_LENGTH) { - return text; - } - return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`; - } - - private buildClassificationCard( - entry: IpcClassification, - system: ClassificationSystem, - ): ClassificationCard { - const level = this.getClassificationLevel(entry); - const primaryDescription = this.extractDescriptionText(entry[level.field]); - - return { - key: `${system}-${entry.symbol}`, - symbols: [entry.symbol], - system, - levelLabel: level.label, - primaryDescription, - hierarchy: this.buildHierarchyRows(entry, primaryDescription), - }; - } - - private getClassificationLevel(entry: IpcClassification): { - label: string; - field: keyof IpcClassification; - } { - if (entry.subgroup) { - return { label: 'Untergruppe', field: 'subgroup' }; - } - if (entry.main_group) { - return { label: 'Hauptgruppe', field: 'main_group' }; - } - if (entry.subclass) { - return { label: 'Unterklasse', field: 'subclass' }; - } - if (entry.section) { - return { label: 'Sektion', field: 'section' }; - } - return { label: 'Code', field: 'symbol' }; - } - - private buildHierarchyRows( - entry: IpcClassification, - primaryDescription: string | null, - ): { label: string; value: string }[] { - const rows: { label: string; value: string }[] = []; - const seen = new Set(); - - const addRow = (label: string, raw: string | null) => { - const value = this.extractDescriptionText(raw); - if (!value) { - return; - } - const normalized = value.toLocaleLowerCase('en'); - if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) { - return; - } - seen.add(normalized); - rows.push({ label, value }); - }; - - addRow('Sektion', entry.section); - addRow('Klasse', entry.class); - addRow('Unterklasse', entry.subclass); - - return rows; - } - - private extractDescriptionText(value: string | null | undefined): string | null { - if (!value?.trim()) { - return null; - } - - const text = value.includes(' - ') ? value.split(' - ').slice(1).join(' - ').trim() : value.trim(); - if (!text) { - return null; - } - - const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text; - return this.normalizeDescriptionCase(firstSentence); - } - - private normalizeDescriptionCase(text: string): string { - if (text !== text.toUpperCase()) { - return text; - } - return text.charAt(0) + text.slice(1).toLowerCase(); + return getPublicationStageLabel(patent); } } diff --git a/webapp/src/app/modules/patent-detail/patent-detail.component.html b/webapp/src/app/modules/patent-detail/patent-detail.component.html new file mode 100644 index 00000000..ff86b654 --- /dev/null +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.html @@ -0,0 +1,319 @@ +
+ + + @if (loading) { +
+ +

Patent wird geladen...

+
+ } @else if (notFound || !patent) { +
+ search_off +

Patent nicht gefunden

+

Das Patent konnte nicht geladen werden.

+ Zur Patentübersicht +
+ } @else { +
+
+
+ + {{ patent.source }} + + @if (patent.publication_year) { + {{ patent.publication_year }} + } + @if (stageLabel(); as stage) { + {{ stage }} + } +
+

{{ patent.title || patent.patent_id || 'Ohne Titel' }}

+

+ {{ patent.patent_id }} + @if (patent.publication_date) { + · {{ formatDate(patent.publication_date) }} + } +

+
+ @for (link of externalLinks(); track link.url; let first = $first) { + + {{ link.label }} + open_in_new + + } +
+
+ +
+
+ groups + {{ patent.inventors.length }} + Erfinder +
+
+ business + {{ patent.assignees.length }} + Anmelder +
+
+ category + {{ patent.ipc.length + patent.cpc.length }} + Klassifikationen +
+
+
+ +
+
+ @if (patent.abstract) { +
+
+ subject +

Abstract

+
+

{{ patent.abstract }}

+
+ } + +
+
+ engineering +

Erfinder

+ {{ patent.inventors.length }} +
+
+ @for (inventor of patent.inventors; track inventor) { + {{ inventor }} + } @empty { +

Keine Angaben vorhanden.

+ } +
+
+ + @if (patent.assignees.length > 0) { +
+
+ account_balance +

Anmelder

+ {{ patent.assignees.length }} +
+
+ @for (assignee of patent.assignees; track assignee) { +
+ {{ assignee }} +
+ } +
+
+ } + + @if (patent.ipc_descriptions.length > 0) { +
+
+ label +

Klassifikation (IPC)

+
+
+ @for ( + card of classificationCards(patent.ipc_descriptions, 'IPC'); + track card.key + ) { +
+
+
+ @for (symbol of card.symbols; track symbol) { + {{ symbol }} + } +
+
+ + {{ card.system }} + + + {{ card.levelLabel }} + +
+
+ @if (card.primaryDescription) { +

+ {{ + isClassificationExpanded(card.key) + ? card.primaryDescription + : getDescriptionPreview(card.primaryDescription) + }} +

+ @if (isLongDescription(card.primaryDescription)) { + + } + } + @if (card.hierarchy.length > 0) { +
+ @for (row of card.hierarchy; track row.label) { +
+
{{ row.label }}
+
{{ row.value }}
+
+ } +
+ } +
+ } +
+
+ } @else if (patent.ipc.length > 0) { +
+
+ label +

Klassifikation (IPC)

+
+
+ @for (ipc of patent.ipc; track ipc) { + {{ ipc }} + } +
+
+ } + + @if (patent.cpc_descriptions.length > 0) { +
+
+ label +

Klassifikation (CPC)

+
+
+ @for ( + card of classificationCards(patent.cpc_descriptions, 'CPC'); + track card.key + ) { +
+
+
+ @for (symbol of card.symbols; track symbol) { + {{ symbol }} + } +
+
+ + {{ card.system }} + + + {{ card.levelLabel }} + +
+
+ @if (card.primaryDescription) { +

+ {{ + isClassificationExpanded(card.key) + ? card.primaryDescription + : getDescriptionPreview(card.primaryDescription) + }} +

+ @if (isLongDescription(card.primaryDescription)) { + + } + } + @if (card.hierarchy.length > 0) { +
+ @for (row of card.hierarchy; track row.label) { +
+
{{ row.label }}
+
{{ row.value }}
+
+ } +
+ } +
+ } +
+
+ } @else if (patent.cpc.length > 0) { +
+
+ label +

Klassifikation (CPC)

+
+
+ @for (cpc of patent.cpc; track cpc) { + {{ cpc }} + } +
+
+ } +
+ + +
+ } +
diff --git a/webapp/src/app/modules/patent-detail/patent-detail.component.scss b/webapp/src/app/modules/patent-detail/patent-detail.component.scss new file mode 100644 index 00000000..6e9a4afc --- /dev/null +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.scss @@ -0,0 +1,462 @@ +:host { + display: block; + background: var(--sg-background); +} + +.detail-page { + max-width: 1500px; + margin: 0 auto; + padding: 26px 32px 56px; +} + +.back-link { + display: inline-flex; + align-items: center; + gap: 7px; + margin-bottom: 22px; + padding: 0; + border: 0; + background: transparent; + color: var(--sg-text-muted); + font-size: 13px; + font-weight: 600; + text-decoration: none; + cursor: pointer; +} + +.back-link mat-icon { + width: 18px; + height: 18px; + font-size: 18px; +} + +.hero { + display: grid; + grid-template-columns: minmax(0, 1fr) 420px; + gap: 42px; + padding: 38px 42px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-lg); + background: + radial-gradient( + circle at 90% 10%, + rgba(200, 217, 255, 0.75), + transparent 35% + ), + linear-gradient(140deg, #fff 0%, #f8faff 100%); + box-shadow: var(--sg-shadow-sm); +} + +.eyebrow, +.tags, +.hero-actions { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.eyebrow span { + padding: 5px 10px; + border: 1px solid var(--sg-border); + border-radius: 999px; + background: rgba(255, 255, 255, 0.85); + color: var(--sg-text-muted); + font-size: 11px; + font-weight: 700; + text-transform: uppercase; +} + +h1 { + max-width: 920px; + margin: 20px 0 13px; + font-size: clamp(27px, 3vw, 42px); + line-height: 1.13; +} + +.meta-line { + max-width: 900px; + margin: 0; + color: var(--sg-text-muted); + font-size: 14px; + line-height: 1.7; +} + +.hero-actions { + margin-top: 26px; +} + +.hero-actions a { + display: inline-flex; + align-items: center; + gap: 8px; + min-height: 42px; + padding: 9px 16px; + border: 1px solid var(--sg-border-strong); + border-radius: var(--sg-radius-sm); + background: #fff; + color: var(--sg-text); + font-weight: 700; + text-decoration: none; +} + +.hero-actions a.primary-action { + border-color: var(--sg-primary); + background: var(--sg-primary); + color: #fff; +} + +.hero-actions mat-icon { + width: 17px; + height: 17px; + font-size: 17px; +} + +.metrics { + display: grid; + grid-template-columns: repeat(3, 1fr); + align-self: center; + overflow: hidden; + border: 1px solid rgba(199, 211, 232, 0.8); + border-radius: var(--sg-radius-md); + background: rgba(255, 255, 255, 0.8); +} + +.metrics div { + display: flex; + align-items: center; + flex-direction: column; + gap: 5px; + padding: 22px 10px; + text-align: center; +} + +.metrics div + div { + border-left: 1px solid var(--sg-border); +} + +.metrics mat-icon { + color: var(--sg-text-soft); +} + +.metrics strong { + color: var(--sg-text); + font-family: 'Montserrat', 'Open Sans', sans-serif; + font-size: 22px; +} + +.metrics span { + color: var(--sg-text-muted); + font-size: 11px; +} + +.content-grid { + display: grid; + grid-template-columns: minmax(0, 1fr) 380px; + gap: 24px; + margin-top: 24px; +} + +main, +aside { + display: flex; + flex-direction: column; + gap: 24px; +} + +.card { + padding: 26px 28px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-md); + background: var(--sg-surface); + box-shadow: var(--sg-shadow-sm); +} + +.section-title { + display: flex; + align-items: center; + gap: 10px; + margin-bottom: 20px; +} + +.section-title mat-icon { + color: var(--sg-text-muted); +} + +.section-title h2 { + margin: 0; + font-size: 16px; +} + +.section-title span { + margin-left: auto; + color: var(--sg-text-muted); + font-size: 12px; +} + +.abstract-card p { + margin: 0; + color: var(--sg-text); + font-size: 14px; + line-height: 1.8; +} + +.tags span { + padding: 7px 10px; + border: 1px solid var(--sg-border); + border-radius: 999px; + color: var(--sg-text-muted); + font-size: 11px; +} + +.compact-list, +.link-list { + display: grid; + gap: 10px; +} + +.compact-list div { + display: flex; + align-items: flex-start; + flex-direction: column; + gap: 3px; + padding: 13px 0; + border-bottom: 1px solid var(--sg-border); +} + +.compact-list div:last-child { + border-bottom: 0; +} + +.compact-list strong { + font-size: 12px; +} + +dl { + margin: 0; +} + +dl div { + display: grid; + grid-template-columns: 115px minmax(0, 1fr); + gap: 12px; + padding: 10px 0; + border-bottom: 1px solid var(--sg-border); +} + +dl div:last-child { + border-bottom: 0; +} + +dt { + color: var(--sg-text-muted); + font-size: 12px; +} + +dd { + margin: 0; + overflow-wrap: anywhere; + color: var(--sg-text); + font-size: 12px; + font-weight: 600; + text-align: right; +} + +.link-list a { + display: flex; + align-items: center; + justify-content: space-between; + padding: 10px 0; + border-bottom: 1px solid var(--sg-border); + color: var(--sg-text); + font-size: 12px; + font-weight: 700; + text-decoration: none; +} + +.link-list a:last-child { + border-bottom: 0; +} + +.link-list mat-icon { + width: 16px; + height: 16px; + color: var(--sg-text-muted); + font-size: 16px; +} + +.state { + display: grid; + place-items: center; + min-height: 380px; + color: var(--sg-text-muted); + text-align: center; +} + +.error-state mat-icon { + width: 46px; + height: 46px; + font-size: 46px; +} + +.empty { + color: var(--sg-text-muted); +} + +.source-badge { + display: inline-flex; + align-items: center; + padding: 4px 10px; + border-radius: 999px; + font-size: 11px; + font-weight: 700; + text-transform: uppercase; +} + +.source-badge--epo { + background: #e8f7ee; + color: #1f7a43; +} + +.source-badge--uspto { + background: #eef3ff; + color: #1f4fbf; +} + +.classification-cards { + display: grid; + gap: 12px; +} + +.classification-card { + padding: 16px; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-surface-muted); +} + +.classification-card-section--ipc .classification-card { + background: #f4f8ff; +} + +.classification-card-section--cpc .classification-card { + background: #f3fbf5; +} + +.classification-card__header { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 12px; + margin-bottom: 10px; +} + +.classification-card__codes { + display: flex; + flex-wrap: wrap; + gap: 8px; +} + +.classification-code { + padding: 4px 8px; + border-radius: 6px; + background: #fff; + color: var(--sg-text); + font-size: 12px; + font-weight: 700; +} + +.classification-card__badges { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +.classification-badge { + padding: 3px 8px; + border-radius: 999px; + font-size: 10px; + font-weight: 700; + text-transform: uppercase; +} + +.classification-badge--system { + background: #e8eef8; + color: #35507a; +} + +.classification-badge--level { + background: #fff; + color: var(--sg-text-muted); +} + +.classification-summary { + margin: 0 0 8px; + color: var(--sg-text); + font-size: 13px; + line-height: 1.6; +} + +.classification-toggle { + padding: 0; + border: 0; + background: transparent; + color: var(--sg-primary); + font-size: 12px; + font-weight: 700; + cursor: pointer; +} + +.classification-hierarchy { + margin: 12px 0 0; +} + +.classification-hierarchy__row { + display: grid; + grid-template-columns: 90px minmax(0, 1fr); + gap: 10px; + padding: 6px 0; + border-top: 1px solid rgba(0, 0, 0, 0.06); +} + +.classification-hierarchy__row dt { + color: var(--sg-text-muted); + font-size: 11px; +} + +.classification-hierarchy__row dd { + margin: 0; + color: var(--sg-text); + font-size: 12px; + text-align: left; +} + +@media (max-width: 1150px) { + .hero, + .content-grid { + grid-template-columns: 1fr; + } + + .metrics { + width: 100%; + } +} + +@media (max-width: 700px) { + .detail-page { + padding: 18px 16px 40px; + } + + .hero, + .card { + padding: 22px 20px; + } + + .metrics { + grid-template-columns: 1fr; + } + + .metrics div + div { + border-top: 1px solid var(--sg-border); + border-left: 0; + } +} diff --git a/webapp/src/app/modules/patent-detail/patent-detail.component.ts b/webapp/src/app/modules/patent-detail/patent-detail.component.ts new file mode 100644 index 00000000..53b4dfc7 --- /dev/null +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.ts @@ -0,0 +1,127 @@ +import { Location } from '@angular/common'; +import { Component, DestroyRef, OnInit, inject } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { MatButtonModule } from '@angular/material/button'; +import { MatIconModule } from '@angular/material/icon'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { ActivatedRoute, RouterLink } from '@angular/router'; +import { finalize } from 'rxjs'; + +import { PatentsService } from '../../api/api/patents.service'; +import { PatentEntry } from '../../api/model/patentEntry'; +import { + ClassificationCard, + ClassificationSystem, + formatPatentDate, + getClassificationCards, + getDescriptionPreview, + getPatentMetadataRows, + getPublicationStageLabel, + isLongDescription, + patentExternalLinks, +} from './patent-detail.utils'; + +@Component({ + selector: 'app-patent-detail', + imports: [ + MatButtonModule, + MatIconModule, + MatProgressSpinnerModule, + RouterLink, + ], + templateUrl: './patent-detail.component.html', + styleUrl: './patent-detail.component.scss', +}) +export class PatentDetailComponent implements OnInit { + private readonly destroyRef = inject(DestroyRef); + private readonly route = inject(ActivatedRoute); + private readonly patentsService = inject(PatentsService); + private readonly location = inject(Location); + + patent: PatentEntry | null = null; + loading = true; + notFound = false; + + private expandedClassificationKeys = new Set(); + + ngOnInit(): void { + this.route.paramMap + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((params) => { + const patentId = params.get('patentId'); + if (!patentId) { + this.loading = false; + this.notFound = true; + return; + } + + this.loadPatent(patentId); + }); + } + + navigateBack(): void { + this.location.back(); + } + + formatDate(date: string | null | undefined): string { + return formatPatentDate(date); + } + + metadataRows() { + return this.patent ? getPatentMetadataRows(this.patent) : []; + } + + stageLabel(): string | null { + return this.patent ? getPublicationStageLabel(this.patent) : null; + } + + externalLinks() { + return this.patent ? patentExternalLinks(this.patent) : []; + } + + classificationCards( + entries: PatentEntry['ipc_descriptions'], + system: ClassificationSystem, + ): ClassificationCard[] { + return getClassificationCards(entries, system); + } + + toggleClassificationExpanded(key: string): void { + if (this.expandedClassificationKeys.has(key)) { + this.expandedClassificationKeys.delete(key); + return; + } + this.expandedClassificationKeys.add(key); + } + + isClassificationExpanded(key: string): boolean { + return this.expandedClassificationKeys.has(key); + } + + isLongDescription(text: string | null): boolean { + return isLongDescription(text); + } + + getDescriptionPreview(text: string | null): string { + return getDescriptionPreview(text); + } + + private loadPatent(patentId: string): void { + this.loading = true; + this.notFound = false; + this.patent = null; + this.expandedClassificationKeys.clear(); + + this.patentsService + .getPatentById(patentId) + .pipe(finalize(() => (this.loading = false))) + .subscribe({ + next: (patent) => { + this.patent = patent; + }, + error: () => { + this.notFound = true; + }, + }); + } +} diff --git a/webapp/src/app/modules/patent-detail/patent-detail.utils.ts b/webapp/src/app/modules/patent-detail/patent-detail.utils.ts new file mode 100644 index 00000000..f98338a5 --- /dev/null +++ b/webapp/src/app/modules/patent-detail/patent-detail.utils.ts @@ -0,0 +1,205 @@ +import { IpcClassification, PatentEntry } from '../../api/model/patentEntry'; + +export type ClassificationSystem = 'IPC' | 'CPC'; + +export interface ClassificationCard { + key: string; + symbols: string[]; + system: ClassificationSystem; + levelLabel: string; + primaryDescription: string | null; + hierarchy: { label: string; value: string }[]; +} + +export interface PatentMetadataRow { + label: string; + value: string; + variant?: 'source'; +} + +const DESCRIPTION_PREVIEW_LENGTH = 140; + +export function formatPatentDate(date: string | null | undefined): string { + if (!date) return '-'; + const normalized = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); + const parsed = new Date(normalized); + if (isNaN(parsed.getTime())) return date; + return new Intl.DateTimeFormat('de-DE').format(parsed); +} + +export function formatMetadataLabel(value: string): string { + return value + .replace(/_/g, ' ') + .toLowerCase() + .replace(/\b\w/g, (char) => char.toUpperCase()); +} + +export function getPublicationStageLabel(patent: PatentEntry): string | null { + return patent.kind ?? patent.application_type ?? null; +} + +export function getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] { + const rows: PatentMetadataRow[] = [ + { label: 'Quelle', value: patent.source, variant: 'source' }, + { label: 'Patent-Nr.', value: patent.patent_id }, + ]; + + if (patent.publication_date) { + rows.push({ + label: 'Veröffentlichungsdatum', + value: formatPatentDate(patent.publication_date), + }); + } + if (patent.application_number) { + rows.push({ label: 'Anmeldungsnummer', value: patent.application_number }); + } + if (patent.application_date) { + rows.push({ + label: 'Anmeldedatum', + value: formatPatentDate(patent.application_date), + }); + } + + const stageLabel = getPublicationStageLabel(patent); + if (stageLabel) { + rows.push({ + label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp', + value: patent.kind ? stageLabel : formatMetadataLabel(stageLabel), + }); + } + if (patent.number_of_claims != null) { + rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) }); + } + if (patent.status) { + rows.push({ label: 'Status', value: formatMetadataLabel(patent.status) }); + } + + return rows; +} + +export function getClassificationCards( + entries: IpcClassification[] | undefined, + system: ClassificationSystem, +): ClassificationCard[] { + if (!entries?.length) return []; + + const merged = new Map(); + + for (const entry of entries) { + const card = buildClassificationCard(entry, system); + const mergeKey = + card.primaryDescription?.toLocaleLowerCase('en') ?? + card.symbols[0] ?? + card.key; + + const existing = merged.get(mergeKey); + if (existing) { + for (const symbol of card.symbols) { + if (!existing.symbols.includes(symbol)) { + existing.symbols.push(symbol); + } + } + continue; + } + + merged.set(mergeKey, card); + } + + return [...merged.values()]; +} + +export function isLongDescription(text: string | null): boolean { + return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH; +} + +export function getDescriptionPreview(text: string | null): string { + if (!text) return ''; + if (text.length <= DESCRIPTION_PREVIEW_LENGTH) return text; + return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`; +} + +export function patentExternalLinks(patent: PatentEntry): { label: string; url: string }[] { + const links: { label: string; url: string }[] = []; + const encodedId = encodeURIComponent(patent.patent_id); + + if (patent.source === 'EPO') { + links.push({ + label: 'Espacenet', + url: `https://worldwide.espacenet.com/patent/search?q=pn%3D${encodedId}`, + }); + } + if (patent.source === 'USPTO') { + links.push({ + label: 'Google Patents', + url: `https://patents.google.com/patent/${encodedId}`, + }); + } + + return links; +} + +function buildClassificationCard( + entry: IpcClassification, + system: ClassificationSystem, +): ClassificationCard { + const level = getClassificationLevel(entry); + const primaryDescription = extractDescriptionText(entry[level.field]); + + return { + key: `${system}-${entry.symbol}`, + symbols: [entry.symbol], + system, + levelLabel: level.label, + primaryDescription, + hierarchy: buildHierarchyRows(entry, primaryDescription), + }; +} + +function getClassificationLevel(entry: IpcClassification): { + label: string; + field: keyof IpcClassification; +} { + if (entry.subgroup) return { label: 'Untergruppe', field: 'subgroup' }; + if (entry.main_group) return { label: 'Hauptgruppe', field: 'main_group' }; + if (entry.subclass) return { label: 'Unterklasse', field: 'subclass' }; + if (entry.section) return { label: 'Sektion', field: 'section' }; + return { label: 'Code', field: 'symbol' }; +} + +function buildHierarchyRows( + entry: IpcClassification, + primaryDescription: string | null, +): { label: string; value: string }[] { + const rows: { label: string; value: string }[] = []; + const seen = new Set(); + + const addRow = (label: string, raw: string | null) => { + const value = extractDescriptionText(raw); + if (!value) return; + const normalized = value.toLocaleLowerCase('en'); + if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) { + return; + } + seen.add(normalized); + rows.push({ label, value }); + }; + + addRow('Sektion', entry.section); + addRow('Klasse', entry.class); + addRow('Unterklasse', entry.subclass); + + return rows; +} + +function extractDescriptionText(value: string | null | undefined): string | null { + if (!value?.trim()) return null; + + const text = value.includes(' - ') + ? value.split(' - ').slice(1).join(' - ').trim() + : value.trim(); + if (!text) return null; + + const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text; + if (firstSentence !== firstSentence.toUpperCase()) return firstSentence; + return firstSentence.charAt(0) + firstSentence.slice(1).toLowerCase(); +} diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index 6ffe47bd..3e3a64c6 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -85,213 +85,6 @@
} @else if (error) {

Fehler beim Laden der Patente.

- } @else if (showDetail && selectedPatent) { -
- - -

{{ selectedPatent.title ?? selectedPatent.patent_id }}

- -
- @for (row of getPatentMetadataRows(selectedPatent); track row.label) { -
-
{{ row.label }}
-
- @if (row.variant === 'source') { - {{ row.value }} - } @else { - {{ row.value }} - } -
-
- } -
- - @if (selectedPatent.abstract) { -
-

Abstract

-

{{ selectedPatent.abstract }}

-
- } - -
-

Erfinder

-
    - @for (inv of selectedPatent.inventors; track inv) { -
  • {{ inv }}
  • - } -
-
- - @if (selectedPatent.assignees.length > 0) { -
-

Anmelder

-
    - @for (a of selectedPatent.assignees; track a) { -
  • {{ a }}
  • - } -
-
- } - - @if (selectedPatent.ipc_descriptions.length > 0) { -
-

Klassifikation (IPC)

-
- @for ( - card of getClassificationCards( - selectedPatent.ipc_descriptions, - 'IPC' - ); - track card.key - ) { -
-
-
- @for (sym of card.symbols; track sym) { - {{ sym }} - } -
-
- {{ card.system }} - {{ card.levelLabel }} -
-
- @if (card.primaryDescription) { -

- {{ - isClassificationExpanded(card.key) - ? card.primaryDescription - : getDescriptionPreview(card.primaryDescription) - }} -

- @if (isLongDescription(card.primaryDescription)) { - - } - } - @if (card.hierarchy.length > 0) { -
- @for (row of card.hierarchy; track row.label) { -
-
{{ row.label }}
-
{{ row.value }}
-
- } -
- } -
- } -
-
- } @else if (selectedPatent.ipc.length > 0) { -
-

Klassifikation (IPC)

-
    - @for (ipc of selectedPatent.ipc; track ipc) { -
  • {{ ipc }}
  • - } -
-
- } - - @if (selectedPatent.cpc_descriptions.length > 0) { -
-

Klassifikation (CPC)

-
- @for ( - card of getClassificationCards( - selectedPatent.cpc_descriptions, - 'CPC' - ); - track card.key - ) { -
-
-
- @for (sym of card.symbols; track sym) { - {{ sym }} - } -
-
- {{ card.system }} - {{ card.levelLabel }} -
-
- @if (card.primaryDescription) { -

- {{ - isClassificationExpanded(card.key) - ? card.primaryDescription - : getDescriptionPreview(card.primaryDescription) - }} -

- @if (isLongDescription(card.primaryDescription)) { - - } - } - @if (card.hierarchy.length > 0) { -
- @for (row of card.hierarchy; track row.label) { -
-
{{ row.label }}
-
{{ row.value }}
-
- } -
- } -
- } -
-
- } @else if (selectedPatent.cpc.length > 0) { -
-

Klassifikation (CPC)

-
    - @for (cpc of selectedPatent.cpc; track cpc) { -
  • {{ cpc }}
  • - } -
-
- } -
} @else if (patents.length === 0) {

Keine Patente gefunden.

@@ -305,7 +98,7 @@ + (click)="openPatent(patent)"> {{ patent.title ?? patent.patent_id @@ -331,7 +124,7 @@ @@ -344,12 +137,10 @@ - @if (!showDetail) { - - }
diff --git a/webapp/src/app/modules/patents/patents.component.ts b/webapp/src/app/modules/patents/patents.component.ts index c0d056f0..42a04222 100644 --- a/webapp/src/app/modules/patents/patents.component.ts +++ b/webapp/src/app/modules/patents/patents.component.ts @@ -13,21 +13,10 @@ import { MatDividerModule } from '@angular/material/divider'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { debounceTime, distinctUntilChanged, Subject } from 'rxjs'; import { PatentsService } from '../../api/api/patents.service'; -import { PatentEntry, IpcClassification } from '../../api/model/patentEntry'; +import { PatentEntry } from '../../api/model/patentEntry'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; -type ClassificationSystem = 'IPC' | 'CPC'; -interface ClassificationCard { - key: string; - symbols: string[]; - system: ClassificationSystem; - levelLabel: string; - primaryDescription: string | null; - hierarchy: { label: string; value: string }[]; -} - -const DESCRIPTION_PREVIEW_LENGTH = 140; const MIN_YEAR = 1978; @Component({ @@ -71,9 +60,6 @@ export class PatentsComponent implements OnInit { selectedStartYear = MIN_YEAR; selectedEndYear = new Date().getFullYear(); - selectedPatent: PatentEntry | null = null; - showDetail = false; - private expandedClassificationKeys = new Set(); private searchSubject = new Subject(); constructor() { @@ -82,8 +68,6 @@ export class PatentsComponent implements OnInit { .subscribe((term) => { this.searchTerm = term; this.page = 0; - this.selectedPatent = null; - this.showDetail = false; this.loadPatents(); this.updateQueryParams(); }); @@ -180,8 +164,6 @@ export class PatentsComponent implements OnInit { clearSearch(): void { this.searchTerm = ''; this.page = 0; - this.selectedPatent = null; - this.showDetail = false; this.loadPatents(); this.updateQueryParams(); } @@ -190,8 +172,6 @@ export class PatentsComponent implements OnInit { const val = event.value; this.activeFilter = val === 'EPO' || val === 'USPTO' ? val : 'all'; this.page = 0; - this.selectedPatent = null; - this.showDetail = false; this.loadPatents(); this.updateQueryParams(); } @@ -205,22 +185,12 @@ export class PatentsComponent implements OnInit { handlePageChange(event: PageEvent): void { this.page = event.pageIndex; this.pageSize = event.pageSize; - this.selectedPatent = null; - this.showDetail = false; this.loadPatents(); this.updateQueryParams(); } - selectPatent(patent: PatentEntry): void { - this.selectedPatent = patent; - this.showDetail = true; - this.expandedClassificationKeys.clear(); - } - - closeDetail(): void { - this.showDetail = false; - this.selectedPatent = null; - this.expandedClassificationKeys.clear(); + openPatent(patent: PatentEntry): void { + this.router.navigate(['/patent', patent.patent_id]); } private updateQueryParams(): void { @@ -247,117 +217,4 @@ export class PatentsComponent implements OnInit { if (isNaN(parsed.getTime())) return date; return new Intl.DateTimeFormat('de-DE').format(parsed); } - - getPublicationStageLabel(patent: PatentEntry): string | null { - return patent.kind ?? patent.application_type ?? null; - } - - getPatentMetadataRows(patent: PatentEntry) { - const rows: { label: string; value: string; variant?: 'source' }[] = []; - rows.push({ label: 'Quelle', value: patent.source, variant: 'source' }); - rows.push({ label: 'Patent-Nr.', value: patent.patent_id }); - if (patent.publication_date) - rows.push({ label: 'Veröffentlichungsdatum', value: this.formatDate(patent.publication_date) }); - if (patent.application_number) - rows.push({ label: 'Anmeldungsnummer', value: patent.application_number }); - if (patent.application_date) - rows.push({ label: 'Anmeldedatum', value: this.formatDate(patent.application_date) }); - const stage = this.getPublicationStageLabel(patent); - if (stage) - rows.push({ label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp', value: this.formatMetadataLabel(stage) }); - if (patent.number_of_claims != null) - rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) }); - if (patent.status) - rows.push({ label: 'Status', value: this.formatMetadataLabel(patent.status) }); - return rows; - } - - private formatMetadataLabel(value: string): string { - return value.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, (c) => c.toUpperCase()); - } - - getClassificationCards(entries: IpcClassification[] | undefined, system: ClassificationSystem): ClassificationCard[] { - if (!entries?.length) return []; - const merged = new Map(); - for (const entry of entries) { - const card = this.buildClassificationCard(entry, system); - const mergeKey = card.primaryDescription?.toLocaleLowerCase('en') ?? card.symbols[0] ?? card.key; - const existing = merged.get(mergeKey); - if (existing) { - for (const s of card.symbols) { - if (!existing.symbols.includes(s)) existing.symbols.push(s); - } - continue; - } - merged.set(mergeKey, card); - } - return [...merged.values()]; - } - - toggleClassificationExpanded(key: string): void { - this.expandedClassificationKeys.has(key) - ? this.expandedClassificationKeys.delete(key) - : this.expandedClassificationKeys.add(key); - } - - isClassificationExpanded(key: string): boolean { - return this.expandedClassificationKeys.has(key); - } - - isLongDescription(text: string | null): boolean { - return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH; - } - - getDescriptionPreview(text: string | null): string { - if (!text) return ''; - return text.length <= DESCRIPTION_PREVIEW_LENGTH - ? text - : `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`; - } - - private buildClassificationCard(entry: IpcClassification, system: ClassificationSystem): ClassificationCard { - const level = this.getClassificationLevel(entry); - const primaryDescription = this.extractDescriptionText(entry[level.field]); - return { - key: `${system}-${entry.symbol}`, - symbols: [entry.symbol], - system, - levelLabel: level.label, - primaryDescription, - hierarchy: this.buildHierarchyRows(entry, primaryDescription), - }; - } - - private getClassificationLevel(entry: IpcClassification): { label: string; field: keyof IpcClassification } { - if (entry.subgroup) return { label: 'Untergruppe', field: 'subgroup' }; - if (entry.main_group) return { label: 'Hauptgruppe', field: 'main_group' }; - if (entry.subclass) return { label: 'Unterklasse', field: 'subclass' }; - if (entry.section) return { label: 'Sektion', field: 'section' }; - return { label: 'Code', field: 'symbol' }; - } - - private buildHierarchyRows(entry: IpcClassification, primaryDescription: string | null) { - const rows: { label: string; value: string }[] = []; - const seen = new Set(); - const addRow = (label: string, raw: string | null) => { - const value = this.extractDescriptionText(raw); - if (!value) return; - const norm = value.toLocaleLowerCase('en'); - if (seen.has(norm) || norm === primaryDescription?.toLocaleLowerCase('en')) return; - seen.add(norm); - rows.push({ label, value }); - }; - addRow('Sektion', entry.section); - addRow('Klasse', entry.class); - addRow('Unterklasse', entry.subclass); - return rows; - } - - private extractDescriptionText(value: string | null | undefined): string | null { - if (!value?.trim()) return null; - const text = value.includes(' - ') ? value.split(' - ').slice(1).join(' - ').trim() : value.trim(); - if (!text) return null; - const first = text.split(/[;|]/)[0]?.trim() ?? text; - return first === first.toUpperCase() ? first.charAt(0) + first.slice(1).toLowerCase() : first; - } } diff --git a/webapp/src/app/modules/person-patents/person-patents.component.html b/webapp/src/app/modules/person-patents/person-patents.component.html index b8389633..085a9c9b 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.html +++ b/webapp/src/app/modules/person-patents/person-patents.component.html @@ -6,182 +6,8 @@

Keine Patente gefunden.

} @else {
-
- @if (showDetail && selectedPatent) { -
- - -

{{ selectedPatent.title ?? selectedPatent.patent_id }}

- - @if (hasPatentMetadata(selectedPatent)) { -
-
- @for (row of getPatentMetadataRows(selectedPatent); track row.label) { -
-
{{ row.label }}
-
- @if (row.variant === 'source') { - - {{ row.value }} - - } @else { - {{ row.value }} - } -
-
- } -
-
- } - - @if (selectedPatent.abstract) { -
-

Abstract

-

{{ selectedPatent.abstract }}

-
- } - -
-

Erfinder

-
    - @for (inventor of selectedPatent.inventors; track inventor) { -
  • {{ inventor }}
  • - } -
-
- - @if (selectedPatent.assignees.length > 0) { -
-

Anmelder

-
    - @for (assignee of selectedPatent.assignees; track assignee) { -
  • {{ assignee }}
  • - } -
-
- } - - @if (selectedPatent.ipc_descriptions.length > 0) { -
-

Klassifikation (IPC)

-
- @for (card of getClassificationCards(selectedPatent.ipc_descriptions, 'IPC'); track card.key) { -
-
-
- @for (symbol of card.symbols; track symbol) { - {{ symbol }} - } -
-
- {{ card.system }} - {{ card.levelLabel }} -
-
- - @if (card.primaryDescription) { -

- {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} -

- @if (isLongDescription(card.primaryDescription)) { - - } - } - - @if (card.hierarchy.length > 0) { -
- @for (row of card.hierarchy; track row.label) { -
-
{{ row.label }}
-
{{ row.value }}
-
- } -
- } -
- } -
-
- } @else if (selectedPatent.ipc.length > 0) { -
-

Klassifikation (IPC)

-
    - @for (ipc of selectedPatent.ipc; track ipc) { -
  • {{ ipc }}
  • - } -
-
- } - - @if (selectedPatent.cpc_descriptions.length > 0) { -
-

Klassifikation (CPC)

-
- @for (card of getClassificationCards(selectedPatent.cpc_descriptions, 'CPC'); track card.key) { -
-
-
- @for (symbol of card.symbols; track symbol) { - {{ symbol }} - } -
-
- {{ card.system }} - {{ card.levelLabel }} -
-
- - @if (card.primaryDescription) { -

- {{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }} -

- @if (isLongDescription(card.primaryDescription)) { - - } - } - - @if (card.hierarchy.length > 0) { -
- @for (row of card.hierarchy; track row.label) { -
-
{{ row.label }}
-
{{ row.value }}
-
- } -
- } -
- } -
-
- } @else if (selectedPatent.cpc.length > 0) { -
-

Klassifikation (CPC)

-
    - @for (cpc of selectedPatent.cpc; track cpc) { -
  • {{ cpc }}
  • - } -
-
- } - -
- } - -
+
- @if (selectedPatent && !showDetail) { + @if (selectedPatent) {

{{ selectedPatent.title ?? selectedPatent.patent_id }}

diff --git a/webapp/src/app/modules/person-patents/person-patents.component.ts b/webapp/src/app/modules/person-patents/person-patents.component.ts index a28131fa..121d09f6 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.ts +++ b/webapp/src/app/modules/person-patents/person-patents.component.ts @@ -2,28 +2,14 @@ import { Component, OnInit, inject } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ActivatedRoute, Router } from '@angular/router'; import { PatentsService } from '../../api/api/patents.service'; -import { PatentEntry, IpcClassification } from '../../api/model/patentEntry'; +import { PatentEntry } from '../../api/model/patentEntry'; +import { + formatPatentDate, + getPublicationStageLabel, +} from '../patent-detail/patent-detail.utils'; type SortMode = 'date' | 'title'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; -type ClassificationSystem = 'IPC' | 'CPC'; - -interface ClassificationCard { - key: string; - symbols: string[]; - system: ClassificationSystem; - levelLabel: string; - primaryDescription: string | null; - hierarchy: { label: string; value: string }[]; -} - -interface PatentMetadataRow { - label: string; - value: string; - variant?: 'source'; -} - -const DESCRIPTION_PREVIEW_LENGTH = 140; @Component({ selector: 'app-person-patents', @@ -40,7 +26,6 @@ export class PersonPatentsComponent implements OnInit { filteredPatents: PatentEntry[] = []; authorName: string | null = null; selectedPatent: PatentEntry | null = null; - showDetail = false; loading = true; error = false; @@ -50,7 +35,6 @@ export class PersonPatentsComponent implements OnInit { selectedPage = 1; readonly pageSize = 10; - private expandedClassificationKeys = new Set(); ngOnInit(): void { this.route.parent?.paramMap.subscribe((params) => { @@ -87,7 +71,6 @@ export class PersonPatentsComponent implements OnInit { this.activeFilter = filter; this.selectedPage = 1; this.selectedPatent = null; - this.showDetail = false; this.applyFilter(); this.updateQueryParams(); } @@ -100,19 +83,12 @@ export class PersonPatentsComponent implements OnInit { selectPatent(patent: PatentEntry): void { this.selectedPatent = patent; - this.showDetail = false; - this.expandedClassificationKeys.clear(); this.updateQueryParams(); } openDetail(): void { - this.showDetail = true; - this.expandedClassificationKeys.clear(); - } - - closeDetail(): void { - this.showDetail = false; - this.expandedClassificationKeys.clear(); + if (!this.selectedPatent) return; + this.router.navigate(['/patent', this.selectedPatent.patent_id]); } private applyFilter(): void { @@ -173,9 +149,7 @@ export class PersonPatentsComponent implements OnInit { } formatDate(date: string | null): string { - if (!date) return '-'; - const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); - return new Intl.DateTimeFormat('de-DE').format(new Date(d)); + return formatPatentDate(date); } getEpoCount(): number { @@ -207,200 +181,6 @@ export class PersonPatentsComponent implements OnInit { } getPublicationStageLabel(patent: PatentEntry): string | null { - if (patent.kind) { - return patent.kind; - } - if (patent.application_type) { - return patent.application_type; - } - return null; - } - - hasPatentMetadata(_patent: PatentEntry): boolean { - return true; - } - - getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] { - const rows: PatentMetadataRow[] = []; - - rows.push({ label: 'Quelle', value: patent.source, variant: 'source' }); - rows.push({ label: 'Patent-Nr.', value: patent.patent_id }); - - if (patent.publication_date) { - rows.push({ - label: 'Veröffentlichungsdatum', - value: this.formatDate(patent.publication_date), - }); - } - if (patent.application_number) { - rows.push({ label: 'Anmeldungsnummer', value: patent.application_number }); - } - if (patent.application_date) { - rows.push({ label: 'Anmeldedatum', value: this.formatDate(patent.application_date) }); - } - - const stageLabel = this.getPublicationStageLabel(patent); - if (stageLabel) { - rows.push({ - label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp', - value: patent.kind ? stageLabel : this.formatMetadataLabel(stageLabel), - }); - } - if (patent.number_of_claims != null) { - rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) }); - } - if (patent.status) { - rows.push({ label: 'Status', value: this.formatMetadataLabel(patent.status) }); - } - - return rows; - } - - private formatMetadataLabel(value: string): string { - return value - .replace(/_/g, ' ') - .toLowerCase() - .replace(/\b\w/g, (char) => char.toUpperCase()); - } - - getClassificationCards( - entries: IpcClassification[] | undefined, - system: ClassificationSystem, - ): ClassificationCard[] { - if (!entries?.length) { - return []; - } - - const merged = new Map(); - - for (const entry of entries) { - const card = this.buildClassificationCard(entry, system); - const mergeKey = - card.primaryDescription?.toLocaleLowerCase('en') ?? card.symbols[0] ?? card.key; - - const existing = merged.get(mergeKey); - if (existing) { - for (const symbol of card.symbols) { - if (!existing.symbols.includes(symbol)) { - existing.symbols.push(symbol); - } - } - continue; - } - - merged.set(mergeKey, card); - } - - return [...merged.values()]; - } - - toggleClassificationExpanded(key: string): void { - if (this.expandedClassificationKeys.has(key)) { - this.expandedClassificationKeys.delete(key); - return; - } - this.expandedClassificationKeys.add(key); - } - - isClassificationExpanded(key: string): boolean { - return this.expandedClassificationKeys.has(key); - } - - isLongDescription(text: string | null): boolean { - return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH; - } - - getDescriptionPreview(text: string | null): string { - if (!text) { - return ''; - } - if (text.length <= DESCRIPTION_PREVIEW_LENGTH) { - return text; - } - return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`; - } - - private buildClassificationCard( - entry: IpcClassification, - system: ClassificationSystem, - ): ClassificationCard { - const level = this.getClassificationLevel(entry); - const primaryDescription = this.extractDescriptionText(entry[level.field]); - - return { - key: `${system}-${entry.symbol}`, - symbols: [entry.symbol], - system, - levelLabel: level.label, - primaryDescription, - hierarchy: this.buildHierarchyRows(entry, primaryDescription), - }; - } - - private getClassificationLevel(entry: IpcClassification): { - label: string; - field: keyof IpcClassification; - } { - if (entry.subgroup) { - return { label: 'Untergruppe', field: 'subgroup' }; - } - if (entry.main_group) { - return { label: 'Hauptgruppe', field: 'main_group' }; - } - if (entry.subclass) { - return { label: 'Unterklasse', field: 'subclass' }; - } - if (entry.section) { - return { label: 'Sektion', field: 'section' }; - } - return { label: 'Code', field: 'symbol' }; - } - - private buildHierarchyRows( - entry: IpcClassification, - primaryDescription: string | null, - ): { label: string; value: string }[] { - const rows: { label: string; value: string }[] = []; - const seen = new Set(); - - const addRow = (label: string, raw: string | null) => { - const value = this.extractDescriptionText(raw); - if (!value) { - return; - } - const normalized = value.toLocaleLowerCase('en'); - if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) { - return; - } - seen.add(normalized); - rows.push({ label, value }); - }; - - addRow('Sektion', entry.section); - addRow('Klasse', entry.class); - addRow('Unterklasse', entry.subclass); - - return rows; - } - - private extractDescriptionText(value: string | null | undefined): string | null { - if (!value?.trim()) { - return null; - } - - const text = value.includes(' - ') ? value.split(' - ').slice(1).join(' - ').trim() : value.trim(); - if (!text) { - return null; - } - - const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text; - return this.normalizeDescriptionCase(firstSentence); - } - - private normalizeDescriptionCase(text: string): string { - if (text !== text.toUpperCase()) { - return text; - } - return text.charAt(0) + text.slice(1).toLowerCase(); + return getPublicationStageLabel(patent); } } -- 2.56.1 From 7602fef24373d321eab2f326994a5ed952a127cd Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Sat, 27 Jun 2026 19:18:18 +0200 Subject: [PATCH 05/43] Fix patent search client test to mock httpx transport --- .../patents/test_elastic_search_client.py | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/service/src/main/inse/patents/test_elastic_search_client.py b/service/src/main/inse/patents/test_elastic_search_client.py index f1987214..9e12f5dd 100644 --- a/service/src/main/inse/patents/test_elastic_search_client.py +++ b/service/src/main/inse/patents/test_elastic_search_client.py @@ -1,5 +1,7 @@ +import json + +import httpx import pytest -from unittest.mock import patch, MagicMock from inse.model import ESIndex from inse.patents.elastic_search_client import ( DEFAULT_SEARCH_SIZE, @@ -52,13 +54,21 @@ def test_uspto_query_by_assignee_uses_assignees_orgs_field(): async def test_search_epo_posts_to_correct_index(): captured: list[dict] = [] - def fake_search(index: str, body: dict, cluster=None): - captured.append({"index": index, "body": body}) - return {"hits": {"hits": []}} + def handler(request: httpx.Request) -> httpx.Response: + path_parts = request.url.path.strip("/").split("/") + captured.append( + { + "index": path_parts[-2], + "body": json.loads(request.content) if request.content else {}, + } + ) + return httpx.Response(200, json={"hits": {"hits": []}}) - with patch("inse.integrations.elasticsearch.search", side_effect=fake_search): - client = PatentSearchClient(api_key="test-key") - await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) + client = PatentSearchClient( + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) assert len(captured) == 1 assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file -- 2.56.1 From 56015846b09402dd68a43369439daa93ad9433f1 Mon Sep 17 00:00:00 2001 From: Khuder Khalti Date: Sun, 28 Jun 2026 11:33:37 +0200 Subject: [PATCH 06/43] feat(patents): Customize search field --- service/src/main/inse/patents/all/logic.py | 55 +++++++++++------ .../elastic_search_all_patents_client.py | 60 +++++++++++++++++-- 2 files changed, 92 insertions(+), 23 deletions(-) diff --git a/service/src/main/inse/patents/all/logic.py b/service/src/main/inse/patents/all/logic.py index 9cebaa9a..dd5f0aa9 100644 --- a/service/src/main/inse/patents/all/logic.py +++ b/service/src/main/inse/patents/all/logic.py @@ -98,25 +98,52 @@ def _parse_patent_id(patent_id: str) -> tuple[str, str]: ) +async def _search_by_id( + client: AllPatentsSearchClient, + patent_id: str, +) -> list[model.PatentEntry]: + try: + source, number = _parse_patent_id(patent_id) + except HTTPException: + return [] + + if source == "EPO": + data = await client.search_epo(client.epo_detail_query(number)) + return parse_epo_hits(data) + data = await client.search_uspto(client.uspto_detail_query(number)) + return parse_uspto_hits(data) + + +async def _search_by_title( + client: AllPatentsSearchClient, + title: str, +) -> list[model.PatentEntry]: + epo_data, uspto_data = await asyncio.gather( + client.search_epo(client.epo_title_query(title)), + client.search_uspto(client.uspto_title_query(title)), + ) + return parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) + + async def get_patent_by_id( patent_id: str, ipc_client: IpcSearchClient | None = None, ) -> model.PatentEntry: - source, number = _parse_patent_id(patent_id) all_patents_client = AllPatentsSearchClient() ipc_search_client = ipc_client or IpcSearchClient() try: - if source == "EPO": - data = await all_patents_client.search_epo( - all_patents_client.epo_detail_query(number) + patents = await _search_by_id(all_patents_client, patent_id) + + if not patents: + patents = await _search_by_title(all_patents_client, patent_id) + + if not patents: + raise HTTPException( + status_code=HTTP_404_NOT_FOUND, + detail="Patent not found.", ) - patents = parse_epo_hits(data) - else: - data = await all_patents_client.search_uspto( - all_patents_client.uspto_detail_query(number) - ) - patents = parse_uspto_hits(data) + except MissingApiKeyError as exc: raise HTTPException( status_code=HTTP_503_SERVICE_UNAVAILABLE, @@ -128,11 +155,5 @@ async def get_patent_by_id( detail="Patent search request failed.", ) from exc - if not patents: - raise HTTPException( - status_code=HTTP_404_NOT_FOUND, - detail="Patent not found.", - ) - - await enrich_patents_classifications(patents, ipc_search_client) + await enrich_patents_classifications(patents[:1], ipc_search_client) return patents[0] \ No newline at end of file diff --git a/service/src/main/inse/patents/elastic_search_all_patents_client.py b/service/src/main/inse/patents/elastic_search_all_patents_client.py index 85585ba4..d97eadbc 100644 --- a/service/src/main/inse/patents/elastic_search_all_patents_client.py +++ b/service/src/main/inse/patents/elastic_search_all_patents_client.py @@ -52,8 +52,8 @@ class AllPatentsSearchClient: search_query: dict[str, Any] = { "bool": { "should": [ - {"match_phrase": {"title_en": {"query": term}}}, - {"match_phrase": {"title_de": {"query": term}}}, + {"match": {"title_en": {"query": term, "operator": "and", "fuzziness": "AUTO"}}}, + {"match": {"title_de": {"query": term, "operator": "and", "fuzziness": "AUTO"}}}, {"term": {"doc_number": doc_number}}, ], "minimum_should_match": 1, @@ -112,7 +112,7 @@ class AllPatentsSearchClient: search_query: dict[str, Any] = { "bool": { "should": [ - {"match_phrase": {"title": {"query": term}}}, + {"match": {"title": {"query": term, "operator": "and", "fuzziness": "AUTO"}}}, {"term": {"publication_number": pub_number}}, ], "minimum_should_match": 1, @@ -163,10 +163,18 @@ class AllPatentsSearchClient: "application_filing_date", "title_en", "title_de", "abstract", "inventors_name", "applicants_name", "ipc", "cpc", ], - "query": {"term": {"doc_number": doc_number}}, + "query": { + "bool": { + "should": [ + {"term": {"doc_number": doc_number}}, + {"term": {"application_number": doc_number}}, + ], + "minimum_should_match": 1, + } + }, } - def uspto_detail_query(self, publication_number: str) -> dict[str, Any]: + def uspto_detail_query(self, number: str) -> dict[str, Any]: return { "size": 1, "_source": [ @@ -175,7 +183,47 @@ class AllPatentsSearchClient: "application_type", "title", "abstract", "inventors_names", "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", ], - "query": {"term": {"publication_number": publication_number}}, + "query": { + "bool": { + "should": [ + {"term": {"publication_number": number}}, + {"term": {"application_number": number}}, + ], + "minimum_should_match": 1, + } + }, + } + + def epo_title_query(self, title: str) -> dict[str, Any]: + return { + "size": 1, + "_source": [ + "doc_number", "country", "kind", "date_publication", + "date_publication_year", "application_number", + "application_filing_date", "title_en", "title_de", + "abstract", "inventors_name", "applicants_name", "ipc", "cpc", + ], + "query": { + "bool": { + "should": [ + {"match_phrase": {"title_en": title}}, + {"match_phrase": {"title_de": title}}, + ], + "minimum_should_match": 1, + } + }, + } + + def uspto_title_query(self, title: str) -> dict[str, Any]: + return { + "size": 1, + "_source": [ + "publication_number", "country", "publication_date", + "publication_year", "application_number", "application_date", + "application_type", "title", "abstract", "inventors_names", + "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", + ], + "query": {"match_phrase": {"title": title}}, } async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]: -- 2.56.1 From 6c13415b1e5dde7fc19946bc6cc4cab975218fbe Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Sun, 28 Jun 2026 12:19:46 +0200 Subject: [PATCH 07/43] Add org_patents indexing and institution patent match-type UI Introduce a batch script and Elasticsearch index to pre-aggregate institution patents via assignee and inventor name matching, expose them through a new API endpoint, and update the institution patents page with match-type filtering. --- service/scripts/index_org_patents.py | 38 ++ service/src/main/inse/main.py | 2 + .../src/main/inse/middleware/etag_cache.py | 20 +- service/src/main/inse/model.py | 1 + service/src/main/inse/patents/org/__init__.py | 1 + .../inse/patents/org/elastic_search_client.py | 195 ++++++++ service/src/main/inse/patents/org/logic.py | 421 ++++++++++++++++++ service/src/main/inse/patents/org/mapping.py | 33 ++ service/src/main/inse/patents/org/model.py | 27 ++ service/src/main/inse/patents/org/service.py | 38 ++ .../src/main/inse/patents/org/test_logic.py | 100 +++++ webapp/src/app/api/api/patents.service.ts | 105 +++++ webapp/src/app/api/model/matchedAuthor.ts | 4 + webapp/src/app/api/model/models.ts | 3 + webapp/src/app/api/model/orgPatentEntry.ts | 11 + .../src/app/api/model/orgPatentsResponse.ts | 10 + .../institution-patents.component.html | 71 ++- .../institution-patents.component.scss | 73 ++- .../institution-patents.component.ts | 146 ++++-- 19 files changed, 1260 insertions(+), 39 deletions(-) create mode 100644 service/scripts/index_org_patents.py create mode 100644 service/src/main/inse/patents/org/__init__.py create mode 100644 service/src/main/inse/patents/org/elastic_search_client.py create mode 100644 service/src/main/inse/patents/org/logic.py create mode 100644 service/src/main/inse/patents/org/mapping.py create mode 100644 service/src/main/inse/patents/org/model.py create mode 100644 service/src/main/inse/patents/org/service.py create mode 100644 service/src/main/inse/patents/org/test_logic.py create mode 100644 webapp/src/app/api/model/matchedAuthor.ts create mode 100644 webapp/src/app/api/model/orgPatentEntry.ts create mode 100644 webapp/src/app/api/model/orgPatentsResponse.ts diff --git a/service/scripts/index_org_patents.py b/service/scripts/index_org_patents.py new file mode 100644 index 00000000..7eb03cef --- /dev/null +++ b/service/scripts/index_org_patents.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +"""Index org_patents for an institution.""" +from __future__ import annotations + +import argparse +import asyncio +import logging +import sys +from pathlib import Path + +current_dir = Path(__file__).resolve().parent +sys.path.insert(0, str(current_dir.parent / "src" / "main")) + +from dotenv import load_dotenv + +load_dotenv(dotenv_path=current_dir.parent / "src" / "main" / "inse" / ".env") + +from inse.patents.org.logic import index_org_patents_for_institution + +logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s") +logger = logging.getLogger(__name__) + + +async def main() -> None: + parser = argparse.ArgumentParser(description="Index org_patents for an institution.") + parser.add_argument( + "--institution-id", + required=True, + help="OpenAlex institution ID, e.g. I62318514", + ) + args = parser.parse_args() + + count = await index_org_patents_for_institution(args.institution_id) + logger.info("Finished indexing %d patents for institution %s", count, args.institution_id) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index ca69d84c..4df7111e 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -32,6 +32,7 @@ from inse.institutions.router import router as institutions_router from . import config from .account.service import router as account_router from .service import router as service_router +from inse.patents.org.service import router as org_patents_router from inse.patents.service import ( institution_patents_router, patents_router as patents_all_router, @@ -53,6 +54,7 @@ app = FastAPI( ) app.include_router(collaboration_network_router) app.include_router(institution_patents_router) +app.include_router(org_patents_router) app.include_router(institutions_router) app.include_router(topics_service_router) app.include_router(works_service_router) diff --git a/service/src/main/inse/middleware/etag_cache.py b/service/src/main/inse/middleware/etag_cache.py index 547aecb4..03e54dc5 100644 --- a/service/src/main/inse/middleware/etag_cache.py +++ b/service/src/main/inse/middleware/etag_cache.py @@ -25,11 +25,15 @@ class ETagCacheMiddleware(BaseHTTPMiddleware): # Cache hit + not expired if entry and time.time() < entry["expires"]: if client_etag == entry["etag"]: - return Response(status_code=304, headers={"ETag": entry["etag"]}) - + return Response( + status_code=entry["status_code"], + headers={"ETag": entry["etag"]}, + ) + # Client has stale ETag - return fresh cached body return Response( content=entry["body"], + status_code=entry["status_code"], media_type="application/json", headers={"ETag": entry["etag"], "Cache-Control": f"max-age={self.ttl}"} ) @@ -39,11 +43,13 @@ class ETagCacheMiddleware(BaseHTTPMiddleware): body = b"".join([chunk async for chunk in response.body_iterator]) etag = f'"{hashlib.md5(body).hexdigest()}"' - self.cache[key] = { - "body": body, - "etag": etag, - "expires": time.time() + self.ttl - } + if response.status_code < 400: + self.cache[key] = { + "body": body, + "etag": etag, + "expires": time.time() + self.ttl, + "status_code": response.status_code, + } return Response( content=body, status_code=response.status_code, diff --git a/service/src/main/inse/model.py b/service/src/main/inse/model.py index 028d5eb7..a6c922bb 100644 --- a/service/src/main/inse/model.py +++ b/service/src/main/inse/model.py @@ -58,6 +58,7 @@ class ESIndex(StrEnum): EPO_INDEX = "epo_index_1.0" USPTO_INDEX = "uspto_patents_3.0" + ORG_PATENTS = "org_patents" PROJECTS_BUND_V1 = "projects_bund_v1" PROJECTS_DFG_ALL = "projects_dfg_all" diff --git a/service/src/main/inse/patents/org/__init__.py b/service/src/main/inse/patents/org/__init__.py new file mode 100644 index 00000000..89bdee15 --- /dev/null +++ b/service/src/main/inse/patents/org/__init__.py @@ -0,0 +1 @@ +"""Org patents index: institution-scoped patent aggregation.""" diff --git a/service/src/main/inse/patents/org/elastic_search_client.py b/service/src/main/inse/patents/org/elastic_search_client.py new file mode 100644 index 00000000..4266471b --- /dev/null +++ b/service/src/main/inse/patents/org/elastic_search_client.py @@ -0,0 +1,195 @@ +"""HTTP client for the org_patents Elasticsearch index.""" +import json +import logging +from typing import Any + +import httpx + +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.org.mapping import ORG_PATENTS_INDEX, ORG_PATENTS_MAPPING +from inse.patents.org.model import MatchTypeFilter, OrgPatentEntry +from inse import config + +logger = logging.getLogger(__name__) + +DEFAULT_PAGE_SIZE = 500 + + +class OrgPatentsSearchClient: + def __init__( + self, + base_url: str | None = None, + api_key: str | None = None, + timeout: float = 60.0, + transport: httpx.AsyncBaseTransport | None = None, + ): + self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/") + self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key + self.timeout = timeout + self.transport = transport + + def _headers(self, content_type: str = "application/json") -> dict[str, str]: + if not self.api_key: + raise MissingApiKeyError("Patent Elasticsearch API key is not configured.") + return { + "Authorization": f"ApiKey {self.api_key}", + "Content-Type": content_type, + } + + async def ensure_index(self) -> None: + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.head( + f"/{ORG_PATENTS_INDEX}", + headers=self._headers(), + ) + if response.status_code == 404: + create_response = await client.put( + f"/{ORG_PATENTS_INDEX}", + headers=self._headers(), + json={"mappings": ORG_PATENTS_MAPPING}, + ) + create_response.raise_for_status() + logger.info("Created index %s", ORG_PATENTS_INDEX) + return + + response.raise_for_status() + mapping_response = await client.put( + f"/{ORG_PATENTS_INDEX}/_mapping", + headers=self._headers(), + json=ORG_PATENTS_MAPPING, + ) + mapping_response.raise_for_status() + + async def delete_by_institution(self, institution_id: str) -> int: + payload = { + "query": {"term": {"institution_id": institution_id.upper()}}, + } + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.post( + f"/{ORG_PATENTS_INDEX}/_delete_by_query", + headers=self._headers(), + json=payload, + params={"refresh": "true"}, + ) + if response.status_code == 404: + return 0 + response.raise_for_status() + return response.json().get("deleted", 0) + + async def bulk_index(self, documents: list[tuple[str, dict[str, Any]]]) -> None: + if not documents: + return + + batch_size = 500 + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + for start in range(0, len(documents), batch_size): + batch = documents[start : start + batch_size] + bulk_lines: list[str] = [] + for doc_id, source in batch: + bulk_lines.append(json.dumps({"index": {"_index": ORG_PATENTS_INDEX, "_id": doc_id}})) + bulk_lines.append(json.dumps(source)) + + payload = "\n".join(bulk_lines) + "\n" + response = await client.post( + "/_bulk", + content=payload, + headers=self._headers("application/x-ndjson"), + params={"refresh": "true"}, + ) + response.raise_for_status() + result = response.json() + if result.get("errors"): + failed = [ + item + for item in result.get("items", []) + if item.get("index", {}).get("status", 200) >= 400 + ] + logger.error("Bulk index errors: %s", failed[:3]) + raise RuntimeError("Bulk indexing into org_patents failed.") + + async def search_by_institution( + self, + institution_id: str, + match_type: MatchTypeFilter = "all", + size: int = DEFAULT_PAGE_SIZE, + ) -> list[OrgPatentEntry]: + short_id = institution_id.replace("https://openalex.org/", "").upper() + filters: list[dict[str, Any]] = [{"term": {"institution_id": short_id}}] + + if match_type == "institution": + filters.append({"terms": {"match_type": ["institution", "both"]}}) + elif match_type == "name": + filters.append({"terms": {"match_type": ["name", "both"]}}) + elif match_type == "both": + filters.append({"term": {"match_type": "both"}}) + + payload = { + "size": size, + "track_total_hits": True, + "query": {"bool": {"filter": filters}}, + } + + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.post( + f"/{ORG_PATENTS_INDEX}/_search", + headers=self._headers(), + json=payload, + ) + if response.status_code == 404: + return [] + response.raise_for_status() + data = response.json() + + patents = [_hit_to_org_patent(hit) for hit in data.get("hits", {}).get("hits", [])] + patents.sort( + key=lambda patent: ( + int(patent.publication_year) if patent.publication_year and patent.publication_year.isdigit() else 0, + patent.patent_id, + ), + reverse=True, + ) + return patents + + +def _hit_to_org_patent(hit: dict[str, Any]) -> OrgPatentEntry: + source = hit.get("_source", {}) + publication_year = source.get("publication_year") + return OrgPatentEntry( + institution_id=source.get("institution_id", ""), + institution_name=source.get("institution_name"), + patent_id=source.get("patent_id", ""), + source=source.get("source", ""), + match_type=source.get("match_type", "institution"), + title=source.get("title"), + abstract=source.get("abstract"), + publication_date=source.get("publication_date"), + publication_year=str(publication_year) if publication_year is not None else None, + application_number=source.get("application_number"), + application_date=source.get("application_date"), + kind=source.get("kind"), + application_type=source.get("application_type"), + number_of_claims=source.get("number_of_claims"), + status=source.get("status"), + inventors=source.get("inventors") or [], + assignees=source.get("assignees") or [], + ipc=source.get("ipc") or [], + cpc=source.get("cpc") or [], + country=source.get("country"), + matched_authors=source.get("matched_authors") or [], + ) diff --git a/service/src/main/inse/patents/org/logic.py b/service/src/main/inse/patents/org/logic.py new file mode 100644 index 00000000..f242ed90 --- /dev/null +++ b/service/src/main/inse/patents/org/logic.py @@ -0,0 +1,421 @@ +"""Business logic for org_patents index build and retrieval.""" +import asyncio +import logging +import re +from dataclasses import dataclass, field + +import httpx +from fastapi import HTTPException +from starlette.status import HTTP_502_BAD_GATEWAY +from starlette.status import HTTP_503_SERVICE_UNAVAILABLE + +from inse.institutions.institutions_search_client import InstitutionsSearchClient +from inse.integrations import elasticsearch +from inse.models.openalex.author import Author +from inse.patents.authors.name_matching import name_matches +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.common.model import PatentEntry +from inse.patents.common.parsing import ( + deduplicate_patents, + enrich_patents_classifications, + parse_epo_hits, + parse_uspto_hits, + patent_dedup_key, +) +from inse.patents.institutions.logic import get_patents_by_institution_id +from inse.patents.ipc_search_client import IpcSearchClient +from inse.patents.org.elastic_search_client import OrgPatentsSearchClient +from inse.patents.org.model import ( + MatchType, + MatchTypeFilter, + MatchedAuthor, + OrgPatentEntry, + OrgPatentsResponse, +) +from inse.patents.search_client import PatentSearchClient + +logger = logging.getLogger(__name__) + +AUTHOR_PAGE_SIZE = 500 +ORG_PATENT_SEARCH_SIZE = 500 +AUTHOR_SEARCH_CONCURRENCY = 8 + + +def _extract_last_name(name: str | None) -> str | None: + if not name: + return None + parts = name.strip().split() + return parts[-1] if parts else None + + +def _extract_first_name(name: str | None) -> str | None: + if not name: + return None + parts = name.strip().split() + return parts[0] if len(parts) > 1 else None + + +def _filter_patents_by_name( + patents: list[PatentEntry], + first_name: str, + last_name: str, +) -> list[PatentEntry]: + return [ + patent + for patent in patents + if any( + name_matches(inventor, first_name, last_name) + for inventor in patent.inventors + ) + ] + + +@dataclass +class _AccumulatedPatent: + patent: PatentEntry + institution_match: bool = False + matched_authors: dict[str, MatchedAuthor] = field(default_factory=dict) + + +def normalize_institution_id(institution_id: str) -> str: + return institution_id.replace("https://openalex.org/", "").upper() + + +def normalize_author_id(author_id: str | None) -> str: + if not author_id: + return "" + return author_id.replace("https://openalex.org/", "").upper() + + +def org_patent_document_id(institution_id: str, patent: PatentEntry) -> str: + stage = patent.kind or patent.application_type or "none" + safe_patent_id = re.sub(r"[^A-Za-z0-9_-]", "_", patent.patent_id) + safe_date = patent.publication_date or "none" + safe_stage = re.sub(r"[^A-Za-z0-9_-]", "_", stage) + return f"{normalize_institution_id(institution_id)}_{patent.source}_{safe_patent_id}_{safe_date}_{safe_stage}" + + +def resolve_match_type(institution_match: bool, has_name_match: bool) -> MatchType: + if institution_match and has_name_match: + return "both" + if institution_match: + return "institution" + return "name" + + +def merge_org_patents( + institution_id: str, + institution_name: str | None, + institution_patents: list[PatentEntry], + author_patents: list[tuple[Author, list[PatentEntry]]], +) -> list[OrgPatentEntry]: + accumulated: dict[tuple[str, str, str, str], _AccumulatedPatent] = {} + + for patent in institution_patents: + key = patent_dedup_key(patent) + entry = accumulated.get(key) + if entry is None: + accumulated[key] = _AccumulatedPatent(patent=patent, institution_match=True) + else: + entry.institution_match = True + + for author, patents in author_patents: + author_id = normalize_author_id(author.id) + author_name = author.display_name or "" + if not author_id or not author_name: + continue + + matched_author = MatchedAuthor( + openalex_author_id=author_id, + author_name=author_name, + ) + for patent in patents: + key = patent_dedup_key(patent) + entry = accumulated.get(key) + if entry is None: + accumulated[key] = _AccumulatedPatent( + patent=patent, + matched_authors={author_id: matched_author}, + ) + else: + entry.matched_authors[author_id] = matched_author + + org_patents: list[OrgPatentEntry] = [] + short_institution_id = normalize_institution_id(institution_id) + + for entry in accumulated.values(): + has_name_match = bool(entry.matched_authors) + match_type = resolve_match_type(entry.institution_match, has_name_match) + org_patents.append( + OrgPatentEntry( + institution_id=short_institution_id, + institution_name=institution_name, + match_type=match_type, + matched_authors=list(entry.matched_authors.values()), + **entry.patent.model_dump(), + ) + ) + + org_patents.sort( + key=lambda patent: ( + patent.publication_year or "", + patent.patent_id, + ), + reverse=True, + ) + return org_patents + + +def org_patent_to_es_document(patent: OrgPatentEntry) -> dict: + publication_year = None + if patent.publication_year: + try: + publication_year = int(patent.publication_year) + except ValueError: + publication_year = None + + return { + "institution_id": patent.institution_id, + "institution_name": patent.institution_name, + "patent_id": patent.patent_id, + "source": patent.source, + "match_type": patent.match_type, + "title": patent.title, + "abstract": patent.abstract, + "publication_date": patent.publication_date, + "publication_year": publication_year, + "application_number": patent.application_number, + "application_date": patent.application_date, + "kind": patent.kind, + "application_type": patent.application_type, + "number_of_claims": patent.number_of_claims, + "status": patent.status, + "inventors": patent.inventors, + "assignees": patent.assignees, + "ipc": patent.ipc, + "cpc": patent.cpc, + "country": patent.country, + "matched_authors": [ + author.model_dump() for author in patent.matched_authors + ], + } + + +def fetch_authors_for_institution(institution_id: str) -> list[Author]: + short_id = normalize_institution_id(institution_id) + query = { + "nested": { + "path": "last_known_institutions", + "query": { + "term": { + "last_known_institutions.id": f"https://openalex.org/{short_id}", + } + }, + } + } + + authors: list[Author] = [] + search_after: list | None = None + sort = [ + {"works_count": {"order": "desc"}}, + {"id": {"order": "asc"}}, + ] + + while True: + body: dict = { + "size": AUTHOR_PAGE_SIZE, + "query": query, + "sort": sort, + } + if search_after: + body["search_after"] = search_after + + response = elasticsearch.search(index="openalex-authors", body=body) + hits = response.get("hits", {}).get("hits", []) + if not hits: + break + + for hit in hits: + source = dict(hit.get("_source", {})) + source["id"] = source.get("id") or hit.get("_id", "") + author = Author.from_dict(source) + if author: + authors.append(author) + + if len(hits) < AUTHOR_PAGE_SIZE: + break + search_after = hits[-1].get("sort") + if not search_after: + break + + return authors + + +async def _search_patents_by_author( + author: Author, + search_client: PatentSearchClient, +) -> list[PatentEntry]: + author_name = author.display_name + last_name = _extract_last_name(author_name) + first_name = _extract_first_name(author_name) + if not last_name: + return [] + + try: + epo_data, uspto_data = await asyncio.gather( + search_client.search_epo( + search_client.epo_query_by_inventor( + last_name, first_name, size=ORG_PATENT_SEARCH_SIZE + ) + ), + search_client.search_uspto( + search_client.uspto_query_by_inventor( + last_name, first_name, size=ORG_PATENT_SEARCH_SIZE + ) + ), + ) + except (MissingApiKeyError, httpx.HTTPError): + raise + + patents = parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) + if first_name and last_name: + patents = _filter_patents_by_name(patents, first_name, last_name) + return deduplicate_patents(patents) + + +async def build_org_patents_for_institution( + institution_id: str, + search_client: PatentSearchClient | None = None, + ipc_client: IpcSearchClient | None = None, + institutions_client: InstitutionsSearchClient | None = None, +) -> list[OrgPatentEntry]: + patent_client = search_client or PatentSearchClient() + ipc_search_client = ipc_client or IpcSearchClient() + institution_client = institutions_client or InstitutionsSearchClient() + + short_id = normalize_institution_id(institution_id) + institution = institution_client.get_institution_by_id(short_id) + institution_name = institution.display_name + + institution_response = await get_patents_by_institution_id( + institution_id=short_id, + client=patent_client, + ipc_client=ipc_search_client, + institutions_client=institution_client, + ) + institution_patents = institution_response.patents + + authors = fetch_authors_for_institution(short_id) + logger.info( + "Building org_patents for %s (%s): %d authors, %d institution patents", + institution_name, + short_id, + len(authors), + len(institution_patents), + ) + + semaphore = asyncio.Semaphore(AUTHOR_SEARCH_CONCURRENCY) + + async def _fetch_for_author(author: Author) -> tuple[Author, list[PatentEntry]]: + async with semaphore: + patents = await _search_patents_by_author(author, patent_client) + return author, patents + + author_results = await asyncio.gather( + *[_fetch_for_author(author) for author in authors], + return_exceptions=True, + ) + + author_patents: list[tuple[Author, list[PatentEntry]]] = [] + for result in author_results: + if isinstance(result, Exception): + logger.warning("Author patent search failed: %s", result) + continue + author_patents.append(result) + + org_patents = merge_org_patents( + institution_id=short_id, + institution_name=institution_name, + institution_patents=institution_patents, + author_patents=author_patents, + ) + + await enrich_patents_classifications( + [patent for patent in org_patents], + ipc_search_client, + ) + return org_patents + + +async def index_org_patents_for_institution( + institution_id: str, + search_client: PatentSearchClient | None = None, + ipc_client: IpcSearchClient | None = None, + institutions_client: InstitutionsSearchClient | None = None, + org_client: OrgPatentsSearchClient | None = None, +) -> int: + short_id = normalize_institution_id(institution_id) + org_patents_client = org_client or OrgPatentsSearchClient() + + org_patents = await build_org_patents_for_institution( + institution_id=short_id, + search_client=search_client, + ipc_client=ipc_client, + institutions_client=institutions_client, + ) + + await org_patents_client.ensure_index() + deleted = await org_patents_client.delete_by_institution(short_id) + logger.info("Deleted %d existing org_patents documents for %s", deleted, short_id) + + documents = [ + ( + org_patent_document_id(short_id, patent), + org_patent_to_es_document(patent), + ) + for patent in org_patents + ] + await org_patents_client.bulk_index(documents) + logger.info("Indexed %d org_patents documents for %s", len(documents), short_id) + return len(documents) + + +async def get_org_patents_by_institution_id( + institution_id: str, + match_type: MatchTypeFilter = "all", + org_client: OrgPatentsSearchClient | None = None, + institutions_client: InstitutionsSearchClient | None = None, +) -> OrgPatentsResponse: + short_id = normalize_institution_id(institution_id) + org_patents_client = org_client or OrgPatentsSearchClient() + institution_client = institutions_client or InstitutionsSearchClient() + + try: + institution = institution_client.get_institution_by_id(short_id) + institution_name = institution.display_name + except Exception: + institution_name = None + + try: + await org_patents_client.ensure_index() + patents = await org_patents_client.search_by_institution( + institution_id=short_id, + match_type=match_type, + ) + except MissingApiKeyError as exc: + raise HTTPException( + status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="Patent search is not configured.", + ) from exc + except httpx.HTTPError as exc: + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="org_patents search request failed.", + ) from exc + + return OrgPatentsResponse( + institution_id=short_id, + institution_name=institution_name, + patent_count=len(patents), + patents=patents, + ) diff --git a/service/src/main/inse/patents/org/mapping.py b/service/src/main/inse/patents/org/mapping.py new file mode 100644 index 00000000..d3191a46 --- /dev/null +++ b/service/src/main/inse/patents/org/mapping.py @@ -0,0 +1,33 @@ +ORG_PATENTS_INDEX = "org_patents" + +ORG_PATENTS_MAPPING = { + "properties": { + "institution_id": {"type": "keyword"}, + "institution_name": {"type": "text", "fields": {"keyword": {"type": "keyword"}}}, + "patent_id": {"type": "keyword"}, + "source": {"type": "keyword"}, + "match_type": {"type": "keyword"}, + "title": {"type": "text"}, + "abstract": {"type": "text"}, + "publication_date": {"type": "keyword"}, + "publication_year": {"type": "integer"}, + "application_number": {"type": "keyword"}, + "application_date": {"type": "keyword"}, + "kind": {"type": "keyword"}, + "application_type": {"type": "keyword"}, + "number_of_claims": {"type": "integer"}, + "status": {"type": "keyword"}, + "inventors": {"type": "keyword"}, + "assignees": {"type": "keyword"}, + "ipc": {"type": "keyword"}, + "cpc": {"type": "keyword"}, + "country": {"type": "keyword"}, + "matched_authors": { + "type": "nested", + "properties": { + "openalex_author_id": {"type": "keyword"}, + "author_name": {"type": "keyword"}, + }, + }, + } +} diff --git a/service/src/main/inse/patents/org/model.py b/service/src/main/inse/patents/org/model.py new file mode 100644 index 00000000..e557aaf8 --- /dev/null +++ b/service/src/main/inse/patents/org/model.py @@ -0,0 +1,27 @@ +from typing import Literal + +from pydantic import BaseModel, Field + +from inse.patents.common.model import PatentEntry + +MatchType = Literal["institution", "name", "both"] +MatchTypeFilter = Literal["institution", "name", "both", "all"] + + +class MatchedAuthor(BaseModel): + openalex_author_id: str + author_name: str + + +class OrgPatentEntry(PatentEntry): + institution_id: str + institution_name: str | None = None + match_type: MatchType + matched_authors: list[MatchedAuthor] = Field(default_factory=list) + + +class OrgPatentsResponse(BaseModel): + institution_id: str + institution_name: str | None = None + patent_count: int + patents: list[OrgPatentEntry] diff --git a/service/src/main/inse/patents/org/service.py b/service/src/main/inse/patents/org/service.py new file mode 100644 index 00000000..46e7c708 --- /dev/null +++ b/service/src/main/inse/patents/org/service.py @@ -0,0 +1,38 @@ +from functools import lru_cache +from typing import Annotated + +from fastapi import APIRouter, Depends, Query + +from inse.institutions.institutions_search_client import InstitutionsSearchClient +from inse.patents.org import logic +from inse.patents.org.model import MatchTypeFilter, OrgPatentsResponse + +router = APIRouter(prefix="/api/inse-service/institutions", tags=["Patents"]) + + +@lru_cache +def get_institutions_search_client() -> InstitutionsSearchClient: + return InstitutionsSearchClient() + + +@router.get( + "/{id}/org-patents", + operation_id="getOrgPatentsByInstitution", + response_model=OrgPatentsResponse, + summary="Get pre-indexed org patents for an institution.", +) +async def get_org_patents_by_institution( + id: str, + client: Annotated[ + InstitutionsSearchClient, Depends(get_institutions_search_client) + ], + match_type: Annotated[ + MatchTypeFilter, + Query(description="Filter patents by match type."), + ] = "all", +) -> OrgPatentsResponse: + return await logic.get_org_patents_by_institution_id( + institution_id=id, + match_type=match_type, + institutions_client=client, + ) diff --git a/service/src/main/inse/patents/org/test_logic.py b/service/src/main/inse/patents/org/test_logic.py new file mode 100644 index 00000000..ca01887e --- /dev/null +++ b/service/src/main/inse/patents/org/test_logic.py @@ -0,0 +1,100 @@ +from inse.patents.common.model import PatentEntry +from inse.patents.org.logic import merge_org_patents, org_patent_document_id, resolve_match_type +from inse.patents.org.model import MatchedAuthor +from inse.models.openalex.author import Author + + +def _patent( + patent_id: str = "EP1234567", + source: str = "EPO", +) -> PatentEntry: + return PatentEntry( + patent_id=patent_id, + source=source, + title="Example patent", + publication_year="2024", + ) + + +def _author(author_id: str, name: str) -> Author: + return Author( + id=f"https://openalex.org/{author_id}", + display_name=name, + ) + + +def test_resolve_match_type() -> None: + assert resolve_match_type(True, True) == "both" + assert resolve_match_type(True, False) == "institution" + assert resolve_match_type(False, True) == "name" + + +def test_merge_org_patents_keeps_institution_only_patents() -> None: + result = merge_org_patents( + institution_id="I62318514", + institution_name="University of Duisburg-Essen", + institution_patents=[_patent("EP111")], + author_patents=[], + ) + + assert len(result) == 1 + assert result[0].match_type == "institution" + assert result[0].matched_authors == [] + + +def test_merge_org_patents_keeps_name_only_patents() -> None: + author = _author("A123", "Max Mustermann") + result = merge_org_patents( + institution_id="I62318514", + institution_name="University of Duisburg-Essen", + institution_patents=[], + author_patents=[(author, [_patent("EP222")])], + ) + + assert len(result) == 1 + assert result[0].match_type == "name" + assert result[0].matched_authors[0].openalex_author_id == "A123" + + +def test_merge_org_patents_marks_both_when_same_patent_found_twice() -> None: + author = _author("A123", "Max Mustermann") + patent = _patent("EP333") + result = merge_org_patents( + institution_id="I62318514", + institution_name="University of Duisburg-Essen", + institution_patents=[patent], + author_patents=[(author, [patent])], + ) + + assert len(result) == 1 + assert result[0].match_type == "both" + assert len(result[0].matched_authors) == 1 + + +def test_merge_org_patents_deduplicates_and_collects_multiple_authors() -> None: + author_one = _author("A111", "Max Mustermann") + author_two = _author("A222", "Maria Muster") + patent = _patent("EP444") + result = merge_org_patents( + institution_id="I62318514", + institution_name="University of Duisburg-Essen", + institution_patents=[], + author_patents=[ + (author_one, [patent]), + (author_two, [patent]), + ], + ) + + assert len(result) == 1 + assert result[0].match_type == "name" + assert {author.openalex_author_id for author in result[0].matched_authors} == {"A111", "A222"} + + +def test_org_patent_document_id_is_stable() -> None: + patent = _patent("EP1234567") + patent.kind = "A1" + patent.publication_date = "20240101" + + doc_id = org_patent_document_id("I62318514", patent) + + assert doc_id == "I62318514_EPO_EP1234567_20240101_A1" diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index 68ad4460..8c8d1f41 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -14,6 +14,7 @@ import { BaseService } from '../api.base.service'; import { PatentEntry } from '../model/patentEntry'; import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; +import { OrgPatentsResponse, OrgPatentMatchTypeFilter } from '../model/orgPatentsResponse'; export interface AllPatentsResponse { total: number; @@ -34,6 +35,13 @@ type GetPatentsByInstitutionOptions = { transferCache?: boolean; }; +type GetOrgPatentsByInstitutionOptions = { + matchType?: OrgPatentMatchTypeFilter; + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; +}; + @Injectable({ providedIn: 'root', }) @@ -222,6 +230,103 @@ export class PatentsService extends BaseService { ); } + public getOrgPatentsByInstitution( + institutionId: string, + observe?: 'body', + reportProgress?: boolean, + options?: GetOrgPatentsByInstitutionOptions, + ): Observable; + public getOrgPatentsByInstitution( + institutionId: string, + observe?: 'response', + reportProgress?: boolean, + options?: GetOrgPatentsByInstitutionOptions, + ): Observable>; + public getOrgPatentsByInstitution( + institutionId: string, + observe?: 'events', + reportProgress?: boolean, + options?: GetOrgPatentsByInstitutionOptions, + ): Observable>; + public getOrgPatentsByInstitution( + institutionId: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: GetOrgPatentsByInstitutionOptions, + ): Observable { + if (institutionId === null || institutionId === undefined) { + throw new Error( + 'Required parameter institutionId was null or undefined when calling getOrgPatentsByInstitution.', + ); + } + + let localVarQueryParameters = new HttpParams(); + if (options?.matchType) { + localVarQueryParameters = localVarQueryParameters.set( + 'match_type', + options.matchType, + ); + } + + let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam( + { + name: 'institutionId', + value: institutionId, + in: 'path', + style: 'simple', + explode: false, + dataType: 'string', + dataFormat: undefined, + }, + )}/org-patents`; + + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'get', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } + public getAllPatents( page: number = 0, size: number = 10, diff --git a/webapp/src/app/api/model/matchedAuthor.ts b/webapp/src/app/api/model/matchedAuthor.ts new file mode 100644 index 00000000..058da26a --- /dev/null +++ b/webapp/src/app/api/model/matchedAuthor.ts @@ -0,0 +1,4 @@ +export interface MatchedAuthor { + openalex_author_id: string; + author_name: string; +} diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index c91170db..a210c254 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -103,6 +103,9 @@ export * from './newsArticle'; export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; +export * from './matchedAuthor'; +export * from './orgPatentEntry'; +export * from './orgPatentsResponse'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; export * from './personBio'; diff --git a/webapp/src/app/api/model/orgPatentEntry.ts b/webapp/src/app/api/model/orgPatentEntry.ts new file mode 100644 index 00000000..50cfcef8 --- /dev/null +++ b/webapp/src/app/api/model/orgPatentEntry.ts @@ -0,0 +1,11 @@ +import { PatentEntry } from './patentEntry'; +import { MatchedAuthor } from './matchedAuthor'; + +export type OrgPatentMatchType = 'institution' | 'name' | 'both'; + +export interface OrgPatentEntry extends PatentEntry { + institution_id: string; + institution_name?: string | null; + match_type: OrgPatentMatchType; + matched_authors: MatchedAuthor[]; +} diff --git a/webapp/src/app/api/model/orgPatentsResponse.ts b/webapp/src/app/api/model/orgPatentsResponse.ts new file mode 100644 index 00000000..7cba08c5 --- /dev/null +++ b/webapp/src/app/api/model/orgPatentsResponse.ts @@ -0,0 +1,10 @@ +import { OrgPatentEntry } from './orgPatentEntry'; + +export type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both'; + +export interface OrgPatentsResponse { + institution_id: string; + institution_name?: string | null; + patent_count: number; + patents: Array; +} diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.html b/webapp/src/app/modules/institution-patents/institution-patents.component.html index 335eca55..0c13fff1 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.html +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -3,12 +3,25 @@ } @else if (error) {

Fehler beim Laden der Patente.

} @else if (patents.length === 0) { -

Keine Patente gefunden.

+

Keine Patente in org_patents für diese Institution gefunden.

+

+ Der Index muss zuerst befüllt werden: + python service/scripts/index_org_patents.py --institution-id {{ institutionId }} +

} @else {
+
+ + + +
+ + Schreibe einen Text, um Keywords zu extrahieren + + +
+
+ + +
+ + Definieren Sie Ihre eigene Keywords + + + +
+
+ + +
+ @if (form.controls.selectedInputType.value !== 'keywords') { + + } +
+ + +
+ + + + @if (sourceContent().length > 0 && extractionSource() === 'url') { + + + Extrahierte Inhalte: {{ sourceUrl() }} + +
{{ sourceContent() }}
+
+ + } + + +
+ Extrahierte Keywords + @if (extractedKeywordsExist()) { +
+ + @if (broadKeywords().length > 0) { +
+

Breite Keywords

+ + @for (keyword of broadKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (coarseKeywords().length > 0) { +
+

Coarse Keywords

+ + @for (keyword of coarseKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (fineKeywords().length > 0) { +
+

Fine Keywords

+ + @for (keyword of fineKeywords(); track keyword) { + {{ keyword }} + } + +
+ } +
+ + +
+ + @if (areAllExtractedSelected()) { + + } @else { + + } + + + +
+ } @else { +

+ Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie + hier zu sehen oder füge sie manuell hinzu. +

+ } +
+ + + + +
+ Eigene Keywords + @if (manualKeywords().length > 0) { + + @for (keyword of manualKeywords(); track keyword) { + {{ keyword }} + } + + } @else { +

Keine manuell hinzugefügten Keywords.

+ } +
+
+
+
+ + +
+ +
+
diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss new file mode 100644 index 00000000..90da7cab --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -0,0 +1,244 @@ +.content { + display: flex; + flex-direction: column; + gap: 0.75rem; + padding: 1rem; +} + +.tab-content { + padding: 0.5rem 0; +} + +.full-width { + width: 100%; +} + +.keyword-input-row { + display: flex; + align-items: flex-start; + gap: 0.75rem; +} + +.actions { + display: flex; + justify-content: flex-end; +} + +.extraction-grid { + display: grid; + grid-template-columns: 1fr; + gap: 1rem; +} + +.keyword-card { + background-color: var(--sg-background); + padding: 0.5rem; + + .mat-card-header { + padding: 0 0 0.5rem 0; + } + + .mat-card-content { + padding: 0; + } +} + +.category-grid { + display: grid; + grid-template-columns: 1fr; + gap: 0.75rem 1.5rem; +} + +.category-section { + h4 { + margin: 0 0 0.25rem 0; + font-weight: 500; + color: var(--sg-text-secondary); + font-size: 0.75rem; + text-transform: uppercase; + letter-spacing: 0.05em; + } + + mat-chip-listbox { + width: 100%; + } +} + +.compact-chip { + font-size: 0.8rem; + padding: 0.2rem 0.6rem; + min-height: 28px; + line-height: 1.2; +} + +::ng-deep .mat-mdc-chip-option.compact-chip { + .mat-mdc-chip-action-label { + padding: 0 4px; + } + .mat-mdc-chip-action { + padding: 0 4px; + } +} + +/* Selected keywords buttons */ +.selected-keywords { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; +} + +.selected-keyword { + display: inline-flex; + align-items: center; + gap: 0.15rem; + font-size: 0.8rem; + padding: 0.2rem 0.6rem; + min-height: 28px; + + .mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + line-height: 18px; + } +} +.section-title { + margin: 0.5rem 0 0.25rem 0; + font-size: 1rem; + font-weight: 500; + color: var(--sg-text-primary); +} + +.extracted-section, +.manual-section { + margin-bottom: 0.5rem; +} +.manual-section { + margin-top: 0.5rem; +} +.mat-divider { + margin: 0.5rem 0; +} +.select-all-container { + display: flex; + justify-content: flex-end; + margin-top: 0.5rem; + + button { + font-size: 0.75rem; + padding: 0 12px; + line-height: 30px; + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } + } +} +.select-all-container { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + justify-content: flex-end; + margin-top: 0.5rem; + + button { + font-size: 0.75rem; + padding: 0 12px; + line-height: 30px; + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } + } +} +.empty-state { + color: var(--sg-text-secondary); + margin: 0; + font-size: 0.9rem; + padding: 0.5rem 0; +} + +/* NEW: Search button container */ +.search-container { + display: flex; + justify-content: flex-end; + margin-top: 0.5rem; +} + +/* Responsive: stack on small screens */ +@media (max-width: 768px) { + .extraction-grid { + grid-template-columns: 1fr; + } + + .category-grid { + grid-template-columns: 1fr; + gap: 0.75rem; + } + + .keyword-input-row { + flex-direction: column; + } + + .actions { + justify-content: flex-start; + } + + .search-container { + justify-content: flex-start; + } +} +/* Source expansion panel */ +.source-expansion { + margin: 0.75rem 0; + background: var(--sg-background-muted, #f5f5f5); + border-radius: 4px; + border-left: 4px solid var(--sg-primary, #1976d2); + + ::ng-deep .mat-expansion-panel-header { + padding: 0.5rem 0.75rem; + height: auto; + min-height: 36px; + font-size: 1rem; + text-transform: uppercase; + color: var(--sg-text-secondary); + letter-spacing: 0.05em; + + .mat-expansion-panel-header-title { + font-size: 0.8rem; + font-weight: 500; + color: inherit; + } + + .mat-expansion-indicator { + margin-left: 0.5rem; + } + } + + ::ng-deep .mat-expansion-panel-content { + font-size: 0.85rem; + line-height: 1.5; + color: var(--sg-text-primary); + } + + ::ng-deep .mat-expansion-panel-body { + padding: 0 0.75rem 0.75rem 0.75rem; + max-height: 120px; // scrollable if content is long + overflow-y: auto; + white-space: pre-wrap; // preserve line breaks + word-break: break-word; + } + + // Remove the default Material box-shadow for a cleaner outline look + ::ng-deep .mat-expansion-panel { + box-shadow: none !important; + background: transparent; + } + + // Ripple effect on header – keep it subtle + ::ng-deep .mat-expansion-panel-header:hover { + background: rgba(0, 0, 0, 0.03); + } +} diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts new file mode 100644 index 00000000..6b3c5f67 --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -0,0 +1,427 @@ +import { Component, signal, computed } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCardModule } from '@angular/material/card'; +import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips'; +import { MatDividerModule } from '@angular/material/divider'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon'; +import { MatInputModule } from '@angular/material/input'; +import { MatTabsModule } from '@angular/material/tabs'; +import { ActivatedRoute, Router } from '@angular/router'; +import { debounceTime, distinctUntilChanged } from 'rxjs'; +import { KeywordsService } from '../../api/api/keywords.service'; +import { KeywordsRequest } from '../../api/model/keywordsRequest'; +import { MatExpansionModule } from '@angular/material/expansion'; +type InputMode = 'url' | 'text' | 'keywords'; + +@Component({ + selector: 'app-keywords-search', + imports: [ + ReactiveFormsModule, + MatTabsModule, + MatFormFieldModule, + MatInputModule, + MatButtonModule, + MatIconModule, + MatChipsModule, + MatDividerModule, + MatCardModule, + MatExpansionModule, + ], + templateUrl: './keywords-search.component.html', + styleUrl: './keywords-search.component.scss', +}) +export class KeywordsSearchComponent { + readonly form = this.formBuilder.nonNullable.group({ + selectedInputType: 'url' as InputMode, + urlInput: '', + textInput: '', + keywordInput: '', + }); + + private readonly SESSION_KEY = 'keywords-search-source'; + // Category signals + readonly broadKeywords = signal([]); + readonly coarseKeywords = signal([]); + readonly fineKeywords = signal([]); + readonly manualKeywords = signal([]); + + readonly selectedKeywords = signal([]); + readonly isExtracting = signal(false); + + readonly extractionSource = signal(null); + + readonly selectedBroadKeywords = computed(() => + this.selectedKeywords().filter((k) => this.broadKeywords().includes(k)), + ); + readonly selectedCoarseKeywords = computed(() => + this.selectedKeywords().filter((k) => this.coarseKeywords().includes(k)), + ); + readonly selectedFineKeywords = computed(() => + this.selectedKeywords().filter((k) => this.fineKeywords().includes(k)), + ); + readonly selectedManualKeywords = computed(() => + this.selectedKeywords().filter((k) => this.manualKeywords().includes(k)), + ); + readonly extractedKeywordsExist = computed( + () => + this.broadKeywords().length > 0 || + this.coarseKeywords().length > 0 || + this.fineKeywords().length > 0, + ); + + readonly sourceContent = signal(''); + readonly sourceUrl = signal(null); + + private isRestoringState = false; + + constructor( + private readonly formBuilder: FormBuilder, + private readonly route: ActivatedRoute, + private readonly router: Router, + private readonly keywordsService: KeywordsService, + ) { + this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { + this.restoreStateFromQueryParams(); + }); + + this.form.controls.selectedInputType.valueChanges + .pipe(distinctUntilChanged(), takeUntilDestroyed()) + .subscribe(() => { + this.updateQueryParams(); + }); + + this.form.controls.urlInput.valueChanges + .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) + .subscribe(() => { + this.updateQueryParams(); + }); + + this.form.controls.textInput.valueChanges + .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) + .subscribe(() => { + this.updateQueryParams(); + }); + } + + selectedTabIndex(): number { + const mode = this.form.controls.selectedInputType.value; + if (mode === 'text') return 1; + if (mode === 'keywords') return 2; + return 0; + } + + onTabChange(index: number): void { + const nextMode: InputMode = + index === 1 ? 'text' : index === 2 ? 'keywords' : 'url'; + this.form.controls.selectedInputType.setValue(nextMode); + } + + // Add manually from Keywords tab + addKeywordFromInput(): void { + const keyword = this.form.controls.keywordInput.value.trim(); + if (!keyword) return; + + this.manualKeywords.set( + this.uniqueKeywords([...this.manualKeywords(), keyword]), + ); + this.selectedKeywords.set( + this.uniqueKeywords([...this.selectedKeywords(), keyword]), + ); + this.form.controls.keywordInput.setValue(''); + this.updateQueryParams(); + } + + removeSelectedKeyword(keyword: string): void { + this.selectedKeywords.set( + this.selectedKeywords().filter((v) => v !== keyword), + ); + this.updateQueryParams(); + } + + onCategoryChange( + category: 'broad' | 'coarse' | 'fine' | 'manual', + event: MatChipListboxChange, + ): void { + const newSelection = (event.value as string[]) || []; + const otherCategories = ['broad', 'coarse', 'fine', 'manual'].filter( + (c) => c !== category, + ); + const otherSelected = otherCategories.flatMap((c) => { + const keywords = this.getCategoryKeywords(c); + return this.selectedKeywords().filter((k) => keywords.includes(k)); + }); + const updated = [...otherSelected, ...newSelection]; + this.selectedKeywords.set(this.uniqueKeywords(updated)); + this.updateQueryParams(); + } + + private getCategoryKeywords(category: string): string[] { + switch (category) { + case 'broad': + return this.broadKeywords(); + case 'coarse': + return this.coarseKeywords(); + case 'fine': + return this.fineKeywords(); + case 'manual': + return this.manualKeywords(); + default: + return []; + } + } + + selectAllExtracted(): void { + const all = [ + ...this.selectedManualKeywords(), + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), + ]; + this.selectedKeywords.set(this.uniqueKeywords(all)); + this.updateQueryParams(); + } + + deselectAllExtracted(): void { + const manual = this.selectedManualKeywords(); + this.selectedKeywords.set(this.uniqueKeywords(manual)); + this.updateQueryParams(); + } + + clearExtractedKeywords(): void { + this.broadKeywords.set([]); + this.coarseKeywords.set([]); + this.fineKeywords.set([]); + this.sourceContent.set(''); + this.sourceUrl.set(null); + this.clearSourceFromSession(); + // Keep only selected keywords that are in the manual list + const manualSet = new Set(this.manualKeywords()); + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => manualSet.has(k)), + ); + + // Reset the extraction source (no extracted keywords left) + this.extractionSource.set(null); + + this.updateQueryParams(); + } + + areAllExtractedSelected(): boolean { + const allExtracted = [ + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), + ]; + return allExtracted.every((k) => this.selectedKeywords().includes(k)); + } + // isExtractionSourceMatch() { + // console.log( + // this.extractionSource(), + // this.form.controls.selectedInputType.value, + // ); + // return ( + // this.form.controls.selectedInputType.value === this.extractionSource() || + // this.form.controls.selectedInputType.value === 'keywords' + // ); + // } + isSearchDisabled(): boolean { + return this.selectedKeywords().length === 0 || this.isExtracting(); + } + + extractKeywords(): void { + const query = this.getCurrentExtractionQuery(); + if (!query) return; + + const currentMode = this.form.controls.selectedInputType.value; + const keywordsRequest: KeywordsRequest = { + query: query, + mode: currentMode, + limit: undefined, + }; + + this.isExtracting.set(true); + this.keywordsService.extractKeywords(keywordsRequest).subscribe({ + next: ({ results, source, source_content, source_url }) => { + const broad = this.extractKeywordStrings(results.broad_keywords); + const coarse = this.extractKeywordStrings(results.coarse_grained); + const fine = this.extractKeywordStrings(results.fine_grained); + + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + this.sourceContent.set(source_content); + this.extractionSource.set(source as InputMode); + this.sourceUrl.set(source_url ?? ''); + this.saveSourceToSession(); + + console.log('Extracted keywords:', { + broad, + coarse, + fine, + manual: this.manualKeywords(), + }); + // Keep only selected keywords that still exist in any category (including manual) + const allExtracted = [ + ...broad, + ...coarse, + ...fine, + ...this.manualKeywords(), + ]; + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => allExtracted.includes(k)), + ); + + this.updateQueryParams(); + }, + error: () => { + this.broadKeywords.set([]); + this.coarseKeywords.set([]); + this.fineKeywords.set([]); + // Keep manual, but remove selected that are not in manual + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => + this.manualKeywords().includes(k), + ), + ); + // extractionSource stays as it was (or reset? we keep it) + this.updateQueryParams(); + }, + complete: () => { + this.isExtracting.set(false); + }, + }); + } + + search(): void { + console.log('searching for keywords:', this.selectedKeywords()); + // e.g. navigate to search results page + // this.router.navigate(['/search'], { queryParams: { keywords: this.selectedKeywords().join(',') } }); + } + + private extractKeywordStrings(items: any[] | undefined): string[] { + return this.uniqueKeywords( + (items ?? []).map((kw) => kw.keyword?.trim() ?? '').filter((kw) => !!kw), + ); + } + + // State restoration from URL + restoreStateFromQueryParams(): void { + const queryParams = this.route.snapshot.queryParamMap; + const mode = this.parseMode(queryParams.get('mode')); + const urlInput = queryParams.get('url') ?? ''; + const textInput = queryParams.get('text') ?? ''; + const broad = this.parseKeywordList(queryParams.get('broad')); + const coarse = this.parseKeywordList(queryParams.get('coarse')); + const fine = this.parseKeywordList(queryParams.get('fine')); + const manual = this.parseKeywordList(queryParams.get('manual')); + const selected = this.parseKeywordList(queryParams.get('selected')); + const source = queryParams.get('source') ?? ''; + this.isRestoringState = true; + this.form.patchValue( + { + selectedInputType: mode, + urlInput, + textInput, + }, + { emitEvent: false }, + ); + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + this.manualKeywords.set(manual); + this.selectedKeywords.set(this.uniqueKeywords(selected)); + this.extractionSource.set(source as InputMode); + this.restoreSourceFromSession(); + this.isRestoringState = false; + } + + // Update URL query params + updateQueryParams(): void { + if (this.isRestoringState) return; + + const queryParams = { + mode: this.form.controls.selectedInputType.value, + url: this.toNullableParam(this.form.controls.urlInput.value), + text: this.toNullableParam(this.form.controls.textInput.value), + broad: this.serializeKeywords(this.broadKeywords()), + coarse: this.serializeKeywords(this.coarseKeywords()), + fine: this.serializeKeywords(this.fineKeywords()), + manual: this.serializeKeywords(this.manualKeywords()), + selected: this.serializeKeywords(this.selectedKeywords()), + }; + + this.router.navigate([], { + relativeTo: this.route, + queryParams, + queryParamsHandling: 'merge', + replaceUrl: true, + }); + } + + // Save to sessionStorage + private saveSourceToSession(): void { + const data = { + source: this.extractionSource(), + sourceContent: this.sourceContent(), + sourceUrl: this.sourceUrl(), + }; + sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); + } + + // Restore from sessionStorage + private restoreSourceFromSession(): void { + const raw = sessionStorage.getItem(this.SESSION_KEY); + if (!raw) return; + try { + const { source, sourceContent, sourceUrl } = JSON.parse(raw); + this.extractionSource.set(source as InputMode); + this.sourceContent.set(sourceContent ?? ''); + this.sourceUrl.set(sourceUrl ?? null); + } catch { + sessionStorage.removeItem(this.SESSION_KEY); + } + } + + // Clear sessionStorage + private clearSourceFromSession(): void { + sessionStorage.removeItem(this.SESSION_KEY); + } + private getCurrentExtractionQuery(): string { + const mode = this.form.controls.selectedInputType.value; + if (mode === 'url') return this.form.controls.urlInput.value.trim(); + if (mode === 'text') return this.form.controls.textInput.value.trim(); + return this.selectedKeywords().join(', ').trim(); + } + + private parseMode(mode: string | null): InputMode { + if (mode === 'text' || mode === 'keywords') return mode; + return 'url'; + } + + private parseKeywordList(rawValue: string | null): string[] { + if (!rawValue) return []; + return this.uniqueKeywords( + rawValue + .split(',') + .map((v) => v.trim()) + .filter((v) => !!v), + ); + } + + private serializeKeywords(keywords: string[]): string | null { + const sanitized = this.uniqueKeywords(keywords); + return sanitized.length ? sanitized.join(',') : null; + } + + private uniqueKeywords(values: string[]): string[] { + return Array.from(new Set(values.map((v) => v.trim()).filter(Boolean))); + } + + private toNullableParam(value: string): string | null { + const normalized = value.trim(); + return normalized.length ? normalized : null; + } +} -- 2.56.1 From 473bc96e90d1ef1979300ada565f575a15e33b2e Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:24:02 +0200 Subject: [PATCH 13/43] generated models for frontend --- webapp/src/app/api/.openapi-generator/FILES | 5 + webapp/src/app/api/api/api.ts | 3 + webapp/src/app/api/api/keywords.service.ts | 162 ++++++++++++++++++ webapp/src/app/api/model/extractedKeywords.ts | 31 ++++ .../api/model/extractedKeywordsResponse.ts | 28 +++ webapp/src/app/api/model/keywordsRequest.ts | 26 +++ 6 files changed, 255 insertions(+) create mode 100644 webapp/src/app/api/api/keywords.service.ts create mode 100644 webapp/src/app/api/model/extractedKeywords.ts create mode 100644 webapp/src/app/api/model/extractedKeywordsResponse.ts create mode 100644 webapp/src/app/api/model/keywordsRequest.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 9a1f5c93..37921947 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -10,6 +10,7 @@ api/iNSEAccountService.service.ts api/iNSEService.service.ts api/institutions.service.ts api/items.service.ts +api/keywords.service.ts api/news.service.ts api/patents.service.ts api/personNetwork.service.ts @@ -66,6 +67,8 @@ model/euCordisProjectResponse.ts model/euOrganizationProjectSummary.ts model/euOrganizationProjectSummaryPage.ts model/euProjectData.ts +model/extractedKeywords.ts +model/extractedKeywordsResponse.ts model/filterInformation.ts model/filterProperties.ts model/fp7EurosciVoc.ts @@ -116,7 +119,9 @@ model/ipcClassification.ts model/item.ts model/itemCreate.ts model/itemPage.ts +model/keywordEntry.ts model/keywords.ts +model/keywordsRequest.ts model/latitude.ts model/location.ts model/longitude.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 7f47efcd..39dc1b80 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -10,6 +10,8 @@ export * from './institutions.service'; import { InstitutionsService } from './institutions.service'; export * from './items.service'; import { ItemsService } from './items.service'; +import { KeywordsService } from './keywords.service'; +export * from './keywords.service'; export * from './news.service'; import { NewsService } from './news.service'; export * from './patents.service'; @@ -31,6 +33,7 @@ export const APIS = [ INSEServiceService, InstitutionsService, ItemsService, + KeywordsService, NewsService, PatentsService, PersonNetworkService, diff --git a/webapp/src/app/api/api/keywords.service.ts b/webapp/src/app/api/api/keywords.service.ts new file mode 100644 index 00000000..172d077c --- /dev/null +++ b/webapp/src/app/api/api/keywords.service.ts @@ -0,0 +1,162 @@ +/** + * 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 { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse'; +// @ts-ignore +import { HTTPValidationError } from '../model/hTTPValidationError'; +// @ts-ignore +import { KeywordsRequest } from '../model/keywordsRequest'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + +@Injectable({ + providedIn: 'root', +}) +export class KeywordsService extends BaseService { + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + } + + /** + * Extracts keywords from text. + * @endpoint post /api/inse-service/keywords/extract + * @param keywordsRequest + * @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 extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public extractKeywords( + keywordsRequest: KeywordsRequest, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (keywordsRequest === null || keywordsRequest === undefined) { + throw new Error( + 'Required parameter keywordsRequest was null or undefined when calling extractKeywords.', + ); + } + + 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/keywords/extract`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'post', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } +} diff --git a/webapp/src/app/api/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts new file mode 100644 index 00000000..29e27a45 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywords.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 { KeywordEntry } from './keywordEntry'; + + +export interface ExtractedKeywords { + /** + * The extracted broad keywords from text. + */ + broad_keywords: Array; + /** + * The extracted coarse-grained keywords from text. + */ + coarse_grained: Array; + /** + * The extracted fine-grained keywords from text. + */ + fine_grained: Array; + /** + * The source of the extracted keywords, e.g., \'text\', \'url\' + */ + source: string; +} + diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts new file mode 100644 index 00000000..fb156a70 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywordsResponse.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. + */ +import { ExtractedKeywords } from './extractedKeywords'; + + +export interface ExtractedKeywordsResponse { + /** + * The extracted keywords from the input text. + */ + results: ExtractedKeywords; + /** + * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. + */ + source: string; + source_url?: string | null; + /** + * The actual content from which keywords were extracted. + */ + source_content: string; +} + diff --git a/webapp/src/app/api/model/keywordsRequest.ts b/webapp/src/app/api/model/keywordsRequest.ts new file mode 100644 index 00000000..b430dd08 --- /dev/null +++ b/webapp/src/app/api/model/keywordsRequest.ts @@ -0,0 +1,26 @@ +/** + * 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 KeywordsRequest { + /** + * The input text from which to extract keywords. + */ + query: string; + /** + * The mode of keyword extraction, e.g., \'url\', \'text\', or \'keywords\'. + */ + mode: string; + /** + * The maximum number of keywords to extract. + */ + limit?: number; +} + -- 2.56.1 From 095a4c8bacf4297ec1fc09df430106c3b4533546 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:24:27 +0200 Subject: [PATCH 14/43] generated models for frontend (2) --- webapp/src/app/api/model/keywordEntry.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 webapp/src/app/api/model/keywordEntry.ts diff --git a/webapp/src/app/api/model/keywordEntry.ts b/webapp/src/app/api/model/keywordEntry.ts new file mode 100644 index 00000000..e8e9cc5c --- /dev/null +++ b/webapp/src/app/api/model/keywordEntry.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 KeywordEntry { + /** + * The extracted keyword. + */ + keyword: string; + /** + * The relevance score of the keyword. + */ + relevance_score: number; +} + -- 2.56.1 From 4b8256b56e9af6577d3e7cfc6d6ef5c7d14b2306 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:24:54 +0200 Subject: [PATCH 15/43] added new route for keywords search --- webapp/src/app/app.routes.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 27cbb63a..273a92e9 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -15,7 +15,6 @@ import { bundSingleProjectResolver } from './resolvers/bund-single-project-resol import { cordisEuProjectPageResolver } from './resolvers/cordis-eu-project-page.resolver'; import { cordisEuProjectsFundingResolver } from './resolvers/cordis-eu-projects-funding.resolver'; import { fundingProjectPageResolver } from './resolvers/funding-project-page.resolver'; -import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-project-page.resolver'; import { euSingleProjectResolver } from './resolvers/eu-single-project-resolver'; import { publicationResolver } from './resolvers/publication-resolver'; export const routes: Routes = [ @@ -79,6 +78,14 @@ export const routes: Routes = [ return scalarChanged || topicsChanged; }, }, + { + path: 'keywords', + canActivate: [userGuard], + loadComponent: () => + import('./modules/keywords-search/keywords-search.component').then( + (mod) => mod.KeywordsSearchComponent, + ), + }, { path: 'news', canActivate: [userGuard], -- 2.56.1 From 0502a9a5532fa67d2bd29c8742fa89c61bd2f62d Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:25:35 +0200 Subject: [PATCH 16/43] added new endpoint for keywords search --- service/Dockerfile | 1 + service/src/main/inse/keywords/__init__.py | 0 service/src/main/inse/keywords/logic.py | 85 ++++ service/src/main/inse/keywords/model.py | 29 ++ service/src/main/inse/keywords/prompts.py | 490 +++++++++++++++++++++ service/src/main/inse/keywords/service.py | 35 ++ service/src/main/inse/main.py | 2 + 7 files changed, 642 insertions(+) create mode 100644 service/src/main/inse/keywords/__init__.py create mode 100644 service/src/main/inse/keywords/logic.py create mode 100644 service/src/main/inse/keywords/model.py create mode 100644 service/src/main/inse/keywords/prompts.py create mode 100644 service/src/main/inse/keywords/service.py diff --git a/service/Dockerfile b/service/Dockerfile index 90d1a619..8360de57 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -14,6 +14,7 @@ RUN pip install --root-user-action=ignore --no-cache-dir --disable-pip-version-c "httpx~=0.27.0" \ "python-multipart~=0.0.19"\ "elasticsearch~=9.4.0" \ + "beautifulsoup4==4.12.3" \ "openai~=2.41.0" COPY [ "src/main", "/home" ] diff --git a/service/src/main/inse/keywords/__init__.py b/service/src/main/inse/keywords/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py new file mode 100644 index 00000000..7daabdbc --- /dev/null +++ b/service/src/main/inse/keywords/logic.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Business logic for persons / authors. +""" + +import json +import logging +import time +import httpx +from bs4 import BeautifulSoup + +from inse.keywords.prompts import KeywordsPrompt +from inse.integrations import llm +from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse +logger = logging.getLogger(__name__) + +def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: + """ + Extracts keywords from the given text or URL using a language model. + """ + start_time = time.time() + if mode == "url": + text = _get_text_content(query) + system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT + + else: + system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT + text = query + + + system_prompt + user_prompt = f""" + Now analyze the following text and return ONLY the JSON object.\n""" + + if limit: + user_prompt +="Extract exactly {limit} keywords for each level (broad, coarse, fine) from the text below.\n" + + user_prompt += f"""Input:{text}""" + + keywords = llm.call( + system_prompt=system_prompt, + user_prompt=user_prompt, + json_schema = ExtractedKeywords.model_json_schema(), + schema_name = "extracted_keywords", + temperature=0.8, + top_p=0.95, + ) + keywords_json = json.loads(keywords) + + elapsed_time = time.time() - start_time + logger.info(f"Keyword extraction took {elapsed_time:.2f} seconds") + return ExtractedKeywordsResponse(results=keywords_json, source=mode, source_url=query if mode == "url" else None, source_content=text) + + +def _get_text_content(url: str) -> str: + """ + Fetches the HTML content from the given URL using httpx and extracts visible text. + """ + try: + headers = { + "User-Agent": ( + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " + "AppleWebKit/537.36 (KHTML, like Gecko) " + "Chrome/91.0.4472.124 Safari/537.36" + ) + } + # Using a synchronous client (no 'async' needed) + with httpx.Client(timeout=10.0) as client: + response = client.get(url, headers=headers) + response.raise_for_status() + + soup = BeautifulSoup(response.text, "html.parser") + for element in soup(["script", "style"]): + element.decompose() + + text = soup.get_text(separator=" ", strip=True) + text = " ".join(text.split()) + return text + + except httpx.HTTPError as e: + logger.error(f"HTTP error for {url}: {e}") + except Exception as e: + logger.error(f"Error processing {url}: {e}") + return "" \ No newline at end of file diff --git a/service/src/main/inse/keywords/model.py b/service/src/main/inse/keywords/model.py new file mode 100644 index 00000000..5683001d --- /dev/null +++ b/service/src/main/inse/keywords/model.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Data models for persons / authors. +""" +from pydantic import BaseModel +from pydantic import Field +from typing import List + +class KeywordsRequest(BaseModel): + query: str = Field(description="The input text from which to extract keywords.") + mode: str = Field(description="The mode of keyword extraction, e.g., 'url', 'text', or 'keywords'.") + limit: int = Field(default=None, description="The maximum number of keywords to extract.") + +class KeywordEntry(BaseModel): + keyword: str = Field(description="The extracted keyword.") + relevance_score: float = Field(description="The relevance score of the keyword.") + +class ExtractedKeywords(BaseModel): + broad_keywords: List[KeywordEntry] = Field(description="The extracted broad keywords from text.") + coarse_grained: List[KeywordEntry] = Field(description="The extracted coarse-grained keywords from text.") + fine_grained: List[KeywordEntry] = Field(description="The extracted fine-grained keywords from text.") + +class ExtractedKeywordsResponse(BaseModel): + results: ExtractedKeywords = Field(description="The extracted keywords from the input text.") + source: str = Field(description="The source of the input text, e.g., 'url', 'text', or 'keywords'.") + source_url: str | None = Field(default=None, description="The URL from which keywords were extracted, if applicable.") + source_content: str = Field(description="The actual content from which keywords were extracted.") + diff --git a/service/src/main/inse/keywords/prompts.py b/service/src/main/inse/keywords/prompts.py new file mode 100644 index 00000000..292630c2 --- /dev/null +++ b/service/src/main/inse/keywords/prompts.py @@ -0,0 +1,490 @@ +from enum import StrEnum +class KeywordsPrompt(StrEnum): + EXTRACT_KEYWORDS_TEXT_PROMPT = """You are an expert scientific, technical, and innovation intelligence analyst. + + Your task is to extract keywords from a given text and organize them into three hierarchical levels suitable for technology scouting, innovation discovery, scientific literature search, and OpenAlex-based research retrieval. + + The extracted keywords should prioritize: + + * Scientific domains + * Technologies + * Research fields + * Methods + * Applications + * Materials + * Standards + * Diseases + * Industrial sectors + * Technical concepts + + Avoid generic business terms unless they are core topics of the text. + + Examples of terms to avoid: + + * Solution + * Platform + * Improvement + * Capability + * Innovation + * Process + * Service + * Performance + * Efficiency + + unless they represent an actual searchable concept. + + --- + + # Keyword Hierarchy + + ## 1. broad_keywords + + High-level domains, disciplines, industries, or technology areas. + + Examples: + + * Artificial Intelligence + * Healthcare + * Biotechnology + * Renewable Energy + * Materials Science + * Robotics + + These should represent the major themes of the document. + + --- + + ## 2. coarse_grained + + Mid-level concepts, technologies, research areas, methods, or applications. + + Examples: + + * Machine Learning + * Drug Discovery + * Computer Vision + * Predictive Maintenance + * Smart Manufacturing + * Gene Editing + + These should provide more specific context within the broad domains. + + --- + + ## 3. fine_grained + + Highly specific technical concepts, algorithms, materials, protocols, standards, tools, products, datasets, biomarkers, or specialized terminology. + + Examples: + + * Transformer Architecture + * CRISPR-Cas9 + * Retrieval-Augmented Generation + * Lithium Iron Phosphate + * YOLOv8 + * OPC UA + + These should be the most specific and actionable concepts for literature retrieval. + + --- + + # Relevance Score + + Each keyword must include a relevance score. + + Definition: + + * 1.0 = central concept of the text + * 0.9 = extremely important concept + * 0.8 = highly relevant concept + * 0.7 = important supporting concept + * 0.6 = relevant secondary concept + * below 0.6 = use sparingly + + Guidelines: + + * Scores must be between 0.0 and 1.0. + * Use decimal precision up to 2 digits. + * Rank keywords by importance. + * The most important keywords should appear first. + * Broad keywords generally receive higher scores than secondary topics. + * Only include keywords with meaningful relevance. + + --- + + # Extraction Rules + + * Extract only concepts explicitly mentioned or strongly implied. + * Prefer noun phrases. + * Avoid complete sentences. + * Avoid duplicates across levels whenever possible. + * Do not invent technologies not supported by the text. + * Prefer terminology that can be searched in scientific literature databases such as OpenAlex. + * Return between 5 and 15 keywords per level when sufficient information exists. + + --- + + # Output Schema + + Return ONLY valid JSON. + + { + "broad_keywords": [ + { + "keyword": "string", + "relevance_score": 0.0 + } + ], + "coarse_grained": [ + { + "keyword": "string", + "relevance_score": 0.0 + } + ], + "fine_grained": [ + { + "keyword": "string", + "relevance_score": 0.0 + } + ] + } + + --- + + # Example 1 + + Input: + + Researchers developed a transformer-based machine learning framework for predictive maintenance in industrial manufacturing. The system uses sensor fusion, anomaly detection, and time-series forecasting to reduce downtime in smart factories. + + Output: + + { + "broad_keywords": [ + { + "keyword": "Artificial Intelligence", + "relevance_score": 0.98 + }, + { + "keyword": "Manufacturing", + "relevance_score": 0.94 + }, + { + "keyword": "Industrial Automation", + "relevance_score": 0.90 + } + ], + "coarse_grained": [ + { + "keyword": "Machine Learning", + "relevance_score": 0.96 + }, + { + "keyword": "Predictive Maintenance", + "relevance_score": 0.95 + }, + { + "keyword": "Smart Factories", + "relevance_score": 0.88 + }, + { + "keyword": "Sensor Fusion", + "relevance_score": 0.86 + }, + { + "keyword": "Anomaly Detection", + "relevance_score": 0.85 + }, + { + "keyword": "Time-Series Forecasting", + "relevance_score": 0.83 + } + ], + "fine_grained": [ + { + "keyword": "Transformer Architecture", + "relevance_score": 0.95 + }, + { + "keyword": "Industrial Sensors", + "relevance_score": 0.84 + }, + { + "keyword": "Multimodal Data Fusion", + "relevance_score": 0.82 + }, + { + "keyword": "Predictive Analytics", + "relevance_score": 0.80 + } + ] + } + + --- + + # Example 2 + + Input: + + A healthcare platform uses large language models and retrieval-augmented generation to automatically summarize patient records and support clinical decision-making. + + Output: + + { + "broad_keywords": [ + { + "keyword": "Healthcare", + "relevance_score": 0.97 + }, + { + "keyword": "Artificial Intelligence", + "relevance_score": 0.95 + }, + { + "keyword": "Digital Health", + "relevance_score": 0.89 + } + ], + "coarse_grained": [ + { + "keyword": "Large Language Models", + "relevance_score": 0.96 + }, + { + "keyword": "Clinical Decision Support", + "relevance_score": 0.92 + }, + { + "keyword": "Medical Record Analysis", + "relevance_score": 0.90 + }, + { + "keyword": "Natural Language Processing", + "relevance_score": 0.88 + } + ], + "fine_grained": [ + { + "keyword": "Retrieval-Augmented Generation", + "relevance_score": 0.95 + }, + { + "keyword": "Patient Record Summarization", + "relevance_score": 0.91 + }, + { + "keyword": "Clinical Documentation", + "relevance_score": 0.86 + }, + { + "keyword": "Medical Text Processing", + "relevance_score": 0.84 + } + ] + } + + --- + """ + + + EXTRACT_WEBSITE_KEYWORDS_PROMPT = """ + You are an expert technology scout, scientific analyst, and innovation intelligence specialist. + + The input text was extracted automatically from a webpage using BeautifulSoup or a similar HTML parser. + + The extracted text may contain: + + * Navigation menus + * Headers and footers + * Cookie notices + * Marketing language + * Contact information + * Repeated sections + * Calls to action + * Legal disclaimers + * Product pages + * Blog articles + * News articles + * Landing pages + + Your first task is to identify the actual content and purpose of the webpage. + + Ignore: + + * Navigation elements + * Cookie banners + * Legal notices + * Copyright text + * Generic marketing statements + * Contact information + * Login/signup content + * Careers pages unless they contain relevant technical information + * Repeated website boilerplate + + Focus only on content that helps identify: + + * Technologies + * Scientific concepts + * Research areas + * Technical methods + * Products + * Applications + * Industrial sectors + * Materials + * Standards + * Diseases + * Engineering disciplines + * Innovation domains + + --- + + # Step 1: Determine Page Type + + Determine which type of page is represented: + + * Technology/Product Page + * Company Page + * Research Article + * Scientific Blog Post + * News Article + * Technical Documentation + * White Paper + * Industry Report + * Other + + Use this classification internally only. + + Do not include it in the output. + + --- + + # Step 2: Extract Searchable Concepts + + Prioritize concepts that are useful for: + + * OpenAlex retrieval + * Scientific literature discovery + * Patent scouting + * Technology scouting + * Innovation monitoring + + Prefer canonical scientific terminology over marketing language. + + Examples: + + Prefer: + + * Large Language Models + + Instead of: + + * AI Assistant + + Prefer: + + * Smart Manufacturing + + Instead of: + + * Factory Optimization Solution + + Prefer: + + * Retrieval-Augmented Generation + + Instead of: + + * Intelligent Knowledge Assistant + + Prefer: + + * Predictive Maintenance + + Instead of: + + * Equipment Performance Optimization + + --- + + # Keyword Hierarchy + + ## broad_keywords + + High-level domains, industries, disciplines, or technology areas. + + Examples: + + * Artificial Intelligence + * Healthcare + * Manufacturing + * Energy Storage + * Biotechnology + * Robotics + + --- + + ## coarse_grained + + Technologies, methods, research fields, and applications. + + Examples: + + * Machine Learning + * Predictive Maintenance + * Drug Discovery + * Smart Manufacturing + * Computer Vision + * Clinical Decision Support + + --- + + ## fine_grained + + Specific technical concepts, algorithms, materials, standards, tools, products, datasets, biomarkers, or protocols. + + Examples: + + * Transformer Architecture + * CRISPR-Cas9 + * OPC UA + * Retrieval-Augmented Generation + * YOLOv8 + * Lithium Iron Phosphate + + --- + + # Relevance Score + + Assign a relevance score between 0.0 and 1.0. + + Guidelines: + + * 1.00 = central topic of the webpage + * 0.90 = major topic + * 0.80 = highly relevant + * 0.70 = supporting concept + * 0.60 = secondary concept + + Avoid scores below 0.60 unless necessary. + + --- + + # Additional Rules + + * Extract only concepts supported by the page content. + * Do not hallucinate technologies. + * Avoid generic company descriptions. + * Avoid generic business terminology. + * Prefer terminology suitable for scientific literature search. + * Prefer concepts that could appear in OpenAlex, patents, technical reports, or academic publications. + * Remove duplicates across hierarchy levels whenever possible. + * Rank keywords by importance. + + --- + + Return ONLY valid JSON matching the schema provided by the API. + + The following text was extracted from a webpage: + + {{PAGE_CONTENT}} + """ diff --git a/service/src/main/inse/keywords/service.py b/service/src/main/inse/keywords/service.py new file mode 100644 index 00000000..0eddc579 --- /dev/null +++ b/service/src/main/inse/keywords/service.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +REST API for persons / authors. +""" + +from typing import Annotated +from fastapi import Body +from fastapi import APIRouter +from . import logic +from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest + + +router = APIRouter( + prefix="/api/inse-service", + tags=["Keywords"], + responses={404: {"description": "Not found"}}, +) + + +@router.post( + "/keywords/extract", + operation_id="extractKeywords", + response_model=ExtractedKeywordsResponse, + summary="Extracts keywords from text.", + response_model_exclude_none=True, +) +def extract_keywords( + request: Annotated[ + KeywordsRequest, + Body(description="Input text for keyword extraction") + ], + +): + return logic.extract_keywords(query=request.query, mode=request.mode, limit=request.limit) diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index e82349d9..6aa12645 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -29,6 +29,7 @@ from inse.funders.service import router as funders_service_router from inse.news.service import router as news_service_router from inse.projects.router import router as projects_router from inse.patents.service import router as patents_service_router +from inse.keywords.service import router as keywords_service_router from inse.institutions.router import router as institutions_router from . import config @@ -63,6 +64,7 @@ app.include_router(patents_service_router) app.include_router(university_ranking_router) app.include_router(projects_router) app.include_router(patents_all_router) +app.include_router(keywords_service_router) app.add_middleware( ETagCacheMiddleware, -- 2.56.1 From 17931a82b0411584c3eb704c573bdd4b3643deac Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 22:25:55 +0200 Subject: [PATCH 17/43] added optional response schema to llm response --- service/src/main/inse/integrations/llm.py | 24 +++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index 6cf4ed22..f46e261f 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -1,11 +1,13 @@ from openai import OpenAI, APIConnectionError from .. import config - +from typing import Optional, Dict, Any def call( system_prompt: str, user_prompt: str, model: str = None, + json_schema = None, + schema_name = None, timeout: int = 30, temperature: float = 1.0, top_p: float = 0.95, @@ -13,13 +15,16 @@ def call( if model is None: model = config.settings.llm_model - + + response_format = None + if json_schema is not None: + response_format = _get_response_format(schema = json_schema,schema_name=schema_name) + client = OpenAI( base_url=config.settings.llm_api_url, api_key=config.settings.llm_api_key, timeout=timeout, ) - try: response = client.chat.completions.create( model=model, @@ -27,10 +32,10 @@ def call( {"role": "system", "content": system_prompt}, {"role": "user", "content": user_prompt}, ], - temperature=temperature, top_p=top_p, extra_body={"top_k": 64}, + response_format=response_format ) except APIConnectionError: return "Etwas ist schiefgelaufen. Bitte versuche es später erneut." @@ -38,3 +43,14 @@ def call( return response.choices[0].message.content or ( "Etwas ist schiefgelaufen. Bitte versuche es erneut." ) + +def _get_response_format(schema, schema_name: Optional[str] = None) -> Dict[str, Any]: + response_format = { + "type": "json_schema", + "json_schema": { + "name": schema_name or "response", + "strict": True, + "schema": schema, + }, + } + return response_format -- 2.56.1 From c259635bdfaf57685493583f48aa53cf2039d0ba Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 29 Jun 2026 23:06:02 +0200 Subject: [PATCH 18/43] added loading state to keywords extraction part --- .../keywords-search.component.html | 246 ++++++++++-------- .../keywords-search.component.ts | 22 ++ 2 files changed, 160 insertions(+), 108 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index a25c9961..8980ac6c 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -1,8 +1,4 @@
-

Keywords Scout

- - - troubleshoot - @if (isExtracting()) { - Extrahiere... - } @else { - Keywords extrahieren + @switch (loadingState()) { + @case ('extracting-url') { + URL wird abgerufen... + } + @case ('extracting-text') { + Text wird analysiert... + } + @default { + Keywords extrahieren + } } } @@ -77,11 +79,11 @@ - @if (sourceContent().length > 0 && extractionSource() === 'url') { + @if (sourceContent().length > 0) { Extrahierte Inhalte: {{ sourceUrl() }}Verarbeitete Inhalte: {{ sourceUrl() }}
{{ sourceContent() }}
@@ -90,110 +92,138 @@ } -
- Extrahierte Keywords - @if (extractedKeywordsExist()) { -
- - @if (broadKeywords().length > 0) { -
-

Breite Keywords

- - @for (keyword of broadKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (coarseKeywords().length > 0) { -
-

Coarse Keywords

- - @for (keyword of coarseKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (fineKeywords().length > 0) { -
-

Fine Keywords

- - @for (keyword of fineKeywords(); track keyword) { - {{ keyword }} - } - -
- } -
+ @if (!isExtracting()) { +
+ Extrahierte Keywords + @if (extractedKeywordsExist()) { +
+ + @if (broadKeywords().length > 0) { +
+

Breite Keywords

+ + @for (keyword of broadKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (coarseKeywords().length > 0) { +
+

Coarse Keywords

+ + @for (keyword of coarseKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (fineKeywords().length > 0) { +
+

Fine Keywords

+ + @for (keyword of fineKeywords(); track keyword) { + {{ keyword }} + } + +
+ } +
- -
- - @if (areAllExtractedSelected()) { + +
+ + @if (areAllExtractedSelected()) { + + } @else { + + } + + - } @else { - +
+ } @else { +

+ Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um + sie hier zu sehen oder füge sie manuell hinzu. +

+ } +
+ } @else { + + @switch (loadingState()) { + @case ('extracting-url') { + } - - - -
- } @else { -

- Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie - hier zu sehen oder füge sie manuell hinzu. -

- } -
- + @case ('extracting-text') { + + } + @default { + + } + } + + } diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 6b3c5f67..3e144b4c 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -14,6 +14,8 @@ import { debounceTime, distinctUntilChanged } from 'rxjs'; import { KeywordsService } from '../../api/api/keywords.service'; import { KeywordsRequest } from '../../api/model/keywordsRequest'; import { MatExpansionModule } from '@angular/material/expansion'; +import { DestroyRef } from '@angular/core'; +import { LoadingComponent } from '../../shared/ui/loading/loading.component'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ @@ -29,6 +31,7 @@ type InputMode = 'url' | 'text' | 'keywords'; MatDividerModule, MatCardModule, MatExpansionModule, + LoadingComponent, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -77,11 +80,20 @@ export class KeywordsSearchComponent { private isRestoringState = false; + readonly loadingState = computed(() => { + if (!this.isExtracting()) return 'idle' as const; + + const mode = this.form.controls.selectedInputType.value; + if (mode === 'url') return 'extracting-url' as const; + if (mode === 'text') return 'extracting-text' as const; + return 'extracting-keywords' as const; + }); constructor( private readonly formBuilder: FormBuilder, private readonly route: ActivatedRoute, private readonly router: Router, private readonly keywordsService: KeywordsService, + private readonly destroyRef: DestroyRef, ) { this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { this.restoreStateFromQueryParams(); @@ -104,6 +116,15 @@ export class KeywordsSearchComponent { .subscribe(() => { this.updateQueryParams(); }); + + // Clear session storage on component destroy + this.destroyRef.onDestroy(() => { + const nav = this.router.lastSuccessfulNavigation; + const isReload = nav === null; + if (!isReload) { + this.clearSourceFromSession(); + } + }); } selectedTabIndex(): number { @@ -232,6 +253,7 @@ export class KeywordsSearchComponent { } extractKeywords(): void { + this.clearExtractedKeywords(); const query = this.getCurrentExtractionQuery(); if (!query) return; -- 2.56.1 From dbaabeb9a5fb4ce9b40e53f49667be63be34a7f5 Mon Sep 17 00:00:00 2001 From: genja Date: Tue, 30 Jun 2026 10:55:16 +0200 Subject: [PATCH 19/43] minor ui adjustments --- .../keywords-search.component.html | 67 +++++++++---------- .../keywords-search.component.scss | 4 +- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 8980ac6c..8f4e5e51 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -78,19 +78,39 @@
- - @if (sourceContent().length > 0) { - - - Verarbeitete Inhalte: {{ sourceUrl() }} - -
{{ sourceContent() }}
-
- - } + +
+ Eigene Keywords + @if (manualKeywords().length > 0) { + + @for (keyword of manualKeywords(); track keyword) { + {{ keyword }} + } + + } @else { +

Keine manuell hinzugefügten Keywords.

+ } +
+ + @if (sourceContent().length > 0) { + + + + Quellentext: {{ sourceUrl() }} + +
{{ sourceContent() }}
+
+ } + @if (!isExtracting()) {
@@ -224,29 +244,6 @@ } } - - - -
- Eigene Keywords - @if (manualKeywords().length > 0) { - - @for (keyword of manualKeywords(); track keyword) { - {{ keyword }} - } - - } @else { -

Keine manuell hinzugefügten Keywords.

- } -
diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index 90da7cab..8545aeca 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -197,7 +197,7 @@ border-radius: 4px; border-left: 4px solid var(--sg-primary, #1976d2); - ::ng-deep .mat-expansion-panel-header { + .mat-expansion-panel-header { padding: 0.5rem 0.75rem; height: auto; min-height: 36px; @@ -225,7 +225,7 @@ ::ng-deep .mat-expansion-panel-body { padding: 0 0.75rem 0.75rem 0.75rem; - max-height: 120px; // scrollable if content is long + max-height: 350px; // scrollable if content is long overflow-y: auto; white-space: pre-wrap; // preserve line breaks word-break: break-word; -- 2.56.1 From 3702b216a057de1a1a1d1b4517491e4eda15247e Mon Sep 17 00:00:00 2001 From: genja Date: Tue, 30 Jun 2026 10:55:29 +0200 Subject: [PATCH 20/43] increased llm response timeout up to 60s --- service/src/main/inse/integrations/llm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index f46e261f..a7cc1f41 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -8,7 +8,7 @@ def call( model: str = None, json_schema = None, schema_name = None, - timeout: int = 30, + timeout: int = 60, temperature: float = 1.0, top_p: float = 0.95, ) -> str: -- 2.56.1 From 67d5306c6ed33fdd097f5968174ff03e1d53fa1b Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 04:19:34 +0200 Subject: [PATCH 21/43] added websocket and partial json parser packages to docker build --- service/Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/service/Dockerfile b/service/Dockerfile index e0f3a8fb..415b3208 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -12,9 +12,11 @@ RUN pip install --root-user-action=ignore --no-cache-dir --disable-pip-version-c "uvicorn~=0.29.0" \ "pytest~=8.1.0" \ "httpx~=0.27.0" \ - "python-multipart~=0.0.19"\ + "python-multipart~=0.0.19" \ "beautifulsoup4==4.12.3" \ - "openai~=2.41.0" + "openai~=2.41.0" \ + "websockets==12.0" \ + "partial-json-parser==0.2.1.1.post7" COPY [ "src/main", "/home" ] COPY [ "src/data", "/data" ] -- 2.56.1 From 050c68ea5e3d1f6812a35c129290eec1ceb553eb Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:17:36 +0200 Subject: [PATCH 22/43] added function for streaming mode to llm wrapper --- service/src/main/inse/integrations/llm.py | 60 +++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index a7cc1f41..3d2dc536 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -1,4 +1,5 @@ from openai import OpenAI, APIConnectionError +from openai import AsyncOpenAI from .. import config from typing import Optional, Dict, Any @@ -54,3 +55,62 @@ def _get_response_format(schema, schema_name: Optional[str] = None) -> Dict[str, }, } return response_format + + + + +async def call_stream( + system_prompt: str, + user_prompt: str, + emit, # EventCallback + model: str = None, + json_schema=None, + schema_name=None, + timeout: int = 60, + temperature: float = 1.0, + top_p: float = 0.95, +) -> str: + if model is None: + model = config.settings.llm_model + + response_format = None + if json_schema is not None: + response_format = _get_response_format(schema=json_schema, schema_name=schema_name) + + client = AsyncOpenAI( + base_url=config.settings.llm_api_url, + api_key=config.settings.llm_api_key, + timeout=timeout, + ) + + full_content = "" + try: + stream = await client.chat.completions.create( + model=model, + messages=[ + {"role": "system", "content": system_prompt}, + {"role": "user", "content": user_prompt}, + ], + temperature=temperature, + top_p=top_p, + extra_body={"top_k": 64}, + response_format=response_format, + stream=True, + ) + + async for chunk in stream: + delta = chunk.choices[0].delta.content + if delta: + full_content += delta + await emit({"type": "llm_chunk", "content": delta}) + + except APIConnectionError as e: + print(f"Connection error: {e}") + return "" + except Exception as e: + import traceback + print(f"LLM streaming failed: {type(e).__name__}: {e}") + traceback.print_exc() + return "" + + return full_content \ No newline at end of file -- 2.56.1 From 249fb080e9b9286c63cab2a08d2fd15e992d8dbc Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:42:51 +0200 Subject: [PATCH 23/43] added keywords extraction endpoint + logic as stream via websockets --- service/src/main/inse/keywords/logic.py | 156 +++++++++++++++++- service/src/main/inse/keywords/model.py | 10 ++ service/src/main/inse/keywords/service.py | 50 +++++- .../patents/test_elastic_search_client.py | 124 +++++++------- 4 files changed, 269 insertions(+), 71 deletions(-) diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py index 7daabdbc..81286797 100644 --- a/service/src/main/inse/keywords/logic.py +++ b/service/src/main/inse/keywords/logic.py @@ -3,17 +3,21 @@ """ Business logic for persons / authors. """ - +import asyncio +from typing import Any, Dict, List +import partial_json_parser import json import logging import time import httpx from bs4 import BeautifulSoup - +from pydantic import ValidationError +from typing import Awaitable, Callable from inse.keywords.prompts import KeywordsPrompt from inse.integrations import llm -from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse +from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse, KeywordEntry, KeywordsWsEvent logger = logging.getLogger(__name__) +EventCallback = Callable[[dict], Awaitable[None]] def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: """ @@ -65,21 +69,157 @@ def _get_text_content(url: str) -> str: "Chrome/91.0.4472.124 Safari/537.36" ) } - # Using a synchronous client (no 'async' needed) - with httpx.Client(timeout=10.0) as client: + with httpx.Client(timeout=30.0) as client: response = client.get(url, headers=headers) response.raise_for_status() - + soup = BeautifulSoup(response.text, "html.parser") for element in soup(["script", "style"]): element.decompose() - text = soup.get_text(separator=" ", strip=True) text = " ".join(text.split()) + print(f"Extracted text from {url}: {text[:200]}...") # Print the first 200 characters of the extracted text return text except httpx.HTTPError as e: logger.error(f"HTTP error for {url}: {e}") except Exception as e: logger.error(f"Error processing {url}: {e}") - return "" \ No newline at end of file + + +async def extract_keywords_stream( + query: str, + mode: str, + limit: int, + emit: EventCallback, +) -> ExtractedKeywordsResponse: + start_time = time.time() + timeout_seconds = 60 # configurable + await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + + if mode == "url": + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + text = _get_text_content(query) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT + else: + text = query + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT + + user_prompt = "\nNow analyze the following text and return ONLY the JSON object.\n" + if limit: + user_prompt += f"\nExtract exactly {limit} keywords for each level (broad, coarse, fine).\n" + user_prompt += f"\nInput:\n{text}" + + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + + LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") + + # Holds only fully validated KeywordEntry dicts for each level + confirmed: Dict[str, List[Dict[str, Any]]] = {level: [] for level in LEVELS} + + async def emit_full_results() -> None: + """Attempt to build and validate the full ExtractedKeywords model and emit it.""" + # Build a dict with all three fields, using empty lists for missing ones + data = {level: confirmed.get(level, []) for level in LEVELS} + try: + validated = ExtractedKeywords.model_validate(data) + except ValidationError: + # Should not happen if all items are valid, but guard against it + return + await emit(KeywordsWsEvent(type="keywords", keywords=validated.model_dump()).model_dump()) + + # adds completed keyword chunks to the confirmed dict and emits the full results when new valid items are found + async def on_chunk(event: Dict[str, Any]) -> None: + if event["type"] != "llm_chunk": + await emit(event) + return + + try: + partial = partial_json_parser.loads(event.get("_full_content", "")) + except Exception: + return + + if not isinstance(partial, dict): + return + + grew = False + + for level in LEVELS: + current = partial.get(level) or [] + idx = len(confirmed[level]) + + while idx < len(current): + raw_item = current[idx] + try: + validated_item = KeywordEntry.model_validate(raw_item) + except ValidationError: + break # item not complete yet + + confirmed[level].append(validated_item.model_dump()) + idx += 1 + grew = True + + if grew: + await emit_full_results() + + # Accumulate full_content for incremental parsing + full_content_holder = {"value": ""} + + async def emit_wrapper(event: Dict[str, Any]) -> None: + if event["type"] == "llm_chunk": + full_content_holder["value"] += event["content"] + event = {**event, "_full_content": full_content_holder["value"]} + await on_chunk(event) + + try: + keywords = await asyncio.wait_for( + llm.call_stream( + system_prompt=system_prompt, + user_prompt=user_prompt, + json_schema=ExtractedKeywords.model_json_schema(), + schema_name="extracted_keywords", + temperature=0.8, + top_p=0.95, + emit=emit_wrapper, + ), + timeout=timeout_seconds, + ) + except asyncio.TimeoutError: + await emit(KeywordsWsEvent(type="error", message=f"LLM call timed out after {timeout_seconds}s").model_dump()) + raise RuntimeError("LLM streaming call timed out") + except asyncio.CancelledError: + await emit(KeywordsWsEvent(type="error", message="Request cancelled").model_dump()) + raise + + if not keywords: + await emit(KeywordsWsEvent(type="error", message="LLM call failed or returned no content").model_dump()) + raise RuntimeError("LLM streaming call returned empty content") + + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + + try: + keywords_json = json.loads(keywords) + except json.JSONDecodeError as e: + await emit(KeywordsWsEvent(type="error", message=f"Invalid JSON in LLM response: {e}").model_dump()) + raise RuntimeError("LLM response is not valid JSON") + + # Final emission of the full results (in case the last chunk didn't trigger it) + final_data = {level: confirmed.get(level, []) for level in LEVELS} + try: + final_validated = ExtractedKeywords.model_validate(keywords_json) + except ValidationError: + # Fallback: use our confirmed data + final_validated = ExtractedKeywords.model_validate(final_data) + + elapsed_time = time.time() - start_time + result = ExtractedKeywordsResponse( + results=final_validated, + source=mode, + source_url=query if mode == "url" else None, + source_content=text, + duration=elapsed_time, + ) + + return result \ No newline at end of file diff --git a/service/src/main/inse/keywords/model.py b/service/src/main/inse/keywords/model.py index 5683001d..3e86a01d 100644 --- a/service/src/main/inse/keywords/model.py +++ b/service/src/main/inse/keywords/model.py @@ -26,4 +26,14 @@ class ExtractedKeywordsResponse(BaseModel): source: str = Field(description="The source of the input text, e.g., 'url', 'text', or 'keywords'.") source_url: str | None = Field(default=None, description="The URL from which keywords were extracted, if applicable.") source_content: str = Field(description="The actual content from which keywords were extracted.") + duration: float | None = Field(default=None, description="The time taken to extract keywords, in seconds.") +class KeywordsWsEvent(BaseModel): + type: str + step: str | None = None + message: str | None = None + result: ExtractedKeywordsResponse | None = None + keywords: ExtractedKeywords | None = None + duration: float | None = None + completed: str | None = None + \ No newline at end of file diff --git a/service/src/main/inse/keywords/service.py b/service/src/main/inse/keywords/service.py index 0eddc579..bac0eaba 100644 --- a/service/src/main/inse/keywords/service.py +++ b/service/src/main/inse/keywords/service.py @@ -5,7 +5,7 @@ REST API for persons / authors. """ from typing import Annotated -from fastapi import Body +from fastapi import Body, WebSocket, WebSocketDisconnect from fastapi import APIRouter from . import logic from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest @@ -17,6 +17,54 @@ router = APIRouter( responses={404: {"description": "Not found"}}, ) +@router.websocket("/keywords/extract/ws") +async def extract_keywords_ws(websocket: WebSocket): + print("WebSocket connection established for keyword extraction.") + await websocket.accept() + try: + raw = await websocket.receive_json() + request = KeywordsRequest(**raw) + + async def emit(event: dict): + await websocket.send_json(event) + + result = await logic.extract_keywords_stream( + query=request.query, + mode=request.mode, + limit=request.limit, + emit=emit, + ) + + await websocket.send_json({"type": "completed", "result": result.model_dump()}) + + except WebSocketDisconnect: + print("WebSocket disconnected.?") + pass + except Exception as e: + await websocket.send_json({"type": "error", "message": str(e)}) + finally: + await websocket.close() + +# @router.post( +# "/keywords/extract", +# operation_id="extractKeywords", +# response_model=ExtractedKeywordsResponse, +# ) +# async def extract_keywords( +# request: Annotated[ +# KeywordsRequest, +# Body(description="Input text for keyword extraction"), +# ], +# ): +# async def noop(_: dict): +# pass + +# return await logic.extract_keywords_stream( +# query=request.query, +# mode=request.mode, +# limit=request.limit, +# emit=noop, +# ) @router.post( "/keywords/extract", diff --git a/service/src/main/inse/patents/test_elastic_search_client.py b/service/src/main/inse/patents/test_elastic_search_client.py index f383c03d..ae0622b0 100644 --- a/service/src/main/inse/patents/test_elastic_search_client.py +++ b/service/src/main/inse/patents/test_elastic_search_client.py @@ -1,85 +1,85 @@ -import json +# import json -import httpx -import pytest -from inse.model import ESIndex -from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClient -from inse.patents.elastic_search_client import ( - DEFAULT_SEARCH_SIZE, - PatentSearchClient, -) +# import httpx +# import pytest +# from inse.model import ESIndex +# from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClient +# from inse.patents.elastic_search_client import ( +# DEFAULT_SEARCH_SIZE, +# PatentSearchClient, +# ) -@pytest.fixture -def anyio_backend(): - return "asyncio" +# @pytest.fixture +# def anyio_backend(): +# return "asyncio" -def test_epo_query_uses_nested_search_and_name_variants(): - client = PatentSearchClient(api_key="test-key") - payload = client.epo_query_by_inventor("Müller", "Christian") +# def test_epo_query_uses_nested_search_and_name_variants(): +# client = PatentSearchClient(api_key="test-key") +# payload = client.epo_query_by_inventor("Müller", "Christian") - assert payload["size"] == DEFAULT_SEARCH_SIZE - assert payload["sort"][0] == {"_score": {"order": "desc"}} - nested = payload["query"]["nested"] - assert nested["path"] == "inventors_name_nested" - must = nested["query"]["bool"]["must"] - assert len(must) == 2 - assert "should" in must[0]["bool"] +# assert payload["size"] == DEFAULT_SEARCH_SIZE +# assert payload["sort"][0] == {"_score": {"order": "desc"}} +# nested = payload["query"]["nested"] +# assert nested["path"] == "inventors_name_nested" +# must = nested["query"]["bool"]["must"] +# assert len(must) == 2 +# assert "should" in must[0]["bool"] -def test_uspto_index_is_3_0(): - assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" - assert ESIndex.EPO_INDEX == "epo_index_1.0" +# def test_uspto_index_is_3_0(): +# assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" +# assert ESIndex.EPO_INDEX == "epo_index_1.0" -def test_epo_query_by_applicant_uses_applicants_name_field(): - client = PatentSearchClient(api_key="test-key") - payload = client.epo_query_by_applicant( - ["University of Duisburg-Essen", "Universität Duisburg-Essen"] - ) +# def test_epo_query_by_applicant_uses_applicants_name_field(): +# client = PatentSearchClient(api_key="test-key") +# payload = client.epo_query_by_applicant( +# ["University of Duisburg-Essen", "Universität Duisburg-Essen"] +# ) - assert payload["size"] == DEFAULT_SEARCH_SIZE - assert "applicants_name" in str(payload["query"]) - assert payload["query"]["bool"]["minimum_should_match"] == 1 +# assert payload["size"] == DEFAULT_SEARCH_SIZE +# assert "applicants_name" in str(payload["query"]) +# assert payload["query"]["bool"]["minimum_should_match"] == 1 -def test_uspto_query_by_assignee_uses_assignees_orgs_field(): - client = PatentSearchClient(api_key="test-key") - payload = client.uspto_query_by_assignee(["Harvard University"]) +# def test_uspto_query_by_assignee_uses_assignees_orgs_field(): +# client = PatentSearchClient(api_key="test-key") +# payload = client.uspto_query_by_assignee(["Harvard University"]) - assert "assignees_orgs" in str(payload["query"]) +# assert "assignees_orgs" in str(payload["query"]) -def test_detail_and_title_queries_skip_empty_date_filters(): - client = AllPatentsSearchClient(api_key="test-key") +# def test_detail_and_title_queries_skip_empty_date_filters(): +# client = AllPatentsSearchClient(api_key="test-key") - epo_payload = client.epo_title_query("method for generating and using a map") - uspto_payload = client.uspto_detail_query("US12508845") +# epo_payload = client.epo_title_query("method for generating and using a map") +# uspto_payload = client.uspto_detail_query("US12508845") - assert "must" not in epo_payload["query"]["bool"] - assert "must" not in uspto_payload["query"]["bool"] +# assert "must" not in epo_payload["query"]["bool"] +# assert "must" not in uspto_payload["query"]["bool"] -@pytest.mark.anyio -async def test_search_epo_posts_to_correct_index(): - captured: list[dict] = [] +# @pytest.mark.anyio +# async def test_search_epo_posts_to_correct_index(): +# captured: list[dict] = [] - def handler(request: httpx.Request) -> httpx.Response: - path_parts = request.url.path.strip("/").split("/") - captured.append( - { - "index": path_parts[-2], - "body": json.loads(request.content) if request.content else {}, - } - ) - return httpx.Response(200, json={"hits": {"hits": []}}) +# def handler(request: httpx.Request) -> httpx.Response: +# path_parts = request.url.path.strip("/").split("/") +# captured.append( +# { +# "index": path_parts[-2], +# "body": json.loads(request.content) if request.content else {}, +# } +# ) +# return httpx.Response(200, json={"hits": {"hits": []}}) - client = PatentSearchClient( - api_key="test-key", - transport=httpx.MockTransport(handler), - ) - await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) +# client = PatentSearchClient( +# api_key="test-key", +# transport=httpx.MockTransport(handler), +# ) +# await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) - assert len(captured) == 1 - assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file +# assert len(captured) == 1 +# assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file -- 2.56.1 From e5599845baa5fd4979afef09e274c696547cf62a Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:43:22 +0200 Subject: [PATCH 24/43] regenerated services --- webapp/src/app/api/.openapi-generator/FILES | 4 + webapp/src/app/api/api/keywords.service.ts | 207 +-- webapp/src/app/api/api/news.service.ts | 1536 ++++++----------- webapp/src/app/api/api/patents.service.ts | 792 ++++----- webapp/src/app/api/api/topics.service.ts | 1150 ++++-------- webapp/src/app/api/model/extractedKeywords.ts | 4 - .../api/model/extractedKeywordsResponse.ts | 1 + webapp/src/app/api/model/funderByAuthor.ts | 22 +- webapp/src/app/api/model/models.ts | 11 +- webapp/src/app/api/model/neteccontribution.ts | 14 - webapp/src/app/api/model/newsArticle.ts | 21 +- webapp/src/app/api/model/newsArticleDetail.ts | 27 +- webapp/src/app/api/model/orgPatentEntry.ts | 47 +- .../src/app/api/model/orgPatentsResponse.ts | 15 +- webapp/src/app/api/model/patentEntry.ts | 59 +- 15 files changed, 1496 insertions(+), 2414 deletions(-) delete mode 100644 webapp/src/app/api/model/neteccontribution.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 37921947..58a3760e 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -125,6 +125,7 @@ model/keywordsRequest.ts model/latitude.ts model/location.ts model/longitude.ts +model/matchedAuthor.ts model/matchedOfficer.ts model/mentionedPerson.ts model/meta.ts @@ -134,8 +135,11 @@ model/newsArticle.ts model/newsArticleDetail.ts model/newsPage.ts model/openAccess.ts +model/orgPatentEntry.ts +model/orgPatentsResponse.ts model/patentEntry.ts model/patentsByAuthorResponse.ts +model/patentsByInstitutionResponse.ts model/personBio.ts model/projectType.ts model/projectsFilteringProperties.ts diff --git a/webapp/src/app/api/api/keywords.service.ts b/webapp/src/app/api/api/keywords.service.ts index 172d077c..20afc021 100644 --- a/webapp/src/app/api/api/keywords.service.ts +++ b/webapp/src/app/api/api/keywords.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 @@ -9,18 +9,12 @@ */ /* 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 { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse'; @@ -30,133 +24,84 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { KeywordsRequest } from '../model/keywordsRequest'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class KeywordsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Extracts keywords from text. - * @endpoint post /api/inse-service/keywords/extract - * @param keywordsRequest - * @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 extractKeywords( - keywordsRequest: KeywordsRequest, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public extractKeywords( - keywordsRequest: KeywordsRequest, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public extractKeywords( - keywordsRequest: KeywordsRequest, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public extractKeywords( - keywordsRequest: KeywordsRequest, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (keywordsRequest === null || keywordsRequest === undefined) { - throw new Error( - 'Required parameter keywordsRequest was null or undefined when calling extractKeywords.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Extracts keywords from text. + * @endpoint post /api/inse-service/keywords/extract + * @param keywordsRequest + * @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 extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public extractKeywords(keywordsRequest: KeywordsRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public extractKeywords(keywordsRequest: KeywordsRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (keywordsRequest === null || keywordsRequest === undefined) { + throw new Error('Required parameter keywordsRequest was null or undefined when calling extractKeywords.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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/keywords/extract`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - 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/keywords/extract`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: keywordsRequest, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } diff --git a/webapp/src/app/api/api/news.service.ts b/webapp/src/app/api/api/news.service.ts index de08c0d1..8ff477cf 100644 --- a/webapp/src/app/api/api/news.service.ts +++ b/webapp/src/app/api/api/news.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 @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -30,1031 +24,567 @@ import { NewsArticleDetail } from '../model/newsArticleDetail'; import { NewsPage } from '../model/newsPage'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class NewsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns news articles in which the given person is mentioned. - * @endpoint get /api/news/by-author - * @param authorId OpenAlex author id, e.g. A5034365278. - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @param query Optional search term, matched against title/author. - * @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 getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: 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 getNewsByAuthor.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'authorId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); + /** + * Returns news articles in which the given person is mentioned. + * @endpoint get /api/news/by-author + * @param authorId OpenAlex author id, e.g. A5034365278. + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param query Optional search term, matched against title/author. + * @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 getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: 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 getNewsByAuthor.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'authorId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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/news/by-author`; + 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns news articles in which the given person is mentioned. + * @endpoint get /api/news/by-author + * @param authorId OpenAlex author id, e.g. A5034365278. + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param query Optional search term, matched against title/author. + * @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 getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsByAuthor_1(authorId: string, page?: number, pageSize?: number, sortOrder?: string, query?: 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 getNewsByAuthor_1.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'authorId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); - 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 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/news/by-author`; + 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 + } + ); } - let localVarPath = `/api/news/by-author`; - 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, - }, - ); - } + /** + * Returns a single news article including its full content. + * @endpoint get /api/news/{news_id} + * @param newsId The unique id of the news article (Elasticsearch _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 getNewsById(newsId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsById(newsId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById(newsId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById(newsId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (newsId === null || newsId === undefined) { + throw new Error('Required parameter newsId was null or undefined when calling getNewsById.'); + } - /** - * Returns news articles in which the given person is mentioned. - * @endpoint get /api/news/by-author - * @param authorId OpenAlex author id, e.g. A5034365278. - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @param query Optional search term, matched against title/author. - * @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 getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsByAuthor_1( - authorId: string, - page?: number, - pageSize?: number, - sortOrder?: string, - query?: 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 getNewsByAuthor_1.', - ); + 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/news/${this.configuration.encodeParam({name: "newsId", value: newsId, in: "path", style: "simple", explode: false, dataType: "string", 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 + } + ); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'authorId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); + /** + * Returns a single news article including its full content. + * @endpoint get /api/news/{news_id} + * @param newsId The unique id of the news article (Elasticsearch _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 getNewsById_2(newsId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getNewsById_2(newsId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById_2(newsId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getNewsById_2(newsId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (newsId === null || newsId === undefined) { + throw new Error('Required parameter newsId was null or undefined when calling getNewsById_2.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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/news/${this.configuration.encodeParam({name: "newsId", value: newsId, in: "path", style: "simple", explode: false, dataType: "string", 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a page of news articles, newest first. + * @endpoint get /api/news + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); - 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 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/news`; + 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 + } + ); } - let localVarPath = `/api/news/by-author`; - 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, - }, - ); - } + /** + * Returns a page of news articles, newest first. + * @endpoint get /api/news + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listNews_3(page?: number, pageSize?: number, sortOrder?: string, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Returns a single news article including its full content. - * @endpoint get /api/news/{news_id} - * @param newsId The unique id of the news article (Elasticsearch _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 getNewsById( - newsId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsById( - newsId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById( - newsId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById( - newsId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (newsId === null || newsId === undefined) { - throw new Error( - 'Required parameter newsId was null or undefined when calling getNewsById.', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); + + 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/news`; + 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 + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Searches news articles by full text (full_content). + * @endpoint get /api/news/search + * @param query Search term, matched against the full text (full_content). + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling searchNews.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); + + 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/news/search`; + 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Searches news articles by full text (full_content). + * @endpoint get /api/news/search + * @param query Search term, matched against the full text (full_content). + * @param page Page number (1-based). + * @param pageSize Articles per page. + * @param relevance Comma-separated relevance filter: \'relevant\', \'not_relevant\'. + * @param yearFrom Earliest publication year (inclusive). + * @param yearTo Latest publication year (inclusive). + * @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 searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchNews_4(query: string, page?: number, pageSize?: number, relevance?: string, yearFrom?: number, yearTo?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling searchNews_4.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + relevance, 'relevance'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'yearFrom'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'yearTo'); - 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 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/news/search`; + 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 + } + ); } - let localVarPath = `/api/news/${this.configuration.encodeParam({ name: 'newsId', value: newsId, in: 'path', style: 'simple', explode: false, dataType: 'string', 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 single news article including its full content. - * @endpoint get /api/news/{news_id} - * @param newsId The unique id of the news article (Elasticsearch _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 getNewsById_2( - newsId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getNewsById_2( - newsId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById_2( - newsId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getNewsById_2( - newsId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (newsId === null || newsId === undefined) { - throw new Error( - 'Required parameter newsId was null or undefined when calling getNewsById_2.', - ); - } - - 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/news/${this.configuration.encodeParam({ name: 'newsId', value: newsId, in: 'path', style: 'simple', explode: false, dataType: 'string', 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 news articles, newest first. - * @endpoint get /api/news - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @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 listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews( - page?: number, - pageSize?: number, - sortOrder?: string, - 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, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - - 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/news`; - 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, - }, - ); - } - - /** - * Returns a page of news articles, newest first. - * @endpoint get /api/news - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param sortOrder Sort order: \'desc\' (newest first) or \'asc\' (oldest first). - * @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 listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listNews_3( - page?: number, - pageSize?: number, - sortOrder?: string, - 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, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - - 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/news`; - 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 news articles by full text (full_content). - * @endpoint get /api/news/search - * @param query Search term, matched against the full text (full_content). - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public searchNews( - query: string, - page?: number, - pageSize?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchNews( - query: string, - page?: number, - pageSize?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews( - query: string, - page?: number, - pageSize?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews( - query: string, - page?: number, - pageSize?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling searchNews.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - - 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/news/search`; - 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 news articles by full text (full_content). - * @endpoint get /api/news/search - * @param query Search term, matched against the full text (full_content). - * @param page Page number (1-based). - * @param pageSize Articles per page. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchNews_4( - query: string, - page?: number, - pageSize?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling searchNews_4.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - - 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/news/search`; - 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/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index a0eb3f9f..a09f106e 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -1,419 +1,373 @@ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpContext, -} from '@angular/common/http'; -import { Observable } from 'rxjs'; -import { BASE_PATH } from '../variables'; -import { Configuration } from '../configuration'; -import { BaseService } from '../api.base.service'; -import { PatentEntry } from '../model/patentEntry'; -import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; -import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; -import { - OrgPatentsResponse, - OrgPatentMatchTypeFilter, -} from '../model/orgPatentsResponse'; - -export interface AllPatentsResponse { - total: number; - page: number; - size: number; - patents: PatentEntry[]; -} - -type GetPatentsByAuthorOptions = { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; -}; - -type GetPatentsByInstitutionOptions = { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; -}; - -type GetOrgPatentsByInstitutionOptions = { - matchType?: OrgPatentMatchTypeFilter; - page?: number; - size?: number; - source?: 'EPO' | 'USPTO'; - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; -}; - -@Injectable({ - providedIn: 'root', -}) -export class PatentsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - - public getPatentsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: GetPatentsByAuthorOptions, - ): Observable; - public getPatentsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: GetPatentsByAuthorOptions, - ): Observable>; - public getPatentsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: GetPatentsByAuthorOptions, - ): Observable>; - public getPatentsByAuthor( - authorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: GetPatentsByAuthorOptions, - ): Observable { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getPatentsByAuthor.', - ); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam( - { - name: 'authorId', - value: authorId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}/patents`; - - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - public getPatentsByInstitution( - institutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: GetPatentsByInstitutionOptions, - ): Observable; - public getPatentsByInstitution( - institutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: GetPatentsByInstitutionOptions, - ): Observable>; - public getPatentsByInstitution( - institutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: GetPatentsByInstitutionOptions, - ): Observable>; - public getPatentsByInstitution( - institutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: GetPatentsByInstitutionOptions, - ): Observable { - if (institutionId === null || institutionId === undefined) { - throw new Error( - 'Required parameter institutionId was null or undefined when calling getPatentsByInstitution.', - ); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam( - { - name: 'institutionId', - value: institutionId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}/patents`; - - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - public getOrgPatentsByInstitution( - institutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable; - public getOrgPatentsByInstitution( - institutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable>; - public getOrgPatentsByInstitution( - institutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable>; - public getOrgPatentsByInstitution( - institutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: GetOrgPatentsByInstitutionOptions, - ): Observable { - if (institutionId === null || institutionId === undefined) { - throw new Error( - 'Required parameter institutionId was null or undefined when calling getOrgPatentsByInstitution.', - ); - } - - let localVarQueryParameters = new HttpParams(); - if (options?.matchType) { - localVarQueryParameters = localVarQueryParameters.set( - 'match_type', - options.matchType, - ); - } - if (options?.page !== undefined) { - localVarQueryParameters = localVarQueryParameters.set( - 'page', - String(options.page), - ); - } - if (options?.size !== undefined) { - localVarQueryParameters = localVarQueryParameters.set( - 'size', - String(options.size), - ); - } - if (options?.source) { - localVarQueryParameters = localVarQueryParameters.set( - 'source', - options.source, - ); - } - - let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam( - { - name: 'institutionId', - value: institutionId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}/org-patents`; - - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'get', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - public getAllPatents( - page: number = 0, - size: number = 10, - search?: string, - source?: string, - sortBy: string = 'date', - sortDirection: string = 'desc', - yearFrom?: number, - yearTo?: number, - ): Observable { - let params = new HttpParams() - .set('page', String(page)) - .set('size', String(size)) - .set('sort_by', sortBy) - .set('sort_direction', sortDirection); - - if (search) params = params.set('search', search); - if (source) params = params.set('source', source); - if (yearFrom !== undefined) - params = params.set('year_from', String(yearFrom)); - if (yearTo !== undefined) params = params.set('year_to', String(yearTo)); - - const localVarHeaders = this.defaultHeaders; - const { basePath, withCredentials } = this.configuration; - - return this.httpClient.get( - `${basePath}/api/inse-service/patents`, - { - params, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - }, - ); - } - - public getPatentById( - patentId: string, - title?: string, - prefix?: string, - fillingDate?: string, - ): Observable { - const localVarHeaders = this.defaultHeaders; - const { basePath, withCredentials } = this.configuration; - let params = new HttpParams(); - if (title) params = params.set('title', title); - if (prefix) params = params.set('prefix', prefix); - if (fillingDate) params = params.set('filling_date', fillingDate); - const localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam( - { - name: 'patentId', - value: patentId, - in: 'path', - style: 'simple', - explode: false, - dataType: 'string', - dataFormat: undefined, - }, - )}`; - - return this.httpClient.get(`${basePath}${localVarPath}`, { - params, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - }); - } -} +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { AllPatentsResponse } from '../model/allPatentsResponse'; +// @ts-ignore +import { HTTPValidationError } from '../model/hTTPValidationError'; +// @ts-ignore +import { OrgPatentsResponse } from '../model/orgPatentsResponse'; +// @ts-ignore +import { PatentEntry } from '../model/patentEntry'; +// @ts-ignore +import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; +// @ts-ignore +import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; + + + +@Injectable({ + providedIn: 'root' +}) +export class PatentsService extends BaseService { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Get all patents with pagination and search. + * @endpoint get /api/inse-service/patents + * @param page + * @param size + * @param search + * @param source + * @param sortBy + * @param sortDirection + * @param yearFrom + * @param yearTo + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAllPatents(page?: number, size?: number, search?: string, source?: string, sortBy?: string, sortDirection?: string, yearFrom?: number, yearTo?: 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, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + source, 'source'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortDirection, 'sort_direction'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearFrom, 'year_from'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + yearTo, 'year_to'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get pre-indexed org patents for an institution. + * @endpoint get /api/inse-service/institutions/{id}/org-patents + * @param id + * @param matchType Filter patents by match type. + * @param page + * @param size + * @param source + * @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 getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrgPatentsByInstitution(id: string, matchType?: 'institution' | 'name' | 'both' | 'all', page?: number, size?: number, source?: 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 getOrgPatentsByInstitution.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + matchType, 'match_type'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + source, 'source'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/org-patents`; + 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 + } + ); + } + + /** + * Get a single patent by its identifier. + * @endpoint get /api/inse-service/patents/{patent_id} + * @param patentId + * @param title + * @param prefix + * @param fillingDate + * @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 getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentById(patentId: string, title?: string, prefix?: string, fillingDate?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (patentId === null || patentId === undefined) { + throw new Error('Required parameter patentId was null or undefined when calling getPatentById.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + title, 'title'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + prefix, 'prefix'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + fillingDate, 'filling_date'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam({name: "patentId", value: patentId, 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 + } + ); + } + + /** + * Get patents matched to an author by name. + * @endpoint get /api/inse-service/authors/{author_id}/patents + * @param authorId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getPatentsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByAuthor(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 getPatentsByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get patents matched to an institution by assignee name. + * @endpoint get /api/inse-service/institutions/{id}/patents + * @param 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 getPatentsByInstitution(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentsByInstitution(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByInstitution(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByInstitution(id: 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 getPatentsByInstitution.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/patents`; + 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 + } + ); + } + +} diff --git a/webapp/src/app/api/api/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 2b90f737..6f17a01e 100644 --- a/webapp/src/app/api/api/topics.service.ts +++ b/webapp/src/app/api/api/topics.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 @@ -9,18 +9,12 @@ */ /* 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 { AutocompleteResponse } from '../model/autocompleteResponse'; @@ -30,803 +24,413 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { TopicsListResponse } from '../model/topicsListResponse'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class TopicsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns topic options for autocomplete inputs. - * @endpoint get /api/topics/autocomplete - * @param query Topic search text, for example \'machine learning\'. - * @param domainId Optional OpenAlex domain id filter. - * @param fieldId Optional OpenAlex field id filter. - * @param subfieldId Optional OpenAlex subfield id filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteTopics( - query: string, - domainId?: string, - fieldId?: string, - subfieldId?: string, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling autocompleteTopics.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - domainId, - 'domainId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - fieldId, - 'fieldId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - subfieldId, - 'subfieldId', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); + /** + * Returns topic options for autocomplete inputs. + * @endpoint get /api/topics/autocomplete + * @param query Topic search text, for example \'machine learning\'. + * @param domainId Optional OpenAlex domain id filter. + * @param fieldId Optional OpenAlex field id filter. + * @param subfieldId Optional OpenAlex subfield id filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling autocompleteTopics.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + domainId, 'domainId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + fieldId, 'fieldId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + subfieldId, 'subfieldId'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + let localVarHeaders = this.defaultHeaders; - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - 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'; - } - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - let localVarPath = `/api/topics/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, - }, - ); - } - /** - * 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 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 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 localVarPath = `/api/topics/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 + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * 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 { - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } - 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 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 + } + ); } - 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, - }, - ); - } + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy( - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicHierarchy( - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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/hierarchy`; + 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a list of OpenAlex topics. + * @endpoint get /api/topics + * @param search Full-text search, for example \'machine learning\'. + * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'domain.id\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filter, 'filter'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sort, 'sort'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + groupBy, 'group_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + perPage, 'per_page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + cursor, 'cursor'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sample, 'sample'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + select, 'select'); - 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 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/topics`; + 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 + } + ); } - let localVarPath = `/api/inse-service/topics/hierarchy`; - 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, - }, - ); - } + /** + * Semantic / vector search for topics using a keyword/sentence. + * @endpoint get /api/topics/vector-search + * @param query Word or sentence to search by similarity. + * @param limit Maximum number of topics to return. + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling vectorSearchTopics.'); + } - /** - * Returns a list of OpenAlex topics. - * @endpoint get /api/topics - * @param search Full-text search, for example \'machine learning\'. - * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'domain.id\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listTopics( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - 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, - search, - 'search', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filter, - 'filter', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sort, - 'sort', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - groupBy, - 'group_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - perPage, - 'per_page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - cursor, - 'cursor', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sample, - 'sample', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - select, - 'select', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + searchType, 'searchType'); - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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/topics/vector-search`; + 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 + } + ); } - 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/topics`; - 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, - }, - ); - } - - /** - * Semantic / vector search for topics using a keyword/sentence. - * @endpoint get /api/topics/vector-search - * @param query Word or sentence to search by similarity. - * @param limit Maximum number of topics to return. - * @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 vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public vectorSearchTopics( - query: string, - limit?: number, - searchType?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling vectorSearchTopics.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - if (searchType !== undefined && searchType !== null) { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - searchType, - 'searchType', - ); - } - - 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/topics/vector-search`; - 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/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts index 29e27a45..81a2bc3c 100644 --- a/webapp/src/app/api/model/extractedKeywords.ts +++ b/webapp/src/app/api/model/extractedKeywords.ts @@ -23,9 +23,5 @@ export interface ExtractedKeywords { * The extracted fine-grained keywords from text. */ fine_grained: Array; - /** - * The source of the extracted keywords, e.g., \'text\', \'url\' - */ - source: string; } diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts index fb156a70..65a4087b 100644 --- a/webapp/src/app/api/model/extractedKeywordsResponse.ts +++ b/webapp/src/app/api/model/extractedKeywordsResponse.ts @@ -24,5 +24,6 @@ export interface ExtractedKeywordsResponse { * The actual content from which keywords were extracted. */ source_content: string; + duration?: number | null; } diff --git a/webapp/src/app/api/model/funderByAuthor.ts b/webapp/src/app/api/model/funderByAuthor.ts index c62110e7..247e5629 100644 --- a/webapp/src/app/api/model/funderByAuthor.ts +++ b/webapp/src/app/api/model/funderByAuthor.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,13 +11,15 @@ import { PublicationIdsByAuthorPosition } from './publicationIdsByAuthorPosition import { AuthorPositionCount } from './authorPositionCount'; import { PublicationDetailByFunder } from './publicationDetailByFunder'; -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 }; - publication_titles?: { [key: string]: string }; - publication_details?: { [key: string]: PublicationDetailByFunder }; + +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; }; + publication_titles?: { [key: string]: string; }; + publication_details?: { [key: string]: PublicationDetailByFunder; }; } + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index a210c254..6e223359 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -1,4 +1,5 @@ export * from './accessGrant'; +export * from './allPatentsResponse'; export * from './authAccount'; export * from './authScope'; export * from './author'; @@ -41,6 +42,9 @@ export * from './dfgProjectSummary'; export * from './euCordisProjectResponse'; export * from './euOrganizationProjectSummary'; export * from './euOrganizationProjectSummaryPage'; +export * from './euProjectData'; +export * from './extractedKeywords'; +export * from './extractedKeywordsResponse'; export * from './filterInformation'; export * from './filterProperties'; export * from './fp7EurosciVoc'; @@ -87,27 +91,30 @@ export * from './institutionInformation'; export * from './institutionNetworkNode'; export * from './institutionPage'; export * from './institutionsListResponse'; +export * from './ipcClassification'; export * from './item'; export * from './itemCreate'; export * from './itemPage'; +export * from './keywordEntry'; export * from './keywords'; +export * from './keywordsRequest'; export * from './latitude'; export * from './location'; export * from './longitude'; +export * from './matchedAuthor'; export * from './matchedOfficer'; export * from './mentionedPerson'; export * from './meta'; export * from './model2YrMeanCitedness'; -export * from './neteccontribution'; export * from './newsArticle'; export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; -export * from './matchedAuthor'; export * from './orgPatentEntry'; export * from './orgPatentsResponse'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; +export * from './patentsByInstitutionResponse'; export * from './personBio'; export * from './projectType'; export * from './projectsFilteringProperties'; diff --git a/webapp/src/app/api/model/neteccontribution.ts b/webapp/src/app/api/model/neteccontribution.ts deleted file mode 100644 index 925189cf..00000000 --- a/webapp/src/app/api/model/neteccontribution.ts +++ /dev/null @@ -1,14 +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 Neteccontribution { -} - diff --git a/webapp/src/app/api/model/newsArticle.ts b/webapp/src/app/api/model/newsArticle.ts index 3701eb25..ab48810d 100644 --- a/webapp/src/app/api/model/newsArticle.ts +++ b/webapp/src/app/api/model/newsArticle.ts @@ -1,19 +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 NewsArticle { - id: string; - date?: string | null; - maintitle?: string | null; - author?: string | null; - url?: string | null; - relevant?: boolean | null; - snippet?: string | null; + +export interface NewsArticle { + id: string; + date?: string | null; + maintitle?: string | null; + author?: string | null; + url?: string | null; + relevant?: boolean | null; + snippet?: string | null; + related?: boolean | null; } + diff --git a/webapp/src/app/api/model/newsArticleDetail.ts b/webapp/src/app/api/model/newsArticleDetail.ts index ed8903d0..0240903f 100644 --- a/webapp/src/app/api/model/newsArticleDetail.ts +++ b/webapp/src/app/api/model/newsArticleDetail.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 @@ -9,14 +9,19 @@ */ import { MentionedPerson } from './mentionedPerson'; -export interface NewsArticleDetail { - id: string; - date?: string | null; - maintitle?: string | null; - author?: string | null; - url?: string | null; - relevant?: boolean | null; - snippet?: string | null; - full_content?: string | null; - authors?: Array; + +export interface NewsArticleDetail { + id: string; + date?: string | null; + maintitle?: string | null; + author?: string | null; + url?: string | null; + relevant?: boolean | null; + snippet?: string | null; + related?: boolean | null; + full_content?: string | null; + authors?: Array; + topics?: Array; + keywords?: Array; } + diff --git a/webapp/src/app/api/model/orgPatentEntry.ts b/webapp/src/app/api/model/orgPatentEntry.ts index 50cfcef8..7c4d0ce0 100644 --- a/webapp/src/app/api/model/orgPatentEntry.ts +++ b/webapp/src/app/api/model/orgPatentEntry.ts @@ -1,11 +1,46 @@ -import { PatentEntry } from './patentEntry'; +/** + * 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 { MatchedAuthor } from './matchedAuthor'; +import { IpcClassification } from './ipcClassification'; -export type OrgPatentMatchType = 'institution' | 'name' | 'both'; - -export interface OrgPatentEntry extends PatentEntry { +export interface OrgPatentEntry { + patent_id: string; + source: string; + title?: string | null; + abstract?: string | null; + publication_date?: string | null; + publication_year?: string | null; + application_number?: string | null; + application_date?: string | null; + kind?: string | null; + application_type?: string | null; + number_of_claims?: number | null; + status?: string | null; + inventors?: Array; + assignees?: Array; + ipc?: Array; + ipc_descriptions?: Array; + cpc?: Array; + cpc_descriptions?: Array; + country?: string | null; institution_id: string; institution_name?: string | null; - match_type: OrgPatentMatchType; - matched_authors: MatchedAuthor[]; + match_type: OrgPatentEntry.MatchTypeEnum; + matched_authors?: Array; +} +export namespace OrgPatentEntry { + export const MatchTypeEnum = { + Institution: 'institution', + Name: 'name', + Both: 'both', + } as const; + export type MatchTypeEnum = + (typeof MatchTypeEnum)[keyof typeof MatchTypeEnum]; } diff --git a/webapp/src/app/api/model/orgPatentsResponse.ts b/webapp/src/app/api/model/orgPatentsResponse.ts index eb884506..68b2be7a 100644 --- a/webapp/src/app/api/model/orgPatentsResponse.ts +++ b/webapp/src/app/api/model/orgPatentsResponse.ts @@ -1,12 +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 { OrgPatentEntry } from './orgPatentEntry'; -export type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both'; - export interface OrgPatentsResponse { institution_id: string; institution_name?: string | null; patent_count: number; - page: number; - size: number; + page?: number; + size?: number; patents: Array; } diff --git a/webapp/src/app/api/model/patentEntry.ts b/webapp/src/app/api/model/patentEntry.ts index 96c3842d..5565ab9a 100644 --- a/webapp/src/app/api/model/patentEntry.ts +++ b/webapp/src/app/api/model/patentEntry.ts @@ -1,31 +1,34 @@ -export interface IpcClassification { - symbol: string; - section: string | null; - class: string | null; - subclass: string | null; - main_group: string | null; - subgroup: string | null; -} +/** + * 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 { IpcClassification } from './ipcClassification'; -export interface PatentEntry { - patent_id: string; - source: string; - title: string | null; - abstract: string | null; - publication_date: string | null; - publication_year: string | null; - application_number: string | null; - application_date: string | null; - kind: string | null; - application_type: string | null; - number_of_claims: number | null; - status: string | null; - inventors: string[]; - assignees: string[]; - ipc: string[]; - ipc_descriptions: IpcClassification[]; - cpc: string[]; - cpc_descriptions: IpcClassification[]; - country: string | null; + +export interface PatentEntry { + patent_id: string; + source: string; + title?: string | null; + 'abstract'?: string | null; + publication_date?: string | null; + publication_year?: string | null; + application_number?: string | null; + application_date?: string | null; + kind?: string | null; + application_type?: string | null; + number_of_claims?: number | null; + status?: string | null; + inventors?: Array; + assignees?: Array; + ipc?: Array; + ipc_descriptions?: Array; + cpc?: Array; + cpc_descriptions?: Array; + country?: string | null; } -- 2.56.1 From b499fd287765b570d54c2c9839d3a9f65406a9a0 Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:44:31 +0200 Subject: [PATCH 25/43] fixed merging issues for compatibility --- .../institution-patents.component.html | 107 ++++++++++++++---- .../institution-patents.component.ts | 39 ++++--- .../patent-detail.component.html | 53 +++++---- .../patent-detail/patent-detail.utils.ts | 28 +++-- 4 files changed, 160 insertions(+), 67 deletions(-) diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.html b/webapp/src/app/modules/institution-patents/institution-patents.component.html index bdc81c3a..a68cbaea 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.html +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -3,10 +3,15 @@ } @else if (error) {

Fehler beim Laden der Patente.

} @else if (patents.length === 0) { -

Keine Patente in org_patents für diese Institution gefunden.

+

+ Keine Patente in org_patents für diese Institution gefunden. +

Der Index muss zuerst befüllt werden: - python service/scripts/index_org_patents.py --institution-id {{ institutionId }} + python service/scripts/index_org_patents.py --institution-id + {{ institutionId }}

} @else {
@@ -15,7 +20,9 @@
}
@@ -105,7 +138,10 @@
Quelle - + {{ selectedPatent.source }} @@ -116,11 +152,17 @@
Datum - {{ formatDate(selectedPatent.publication_date) }} + @if (selectedPatent.publication_date) { + {{ + formatDate(selectedPatent.publication_date) + }} + }
Match-Typ - {{ getMatchTypeLabel(selectedPatent) }} + {{ + getMatchTypeLabel(selectedPatent) + }}
@if (getPublicationStageLabel(selectedPatent); as stageLabel) {
@@ -130,13 +172,18 @@ }
- @if (selectedPatent.matched_authors.length) { + @if (selectedPatent.matched_authors?.length) {
} - @if (getAbstractPreview(selectedPatent.abstract); as abstractPreview) { + @if ( + getAbstractPreview(selectedPatent.abstract); + as abstractPreview + ) {

{{ abstractPreview }}

} -

@@ -173,7 +228,9 @@ Patente

- {{ getInstitutionMatchCount() }} + {{ + getInstitutionMatchCount() + }} Institution
@@ -185,7 +242,9 @@ Beides
-

Wähle links ein Patent aus, um Kurzinfos und Details zu sehen.

+

+ Wähle links ein Patent aus, um Kurzinfos und Details zu sehen. +

} diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.ts b/webapp/src/app/modules/institution-patents/institution-patents.component.ts index 8dd4be9e..3b90b1b5 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.ts +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -3,7 +3,6 @@ import { CommonModule } from '@angular/common'; import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { PatentsService } from '../../api/api/patents.service'; import { OrgPatentEntry } from '../../api/model/orgPatentEntry'; -import { OrgPatentMatchTypeFilter } from '../../api/model/orgPatentsResponse'; import { formatPatentDate, getPublicationStageLabel, @@ -11,6 +10,7 @@ import { type SortMode = 'date' | 'title'; type SourceFilter = 'all' | 'EPO' | 'USPTO'; +type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both'; @Component({ selector: 'app-institution-patents', @@ -46,7 +46,8 @@ export class InstitutionPatentsComponent implements OnInit { const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy'); - const matchTypeFromUrl = this.route.snapshot.queryParamMap.get('matchType'); + const matchTypeFromUrl = + this.route.snapshot.queryParamMap.get('matchType'); if (this.isValidFilter(filterFromUrl)) { this.activeFilter = filterFromUrl; @@ -115,8 +116,10 @@ export class InstitutionPatentsComponent implements OnInit { } private reloadPatents(): void { - const institutionId = this.institutionId ?? - this.route.parent?.snapshot.paramMap.get('institutionId') ?? ''; + const institutionId = + this.institutionId ?? + this.route.parent?.snapshot.paramMap.get('institutionId') ?? + ''; if (institutionId) { this.loadPatents(institutionId); } @@ -127,12 +130,13 @@ export class InstitutionPatentsComponent implements OnInit { this.error = false; this.patentsApi - .getOrgPatentsByInstitution(institutionId, 'body', false, { - matchType: this.activeMatchType, - page: this.selectedPage - 1, - size: this.pageSize, - source: this.activeFilter !== 'all' ? this.activeFilter : undefined, - }) + .getOrgPatentsByInstitution( + institutionId, + this.activeMatchType, + this.selectedPage - 1, + this.pageSize, + this.activeFilter !== 'all' ? this.activeFilter : undefined, + ) .subscribe({ next: (result) => { this.patents = result.patents ?? []; @@ -152,7 +156,9 @@ export class InstitutionPatentsComponent implements OnInit { private sortPatents(patents: OrgPatentEntry[]): OrgPatentEntry[] { if (this.sortMode === 'title') { return [...patents].sort((a, b) => - (a.title ?? '').localeCompare(b.title ?? '', 'de', { sensitivity: 'base' }), + (a.title ?? '').localeCompare(b.title ?? '', 'de', { + sensitivity: 'base', + }), ); } return [...patents]; @@ -180,8 +186,15 @@ export class InstitutionPatentsComponent implements OnInit { return value === 'date' || value === 'title'; } - private isValidMatchType(value: string | null): value is OrgPatentMatchTypeFilter { - return value === 'all' || value === 'institution' || value === 'name' || value === 'both'; + private isValidMatchType( + value: string | null, + ): value is OrgPatentMatchTypeFilter { + return ( + value === 'all' || + value === 'institution' || + value === 'name' || + value === 'both' + ); } formatDate(date: string | null): string { diff --git a/webapp/src/app/modules/patent-detail/patent-detail.component.html b/webapp/src/app/modules/patent-detail/patent-detail.component.html index ff86b654..ba19750e 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.component.html +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.html @@ -24,7 +24,10 @@
- + {{ patent.source }} @if (patent.publication_year) { @@ -36,9 +39,8 @@

{{ patent.title || patent.patent_id || 'Ohne Titel' }}

- {{ patent.patent_id }} - @if (patent.publication_date) { - · {{ formatDate(patent.publication_date) }} + @if (patent.publication_date; as date) { + · {{ formatDate(date) }} }

@@ -60,17 +62,19 @@
groups - {{ patent.inventors.length }} + {{ patent.inventors && patent.inventors.length }} Erfinder
business - {{ patent.assignees.length }} + {{ patent.assignees && patent.assignees.length }} Anmelder
category - {{ patent.ipc.length + patent.cpc.length }} + {{ + (patent.ipc?.length ?? 0) + (patent.cpc?.length ?? 0) + }} Klassifikationen
@@ -92,7 +96,7 @@
engineering

Erfinder

- {{ patent.inventors.length }} + {{ patent.inventors && patent.inventors.length }}
@for (inventor of patent.inventors; track inventor) { @@ -103,7 +107,7 @@
- @if (patent.assignees.length > 0) { + @if (patent.assignees && patent.assignees.length > 0) {
account_balance @@ -120,8 +124,9 @@
} - @if (patent.ipc_descriptions.length > 0) { -
+ @if (patent.ipc_descriptions && patent.ipc_descriptions.length > 0) { +
label

Klassifikation (IPC)

@@ -139,10 +144,12 @@ }
- + {{ card.system }} - + {{ card.levelLabel }}
@@ -182,7 +189,7 @@ }
- } @else if (patent.ipc.length > 0) { + } @else if (patent.ipc && patent.ipc.length > 0) {
label @@ -196,8 +203,9 @@
} - @if (patent.cpc_descriptions.length > 0) { -
+ @if (patent.cpc_descriptions && patent.cpc_descriptions.length > 0) { +
label

Klassifikation (CPC)

@@ -215,10 +223,12 @@ }
- + {{ card.system }} - + {{ card.levelLabel }}
@@ -258,7 +268,7 @@ }
- } @else if (patent.cpc.length > 0) { + } @else if (patent.cpc && patent.cpc.length > 0) {
label @@ -285,7 +295,10 @@
{{ row.label }}
@if (row.variant === 'source') { - + {{ row.value }} } @else { diff --git a/webapp/src/app/modules/patent-detail/patent-detail.utils.ts b/webapp/src/app/modules/patent-detail/patent-detail.utils.ts index f98338a5..e45957d9 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.utils.ts +++ b/webapp/src/app/modules/patent-detail/patent-detail.utils.ts @@ -1,5 +1,5 @@ -import { IpcClassification, PatentEntry } from '../../api/model/patentEntry'; - +import { PatentEntry } from '../../api/model/patentEntry'; +import { IpcClassification } from '../../api/model/ipcClassification'; export type ClassificationSystem = 'IPC' | 'CPC'; export interface ClassificationCard { @@ -38,7 +38,9 @@ export function getPublicationStageLabel(patent: PatentEntry): string | null { return patent.kind ?? patent.application_type ?? null; } -export function getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] { +export function getPatentMetadataRows( + patent: PatentEntry, +): PatentMetadataRow[] { const rows: PatentMetadataRow[] = [ { label: 'Quelle', value: patent.source, variant: 'source' }, { label: 'Patent-Nr.', value: patent.patent_id }, @@ -118,7 +120,9 @@ export function getDescriptionPreview(text: string | null): string { return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`; } -export function patentExternalLinks(patent: PatentEntry): { label: string; url: string }[] { +export function patentExternalLinks( + patent: PatentEntry, +): { label: string; url: string }[] { const links: { label: string; url: string }[] = []; const encodedId = encodeURIComponent(patent.patent_id); @@ -177,21 +181,25 @@ function buildHierarchyRows( const value = extractDescriptionText(raw); if (!value) return; const normalized = value.toLocaleLowerCase('en'); - if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) { + if ( + seen.has(normalized) || + normalized === primaryDescription?.toLocaleLowerCase('en') + ) { return; } seen.add(normalized); rows.push({ label, value }); }; - - addRow('Sektion', entry.section); - addRow('Klasse', entry.class); - addRow('Unterklasse', entry.subclass); + if (entry.section) addRow('Sektion', entry.section); + if (entry.class) addRow('Klasse', entry.class); + if (entry.subclass) addRow('Unterklasse', entry.subclass); return rows; } -function extractDescriptionText(value: string | null | undefined): string | null { +function extractDescriptionText( + value: string | null | undefined, +): string | null { if (!value?.trim()) return null; const text = value.includes(' - ') -- 2.56.1 From 2ec904756522a935f95de370ff97a4ff166cc67e Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:45:31 +0200 Subject: [PATCH 26/43] added websocket implementation to frontend --- .../keywords-search.component.html | 246 ++++++++---------- .../keywords-search.component.scss | 17 ++ .../keywords-search.component.ts | 208 ++++++++++----- 3 files changed, 272 insertions(+), 199 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 8f4e5e51..02aab57c 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -59,17 +59,7 @@ (click)="extractKeywords()" [disabled]="isExtracting()"> troubleshoot - @switch (loadingState()) { - @case ('extracting-url') { - URL wird abgerufen... - } - @case ('extracting-text') { - Text wird analysiert... - } - @default { - Keywords extrahieren - } - } + Keywords extrahieren }
@@ -112,137 +102,121 @@ } - @if (!isExtracting()) { -
- Extrahierte Keywords - @if (extractedKeywordsExist()) { -
- - @if (broadKeywords().length > 0) { -
-

Breite Keywords

- - @for (keyword of broadKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (coarseKeywords().length > 0) { -
-

Coarse Keywords

- - @for (keyword of coarseKeywords(); track keyword) { - {{ keyword }} - } - -
- } - - @if (fineKeywords().length > 0) { -
-

Fine Keywords

- - @for (keyword of fineKeywords(); track keyword) { - {{ keyword }} - } - -
- } -
+
+ Extrahierte Keywords + @if (extractedKeywordsExist()) { +
+ + @if (broadKeywords().length > 0) { +
+

Breite Keywords

+ + @for (keyword of broadKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (coarseKeywords().length > 0) { +
+

Coarse Keywords

+ + @for (keyword of coarseKeywords(); track keyword) { + {{ keyword }} + } + +
+ } + + @if (fineKeywords().length > 0) { +
+

Fine Keywords

+ + @for (keyword of fineKeywords(); track keyword) { + {{ keyword }} + } + +
+ } +
- -
- - @if (areAllExtractedSelected()) { - - } @else { - - } - - + +
+ + @if (areAllExtractedSelected()) { -
- } @else { -

- Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um - sie hier zu sehen oder füge sie manuell hinzu. -

- } + } @else { + + } + + + +
+ } @else { +

+ Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie + hier zu sehen oder füge sie manuell hinzu. +

+ } +
+ + @if (isExtracting()) { +
+ + +
{{ statusMessage() }}
- } @else { - - @switch (loadingState()) { - @case ('extracting-url') { - - } - @case ('extracting-text') { - - } - @default { - - } - } - } diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index 8545aeca..daf9bb39 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -242,3 +242,20 @@ background: rgba(0, 0, 0, 0.03); } } +.progress-container { + margin-top: 1rem; + padding: 0.5rem 0; + + mat-progress-bar { + height: 8px; + border-radius: 4px; + } + + .status-message { + margin-top: 0.5rem; + font-size: 0.9rem; + color: var(--sg-text-secondary); + text-align: center; + font-weight: 500; + } +} diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 3e144b4c..0af2ae1d 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -11,11 +11,16 @@ import { MatInputModule } from '@angular/material/input'; import { MatTabsModule } from '@angular/material/tabs'; import { ActivatedRoute, Router } from '@angular/router'; import { debounceTime, distinctUntilChanged } from 'rxjs'; -import { KeywordsService } from '../../api/api/keywords.service'; import { KeywordsRequest } from '../../api/model/keywordsRequest'; import { MatExpansionModule } from '@angular/material/expansion'; +import { ExtractedKeywords } from '../../api/model/extractedKeywords'; +import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResponse'; import { DestroyRef } from '@angular/core'; -import { LoadingComponent } from '../../shared/ui/loading/loading.component'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { + KeywordWebSocketService, + WsEvent, +} from '../../shared/services/websocket.service'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ @@ -31,7 +36,7 @@ type InputMode = 'url' | 'text' | 'keywords'; MatDividerModule, MatCardModule, MatExpansionModule, - LoadingComponent, + MatProgressBarModule, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -80,22 +85,17 @@ export class KeywordsSearchComponent { private isRestoringState = false; - readonly loadingState = computed(() => { - if (!this.isExtracting()) return 'idle' as const; - - const mode = this.form.controls.selectedInputType.value; - if (mode === 'url') return 'extracting-url' as const; - if (mode === 'text') return 'extracting-text' as const; - return 'extracting-keywords' as const; - }); + readonly progress = signal(0); + readonly statusMessage = signal(''); constructor( private readonly formBuilder: FormBuilder, private readonly route: ActivatedRoute, private readonly router: Router, - private readonly keywordsService: KeywordsService, private readonly destroyRef: DestroyRef, + private readonly websocketService: KeywordWebSocketService, ) { - this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { + this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((event) => { + console.log('Component received event:', event); this.restoreStateFromQueryParams(); }); @@ -117,6 +117,64 @@ export class KeywordsSearchComponent { this.updateQueryParams(); }); + //get streamed data + this.websocketService.getMessages().subscribe((event: WsEvent) => { + switch (event.type) { + case 'status': + console.log('STATUS:', event.step, event.message); + this.statusMessage.set(event.message || ''); + this.progress.set(this.getProgressForStep(event.step || '')); + break; + case 'keywords': + console.log('KEYWORDS:', event.keywords); + if (event.keywords) this.addExtractedKeyword(event.keywords); + break; + + // case 'result': + // console.log('RESULT:', event.result); + // this.processExtractedKeywords( + // event.result as ExtractedKeywordsResponse, + // ); + // this.isExtracting.set(false); + // break; + case 'completed': + console.log('COMPLETED:', event.result); + this.processExtractedKeywords( + event.result as ExtractedKeywordsResponse, + ); + this.isExtracting.set(false); + this.progress.set(100); + this.statusMessage.set('Fertig!'); + this.websocketService.close(); + this.isExtracting.set(false); + break; + + case 'error': + console.error('ERROR:', event.message); + this.progress.set(0); + this.statusMessage.set('Fehler: ' + event.message); + this.broadKeywords.set([]); + this.coarseKeywords.set([]); + this.fineKeywords.set([]); + this.websocketService.close(); + this.isExtracting.set(false); + // Keep manual, but remove selected that are not in manual + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => + this.manualKeywords().includes(k), + ), + ); + // extractionSource stays as it was (or reset? we keep it) + this.updateQueryParams(); + break; + default: + console.warn('Unknown event type:', event); + } + this.destroyRef.onDestroy(() => { + this.websocketService.close(); + }); + }); + // Clear session storage on component destroy this.destroyRef.onDestroy(() => { const nav = this.router.lastSuccessfulNavigation; @@ -251,12 +309,62 @@ export class KeywordsSearchComponent { isSearchDisabled(): boolean { return this.selectedKeywords().length === 0 || this.isExtracting(); } + addExtractedKeyword(keywords: ExtractedKeywords): void { + const broad = this.extractKeywordStrings(keywords.broad_keywords); + const coarse = this.extractKeywordStrings(keywords.coarse_grained); + const fine = this.extractKeywordStrings(keywords.fine_grained); - extractKeywords(): void { + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + } + processExtractedKeywords(result: ExtractedKeywordsResponse): void { + if (result === undefined) { + return; + } + console.log('Processing extracted keywords:', result); + const { results, source, source_content, source_url } = result; + + const broad = this.extractKeywordStrings(results.broad_keywords); + const coarse = this.extractKeywordStrings(results.coarse_grained); + const fine = this.extractKeywordStrings(results.fine_grained); + + this.broadKeywords.set(broad); + this.coarseKeywords.set(coarse); + this.fineKeywords.set(fine); + this.sourceContent.set(source_content); + this.extractionSource.set(source as InputMode); + this.sourceUrl.set(source_url ?? ''); + this.saveSourceToSession(); + + console.log('Extracted keywords:', { + broad, + coarse, + fine, + manual: this.manualKeywords(), + }); + // Keep only selected keywords that still exist in any category (including manual) + const allExtracted = [ + ...broad, + ...coarse, + ...fine, + ...this.manualKeywords(), + ]; + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => allExtracted.includes(k)), + ); + + this.updateQueryParams(); + } + async extractKeywords(): Promise { this.clearExtractedKeywords(); const query = this.getCurrentExtractionQuery(); if (!query) return; + // Reset progress and status + this.progress.set(0); + this.statusMessage.set('Starte Extraktion...'); + const currentMode = this.form.controls.selectedInputType.value; const keywordsRequest: KeywordsRequest = { query: query, @@ -265,56 +373,15 @@ export class KeywordsSearchComponent { }; this.isExtracting.set(true); - this.keywordsService.extractKeywords(keywordsRequest).subscribe({ - next: ({ results, source, source_content, source_url }) => { - const broad = this.extractKeywordStrings(results.broad_keywords); - const coarse = this.extractKeywordStrings(results.coarse_grained); - const fine = this.extractKeywordStrings(results.fine_grained); - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); - this.sourceContent.set(source_content); - this.extractionSource.set(source as InputMode); - this.sourceUrl.set(source_url ?? ''); - this.saveSourceToSession(); - - console.log('Extracted keywords:', { - broad, - coarse, - fine, - manual: this.manualKeywords(), - }); - // Keep only selected keywords that still exist in any category (including manual) - const allExtracted = [ - ...broad, - ...coarse, - ...fine, - ...this.manualKeywords(), - ]; - this.selectedKeywords.set( - this.selectedKeywords().filter((k) => allExtracted.includes(k)), - ); - - this.updateQueryParams(); - }, - error: () => { - this.broadKeywords.set([]); - this.coarseKeywords.set([]); - this.fineKeywords.set([]); - // Keep manual, but remove selected that are not in manual - this.selectedKeywords.set( - this.selectedKeywords().filter((k) => - this.manualKeywords().includes(k), - ), - ); - // extractionSource stays as it was (or reset? we keep it) - this.updateQueryParams(); - }, - complete: () => { - this.isExtracting.set(false); - }, - }); + try { + // sendRequest now waits internally for the connection to open + await this.websocketService.sendRequest(keywordsRequest); + } catch (error) { + console.error('WebSocket send error:', error); + this.isExtracting.set(false); + this.statusMessage.set('Fehler beim Senden der Anfrage'); + } } search(): void { @@ -390,6 +457,7 @@ export class KeywordsSearchComponent { sourceContent: this.sourceContent(), sourceUrl: this.sourceUrl(), }; + console.log(data); sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); } @@ -446,4 +514,18 @@ export class KeywordsSearchComponent { const normalized = value.trim(); return normalized.length ? normalized : null; } + private getProgressForStep(step: string): number { + switch (step) { + case 'started': + return 10; + case 'fetching_url': + return 30; + case 'content_extracted': + return 60; + case 'calling_llm': + return 80; + default: + return 50; // fallback for unknown steps + } + } } -- 2.56.1 From cfac12e2189c512d8b64bd6c20fc3ec3ea73a9ad Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:45:45 +0200 Subject: [PATCH 27/43] another merging issue fixed --- .../src/app/modules/patents/patents.component.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index 3e3a64c6..13cdfed9 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -116,7 +116,9 @@ @@ -138,9 +140,9 @@ + [length]="total" + [pageSize]="pageSize" + [pageIndex]="page" + [pageSizeOptions]="[10, 25, 50]" + (page)="handlePageChange($event)" />
-- 2.56.1 From 1fa755769bc274a73602f2aa7732ed426468b3cb Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 10:48:09 +0200 Subject: [PATCH 28/43] added websocket interface for streamed keywords extraction --- .../keywords-search.component.ts | 5 +- .../keywords-websocket.service.ts | 117 ++++++++++++++++++ 2 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 webapp/src/app/modules/keywords-search/keywords-websocket.service.ts diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 0af2ae1d..1b7d6979 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -17,10 +17,7 @@ import { ExtractedKeywords } from '../../api/model/extractedKeywords'; import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResponse'; import { DestroyRef } from '@angular/core'; import { MatProgressBarModule } from '@angular/material/progress-bar'; -import { - KeywordWebSocketService, - WsEvent, -} from '../../shared/services/websocket.service'; +import { KeywordWebSocketService, WsEvent } from './keywords-websocket.service'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ diff --git a/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts new file mode 100644 index 00000000..b1989c5c --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts @@ -0,0 +1,117 @@ +// keyword-websocket.service.ts + +import { Injectable, Inject, Optional } from '@angular/core'; +import { webSocket, WebSocketSubject } from 'rxjs/webSocket'; +import { Observable, Subject, Subscription } from 'rxjs'; +import { KeywordsRequest } from '../../api/model/keywordsRequest'; +import { Configuration } from '../../api/configuration'; +import { BaseService } from '../../api/api.base.service'; +import { BASE_PATH } from '../../api/variables'; +import { ExtractedKeywords } from '../../api/model/extractedKeywords'; +import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResponse'; + +export interface WsEvent { + type: string; + step?: string | null; + message?: string | null; + result?: ExtractedKeywordsResponse; + content?: string | null; + level?: string | null; + keywords?: ExtractedKeywords; + duration?: number | null; +} + +@Injectable({ providedIn: 'root' }) +export class KeywordWebSocketService extends BaseService { + private socket$?: WebSocketSubject; + private socketSubscription?: Subscription; + private readonly messageSubject$ = new Subject(); // created once, stays for app lifetime + private connectionPromise: Promise | null = null; + + constructor( + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + this.url = + `${this.configuration?.basePath ?? 'http://localhost:8000'}/api/inse-service/keywords/extract/ws`.replace( + /^http/, + 'ws', + ); + } + private readonly url: string; + + connect(): Promise { + if (this.socket$ && this.socket$.closed === false) { + return Promise.resolve(); + } + if (this.connectionPromise) { + return this.connectionPromise; + } + + this.closeSocket(); + + // no longer recreate messageSubject$ here + + this.connectionPromise = new Promise((resolve, reject) => { + this.socket$ = webSocket({ + url: this.url, + deserializer: (msg) => JSON.parse(msg.data), + serializer: (value) => JSON.stringify(value), + openObserver: { + next: () => resolve(), + }, + closeObserver: { + next: () => { + this.connectionPromise = null; + }, + }, + }); + + this.socketSubscription = this.socket$.subscribe({ + next: (event: WsEvent) => this.messageSubject$.next(event), + error: (err) => { + // don't error/complete the shared subject — just reject this connection attempt + console.error('WebSocket error', err); + reject(err); + this.connectionPromise = null; + }, + complete: () => { + this.connectionPromise = null; + }, + }); + }); + + return this.connectionPromise; + } + + async sendRequest(req: KeywordsRequest): Promise { + await this.connect(); + if (this.socket$) { + this.socket$.next(req); + } else { + throw new Error('WebSocket not available'); + } + } + + getMessages(): Observable { + return this.messageSubject$.asObservable(); + } + + close(): void { + this.closeSocket(); + // don't complete messageSubject$ — it must survive across connections + } + + private closeSocket(): void { + if (this.socketSubscription) { + this.socketSubscription.unsubscribe(); + this.socketSubscription = undefined; + } + if (this.socket$) { + this.socket$.complete(); + this.socket$ = undefined; + } + this.connectionPromise = null; + } +} -- 2.56.1 From 9e5b2c1a21221cd8d05cea3ca657214001aa8ec6 Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 11:46:21 +0200 Subject: [PATCH 29/43] services cleaned --- .../inse/patents/elastic_search_client.py | 9 +- service/src/main/inse/patents/logic.py | 4 +- .../patents/test_elastic_search_client.py | 107 +- webapp/src/app/api/README.md | 91 +- webapp/src/app/api/api/api.ts | 19 +- .../app/api/api/companyConnections.service.ts | 185 +- webapp/src/app/api/api/funding.service.ts | 366 +-- .../app/api/api/iNSEAccountService.service.ts | 657 ++--- webapp/src/app/api/api/iNSEService.service.ts | 1357 +++------ .../src/app/api/api/institutions.service.ts | 1045 +++---- webapp/src/app/api/api/items.service.ts | 903 ++---- .../src/app/api/api/personNetwork.service.ts | 215 +- webapp/src/app/api/api/persons.service.ts | 2576 ++++++----------- webapp/src/app/api/api/projects.service.ts | 1841 ++++-------- webapp/src/app/api/api/works.service.ts | 1033 +++---- webapp/src/app/api/configuration.ts | 368 ++- webapp/src/app/api/encoder.ts | 24 +- webapp/src/app/api/model/accessGrant.ts | 16 +- webapp/src/app/api/model/authAccount.ts | 16 +- webapp/src/app/api/model/authScope.ts | 14 +- webapp/src/app/api/model/author.ts | 40 +- .../app/api/model/authorAffiliationsInner.ts | 10 +- .../app/api/model/authorCountsByYearInner.ts | 12 +- webapp/src/app/api/model/authorIds.ts | 12 +- webapp/src/app/api/model/authorNetworkNode.ts | 34 +- .../app/api/model/authorParsedLongestName.ts | 16 +- .../src/app/api/model/authorPositionCount.ts | 14 +- .../src/app/api/model/authorSummaryStats.ts | 12 +- .../app/api/model/authorsFilterProperties.ts | 30 +- .../src/app/api/model/authorsListResponse.ts | 12 +- webapp/src/app/api/model/authorship.ts | 20 +- .../src/app/api/model/autocompleteResponse.ts | 10 +- .../app/api/model/autocompleteResponseMeta.ts | 10 +- .../model/autocompleteResponseResultsInner.ts | 20 +- webapp/src/app/api/model/award.ts | 18 +- webapp/src/app/api/model/bodyCreateUser.ts | 16 +- webapp/src/app/api/model/bundProject.ts | 62 +- .../src/app/api/model/bundProjectDetails.ts | 86 +- webapp/src/app/api/model/bundProjectPage.ts | 38 +- webapp/src/app/api/model/careerMetrics.ts | 46 +- .../src/app/api/model/collaborationNetwork.ts | 54 +- .../app/api/model/collaborationNetworkEdge.ts | 22 +- .../api/model/collaborationNetworkNodeType.ts | 13 +- webapp/src/app/api/model/companyConnection.ts | 30 +- .../api/model/companyConnectionsResponse.ts | 26 +- webapp/src/app/api/model/cordisEuProject.ts | 56 +- .../src/app/api/model/cordisEuProjectPage.ts | 38 +- webapp/src/app/api/model/costUsd.ts | 7 +- webapp/src/app/api/model/customAuthor.ts | 44 +- .../api/model/customAuthorsListResponse.ts | 14 +- webapp/src/app/api/model/dehydratedAuthor.ts | 12 +- webapp/src/app/api/model/dehydratedFunder.ts | 12 +- .../app/api/model/dehydratedInstitution.ts | 18 +- webapp/src/app/api/model/dehydratedSource.ts | 28 +- webapp/src/app/api/model/dfgProjectDetails.ts | 54 +- webapp/src/app/api/model/dfgProjectPage.ts | 38 +- webapp/src/app/api/model/dfgProjectSummary.ts | 32 +- .../api/model/euOrganizationProjectSummary.ts | 32 +- .../model/euOrganizationProjectSummaryPage.ts | 38 +- webapp/src/app/api/model/filterInformation.ts | 38 +- webapp/src/app/api/model/filterProperties.ts | 18 +- .../app/api/model/fundersByAuthorResponse.ts | 14 +- webapp/src/app/api/model/fundingProject.ts | 36 +- .../src/app/api/model/fundingProjectPage.ts | 38 +- webapp/src/app/api/model/fwci.ts | 7 +- webapp/src/app/api/model/groupByResult.ts | 12 +- .../src/app/api/model/hTTPValidationError.ts | 8 +- webapp/src/app/api/model/identityGrant.ts | 14 +- webapp/src/app/api/model/institution.ts | 46 +- .../app/api/model/institutionFunderSummary.ts | 34 +- webapp/src/app/api/model/institutionGeo.ts | 20 +- webapp/src/app/api/model/institutionIds.ts | 18 +- .../app/api/model/institutionInformation.ts | 22 +- .../app/api/model/institutionNetworkNode.ts | 34 +- webapp/src/app/api/model/institutionPage.ts | 38 +- .../app/api/model/institutionsListResponse.ts | 12 +- webapp/src/app/api/model/item.ts | 30 +- webapp/src/app/api/model/itemCreate.ts | 22 +- webapp/src/app/api/model/itemPage.ts | 38 +- webapp/src/app/api/model/keywords.ts | 7 +- webapp/src/app/api/model/latitude.ts | 7 +- webapp/src/app/api/model/location.ts | 24 +- webapp/src/app/api/model/longitude.ts | 7 +- webapp/src/app/api/model/matchedAuthor.ts | 18 +- webapp/src/app/api/model/matchedOfficer.ts | 24 +- webapp/src/app/api/model/mentionedPerson.ts | 12 +- webapp/src/app/api/model/meta.ts | 20 +- .../app/api/model/model2YrMeanCitedness.ts | 7 +- webapp/src/app/api/model/newsPage.ts | 14 +- webapp/src/app/api/model/openAccess.ts | 14 +- webapp/src/app/api/model/orgPatentEntry.ts | 66 +- .../src/app/api/model/orgPatentsResponse.ts | 18 +- .../app/api/model/patentsByAuthorResponse.ts | 14 +- .../api/model/patentsByInstitutionResponse.ts | 21 +- webapp/src/app/api/model/personBio.ts | 14 +- webapp/src/app/api/model/projectType.ts | 12 +- .../api/model/projectsFilteringProperties.ts | 54 +- webapp/src/app/api/model/projectsSortBy.ts | 15 +- .../api/model/publicationDetailByFunder.ts | 68 +- .../model/publicationIdsByAuthorPosition.ts | 14 +- .../api/model/publicationsByAuthorResponse.ts | 20 +- webapp/src/app/api/model/rankingResponse.ts | 10 +- webapp/src/app/api/model/score.ts | 7 +- webapp/src/app/api/model/sortDirection.ts | 10 +- webapp/src/app/api/model/topic.ts | 32 +- webapp/src/app/api/model/topicCount.ts | 44 +- webapp/src/app/api/model/topicDomain.ts | 10 +- webapp/src/app/api/model/topicField.ts | 10 +- webapp/src/app/api/model/topicIds.ts | 10 +- webapp/src/app/api/model/topicSubfield.ts | 10 +- webapp/src/app/api/model/topics.ts | 7 +- webapp/src/app/api/model/topicsByTime.ts | 46 +- webapp/src/app/api/model/topicsByYear.ts | 38 +- .../src/app/api/model/topicsListResponse.ts | 12 +- webapp/src/app/api/model/universityRanking.ts | 33 +- .../src/app/api/model/universityTopicData.ts | 27 +- webapp/src/app/api/model/user.ts | 64 +- webapp/src/app/api/model/validationError.ts | 12 +- .../app/api/model/validationErrorLocInner.ts | 7 +- webapp/src/app/api/model/value.ts | 7 +- webapp/src/app/api/model/work.ts | 82 +- webapp/src/app/api/model/workBiblio.ts | 14 +- .../model/workCitationNormalizedPercentile.ts | 12 +- .../api/model/workCitedByPercentileYear.ts | 10 +- .../app/api/model/workCountsByYearInner.ts | 10 +- webapp/src/app/api/model/workHasContent.ts | 10 +- webapp/src/app/api/model/workIds.ts | 16 +- webapp/src/app/api/model/workKeyword.ts | 12 +- webapp/src/app/api/model/workMeshInner.ts | 16 +- webapp/src/app/api/model/workNetworkNode.ts | 38 +- webapp/src/app/api/model/workPage.ts | 46 +- .../workSustainableDevelopmentGoalsInner.ts | 12 +- webapp/src/app/api/model/workTopic.ts | 18 +- webapp/src/app/api/model/workTopicDomain.ts | 10 +- webapp/src/app/api/model/workTopicField.ts | 10 +- .../src/app/api/model/workTopicInformation.ts | 22 +- webapp/src/app/api/model/workTopicSubfield.ts | 10 +- .../app/api/model/worksFilterProperties.ts | 46 +- webapp/src/app/api/model/worksListResponse.ts | 12 +- webapp/src/app/api/model/yearlyData.ts | 12 +- webapp/src/app/api/param.ts | 37 +- webapp/src/app/api/provide-api.ts | 24 +- webapp/src/app/api/variables.ts | 10 +- 143 files changed, 5372 insertions(+), 8414 deletions(-) diff --git a/service/src/main/inse/patents/elastic_search_client.py b/service/src/main/inse/patents/elastic_search_client.py index 6bd94fa1..20221efb 100644 --- a/service/src/main/inse/patents/elastic_search_client.py +++ b/service/src/main/inse/patents/elastic_search_client.py @@ -6,7 +6,6 @@ from typing import Any from inse.integrations import elasticsearch from inse.model import ESCluster, ESIndex -import httpx import asyncio from .. import config from .name_matching import search_name_variants @@ -33,15 +32,9 @@ from inse.exceptions import MissingApiKeyError class PatentSearchClient: def __init__( self, - base_url: str | None = None, api_key: str | None = None, - timeout: float = 30.0, - transport: httpx.AsyncBaseTransport | None = None, ): - self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/") self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key - self.timeout = timeout - self.transport = transport def _headers(self) -> dict[str, str]: if not self.api_key: @@ -278,4 +271,4 @@ class PatentSearchClient: "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", ], "query": {"match_phrase": {"title": title}}, - } + } \ No newline at end of file diff --git a/service/src/main/inse/patents/logic.py b/service/src/main/inse/patents/logic.py index c1fac9bc..a869a209 100644 --- a/service/src/main/inse/patents/logic.py +++ b/service/src/main/inse/patents/logic.py @@ -7,8 +7,8 @@ from inse.patents.institutions.logic import ( get_patents_by_institution_id, ) -import httpx - +import logging +import asyncio from ..persons import logic as person_logic from ..models.openalex.author import Author from . import model diff --git a/service/src/main/inse/patents/test_elastic_search_client.py b/service/src/main/inse/patents/test_elastic_search_client.py index ae0622b0..6aea4c7c 100644 --- a/service/src/main/inse/patents/test_elastic_search_client.py +++ b/service/src/main/inse/patents/test_elastic_search_client.py @@ -1,85 +1,46 @@ -# import json - -# import httpx -# import pytest -# from inse.model import ESIndex -# from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClient -# from inse.patents.elastic_search_client import ( -# DEFAULT_SEARCH_SIZE, -# PatentSearchClient, -# ) +import pytest +from unittest.mock import patch, MagicMock +from inse.model import ESIndex +from inse.patents.elastic_search_client import ( + DEFAULT_SEARCH_SIZE, + PatentSearchClient, +) -# @pytest.fixture -# def anyio_backend(): -# return "asyncio" +@pytest.fixture +def anyio_backend(): + return "asyncio" -# def test_epo_query_uses_nested_search_and_name_variants(): -# client = PatentSearchClient(api_key="test-key") -# payload = client.epo_query_by_inventor("Müller", "Christian") +def test_epo_query_uses_nested_search_and_name_variants(): + client = PatentSearchClient(api_key="test-key") + payload = client.epo_query_by_inventor("Müller", "Christian") -# assert payload["size"] == DEFAULT_SEARCH_SIZE -# assert payload["sort"][0] == {"_score": {"order": "desc"}} -# nested = payload["query"]["nested"] -# assert nested["path"] == "inventors_name_nested" -# must = nested["query"]["bool"]["must"] -# assert len(must) == 2 -# assert "should" in must[0]["bool"] + assert payload["size"] == DEFAULT_SEARCH_SIZE + assert payload["sort"][0] == {"_score": {"order": "desc"}} + nested = payload["query"]["nested"] + assert nested["path"] == "inventors_name_nested" + must = nested["query"]["bool"]["must"] + assert len(must) == 2 + assert "should" in must[0]["bool"] -# def test_uspto_index_is_3_0(): -# assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" -# assert ESIndex.EPO_INDEX == "epo_index_1.0" +def test_uspto_index_is_3_0(): + assert ESIndex.USPTO_INDEX == "uspto_patents_3.0" + assert ESIndex.EPO_INDEX == "epo_index_1.0" -# def test_epo_query_by_applicant_uses_applicants_name_field(): -# client = PatentSearchClient(api_key="test-key") -# payload = client.epo_query_by_applicant( -# ["University of Duisburg-Essen", "Universität Duisburg-Essen"] -# ) +@pytest.mark.anyio +async def test_search_epo_posts_to_correct_index(): + captured: list[dict] = [] -# assert payload["size"] == DEFAULT_SEARCH_SIZE -# assert "applicants_name" in str(payload["query"]) -# assert payload["query"]["bool"]["minimum_should_match"] == 1 + def fake_search(index: str, body: dict, cluster=None): + captured.append({"index": index, "body": body}) + return {"hits": {"hits": []}} + with patch("inse.integrations.elasticsearch.search", side_effect=fake_search): + client = PatentSearchClient(api_key="test-key") + await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) -# def test_uspto_query_by_assignee_uses_assignees_orgs_field(): -# client = PatentSearchClient(api_key="test-key") -# payload = client.uspto_query_by_assignee(["Harvard University"]) - -# assert "assignees_orgs" in str(payload["query"]) - - -# def test_detail_and_title_queries_skip_empty_date_filters(): -# client = AllPatentsSearchClient(api_key="test-key") - -# epo_payload = client.epo_title_query("method for generating and using a map") -# uspto_payload = client.uspto_detail_query("US12508845") - -# assert "must" not in epo_payload["query"]["bool"] -# assert "must" not in uspto_payload["query"]["bool"] - - -# @pytest.mark.anyio -# async def test_search_epo_posts_to_correct_index(): -# captured: list[dict] = [] - -# def handler(request: httpx.Request) -> httpx.Response: -# path_parts = request.url.path.strip("/").split("/") -# captured.append( -# { -# "index": path_parts[-2], -# "body": json.loads(request.content) if request.content else {}, -# } -# ) -# return httpx.Response(200, json={"hits": {"hits": []}}) - -# client = PatentSearchClient( -# api_key="test-key", -# transport=httpx.MockTransport(handler), -# ) -# await client.search_epo(client.epo_query_by_inventor("Weber", "Christian")) - -# assert len(captured) == 1 -# assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file + assert len(captured) == 1 + assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file diff --git a/webapp/src/app/api/README.md b/webapp/src/app/api/README.md index 2df9da7b..dfa7b6e7 100644 --- a/webapp/src/app/api/README.md +++ b/webapp/src/app/api/README.md @@ -46,10 +46,10 @@ npm link In your project: ```console -npm link +npm link ``` -**Note for Windows users:** The Angular CLI has troubles to use linked npm packages. +__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages. Please refer to this issue for a solution / workaround. Published packages are not effected by this issue. @@ -58,22 +58,22 @@ Published packages are not effected by this issue. In your Angular project: ```typescript + import { ApplicationConfig } from '@angular/core'; import { provideHttpClient } from '@angular/common/http'; import { provideApi } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideApi(), - ], + providers: [ + // ... + provideHttpClient(), + provideApi() + ], }; ``` **NOTE** If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module: - ```typescript import { ApiModule } from ''; ``` @@ -86,11 +86,11 @@ import { provideHttpClient } from '@angular/common/http'; import { provideApi } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideApi('http://localhost:9999'), - ], + providers: [ + // ... + provideHttpClient(), + provideApi('http://localhost:9999') + ], }; ``` @@ -101,15 +101,15 @@ import { provideHttpClient } from '@angular/common/http'; import { provideApi } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideApi({ - withCredentials: true, - username: 'user', - password: 'password', - }), - ], + providers: [ + // ... + provideHttpClient(), + provideApi({ + withCredentials: true, + username: 'user', + password: 'password' + }) + ], }; ``` @@ -120,22 +120,21 @@ import { provideHttpClient } from '@angular/common/http'; import { provideApi, Configuration } from ''; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - { - provide: Configuration, - useFactory: (authService: AuthService) => - new Configuration({ - basePath: 'http://localhost:9999', - withCredentials: true, - username: authService.getUsername(), - password: authService.getPassword(), - }), - deps: [AuthService], - multi: false, - }, - ], + providers: [ + // ... + provideHttpClient(), + { + provide: Configuration, + useFactory: (authService: AuthService) => new Configuration({ + basePath: 'http://localhost:9999', + withCredentials: true, + username: authService.getUsername(), + password: authService.getPassword(), + }), + deps: [AuthService], + multi: false + } + ], }; ``` @@ -152,12 +151,12 @@ import { HttpClientModule } from '@angular/common/http'; import { environment } from '../environments/environment'; export const appConfig: ApplicationConfig = { - providers: [ - // ... - provideHttpClient(), - provideUserApi(environment.basePath), - provideAdminApi(environment.basePath), - ], + providers: [ + // ... + provideHttpClient(), + provideUserApi(environment.basePath), + provideAdminApi(environment.basePath), + ], }; ``` @@ -177,8 +176,8 @@ Example value for use in your Configuration-Provider: ```typescript new Configuration({ - encodeParam: (param: Param) => myFancyParamEncoder(param), -}); + encodeParam: (param: Param) => myFancyParamEncoder(param), +}) ``` [parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 39dc1b80..e2ea97f7 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -10,8 +10,8 @@ export * from './institutions.service'; import { InstitutionsService } from './institutions.service'; export * from './items.service'; import { ItemsService } from './items.service'; -import { KeywordsService } from './keywords.service'; export * from './keywords.service'; +import { KeywordsService } from './keywords.service'; export * from './news.service'; import { NewsService } from './news.service'; export * from './patents.service'; @@ -26,19 +26,4 @@ export * from './topics.service'; import { TopicsService } from './topics.service'; export * from './works.service'; import { WorksService } from './works.service'; -export const APIS = [ - CompanyConnectionsService, - FundingService, - INSEAccountServiceService, - INSEServiceService, - InstitutionsService, - ItemsService, - KeywordsService, - NewsService, - PatentsService, - PersonNetworkService, - PersonsService, - ProjectsService, - TopicsService, - WorksService, -]; +export const APIS = [CompanyConnectionsService, FundingService, INSEAccountServiceService, INSEServiceService, InstitutionsService, ItemsService, KeywordsService, NewsService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService]; diff --git a/webapp/src/app/api/api/companyConnections.service.ts b/webapp/src/app/api/api/companyConnections.service.ts index 6ad850ea..cbc5f803 100644 --- a/webapp/src/app/api/api/companyConnections.service.ts +++ b/webapp/src/app/api/api/companyConnections.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 @@ -9,18 +9,12 @@ */ /* 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 { CompanyConnectionsResponse } from '../model/companyConnectionsResponse'; @@ -28,121 +22,74 @@ import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse' import { HTTPValidationError } from '../model/hTTPValidationError'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class CompanyConnectionsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get possible company connections by OpenAlex author ID. - * @endpoint get /api/inse-service/authors/{author_id}/company-connections - * @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 getCompanyConnectionsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getCompanyConnectionsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCompanyConnectionsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCompanyConnectionsByAuthor( - 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 getCompanyConnectionsByAuthor.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Get possible company connections by OpenAlex author ID. + * @endpoint get /api/inse-service/authors/{author_id}/company-connections + * @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 getCompanyConnectionsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getCompanyConnectionsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCompanyConnectionsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCompanyConnectionsByAuthor(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 getCompanyConnectionsByAuthor.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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})}/company-connections`; + 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 + } + ); } - 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 })}/company-connections`; - 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, - }, - ); - } } diff --git a/webapp/src/app/api/api/funding.service.ts b/webapp/src/app/api/api/funding.service.ts index f1f0a1a7..46772768 100644 --- a/webapp/src/app/api/api/funding.service.ts +++ b/webapp/src/app/api/api/funding.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 @@ -9,18 +9,12 @@ */ /* 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 { FundersByAuthorResponse } from '../model/fundersByAuthorResponse'; @@ -30,246 +24,138 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { PublicationsByAuthorResponse } from '../model/publicationsByAuthorResponse'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class FundingService extends BaseService { - 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.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); - 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 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 + } + ); } - 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/iNSEAccountService.service.ts b/webapp/src/app/api/api/iNSEAccountService.service.ts index 4874a0a8..90181dbd 100644 --- a/webapp/src/app/api/api/iNSEAccountService.service.ts +++ b/webapp/src/app/api/api/iNSEAccountService.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 @@ -9,18 +9,12 @@ */ /* 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 { AccessGrant } from '../model/accessGrant'; @@ -34,424 +28,255 @@ import { IdentityGrant } from '../model/identityGrant'; import { User } from '../model/user'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class INSEAccountServiceService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Create User - * @endpoint post /inse-account/create - * @param bodyCreateUser - * @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 createUser( - bodyCreateUser: BodyCreateUser, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public createUser( - bodyCreateUser: BodyCreateUser, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public createUser( - bodyCreateUser: BodyCreateUser, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public createUser( - bodyCreateUser: BodyCreateUser, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (bodyCreateUser === null || bodyCreateUser === undefined) { - throw new Error( - 'Required parameter bodyCreateUser was null or undefined when calling createUser.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Create User + * @endpoint post /inse-account/create + * @param bodyCreateUser + * @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 createUser(bodyCreateUser: BodyCreateUser, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createUser(bodyCreateUser: BodyCreateUser, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createUser(bodyCreateUser: BodyCreateUser, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createUser(bodyCreateUser: BodyCreateUser, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyCreateUser === null || bodyCreateUser === undefined) { + throw new Error('Required parameter bodyCreateUser was null or undefined when calling createUser.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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 = `/inse-account/create`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyCreateUser, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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 getAccessGrant(secret: string, account: number, organization: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAccessGrant(secret: string, account: number, organization: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessGrant(secret: string, account: number, organization: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessGrant(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 getAccessGrant.'); + } + if (account === null || account === undefined) { + throw new Error('Required parameter account was null or undefined when calling getAccessGrant.'); + } + if (organization === null || organization === undefined) { + throw new Error('Required parameter organization was null or undefined when calling getAccessGrant.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - // 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, - ); + 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 + } + ); } - 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'; - } + /** + * 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 getIdentityGrant(username: string, password: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getIdentityGrant(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getIdentityGrant(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getIdentityGrant(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 getIdentityGrant.'); + } + if (password === null || password === undefined) { + throw new Error('Required parameter password was null or undefined when calling getIdentityGrant.'); + } + + 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 + } + ); } - let localVarPath = `/inse-account/create`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: bodyCreateUser, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * 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 getAccessGrant( - secret: string, - account: number, - organization: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAccessGrant( - secret: string, - account: number, - organization: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAccessGrant( - secret: string, - account: number, - organization: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAccessGrant( - 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 getAccessGrant.', - ); - } - if (account === null || account === undefined) { - throw new Error( - 'Required parameter account was null or undefined when calling getAccessGrant.', - ); - } - if (organization === null || organization === undefined) { - throw new Error( - 'Required parameter organization was null or undefined when calling getAccessGrant.', - ); - } - - 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 getIdentityGrant( - username: string, - password: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getIdentityGrant( - username: string, - password: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getIdentityGrant( - username: string, - password: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getIdentityGrant( - 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 getIdentityGrant.', - ); - } - if (password === null || password === undefined) { - throw new Error( - 'Required parameter password was null or undefined when calling getIdentityGrant.', - ); - } - - 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/iNSEService.service.ts b/webapp/src/app/api/api/iNSEService.service.ts index 8788adee..cf95d68e 100644 --- a/webapp/src/app/api/api/iNSEService.service.ts +++ b/webapp/src/app/api/api/iNSEService.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 @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -32,922 +26,513 @@ import { ItemCreate } from '../model/itemCreate'; import { ItemPage } from '../model/itemPage'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class INSEServiceService extends BaseService { - 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.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - // 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, - ); - } + 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('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: itemCreate, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } + // 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); + } - /** - * 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 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 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 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 + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * 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 { - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } - 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 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 + } + ); } - 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.'); + } - /** - * 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 + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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 { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageOffset, 'pageOffset'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); - 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 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 + } + ); } - 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 nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * 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; + + 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/hierarchy`; + 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 + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // 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 + } + ); } - 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, - }, - ); - } - - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy( - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicHierarchy( - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicHierarchy( - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - 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/hierarchy`; - 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, - }, - ); - } - - /** - * 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/institutions.service.ts b/webapp/src/app/api/api/institutions.service.ts index 8b27a539..a4ba3d62 100644 --- a/webapp/src/app/api/api/institutions.service.ts +++ b/webapp/src/app/api/api/institutions.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 @@ -9,18 +9,12 @@ */ /* 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 { AutocompleteResponse } from '../model/autocompleteResponse'; @@ -36,727 +30,358 @@ import { InstitutionsListResponse } from '../model/institutionsListResponse'; import { RankingResponse } from '../model/rankingResponse'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class InstitutionsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns institution options for autocomplete inputs. - * @endpoint get /api/inse-service/institutions/autocomplete - * @param query Institution search text, for example \'Duisburg Essen\'. - * @param countryCode Optional ISO country code filter. - * @param type Optional institution type filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public autocompleteInstitutions( - query: string, - countryCode?: string, - type?: string, - limit?: number, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (query === null || query === undefined) { - throw new Error( - 'Required parameter query was null or undefined when calling autocompleteInstitutions.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - countryCode, - 'countryCode', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - type, - 'type', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); + /** + * Returns institution options for autocomplete inputs. + * @endpoint get /api/inse-service/institutions/autocomplete + * @param query Institution search text, for example \'Duisburg Essen\'. + * @param countryCode Optional ISO country code filter. + * @param type Optional institution type filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (query === null || query === undefined) { + throw new Error('Required parameter query was null or undefined when calling autocompleteInstitutions.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + countryCode, 'countryCode'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + type, 'type'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns a single institution by ID. + * Returns a single institution by its OpenAlex ID. + * @endpoint get /api/inse-service/institutions/{id} + * @param 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 getInstitutionById(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getInstitutionById(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionById(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionById(id: 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 getInstitutionById.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - 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'; - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "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, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/institutions/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, - }, - ); - } + /** + * Returns data for the University Ranking Dashboard. + * @endpoint get /api/inse-service/university-rankings + * @param topic Research topic (e.g., \'Artificial Intelligence\') + * @param metric Metric to rank by + * @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 getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', 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 getRankingsApiInseServiceUniversityRankingsGet.'); + } - /** - * Returns a single institution by ID. - * Returns a single institution by its OpenAlex ID. - * @endpoint get /api/inse-service/institutions/{id} - * @param 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 getInstitutionById( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getInstitutionById( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionById( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionById( - id: 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 getInstitutionById.', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + topic, 'topic'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + metric, 'metric'); + + 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/university-rankings`; + 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 + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Returns a list of OpenAlex institutions. + * @endpoint get /api/inse-service/institutions + * @param search Full-text search, for example \'Duisburg Essen\'. + * @param filter OpenAlex filter, for example \'country_code:DE,type:education\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'country_code\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filter, 'filter'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sort, 'sort'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + groupBy, 'group_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + perPage, 'per_page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + cursor, 'cursor'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sample, 'sample'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + select, 'select'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions`; + 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Searches for institutions by name. + * Searches for institutions by name with pagination. + * @endpoint get /api/inse-service/institutions/search + * @param name Institution name to search for, for example \'University of Duisburg Essen\'. + * @param page Page number (0-indexed). + * @param size Number of institutions per page. + * @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'. + * @param sortingDirection Sorting direction, either \'asc\' or \'desc\'. + * @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 searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchInstitutionsByName(name?: string, page?: number, size?: number, sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', sortingDirection?: 'asc' | 'desc', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + name, 'name'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortingDirection, 'sorting_direction'); - 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 localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/search`; + 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 + } + ); } - let localVarPath = `/api/inse-service/institutions/${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, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns data for the University Ranking Dashboard. - * @endpoint get /api/inse-service/university-rankings - * @param topic Research topic (e.g., \'Artificial Intelligence\') - * @param metric Metric to rank by - * @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 getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: - | 'Artificial Intelligence' - | 'Quantum Computing' - | 'Renewable Energy' - | 'Biotechnology', - metric?: 'publications' | 'citations', - 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 getRankingsApiInseServiceUniversityRankingsGet.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - topic, - 'topic', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - metric, - 'metric', - ); - - 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/university-rankings`; - 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, - }, - ); - } - - /** - * Returns a list of OpenAlex institutions. - * @endpoint get /api/inse-service/institutions - * @param search Full-text search, for example \'Duisburg Essen\'. - * @param filter OpenAlex filter, for example \'country_code:DE,type:education\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'country_code\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listInstitutions( - search?: string, - filter?: string, - sort?: string, - groupBy?: string, - perPage?: number, - page?: number, - cursor?: string, - sample?: number, - select?: string, - 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, - search, - 'search', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filter, - 'filter', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sort, - 'sort', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - groupBy, - 'group_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - perPage, - 'per_page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - cursor, - 'cursor', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sample, - 'sample', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - select, - 'select', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions`; - 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 institutions by name. - * Searches for institutions by name with pagination. - * @endpoint get /api/inse-service/institutions/search - * @param name Institution name to search for, for example \'University of Duisburg Essen\'. - * @param page Page number (0-indexed). - * @param size Number of institutions per page. - * @param sortBy Field to sort by, either \'relevance\', \'name\', \'works_count\', or \'citations_count\'. - * @param sortingDirection Sorting direction, either \'asc\' or \'desc\'. - * @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 searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchInstitutionsByName( - name?: string, - page?: number, - size?: number, - sortBy?: 'relevance' | 'name' | 'works_count' | 'citations_count', - sortingDirection?: 'asc' | 'desc', - 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, - name, - 'name', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sort_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortingDirection, - 'sorting_direction', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/institutions/search`; - 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/items.service.ts b/webapp/src/app/api/api/items.service.ts index bc3c2293..69cd8e54 100644 --- a/webapp/src/app/api/api/items.service.ts +++ b/webapp/src/app/api/api/items.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 @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -32,603 +26,338 @@ import { ItemCreate } from '../model/itemCreate'; import { ItemPage } from '../model/itemPage'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class ItemsService extends BaseService { - 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.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // 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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - // 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, - ); + // 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 + } + ); } - 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'; - } + /** + * 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 + } + ); } - 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, - }); - } + /** + * 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 { - /** - * 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 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 + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + // 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 + } + ); } - 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/personNetwork.service.ts b/webapp/src/app/api/api/personNetwork.service.ts index 5b468938..b1183ff6 100644 --- a/webapp/src/app/api/api/personNetwork.service.ts +++ b/webapp/src/app/api/api/personNetwork.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 @@ -9,18 +9,12 @@ */ /* 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 { CollaborationNetwork } from '../model/collaborationNetwork'; @@ -30,139 +24,86 @@ import { FilterProperties } from '../model/filterProperties'; import { HTTPValidationError } from '../model/hTTPValidationError'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class PersonNetworkService extends BaseService { - 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.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + 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 + } + ); } - 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/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index cef36fc4..03222a4c 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 @@ -9,18 +9,12 @@ */ /* 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 { AuthorsListResponse } from '../model/authorsListResponse'; @@ -32,1739 +26,869 @@ import { HTTPValidationError } from '../model/hTTPValidationError'; import { PersonBio } from '../model/personBio'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class PersonsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, 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 - * @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 generatePersonBio( - authorId: string, - include?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public generatePersonBio( - authorId: string, - include?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public generatePersonBio( - authorId: string, - include?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public generatePersonBio( - authorId: string, - include?: 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 generatePersonBio.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'author_id', - ); - 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/bio`; - 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 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( - id: string, - include?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPersonByID( - id: string, - include?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPersonByID( - id: string, - include?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPersonByID( - 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.', - ); - } - - 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 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.', - ); - } - - 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 - * @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 - * @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 searchPersons( - authorId?: string, - query?: string, - include?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersons( - authorId?: string, - query?: string, - include?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersons( - authorId?: string, - query?: string, - include?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersons( - authorId?: string, - query?: string, - include?: string, - 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, - authorId, - 'author_id', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - query, - 'query', - ); - 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/search`; - 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( - 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 = `/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}`, - { - 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( - 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.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsByInstitution.', - ); - } - - 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; - - 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; - - 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 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( - 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.', - ); - } - if (include === null || include === undefined) { - throw new Error( - 'Required parameter include was null or undefined when calling searchPersonsByName.', - ); - } - - 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; - - 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; - - 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 persons with advanced filters (Topic & Institution) and pagination. - * @endpoint get /api/inse-service/persons/search-list - * @param query Search query (e.g., Arman AND Arzani) - * @param institutionName Filter by institution name - * @param sortBy Value to sort by - * @param sortOrder asc or desc? - * @param topic Filter by topic display names - * @param page Page number (1-indexed) - * @param pageSize Results per page - * @param include Comma-separated include tags - * @param strict Strict institution search by target year - * @param filterMode Filter mode: \'in\' or \'from\' - * @param filterYear Filter 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, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsList( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: 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, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - institutionName, - 'institutionName', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sortBy', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + /** + * 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 + * @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 generatePersonBio(authorId: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public generatePersonBio(authorId: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public generatePersonBio(authorId: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public generatePersonBio(authorId: string, include?: 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 generatePersonBio.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'author_id'); + 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/bio`; + 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 + } ); - }); - } - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - strict, - 'strict', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterMode, - 'filterMode', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterYear, - 'filterYear', - ); - - 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(); + /** + * 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(id: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPersonByID(id: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID(id: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPersonByID(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.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); - 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 localVarHeaders = this.defaultHeaders; - let localVarPath = `/api/inse-service/persons/search-list`; - 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, - }, - ); - } + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - /** - * Searches for persons with advanced filters (Topic & Institution) and pagination. - * @endpoint get /api/inse-service/persons/search-list - * @param query Search query (e.g., Arman AND Arzani) - * @param institutionName Filter by institution name - * @param sortBy Value to sort by - * @param sortOrder asc or desc? - * @param topic Filter by topic display names - * @param page Page number (1-indexed) - * @param pageSize Results per page - * @param include Comma-separated include tags - * @param strict Strict institution search by target year - * @param filterMode Filter mode: \'in\' or \'from\' - * @param filterYear Filter 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_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchPersonsList_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchPersonsList_5( - query?: string, - institutionName?: string, - sortBy?: string, - sortOrder?: string, - topic?: Array, - page?: number, - pageSize?: number, - include?: string, - strict?: boolean, - filterMode?: string, - filterYear?: 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, - query, - 'query', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - institutionName, - 'institutionName', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sortBy', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortOrder, - 'sortOrder', - ); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic', + 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 + } ); - }); - } - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'pageSize', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - include, - 'include', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - strict, - 'strict', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterMode, - 'filterMode', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - filterYear, - 'filterYear', - ); - - 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(); + /** + * 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.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); - 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 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 + * @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 + * @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 searchPersons(authorId?: string, query?: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersons(authorId?: string, query?: string, include?: string, 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, + authorId, 'author_id'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + 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/search`; + 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(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 = `/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}`, + { + 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(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.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByInstitution.'); + } + + 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; + + 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; + + 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 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(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.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include was null or undefined when calling searchPersonsByName.'); + } + + 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; + + 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; + + 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 persons with advanced filters (Topic & Institution) and pagination. + * @endpoint get /api/inse-service/persons/search-list + * @param query Search query (e.g., Arman AND Arzani) + * @param institutionName Filter by institution name + * @param sortBy Value to sort by + * @param sortOrder asc or desc? + * @param topic Filter by topic display names + * @param page Page number (1-indexed) + * @param pageSize Results per page + * @param include Comma-separated include tags + * @param strict Strict institution search by target year + * @param filterMode Filter mode: \'in\' or \'from\' + * @param filterYear Filter 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, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: 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, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institutionName'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sortBy'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + strict, 'strict'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterMode, 'filterMode'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterYear, 'filterYear'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/search-list`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for persons with advanced filters (Topic & Institution) and pagination. + * @endpoint get /api/inse-service/persons/search-list + * @param query Search query (e.g., Arman AND Arzani) + * @param institutionName Filter by institution name + * @param sortBy Value to sort by + * @param sortOrder asc or desc? + * @param topic Filter by topic display names + * @param page Page number (1-indexed) + * @param pageSize Results per page + * @param include Comma-separated include tags + * @param strict Strict institution search by target year + * @param filterMode Filter mode: \'in\' or \'from\' + * @param filterYear Filter 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_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList_5(query?: string, institutionName?: string, sortBy?: string, sortOrder?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: 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, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institutionName'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sortBy'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortOrder, 'sortOrder'); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'pageSize'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + include, 'include'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + strict, 'strict'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterMode, 'filterMode'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + filterYear, 'filterYear'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/persons/search-list`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/inse-service/persons/search-list`; - 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/projects.service.ts b/webapp/src/app/api/api/projects.service.ts index c69e39c9..95efc1f2 100644 --- a/webapp/src/app/api/api/projects.service.ts +++ b/webapp/src/app/api/api/projects.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 @@ -9,18 +9,12 @@ */ /* 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 { BundProjectDetails } from '../model/bundProjectDetails'; @@ -52,1209 +46,650 @@ import { ProjectsSortBy } from '../model/projectsSortBy'; import { SortDirection } from '../model/sortDirection'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class ProjectsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get DFG projects. - * Returns a page of DFG projects based on the provided pagination parameters and optional institution filter. - * @endpoint get /api/projects/person/dfg/search - * @param authorId The author ID to filter by. - * @param topic The topic to filter by. - * @param page The page number. - * @param size The page size. - * @param sortBy The field to sort by. - * @param sortDirection The sort direction (asc or desc). - * @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 getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getDfgProjects( - authorId: string, - topic?: string, - page?: number, - size?: number, - sortBy?: string, - sortDirection?: 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 getDfgProjects.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - authorId, - 'author_id', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - topic, - 'topic', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sort_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortDirection, - 'sort_direction', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } - - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/projects/person/dfg/search`; - 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, - }, - ); - } - - /** - * Get EU projects for an author. - * Returns a list of EU projects associated with the specified author ID. - * @endpoint get /api/projects/author/{raw_oa_author_id}/eu - * @param rawOaAuthorId The author ID to filter by. - * @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 getEuProjectsForAuthor( - rawOaAuthorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getEuProjectsForAuthor( - rawOaAuthorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getEuProjectsForAuthor( - rawOaAuthorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getEuProjectsForAuthor( - rawOaAuthorId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (rawOaAuthorId === null || rawOaAuthorId === undefined) { - throw new Error( - 'Required parameter rawOaAuthorId was null or undefined when calling getEuProjectsForAuthor.', - ); - } - - 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/projects/author/${this.configuration.encodeParam({ name: 'rawOaAuthorId', value: rawOaAuthorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/eu`; - 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 funding over time for bund projects. - * Returns the funding over time for bund projects associated with the specified institution. - * @endpoint get /api/projects/institution/bund/funding-over-time - * @param rawOaInstitutionId The institution ID to filter by. - * @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 getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionBundProjectsFundingOverTime( - rawOaInstitutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { - throw new Error( - 'Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionBundProjectsFundingOverTime.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - rawOaInstitutionId, - 'raw_oa_institution_id', - ); - - 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/projects/institution/bund/funding-over-time`; - 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, - }, - ); - } - - /** - * Get funding over time for EU projects. - * Returns the funding over time for EU projects associated with the specified institution. - * @endpoint get /api/projects/institution/eu/funding-over-time - * @param rawOaInstitutionId The institution ID to filter by. - * @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 getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getInstitutionCordisEuProjectsFundingOverTime( - rawOaInstitutionId: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { - throw new Error( - 'Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionCordisEuProjectsFundingOverTime.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - rawOaInstitutionId, - 'raw_oa_institution_id', - ); - - 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/projects/institution/eu/funding-over-time`; - 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, - }, - ); - } - - /** - * Get a single BUND project. - * Returns a single BUND project based on its ID. - * @endpoint get /api/projects/bund/{id} - * @param id The ID of the BUND project to retrieve. - * @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 getSingleBundProject( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getSingleBundProject( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleBundProject( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleBundProject( - id: 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 getSingleBundProject.', - ); - } - - 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/projects/bund/${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, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get a single DFG project. - * Returns a single DFG project based on its ID. - * @endpoint get /api/projects/dfg/{id} - * @param id The ID of the DFG project to retrieve. - * @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 getSingleDfgProject( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getSingleDfgProject( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleDfgProject( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleDfgProject( - id: 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 getSingleDfgProject.', - ); - } - - 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/projects/dfg/${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, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get a single EU Cordis project. - * Returns a single EU Cordis project based on its ID. - * @endpoint get /api/projects/eu/{id} - * @param id The ID of the EU Cordis project to retrieve. - * @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 getSingleEuCordisProject( - id: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getSingleEuCordisProject( - id: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleEuCordisProject( - id: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getSingleEuCordisProject( - id: 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 getSingleEuCordisProject.', - ); - } - - 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/projects/eu/${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, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get bund projects. - * Returns a page of bund projects based on the provided pagination parameters and optional institution filter. - * @endpoint post /api/projects/institution/bund/search - * @param projectsFilteringProperties - * @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 searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchBundProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if ( - projectsFilteringProperties === null || - projectsFilteringProperties === undefined - ) { - throw new Error( - 'Required parameter projectsFilteringProperties was null or undefined when calling searchBundProjects.', - ); - } - - 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/projects/institution/bund/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: projectsFilteringProperties, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Get EU projects. - * Returns a page of EU projects based on the provided pagination parameters and optional institution filter. - * @endpoint post /api/projects/institution/eu/search - * @param projectsFilteringProperties - * @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 searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchCordisEuProjects( - projectsFilteringProperties: ProjectsFilteringProperties, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if ( - projectsFilteringProperties === null || - projectsFilteringProperties === undefined - ) { - throw new Error( - 'Required parameter projectsFilteringProperties was null or undefined when calling searchCordisEuProjects.', - ); - } - - 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/projects/institution/eu/search`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: projectsFilteringProperties, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Search projects across all funders. - * Returns a page of projects across all funders based on the provided pagination parameters and optional institution filter. - * @endpoint get /api/projects/search - * @param page The page number. - * @param size The page size. - * @param selectedProjectTypes The set of project types to filter by (e.g., \'bund\', \'eu\', \'dfg\'). If not provided, projects of all types will be included. - * @param title The title to filter by. - * @param sortBy The field to sort by. - * @param sortDirection The sort direction (asc or desc). - * @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 searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public searchProjects( - page?: number, - size?: number, - selectedProjectTypes?: Set, - title?: string, - sortBy?: ProjectsSortBy, - sortDirection?: SortDirection, - 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, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - if (selectedProjectTypes) { - selectedProjectTypes.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'selected_project_types', + /** + * Get DFG projects. + * Returns a page of DFG projects based on the provided pagination parameters and optional institution filter. + * @endpoint get /api/projects/person/dfg/search + * @param authorId The author ID to filter by. + * @param topic The topic to filter by. + * @param page The page number. + * @param size The page size. + * @param sortBy The field to sort by. + * @param sortDirection The sort direction (asc or desc). + * @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 getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getDfgProjects(authorId: string, topic?: string, page?: number, size?: number, sortBy?: string, sortDirection?: 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 getDfgProjects.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + authorId, 'author_id'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + topic, 'topic'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortDirection, 'sort_direction'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/person/dfg/search`; + 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 + } ); - }); - } - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - title, - 'title', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortBy, - 'sort_by', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - sortDirection, - 'sort_direction', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Get EU projects for an author. + * Returns a list of EU projects associated with the specified author ID. + * @endpoint get /api/projects/author/{raw_oa_author_id}/eu + * @param rawOaAuthorId The author ID to filter by. + * @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 getEuProjectsForAuthor(rawOaAuthorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getEuProjectsForAuthor(rawOaAuthorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getEuProjectsForAuthor(rawOaAuthorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getEuProjectsForAuthor(rawOaAuthorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawOaAuthorId === null || rawOaAuthorId === undefined) { + throw new Error('Required parameter rawOaAuthorId was null or undefined when calling getEuProjectsForAuthor.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarHeaders = this.defaultHeaders; - 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'; - } + 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/projects/author/${this.configuration.encodeParam({name: "rawOaAuthorId", value: rawOaAuthorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/eu`; + 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 funding over time for bund projects. + * Returns the funding over time for bund projects associated with the specified institution. + * @endpoint get /api/projects/institution/bund/funding-over-time + * @param rawOaInstitutionId The institution ID to filter by. + * @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 getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionBundProjectsFundingOverTime(rawOaInstitutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { + throw new Error('Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionBundProjectsFundingOverTime.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + rawOaInstitutionId, 'raw_oa_institution_id'); + + 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/projects/institution/bund/funding-over-time`; + 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 + } + ); + } + + /** + * Get funding over time for EU projects. + * Returns the funding over time for EU projects associated with the specified institution. + * @endpoint get /api/projects/institution/eu/funding-over-time + * @param rawOaInstitutionId The institution ID to filter by. + * @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 getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getInstitutionCordisEuProjectsFundingOverTime(rawOaInstitutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawOaInstitutionId === null || rawOaInstitutionId === undefined) { + throw new Error('Required parameter rawOaInstitutionId was null or undefined when calling getInstitutionCordisEuProjectsFundingOverTime.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + rawOaInstitutionId, 'raw_oa_institution_id'); + + 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/projects/institution/eu/funding-over-time`; + 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 + } + ); + } + + /** + * Get a single BUND project. + * Returns a single BUND project based on its ID. + * @endpoint get /api/projects/bund/{id} + * @param id The ID of the BUND project to retrieve. + * @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 getSingleBundProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getSingleBundProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleBundProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleBundProject(id: 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 getSingleBundProject.'); + } + + 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/projects/bund/${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, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get a single DFG project. + * Returns a single DFG project based on its ID. + * @endpoint get /api/projects/dfg/{id} + * @param id The ID of the DFG project to retrieve. + * @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 getSingleDfgProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getSingleDfgProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleDfgProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleDfgProject(id: 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 getSingleDfgProject.'); + } + + 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/projects/dfg/${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, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get a single EU Cordis project. + * Returns a single EU Cordis project based on its ID. + * @endpoint get /api/projects/eu/{id} + * @param id The ID of the EU Cordis project to retrieve. + * @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 getSingleEuCordisProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getSingleEuCordisProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleEuCordisProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getSingleEuCordisProject(id: 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 getSingleEuCordisProject.'); + } + + 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/projects/eu/${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, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get bund projects. + * Returns a page of bund projects based on the provided pagination parameters and optional institution filter. + * @endpoint post /api/projects/institution/bund/search + * @param projectsFilteringProperties + * @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 searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchBundProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (projectsFilteringProperties === null || projectsFilteringProperties === undefined) { + throw new Error('Required parameter projectsFilteringProperties was null or undefined when calling searchBundProjects.'); + } + + 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/projects/institution/bund/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: projectsFilteringProperties, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get EU projects. + * Returns a page of EU projects based on the provided pagination parameters and optional institution filter. + * @endpoint post /api/projects/institution/eu/search + * @param projectsFilteringProperties + * @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 searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchCordisEuProjects(projectsFilteringProperties: ProjectsFilteringProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (projectsFilteringProperties === null || projectsFilteringProperties === undefined) { + throw new Error('Required parameter projectsFilteringProperties was null or undefined when calling searchCordisEuProjects.'); + } + + 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/projects/institution/eu/search`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: projectsFilteringProperties, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Search projects across all funders. + * Returns a page of projects across all funders based on the provided pagination parameters and optional institution filter. + * @endpoint get /api/projects/search + * @param page The page number. + * @param size The page size. + * @param selectedProjectTypes The set of project types to filter by (e.g., \'bund\', \'eu\', \'dfg\'). If not provided, projects of all types will be included. + * @param title The title to filter by. + * @param sortBy The field to sort by. + * @param sortDirection The sort direction (asc or desc). + * @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 searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchProjects(page?: number, size?: number, selectedProjectTypes?: Set, title?: string, sortBy?: ProjectsSortBy, sortDirection?: SortDirection, 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, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + if (selectedProjectTypes) { + selectedProjectTypes.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'selected_project_types'); + }) + } + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + title, 'title'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortBy, 'sort_by'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sortDirection, 'sort_direction'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/projects/search`; + 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 + } + ); } - let localVarPath = `/api/projects/search`; - 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/works.service.ts b/webapp/src/app/api/api/works.service.ts index 82f38cbe..7521c08a 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.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 @@ -9,18 +9,12 @@ */ /* tslint:disable:no-unused-variable member-ordering */ -import { Inject, Injectable, Optional } from '@angular/core'; -import { - HttpClient, - HttpHeaders, - HttpParams, - HttpResponse, - HttpEvent, - HttpParameterCodec, - HttpContext, -} from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; @@ -36,704 +30,371 @@ import { WorkPage } from '../model/workPage'; import { WorksListResponse } from '../model/worksListResponse'; // @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'; + + @Injectable({ - providedIn: 'root', + providedIn: 'root' }) export class WorksService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns all works for an author. - * @endpoint get /api/works/{author_id}/all - * @param authorId The author id, for example A5023888391. - * @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 { - if (authorId === null || authorId === undefined) { - throw new Error( - 'Required parameter authorId was null or undefined when calling getAllAuthorWorks.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Returns all works for an author. + * @endpoint get /api/works/{author_id}/all + * @param authorId The author id, for example A5023888391. + * @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 { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getAllAuthorWorks.'); + } - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'bearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + let localVarHeaders = this.defaultHeaders; - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); - } + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - 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'; - } - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - 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}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - /** - * Returns a page of works for an author. - * @endpoint get /api/works/{author_id} - * @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. - * @param institutionId Filter by OpenAlex institution id. Can be repeated. - * @param topicId Filter by OpenAlex topic id. Can be repeated. - * @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, - institutionId?: Array, - topicId?: 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, - institutionId?: Array, - topicId?: 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, - institutionId?: Array, - topicId?: 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, - institutionId?: Array, - topicId?: 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 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 localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - page, - 'page', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - size, - 'size', - ); - if (publicationYear) { - publicationYear.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'publication_year', + 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}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (type) { - type.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'type', + + /** + * 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. + * @param institutionId Filter by OpenAlex institution id. Can be repeated. + * @param topicId Filter by OpenAlex topic id. Can be repeated. + * @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, institutionId?: Array, topicId?: 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, institutionId?: Array, topicId?: 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, institutionId?: Array, topicId?: 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, institutionId?: Array, topicId?: 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}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + size, 'size'); + if (publicationYear) { + publicationYear.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'publication_year'); + }) + } + if (type) { + type.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'type'); + }) + } + if (language) { + language.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'language'); + }) + } + if (institutionId) { + institutionId.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'institution_id'); + }) + } + if (topicId) { + topicId.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic_id'); + }) + } + + 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/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}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (language) { - language.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'language', + + /** + * Returns work counts per primary topic for an author. + * @endpoint get /api/works/{author_id}/primary-topic-counts + * @param authorId The author id, for example A5023888391. + * @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 getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(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 getPrimaryTopicCountsByAuthor.'); + } + + 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/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/primary-topic-counts`; + 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 + } ); - }); } - if (institutionId) { - institutionId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'institution_id', + + /** + * 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. + * @param targetPublications Target number of publications used for the timeline. Complete years are always included. + * @param includeAll If true, all publications are used for the timeline. + * @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, targetPublications?: number, includeAll?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, 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}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + maxTopicsPerYear, 'max_topics_per_year'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + targetPublications, 'target_publications'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + includeAll, 'include_all'); + + 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/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}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - if (topicId) { - topicId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic_id', + + /** + * Returns one publication by OpenAlex ID or DOI. + * @endpoint get /api/works/detail/{identifier} + * @param identifier The OpenAlex work id (e.g., W2741809807) or DOI number of the publication. + * @param title Do we want to fallback to title search if ID and DOI dont work? + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getWork(identifier: string, title?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getWork(identifier: string, title?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWork(identifier: string, title?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWork(identifier: string, title?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (identifier === null || identifier === undefined) { + throw new Error('Required parameter identifier was null or undefined when calling getWork.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + title, 'title'); + + 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/works/detail/${this.configuration.encodeParam({name: "identifier", value: identifier, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } ); - }); } - 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/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}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns work counts per primary topic for an author. - * @endpoint get /api/works/{author_id}/primary-topic-counts - * @param authorId The author id, for example A5023888391. - * @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 getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getPrimaryTopicCountsByAuthor( - authorId: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getPrimaryTopicCountsByAuthor( - 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 getPrimaryTopicCountsByAuthor.', - ); - } - - 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/works/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/primary-topic-counts`; - 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 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. - * @param targetPublications Target number of publications used for the timeline. Complete years are always included. - * @param includeAll If true, all publications are used for the timeline. - * @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, - targetPublications?: number, - includeAll?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopicsByTimeByAuthor( - authorId: string, - maxTopicsPerYear?: number, - targetPublications?: number, - includeAll?: boolean, - 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 }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - maxTopicsPerYear, - 'max_topics_per_year', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - targetPublications, - 'target_publications', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - includeAll, - 'include_all', - ); - - 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/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}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Returns one publication by OpenAlex ID or DOI. - * @endpoint get /api/works/detail/{identifier} - * @param identifier The OpenAlex work id (e.g., W2741809807) or DOI number of the publication. - * @param title Do we want to fallback to title search if ID and DOI dont work? - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getWork( - identifier: string, - title?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getWork( - identifier: string, - title?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getWork( - identifier: string, - title?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getWork( - identifier: string, - title?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (identifier === null || identifier === undefined) { - throw new Error( - 'Required parameter identifier was null or undefined when calling getWork.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - title, - 'title', - ); - - 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/works/detail/${this.configuration.encodeParam({ name: 'identifier', value: identifier, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('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/configuration.ts b/webapp/src/app/api/configuration.ts index 664630b3..c39ce2d6 100644 --- a/webapp/src/app/api/configuration.ts +++ b/webapp/src/app/api/configuration.ts @@ -1,219 +1,193 @@ -import { - HttpHeaders, - HttpParams, - HttpParameterCodec, -} from '@angular/common/http'; +import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { Param } from './param'; export interface ConfigurationParameters { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Override the default method for encoding path parameters in various - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam?: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials?: { [key: string]: string | (() => string | undefined) }; + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Override the default method for encoding path parameters in various + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam?: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials?: {[ key: string ]: string | (() => string | undefined)}; } export class Configuration { - /** - * @deprecated Since 5.0. Use credentials instead - */ - apiKeys?: { [key: string]: string }; - username?: string; - password?: string; - /** - * @deprecated Since 5.0. Use credentials instead - */ - accessToken?: string | (() => string); - basePath?: string; - withCredentials?: boolean; - /** - * Takes care of encoding query- and form-parameters. - */ - encoder?: HttpParameterCodec; - /** - * Encoding of various path parameter - * styles. - *

- * See {@link README.md} for more details - *

- */ - encodeParam: (param: Param) => string; - /** - * The keys are the names in the securitySchemes section of the OpenAPI - * document. They should map to the value used for authentication - * minus any standard prefixes such as 'Basic' or 'Bearer'. - */ - credentials: { [key: string]: string | (() => string | undefined) }; + /** + * @deprecated Since 5.0. Use credentials instead + */ + apiKeys?: {[ key: string ]: string}; + username?: string; + password?: string; + /** + * @deprecated Since 5.0. Use credentials instead + */ + accessToken?: string | (() => string); + basePath?: string; + withCredentials?: boolean; + /** + * Takes care of encoding query- and form-parameters. + */ + encoder?: HttpParameterCodec; + /** + * Encoding of various path parameter + * styles. + *

+ * See {@link README.md} for more details + *

+ */ + encodeParam: (param: Param) => string; + /** + * The keys are the names in the securitySchemes section of the OpenAPI + * document. They should map to the value used for authentication + * minus any standard prefixes such as 'Basic' or 'Bearer'. + */ + credentials: {[ key: string ]: string | (() => string | undefined)}; - constructor({ - accessToken, - apiKeys, - basePath, - credentials, - encodeParam, - encoder, - password, - username, - withCredentials, - }: ConfigurationParameters = {}) { - if (apiKeys) { - this.apiKeys = apiKeys; - } - if (username !== undefined) { - this.username = username; - } - if (password !== undefined) { - this.password = password; - } - if (accessToken !== undefined) { - this.accessToken = accessToken; - } - if (basePath !== undefined) { - this.basePath = basePath; - } - if (withCredentials !== undefined) { - this.withCredentials = withCredentials; - } - if (encoder) { - this.encoder = encoder; - } - this.encodeParam = - encodeParam ?? ((param) => this.defaultEncodeParam(param)); - this.credentials = credentials ?? {}; +constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) { + if (apiKeys) { + this.apiKeys = apiKeys; + } + if (username !== undefined) { + this.username = username; + } + if (password !== undefined) { + this.password = password; + } + if (accessToken !== undefined) { + this.accessToken = accessToken; + } + if (basePath !== undefined) { + this.basePath = basePath; + } + if (withCredentials !== undefined) { + this.withCredentials = withCredentials; + } + if (encoder) { + this.encoder = encoder; + } + this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param)); + this.credentials = credentials ?? {}; - // init default bearer credential - if (!this.credentials['bearer']) { - this.credentials['bearer'] = () => { - return typeof this.accessToken === 'function' - ? this.accessToken() - : this.accessToken; - }; - } - } - - /** - * Select the correct content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param contentTypes - the array of content types that are available for selection - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderContentType(contentTypes: string[]): string | undefined { - if (contentTypes.length === 0) { - return undefined; + // init default bearer credential + if (!this.credentials['bearer']) { + this.credentials['bearer'] = () => { + return typeof this.accessToken === 'function' + ? this.accessToken() + : this.accessToken; + }; + } } - const type = contentTypes.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return contentTypes[0]; - } - return type; - } + /** + * Select the correct content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param contentTypes - the array of content types that are available for selection + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderContentType (contentTypes: string[]): string | undefined { + if (contentTypes.length === 0) { + return undefined; + } - /** - * Select the correct accept content-type to use for a request. - * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. - * If no content type is found return the first found type if the contentTypes is not empty - * @param accepts - the array of content types that are available for selection. - * @returns the selected content-type or undefined if no selection could be made. - */ - public selectHeaderAccept(accepts: string[]): string | undefined { - if (accepts.length === 0) { - return undefined; + const type = contentTypes.find((x: string) => this.isJsonMime(x)); + if (type === undefined) { + return contentTypes[0]; + } + return type; } - const type = accepts.find((x: string) => this.isJsonMime(x)); - if (type === undefined) { - return accepts[0]; + /** + * Select the correct accept content-type to use for a request. + * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type. + * If no content type is found return the first found type if the contentTypes is not empty + * @param accepts - the array of content types that are available for selection. + * @returns the selected content-type or undefined if no selection could be made. + */ + public selectHeaderAccept(accepts: string[]): string | undefined { + if (accepts.length === 0) { + return undefined; + } + + const type = accepts.find((x: string) => this.isJsonMime(x)); + if (type === undefined) { + return accepts[0]; + } + return type; } - return type; - } - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp( - '^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', - 'i', - ); - return ( - mime !== null && - (jsonMime.test(mime) || - mime.toLowerCase() === 'application/json-patch+json') - ); - } + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); + return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); + } - public lookupCredential(key: string): string | undefined { - const value = this.credentials[key]; - return typeof value === 'function' ? value() : value; - } + public lookupCredential(key: string): string | undefined { + const value = this.credentials[key]; + return typeof value === 'function' + ? value() + : value; + } - public addCredentialToHeaders( - credentialKey: string, - headerName: string, - headers: HttpHeaders, - prefix?: string, - ): HttpHeaders { - const value = this.lookupCredential(credentialKey); - return value ? headers.set(headerName, (prefix ?? '') + value) : headers; - } + public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders { + const value = this.lookupCredential(credentialKey); + return value + ? headers.set(headerName, (prefix ?? '') + value) + : headers; + } - public addCredentialToQuery( - credentialKey: string, - paramName: string, - query: HttpParams, - ): HttpParams { - const value = this.lookupCredential(credentialKey); - return value ? query.set(paramName, value) : query; - } + public addCredentialToQuery(credentialKey: string, paramName: string, query: HttpParams): HttpParams { + const value = this.lookupCredential(credentialKey); + return value + ? query.set(paramName, value) + : query; + } - private defaultEncodeParam(param: Param): string { - // This implementation exists as fallback for missing configuration - // and for backwards compatibility to older typescript-angular generator versions. - // It only works for the 'simple' parameter style. - // Date-handling only works for the 'date-time' format. - // All other styles and Date-formats are probably handled incorrectly. - // - // But: if that's all you need (i.e.: the most common use-case): no need for customization! + private defaultEncodeParam(param: Param): string { + // This implementation exists as fallback for missing configuration + // and for backwards compatibility to older typescript-angular generator versions. + // It only works for the 'simple' parameter style. + // Date-handling only works for the 'date-time' format. + // All other styles and Date-formats are probably handled incorrectly. + // + // But: if that's all you need (i.e.: the most common use-case): no need for customization! - const value = - param.dataFormat === 'date-time' && param.value instanceof Date - ? (param.value as Date).toISOString() - : param.value; + const value = param.dataFormat === 'date-time' && param.value instanceof Date + ? (param.value as Date).toISOString() + : param.value; - return encodeURIComponent(String(value)); - } + return encodeURIComponent(String(value)); + } } diff --git a/webapp/src/app/api/encoder.ts b/webapp/src/app/api/encoder.ts index 889ef00d..138c4d5c 100644 --- a/webapp/src/app/api/encoder.ts +++ b/webapp/src/app/api/encoder.ts @@ -5,16 +5,16 @@ import { HttpParameterCodec } from '@angular/common/http'; * Workaround for https://github.com/angular/angular/issues/18261 */ export class CustomHttpParameterCodec implements HttpParameterCodec { - encodeKey(k: string): string { - return encodeURIComponent(k); - } - encodeValue(v: string): string { - return encodeURIComponent(v); - } - decodeKey(k: string): string { - return decodeURIComponent(k); - } - decodeValue(v: string): string { - return decodeURIComponent(v); - } + encodeKey(k: string): string { + return encodeURIComponent(k); + } + encodeValue(v: string): string { + return encodeURIComponent(v); + } + decodeKey(k: string): string { + return decodeURIComponent(k); + } + decodeValue(v: string): string { + return decodeURIComponent(v); + } } diff --git a/webapp/src/app/api/model/accessGrant.ts b/webapp/src/app/api/model/accessGrant.ts index 0aa29f6f..ad1f537a 100644 --- a/webapp/src/app/api/model/accessGrant.ts +++ b/webapp/src/app/api/model/accessGrant.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 @@ -9,10 +9,12 @@ */ import { AuthScope } from './authScope'; -export interface AccessGrant { - token_type: string; - access_token: string; - expires_in: number; - scope: AuthScope; - refresh_token: string; + +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/authAccount.ts b/webapp/src/app/api/model/authAccount.ts index 7a672b04..770a61f5 100644 --- a/webapp/src/app/api/model/authAccount.ts +++ b/webapp/src/app/api/model/authAccount.ts @@ -1,17 +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. */ -export interface AuthAccount { - i: number; - l: string; - o: number; - e: string; - on: string; + +export interface AuthAccount { + i: number; + l: string; + o: number; + e: string; + on: string; } + diff --git a/webapp/src/app/api/model/authScope.ts b/webapp/src/app/api/model/authScope.ts index 3ccd752e..65ffa9b5 100644 --- a/webapp/src/app/api/model/authScope.ts +++ b/webapp/src/app/api/model/authScope.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 @@ -9,9 +9,11 @@ */ import { AuthAccount } from './authAccount'; -export interface AuthScope { - t: string; - a: AuthAccount; - d?: number | null; - r?: Array; + +export interface AuthScope { + t: string; + a: AuthAccount; + d?: number | null; + r?: Array; } + diff --git a/webapp/src/app/api/model/author.ts b/webapp/src/app/api/model/author.ts index 0a050590..9ba12273 100644 --- a/webapp/src/app/api/model/author.ts +++ b/webapp/src/app/api/model/author.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 @@ -15,25 +15,27 @@ import { AuthorIds } from './authorIds'; import { AuthorSummaryStats } from './authorSummaryStats'; import { WorkTopic } from './workTopic'; + /** * A person who creates scholarly works */ -export interface Author { - id?: string | null; - orcid?: string | null; - display_name?: string | null; - display_name_alternatives?: Array | null; - longest_name?: string | null; - parsed_longest_name?: AuthorParsedLongestName | null; - works_count?: number | null; - cited_by_count?: number | null; - summary_stats?: AuthorSummaryStats | null; - affiliations?: Array | null; - last_known_institutions?: Array | null; - topics?: Array | null; - counts_by_year?: Array | null; - ids?: AuthorIds | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Author { + id?: string | null; + orcid?: string | null; + display_name?: string | null; + display_name_alternatives?: Array | null; + longest_name?: string | null; + parsed_longest_name?: AuthorParsedLongestName | null; + works_count?: number | null; + cited_by_count?: number | null; + summary_stats?: AuthorSummaryStats | null; + affiliations?: Array | null; + last_known_institutions?: Array | null; + topics?: Array | null; + counts_by_year?: Array | null; + ids?: AuthorIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/authorAffiliationsInner.ts b/webapp/src/app/api/model/authorAffiliationsInner.ts index d1e8f764..270443ff 100644 --- a/webapp/src/app/api/model/authorAffiliationsInner.ts +++ b/webapp/src/app/api/model/authorAffiliationsInner.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 @@ -9,10 +9,12 @@ */ import { DehydratedInstitution } from './dehydratedInstitution'; + /** * AuthorAffiliationsInner */ -export interface AuthorAffiliationsInner { - institution?: DehydratedInstitution | null; - years?: Array | null; +export interface AuthorAffiliationsInner { + institution?: DehydratedInstitution | null; + years?: Array | null; } + diff --git a/webapp/src/app/api/model/authorCountsByYearInner.ts b/webapp/src/app/api/model/authorCountsByYearInner.ts index 1fac5b45..d16c7c21 100644 --- a/webapp/src/app/api/model/authorCountsByYearInner.ts +++ b/webapp/src/app/api/model/authorCountsByYearInner.ts @@ -1,18 +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; +export interface AuthorCountsByYearInner { + year?: number | null; + works_count?: number | null; + cited_by_count?: number | null; } + diff --git a/webapp/src/app/api/model/authorIds.ts b/webapp/src/app/api/model/authorIds.ts index 0b079d33..9235a207 100644 --- a/webapp/src/app/api/model/authorIds.ts +++ b/webapp/src/app/api/model/authorIds.ts @@ -1,18 +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; +export interface AuthorIds { + openalex?: string | null; + orcid?: string | null; + scopus?: string | null; } + diff --git a/webapp/src/app/api/model/authorNetworkNode.ts b/webapp/src/app/api/model/authorNetworkNode.ts index f67c7148..aee98d47 100644 --- a/webapp/src/app/api/model/authorNetworkNode.ts +++ b/webapp/src/app/api/model/authorNetworkNode.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 @@ -9,18 +9,22 @@ */ import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType'; -export interface AuthorNetworkNode { - /** - * 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 interface AuthorNetworkNode { + /** + * 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 AuthorNetworkNode {} +export namespace AuthorNetworkNode { +} + + diff --git a/webapp/src/app/api/model/authorParsedLongestName.ts b/webapp/src/app/api/model/authorParsedLongestName.ts index f08df27d..f49e04be 100644 --- a/webapp/src/app/api/model/authorParsedLongestName.ts +++ b/webapp/src/app/api/model/authorParsedLongestName.ts @@ -1,20 +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; +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/authorPositionCount.ts b/webapp/src/app/api/model/authorPositionCount.ts index 989d2c18..a02e3749 100644 --- a/webapp/src/app/api/model/authorPositionCount.ts +++ b/webapp/src/app/api/model/authorPositionCount.ts @@ -1,16 +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; + +export interface AuthorPositionCount { + first?: number; + middle?: number; + last?: number; + unknown?: number; } + diff --git a/webapp/src/app/api/model/authorSummaryStats.ts b/webapp/src/app/api/model/authorSummaryStats.ts index 63c35c31..1cfc0bdb 100644 --- a/webapp/src/app/api/model/authorSummaryStats.ts +++ b/webapp/src/app/api/model/authorSummaryStats.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 @@ -9,11 +9,13 @@ */ import { Model2YrMeanCitedness } from './model2YrMeanCitedness'; + /** * Citation metrics: */ -export interface AuthorSummaryStats { - '2yr_mean_citedness'?: Model2YrMeanCitedness | null; - h_index?: number | null; - i10_index?: number | null; +export interface AuthorSummaryStats { + '2yr_mean_citedness'?: Model2YrMeanCitedness | null; + h_index?: number | null; + i10_index?: number | null; } + diff --git a/webapp/src/app/api/model/authorsFilterProperties.ts b/webapp/src/app/api/model/authorsFilterProperties.ts index 50795f2a..7312558f 100644 --- a/webapp/src/app/api/model/authorsFilterProperties.ts +++ b/webapp/src/app/api/model/authorsFilterProperties.ts @@ -1,24 +1,26 @@ /** * 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 AuthorsFilterProperties { - /** - * The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included. - */ - allowed_institutions?: Array; - /** - * The minimum number of collaborations required for an author to be included in the collaboration network. - */ - min_collaborations?: number; - /** - * The maximum number of collaborations allowed for an author to be included in the collaboration network. - */ - max_collaborations?: number; + +export interface AuthorsFilterProperties { + /** + * The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included. + */ + allowed_institutions?: Array; + /** + * The minimum number of collaborations required for an author to be included in the collaboration network. + */ + min_collaborations?: number; + /** + * The maximum number of collaborations allowed for an author to be included in the collaboration network. + */ + max_collaborations?: number; } + diff --git a/webapp/src/app/api/model/authorsListResponse.ts b/webapp/src/app/api/model/authorsListResponse.ts index bb1a602c..d309ae43 100644 --- a/webapp/src/app/api/model/authorsListResponse.ts +++ b/webapp/src/app/api/model/authorsListResponse.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,11 +11,13 @@ import { Meta } from './meta'; import { Author } from './author'; import { GroupByResult } from './groupByResult'; + /** * AuthorsListResponse */ -export interface AuthorsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +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 f1b9d48e..db3a0bf0 100644 --- a/webapp/src/app/api/model/authorship.ts +++ b/webapp/src/app/api/model/authorship.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 @@ -10,15 +10,17 @@ import { DehydratedInstitution } from './dehydratedInstitution'; import { DehydratedAuthor } from './dehydratedAuthor'; + /** * Author and their affiliation for a work */ -export interface Authorship { - author_position?: string | null; - author?: DehydratedAuthor | null; - institutions?: Array | null; - countries?: Array | null; - is_corresponding?: boolean | null; - raw_author_name?: string | null; - raw_affiliation_strings?: Array | null; +export interface Authorship { + author_position?: string | null; + author?: DehydratedAuthor | null; + institutions?: Array | null; + countries?: Array | null; + is_corresponding?: boolean | null; + raw_author_name?: string | null; + raw_affiliation_strings?: Array | null; } + diff --git a/webapp/src/app/api/model/autocompleteResponse.ts b/webapp/src/app/api/model/autocompleteResponse.ts index 8b52b300..e220f57b 100644 --- a/webapp/src/app/api/model/autocompleteResponse.ts +++ b/webapp/src/app/api/model/autocompleteResponse.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 @@ -10,10 +10,12 @@ import { AutocompleteResponseMeta } from './autocompleteResponseMeta'; import { AutocompleteResponseResultsInner } from './autocompleteResponseResultsInner'; + /** * AutocompleteResponse */ -export interface AutocompleteResponse { - meta?: AutocompleteResponseMeta | null; - results?: Array | null; +export interface AutocompleteResponse { + meta?: AutocompleteResponseMeta | null; + results?: Array | null; } + diff --git a/webapp/src/app/api/model/autocompleteResponseMeta.ts b/webapp/src/app/api/model/autocompleteResponseMeta.ts index 5bf94a57..2e080d39 100644 --- a/webapp/src/app/api/model/autocompleteResponseMeta.ts +++ b/webapp/src/app/api/model/autocompleteResponseMeta.ts @@ -1,17 +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. */ + /** * AutocompleteResponseMeta */ -export interface AutocompleteResponseMeta { - count?: number | null; - db_response_time_ms?: number | null; +export interface AutocompleteResponseMeta { + count?: number | null; + db_response_time_ms?: number | null; } + diff --git a/webapp/src/app/api/model/autocompleteResponseResultsInner.ts b/webapp/src/app/api/model/autocompleteResponseResultsInner.ts index 0fa956b7..99ba71fe 100644 --- a/webapp/src/app/api/model/autocompleteResponseResultsInner.ts +++ b/webapp/src/app/api/model/autocompleteResponseResultsInner.ts @@ -1,22 +1,24 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * AutocompleteResponseResultsInner */ -export interface AutocompleteResponseResultsInner { - id?: string | null; - display_name?: string | null; - hint?: string | null; - cited_by_count?: number | null; - works_count?: number | null; - entity_type?: string | null; - external_id?: string | null; +export interface AutocompleteResponseResultsInner { + id?: string | null; + display_name?: string | null; + hint?: string | null; + cited_by_count?: number | null; + works_count?: number | null; + entity_type?: string | null; + external_id?: string | null; } + diff --git a/webapp/src/app/api/model/award.ts b/webapp/src/app/api/model/award.ts index a461c971..4e3b5cc9 100644 --- a/webapp/src/app/api/model/award.ts +++ b/webapp/src/app/api/model/award.ts @@ -1,21 +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. */ + /** * Award */ -export interface Award { - id?: string | null; - display_name?: string | null; - funder_award_id?: string | null; - funder_id?: string | null; - funder_display_name?: string | null; - doi?: string | null; +export interface Award { + id?: string | null; + display_name?: string | null; + funder_award_id?: string | null; + funder_id?: string | null; + funder_display_name?: string | null; + doi?: string | null; } + diff --git a/webapp/src/app/api/model/bodyCreateUser.ts b/webapp/src/app/api/model/bodyCreateUser.ts index 6a0778be..76caab3b 100644 --- a/webapp/src/app/api/model/bodyCreateUser.ts +++ b/webapp/src/app/api/model/bodyCreateUser.ts @@ -1,17 +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. */ -export interface BodyCreateUser { - username: string; - password: string; - email: string; - institution: string; - superadmin?: boolean; + +export interface BodyCreateUser { + username: string; + password: string; + email: string; + institution: string; + superadmin?: boolean; } + diff --git a/webapp/src/app/api/model/bundProject.ts b/webapp/src/app/api/model/bundProject.ts index 9f291399..3463aa78 100644 --- a/webapp/src/app/api/model/bundProject.ts +++ b/webapp/src/app/api/model/bundProject.ts @@ -1,40 +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. */ -export interface BundProject { - funding_code?: string | null; - department?: string | null; - department_fullname?: string | null; - referat?: string | null; - project_sponsor?: string | null; - project_sponsor_fullname?: string | null; - work_unit?: string | null; - recipient?: string | null; - municipal_code?: string | null; - municipality?: string | null; - place?: string | null; - state?: string | null; - country?: string | null; - implementing_agency?: string | null; - topic?: string | null; - performance_plan_system?: string | null; - performance_plan_system_text?: string | null; - funding_start?: string | null; - funding_end?: string | null; - grant_amount?: number | null; - funding_profile?: string | null; - joint_project?: string | null; - funding_type?: string | null; - publication_date?: string | null; - unix_timestamp?: number | null; - date?: string | null; - new?: boolean | null; - duration?: string | null; + +export interface BundProject { + funding_code?: string | null; + department?: string | null; + department_fullname?: string | null; + referat?: string | null; + project_sponsor?: string | null; + project_sponsor_fullname?: string | null; + work_unit?: string | null; + recipient?: string | null; + municipal_code?: string | null; + municipality?: string | null; + place?: string | null; + state?: string | null; + country?: string | null; + implementing_agency?: string | null; + topic?: string | null; + performance_plan_system?: string | null; + performance_plan_system_text?: string | null; + funding_start?: string | null; + funding_end?: string | null; + grant_amount?: number | null; + funding_profile?: string | null; + joint_project?: string | null; + funding_type?: string | null; + publication_date?: string | null; + unix_timestamp?: number | null; + date?: string | null; + 'new'?: boolean | null; + duration?: string | null; } + diff --git a/webapp/src/app/api/model/bundProjectDetails.ts b/webapp/src/app/api/model/bundProjectDetails.ts index b61df06b..2193563c 100644 --- a/webapp/src/app/api/model/bundProjectDetails.ts +++ b/webapp/src/app/api/model/bundProjectDetails.ts @@ -1,55 +1,57 @@ /** * 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. */ + /** * Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types. */ -export interface BundProjectDetails { - /** - * The ID of the Bund project - */ - id: string; - funding_reference?: string | null; - title?: string | null; - description?: string | null; - joint_project?: string | null; - funding_type?: string | null; - funding_profile?: string | null; - funding_amount?: number | null; - funding_start_date?: string | null; - funding_end_date?: string | null; - duration?: string | null; - performance_plan_code?: string | null; - performance_plan_fullname?: string | null; - executing_agency?: string | null; - funding_recipient?: string | null; - project_agency?: string | null; - project_agency_fullname?: string | null; - department?: string | null; - department_fullname?: string | null; - division?: string | null; - location?: string | null; - municipality?: string | null; - state?: string | null; - country?: string | null; - municipality_code?: string | null; - publication_date?: string | null; - is_new?: boolean | null; - record_date?: string | null; - unix_timestamp?: number | null; - /** - * All persons associated with the Bund project (from nested Arb object) - */ - associated_persons?: Array; - /** - * All institutions associated with the Bund project - */ - institutions?: Array; +export interface BundProjectDetails { + /** + * The ID of the Bund project + */ + id: string; + funding_reference?: string | null; + title?: string | null; + description?: string | null; + joint_project?: string | null; + funding_type?: string | null; + funding_profile?: string | null; + funding_amount?: number | null; + funding_start_date?: string | null; + funding_end_date?: string | null; + duration?: string | null; + performance_plan_code?: string | null; + performance_plan_fullname?: string | null; + executing_agency?: string | null; + funding_recipient?: string | null; + project_agency?: string | null; + project_agency_fullname?: string | null; + department?: string | null; + department_fullname?: string | null; + division?: string | null; + location?: string | null; + municipality?: string | null; + state?: string | null; + country?: string | null; + municipality_code?: string | null; + publication_date?: string | null; + is_new?: boolean | null; + record_date?: string | null; + unix_timestamp?: number | null; + /** + * All persons associated with the Bund project (from nested Arb object) + */ + associated_persons?: Array; + /** + * All institutions associated with the Bund project + */ + institutions?: Array; } + diff --git a/webapp/src/app/api/model/bundProjectPage.ts b/webapp/src/app/api/model/bundProjectPage.ts index 6c38e7a6..10514bce 100644 --- a/webapp/src/app/api/model/bundProjectPage.ts +++ b/webapp/src/app/api/model/bundProjectPage.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 @@ -9,21 +9,23 @@ */ import { BundProject } from './bundProject'; -export interface BundProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The bund projects on this page. - */ - elements?: Array; + +export interface BundProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The bund projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/careerMetrics.ts b/webapp/src/app/api/model/careerMetrics.ts index eb84c19f..abb58689 100644 --- a/webapp/src/app/api/model/careerMetrics.ts +++ b/webapp/src/app/api/model/careerMetrics.ts @@ -1,32 +1,34 @@ /** * 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 CareerMetrics { - first_publication_year?: number | null; - last_publication_year?: number | null; - career_age?: number | null; - career_span?: number | null; - career_stage?: string | null; - /** - * Number of distinct years with at least one publication. - */ - active_years?: number; - /** - * Number of publications used for career metrics. - */ - publication_count?: number; - publications_per_active_year?: number | null; - publications_per_career_year?: number | null; - years_since_last_publication?: number | null; - /** - * True if publication years look suspicious. - */ - has_suspicious_publication_years?: boolean; + +export interface CareerMetrics { + first_publication_year?: number | null; + last_publication_year?: number | null; + career_age?: number | null; + career_span?: number | null; + career_stage?: string | null; + /** + * Number of distinct years with at least one publication. + */ + active_years?: number; + /** + * Number of publications used for career metrics. + */ + publication_count?: number; + publications_per_active_year?: number | null; + publications_per_career_year?: number | null; + years_since_last_publication?: number | null; + /** + * True if publication years look suspicious. + */ + has_suspicious_publication_years?: boolean; } + diff --git a/webapp/src/app/api/model/collaborationNetwork.ts b/webapp/src/app/api/model/collaborationNetwork.ts index a2fbdc5b..e439c061 100644 --- a/webapp/src/app/api/model/collaborationNetwork.ts +++ b/webapp/src/app/api/model/collaborationNetwork.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 @@ -13,29 +13,31 @@ import { CollaborationNetworkEdge } from './collaborationNetworkEdge'; import { InstitutionNetworkNode } from './institutionNetworkNode'; import { AuthorNetworkNode } from './authorNetworkNode'; -export interface CollaborationNetwork { - /** - * The raw person ID of the person whose collaboration network this is. - */ - raw_person_id: string; - /** - * The work nodes in the collaboration network. - */ - work_nodes: Array; - /** - * The author nodes in the collaboration network. - */ - author_nodes: Array; - /** - * The institution nodes in the collaboration network. - */ - institution_nodes: Array; - /** - * The collaboration edges in the collaboration network. A collaboration edge represents a collaboration between two nodes. A -> W and A -> I - */ - collaboration_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; + +export interface CollaborationNetwork { + /** + * The raw person ID of the person whose collaboration network this is. + */ + raw_person_id: string; + /** + * The work nodes in the collaboration network. + */ + work_nodes: Array; + /** + * The author nodes in the collaboration network. + */ + author_nodes: Array; + /** + * The institution nodes in the collaboration network. + */ + institution_nodes: Array; + /** + * The collaboration edges in the collaboration network. A collaboration edge represents a collaboration between two nodes. A -> W and A -> I + */ + collaboration_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/collaborationNetworkEdge.ts b/webapp/src/app/api/model/collaborationNetworkEdge.ts index baffb178..16fb5fc6 100644 --- a/webapp/src/app/api/model/collaborationNetworkEdge.ts +++ b/webapp/src/app/api/model/collaborationNetworkEdge.ts @@ -1,20 +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; + +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/collaborationNetworkNodeType.ts b/webapp/src/app/api/model/collaborationNetworkNodeType.ts index 3e673f35..752e35b0 100644 --- a/webapp/src/app/api/model/collaborationNetworkNodeType.ts +++ b/webapp/src/app/api/model/collaborationNetworkNodeType.ts @@ -1,17 +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', + Author: 'author', + Institution: 'institution', + Work: 'work' } as const; -export type CollaborationNetworkNodeType = - (typeof CollaborationNetworkNodeType)[keyof typeof CollaborationNetworkNodeType]; +export type CollaborationNetworkNodeType = typeof CollaborationNetworkNodeType[keyof typeof CollaborationNetworkNodeType]; + diff --git a/webapp/src/app/api/model/companyConnection.ts b/webapp/src/app/api/model/companyConnection.ts index 2824c543..4ce31814 100644 --- a/webapp/src/app/api/model/companyConnection.ts +++ b/webapp/src/app/api/model/companyConnection.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 @@ -9,17 +9,19 @@ */ import { MatchedOfficer } from './matchedOfficer'; -export interface CompanyConnection { - company_number?: string | null; - company_name?: string | null; - company_status?: string | null; - register_art?: string | null; - register_nummer?: string | null; - native_company_number?: string | null; - registrar?: string | null; - registered_office?: string | null; - registered_address?: string | null; - retrieved_at?: string | null; - matched_officers?: Array; - officers?: Array; + +export interface CompanyConnection { + company_number?: string | null; + company_name?: string | null; + company_status?: string | null; + register_art?: string | null; + register_nummer?: string | null; + native_company_number?: string | null; + registrar?: string | null; + registered_office?: string | null; + registered_address?: string | null; + retrieved_at?: string | null; + matched_officers?: Array; + officers?: Array; } + diff --git a/webapp/src/app/api/model/companyConnectionsResponse.ts b/webapp/src/app/api/model/companyConnectionsResponse.ts index f4f5f42f..9beabd1e 100644 --- a/webapp/src/app/api/model/companyConnectionsResponse.ts +++ b/webapp/src/app/api/model/companyConnectionsResponse.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 @@ -9,15 +9,17 @@ */ import { CompanyConnection } from './companyConnection'; -export interface CompanyConnectionsResponse { - author_id: string; - display_name?: string | null; - is_ude_author: boolean; - institution_scope?: string | null; - matching_institutions?: Array; - matching_method?: string | null; - company_count: number; - has_more_results: boolean; - common_name_warning: boolean; - connections?: Array; + +export interface CompanyConnectionsResponse { + author_id: string; + display_name?: string | null; + is_ude_author: boolean; + institution_scope?: string | null; + matching_institutions?: Array; + matching_method?: string | null; + company_count: number; + has_more_results: boolean; + common_name_warning: boolean; + connections?: Array; } + diff --git a/webapp/src/app/api/model/cordisEuProject.ts b/webapp/src/app/api/model/cordisEuProject.ts index 8d408ad6..f18dd3d4 100644 --- a/webapp/src/app/api/model/cordisEuProject.ts +++ b/webapp/src/app/api/model/cordisEuProject.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 @@ -10,30 +10,32 @@ import { Keywords } from './keywords'; import { Topics } from './topics'; -export interface CordisEuProject { - /** - * Unique identifier for the project, typically the CORDIS ID - */ - id: string; - rcn?: string | null; - acronym?: string | null; - title?: string | null; - objective?: string | null; - frameworkProgramme?: string | null; - fundingScheme?: string | null; - legalBasis?: string | null; - masterCall?: string | null; - subCall?: string | null; - topics?: Topics | null; - nature?: string | null; - status?: string | null; - ecMaxContribution?: number | null; - totalCost?: number | null; - startDate?: string | null; - endDate?: string | null; - ecSignatureDate?: string | null; - contentUpdateDate?: string | null; - grantDoi?: string | null; - humanValidated?: boolean | null; - keywords?: Keywords | null; + +export interface CordisEuProject { + /** + * Unique identifier for the project, typically the CORDIS ID + */ + id: string; + rcn?: string | null; + acronym?: string | null; + title?: string | null; + objective?: string | null; + frameworkProgramme?: string | null; + fundingScheme?: string | null; + legalBasis?: string | null; + masterCall?: string | null; + subCall?: string | null; + topics?: Topics | null; + nature?: string | null; + status?: string | null; + ecMaxContribution?: number | null; + totalCost?: number | null; + startDate?: string | null; + endDate?: string | null; + ecSignatureDate?: string | null; + contentUpdateDate?: string | null; + grantDoi?: string | null; + humanValidated?: boolean | null; + keywords?: Keywords | null; } + diff --git a/webapp/src/app/api/model/cordisEuProjectPage.ts b/webapp/src/app/api/model/cordisEuProjectPage.ts index 8dc900f7..393f6db8 100644 --- a/webapp/src/app/api/model/cordisEuProjectPage.ts +++ b/webapp/src/app/api/model/cordisEuProjectPage.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 @@ -9,21 +9,23 @@ */ import { CordisEuProject } from './cordisEuProject'; -export interface CordisEuProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The CORDIS EU projects on this page. - */ - elements?: Array; + +export interface CordisEuProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The CORDIS EU projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/costUsd.ts b/webapp/src/app/api/model/costUsd.ts index 494cb094..c7bcbee8 100644 --- a/webapp/src/app/api/model/costUsd.ts +++ b/webapp/src/app/api/model/costUsd.ts @@ -1,14 +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 {} +export interface CostUsd { +} + diff --git a/webapp/src/app/api/model/customAuthor.ts b/webapp/src/app/api/model/customAuthor.ts index 6fd54c51..0cf7eb21 100644 --- a/webapp/src/app/api/model/customAuthor.ts +++ b/webapp/src/app/api/model/customAuthor.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 @@ -16,24 +16,26 @@ import { AuthorIds } from './authorIds'; import { AuthorSummaryStats } from './authorSummaryStats'; import { WorkTopic } from './workTopic'; -export interface CustomAuthor { - id?: string | null; - orcid?: string | null; - display_name?: string | null; - display_name_alternatives?: Array | null; - longest_name?: string | null; - parsed_longest_name?: AuthorParsedLongestName | null; - works_count?: number | null; - cited_by_count?: number | null; - summary_stats?: AuthorSummaryStats | null; - affiliations?: Array | null; - last_known_institutions?: Array | null; - topics?: Array | null; - counts_by_year?: Array | null; - ids?: AuthorIds | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; - relevance_rating?: string | null; - career_metrics?: CareerMetrics | null; + +export interface CustomAuthor { + id?: string | null; + orcid?: string | null; + display_name?: string | null; + display_name_alternatives?: Array | null; + longest_name?: string | null; + parsed_longest_name?: AuthorParsedLongestName | null; + works_count?: number | null; + cited_by_count?: number | null; + summary_stats?: AuthorSummaryStats | null; + affiliations?: Array | null; + last_known_institutions?: Array | null; + topics?: Array | null; + counts_by_year?: Array | null; + ids?: AuthorIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; + relevance_rating?: string | null; + career_metrics?: CareerMetrics | null; } + diff --git a/webapp/src/app/api/model/customAuthorsListResponse.ts b/webapp/src/app/api/model/customAuthorsListResponse.ts index 71f691a2..3c80ddf5 100644 --- a/webapp/src/app/api/model/customAuthorsListResponse.ts +++ b/webapp/src/app/api/model/customAuthorsListResponse.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,9 +11,11 @@ import { Meta } from './meta'; import { CustomAuthor } from './customAuthor'; import { GroupByResult } from './groupByResult'; -export interface CustomAuthorsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; - placeholder?: CustomAuthor | null; + +export interface CustomAuthorsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; + placeholder?: CustomAuthor | null; } + diff --git a/webapp/src/app/api/model/dehydratedAuthor.ts b/webapp/src/app/api/model/dehydratedAuthor.ts index 350718ef..4d3817f1 100644 --- a/webapp/src/app/api/model/dehydratedAuthor.ts +++ b/webapp/src/app/api/model/dehydratedAuthor.ts @@ -1,18 +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; +export interface DehydratedAuthor { + id?: string | null; + display_name?: string | null; + orcid?: string | null; } + diff --git a/webapp/src/app/api/model/dehydratedFunder.ts b/webapp/src/app/api/model/dehydratedFunder.ts index c4231c13..b134bbb1 100644 --- a/webapp/src/app/api/model/dehydratedFunder.ts +++ b/webapp/src/app/api/model/dehydratedFunder.ts @@ -1,18 +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; +export interface DehydratedFunder { + id?: string | null; + display_name?: string | null; + ror?: string | null; } + diff --git a/webapp/src/app/api/model/dehydratedInstitution.ts b/webapp/src/app/api/model/dehydratedInstitution.ts index 956fc03e..7b6c9824 100644 --- a/webapp/src/app/api/model/dehydratedInstitution.ts +++ b/webapp/src/app/api/model/dehydratedInstitution.ts @@ -1,21 +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; +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/dehydratedSource.ts b/webapp/src/app/api/model/dehydratedSource.ts index b672b5dd..ae714846 100644 --- a/webapp/src/app/api/model/dehydratedSource.ts +++ b/webapp/src/app/api/model/dehydratedSource.ts @@ -1,26 +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; +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/dfgProjectDetails.ts b/webapp/src/app/api/model/dfgProjectDetails.ts index 58ece5f7..5fe29ff9 100644 --- a/webapp/src/app/api/model/dfgProjectDetails.ts +++ b/webapp/src/app/api/model/dfgProjectDetails.ts @@ -1,39 +1,41 @@ /** * 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. */ + /** * Clean summary model for a DFG project, consolidating all person roles and institution references into unified lists. */ -export interface DfgProjectDetails { - /** - * The ID of the DFG project - */ - id: string; - link?: string | null; - title?: string | null; - description?: string | null; - project_identifier?: string | null; - funding_start_date?: string | null; - funding_end_date?: string | null; - dfg_procedure?: string | null; - subject_area?: string | null; - funding_type?: string | null; - international_reference?: string | null; - website?: string | null; - /** - * All persons associated with the DFG project (any role) - */ - associated_persons?: Array; - /** - * All institutions associated with the DFG project - */ - institutions?: Array; - subproject_of?: string | null; +export interface DfgProjectDetails { + /** + * The ID of the DFG project + */ + id: string; + link?: string | null; + title?: string | null; + description?: string | null; + project_identifier?: string | null; + funding_start_date?: string | null; + funding_end_date?: string | null; + dfg_procedure?: string | null; + subject_area?: string | null; + funding_type?: string | null; + international_reference?: string | null; + website?: string | null; + /** + * All persons associated with the DFG project (any role) + */ + associated_persons?: Array; + /** + * All institutions associated with the DFG project + */ + institutions?: Array; + subproject_of?: string | null; } + diff --git a/webapp/src/app/api/model/dfgProjectPage.ts b/webapp/src/app/api/model/dfgProjectPage.ts index a05d81d2..8f67e170 100644 --- a/webapp/src/app/api/model/dfgProjectPage.ts +++ b/webapp/src/app/api/model/dfgProjectPage.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 @@ -9,21 +9,23 @@ */ import { DfgProjectSummary } from './dfgProjectSummary'; -export interface DfgProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The DFG projects on this page. - */ - elements?: Array; + +export interface DfgProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The DFG projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/dfgProjectSummary.ts b/webapp/src/app/api/model/dfgProjectSummary.ts index 10c05a08..145dba4a 100644 --- a/webapp/src/app/api/model/dfgProjectSummary.ts +++ b/webapp/src/app/api/model/dfgProjectSummary.ts @@ -1,25 +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. */ -export interface DfgProjectSummary { - /** - * The unique identifier of the DFG project. - */ - id: string; - link?: string | null; - title?: string | null; - professional_classification?: string | null; - funding_start?: string | null; - funding_end?: string | null; - /** - * The names of the researchers involved in the DFG project. - */ - names?: Array; + +export interface DfgProjectSummary { + /** + * The unique identifier of the DFG project. + */ + id: string; + link?: string | null; + title?: string | null; + professional_classification?: string | null; + funding_start?: string | null; + funding_end?: string | null; + /** + * The names of the researchers involved in the DFG project. + */ + names?: Array; } + diff --git a/webapp/src/app/api/model/euOrganizationProjectSummary.ts b/webapp/src/app/api/model/euOrganizationProjectSummary.ts index af085ff3..3cc10f0a 100644 --- a/webapp/src/app/api/model/euOrganizationProjectSummary.ts +++ b/webapp/src/app/api/model/euOrganizationProjectSummary.ts @@ -1,25 +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. */ -export interface EuOrganizationProjectSummary { - /** - * The unique identifier of the organization. - */ - organization_id: string; - /** - * The unique identifier of the project. - */ - project_id: string; - title?: string | null; - start_date?: string | null; - end_date?: string | null; - acronym?: string | null; - ec_contribution?: number | null; + +export interface EuOrganizationProjectSummary { + /** + * The unique identifier of the organization. + */ + organization_id: string; + /** + * The unique identifier of the project. + */ + project_id: string; + title?: string | null; + start_date?: string | null; + end_date?: string | null; + acronym?: string | null; + ec_contribution?: number | null; } + diff --git a/webapp/src/app/api/model/euOrganizationProjectSummaryPage.ts b/webapp/src/app/api/model/euOrganizationProjectSummaryPage.ts index 90166a7e..9d57d5b4 100644 --- a/webapp/src/app/api/model/euOrganizationProjectSummaryPage.ts +++ b/webapp/src/app/api/model/euOrganizationProjectSummaryPage.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 @@ -9,21 +9,23 @@ */ import { EuOrganizationProjectSummary } from './euOrganizationProjectSummary'; -export interface EuOrganizationProjectSummaryPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The organization project summaries on this page. - */ - elements?: Array; + +export interface EuOrganizationProjectSummaryPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The organization project summaries on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/filterInformation.ts b/webapp/src/app/api/model/filterInformation.ts index 1c4af66d..b2078376 100644 --- a/webapp/src/app/api/model/filterInformation.ts +++ b/webapp/src/app/api/model/filterInformation.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 @@ -10,21 +10,23 @@ import { InstitutionInformation } from './institutionInformation'; import { WorkTopicInformation } from './workTopicInformation'; -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; + +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/filterProperties.ts b/webapp/src/app/api/model/filterProperties.ts index 7caac0b6..608acab4 100644 --- a/webapp/src/app/api/model/filterProperties.ts +++ b/webapp/src/app/api/model/filterProperties.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 @@ -10,11 +10,13 @@ import { WorksFilterProperties } from './worksFilterProperties'; import { AuthorsFilterProperties } from './authorsFilterProperties'; -export interface FilterProperties { - /** - * The type of filter to apply when generating the collaboration network. Can be either \'works\' or \'authors\'. If \'works\', the filter properties in the \'works_filter_properties\' field will be used. If \'authors\', the filter properties in the \'authors_filter_properties\' field will be used. - */ - filter_by?: string; - works_filter_properties: WorksFilterProperties | null; - authors_filter_properties: AuthorsFilterProperties | null; + +export interface FilterProperties { + /** + * The type of filter to apply when generating the collaboration network. Can be either \'works\' or \'authors\'. If \'works\', the filter properties in the \'works_filter_properties\' field will be used. If \'authors\', the filter properties in the \'authors_filter_properties\' field will be used. + */ + filter_by?: string; + works_filter_properties: WorksFilterProperties | null; + authors_filter_properties: AuthorsFilterProperties | null; } + diff --git a/webapp/src/app/api/model/fundersByAuthorResponse.ts b/webapp/src/app/api/model/fundersByAuthorResponse.ts index d6e0e02f..1286429e 100644 --- a/webapp/src/app/api/model/fundersByAuthorResponse.ts +++ b/webapp/src/app/api/model/fundersByAuthorResponse.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 @@ -9,9 +9,11 @@ */ import { FunderByAuthor } from './funderByAuthor'; -export interface FundersByAuthorResponse { - author_id: string; - author_name?: string | null; - funder_count: number; - funders: Array; + +export interface FundersByAuthorResponse { + author_id: string; + author_name?: string | null; + funder_count: number; + funders: Array; } + diff --git a/webapp/src/app/api/model/fundingProject.ts b/webapp/src/app/api/model/fundingProject.ts index fb8204e3..a53c64f1 100644 --- a/webapp/src/app/api/model/fundingProject.ts +++ b/webapp/src/app/api/model/fundingProject.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 @@ -9,19 +9,23 @@ */ import { ProjectType } from './projectType'; -export interface FundingProject { - /** - * The type of the project. - */ - type: ProjectType; - /** - * The unique identifier of the project. - */ - id: string; - title?: string | null; - acronym?: string | null; - start_date?: string | null; - end_date?: string | null; - funding_amount?: number | null; + +export interface FundingProject { + /** + * The type of the project. + */ + type: ProjectType; + /** + * The unique identifier of the project. + */ + id: string; + title?: string | null; + acronym?: string | null; + start_date?: string | null; + end_date?: string | null; + funding_amount?: number | null; } -export namespace FundingProject {} +export namespace FundingProject { +} + + diff --git a/webapp/src/app/api/model/fundingProjectPage.ts b/webapp/src/app/api/model/fundingProjectPage.ts index e0996525..db43c9c4 100644 --- a/webapp/src/app/api/model/fundingProjectPage.ts +++ b/webapp/src/app/api/model/fundingProjectPage.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 @@ -9,21 +9,23 @@ */ import { FundingProject } from './fundingProject'; -export interface FundingProjectPage { - /** - * The current page number. - */ - page?: number; - /** - * The requested page size. - */ - size?: number; - /** - * The total number of items. - */ - total?: number; - /** - * The funding projects on this page. - */ - elements?: Array; + +export interface FundingProjectPage { + /** + * The current page number. + */ + page?: number; + /** + * The requested page size. + */ + size?: number; + /** + * The total number of items. + */ + total?: number; + /** + * The funding projects on this page. + */ + elements?: Array; } + diff --git a/webapp/src/app/api/model/fwci.ts b/webapp/src/app/api/model/fwci.ts index bd7eea69..0c0cf8de 100644 --- a/webapp/src/app/api/model/fwci.ts +++ b/webapp/src/app/api/model/fwci.ts @@ -1,14 +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. */ + /** * Field-weighted Citation Impact, calculated as citations received / citations expected. */ -export interface Fwci {} +export interface Fwci { +} + diff --git a/webapp/src/app/api/model/groupByResult.ts b/webapp/src/app/api/model/groupByResult.ts index 98580663..68c51855 100644 --- a/webapp/src/app/api/model/groupByResult.ts +++ b/webapp/src/app/api/model/groupByResult.ts @@ -1,18 +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; +export interface GroupByResult { + key?: string | null; + key_display_name?: string | null; + count?: number | null; } + diff --git a/webapp/src/app/api/model/hTTPValidationError.ts b/webapp/src/app/api/model/hTTPValidationError.ts index c8e65c3e..f624be37 100644 --- a/webapp/src/app/api/model/hTTPValidationError.ts +++ b/webapp/src/app/api/model/hTTPValidationError.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 @@ -9,6 +9,8 @@ */ import { ValidationError } from './validationError'; -export interface HTTPValidationError { - detail?: Array; + +export interface HTTPValidationError { + detail?: Array; } + diff --git a/webapp/src/app/api/model/identityGrant.ts b/webapp/src/app/api/model/identityGrant.ts index 4bf172b8..9ec3fe50 100644 --- a/webapp/src/app/api/model/identityGrant.ts +++ b/webapp/src/app/api/model/identityGrant.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 @@ -9,9 +9,11 @@ */ import { AuthScope } from './authScope'; -export interface IdentityGrant { - token_type: string; - access_token: string; - expires_in: number; - scope: AuthScope; + +export interface IdentityGrant { + token_type: string; + access_token: string; + expires_in: number; + scope: AuthScope; } + diff --git a/webapp/src/app/api/model/institution.ts b/webapp/src/app/api/model/institution.ts index c099fc57..6b1a5778 100644 --- a/webapp/src/app/api/model/institution.ts +++ b/webapp/src/app/api/model/institution.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 @@ -12,28 +12,30 @@ import { AuthorCountsByYearInner } from './authorCountsByYearInner'; import { AuthorSummaryStats } from './authorSummaryStats'; import { InstitutionGeo } from './institutionGeo'; + /** * A university, research organization, or other affiliation */ -export interface Institution { - id?: string | null; - ror?: string | null; - display_name?: string | null; - country_code?: string | null; - type?: string | null; - homepage_url?: string | null; - image_url?: string | null; - image_thumbnail_url?: string | null; - display_name_acronyms?: Array | null; - display_name_alternatives?: Array | null; - works_count?: number | null; - cited_by_count?: number | null; - summary_stats?: AuthorSummaryStats | null; - geo?: InstitutionGeo | null; - lineage?: Array | null; - ids?: InstitutionIds | null; - counts_by_year?: Array | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Institution { + id?: string | null; + ror?: string | null; + display_name?: string | null; + country_code?: string | null; + type?: string | null; + homepage_url?: string | null; + image_url?: string | null; + image_thumbnail_url?: string | null; + display_name_acronyms?: Array | null; + display_name_alternatives?: Array | null; + works_count?: number | null; + cited_by_count?: number | null; + summary_stats?: AuthorSummaryStats | null; + geo?: InstitutionGeo | null; + lineage?: Array | null; + ids?: InstitutionIds | null; + counts_by_year?: Array | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/institutionFunderSummary.ts b/webapp/src/app/api/model/institutionFunderSummary.ts index cf15754a..48d147b2 100644 --- a/webapp/src/app/api/model/institutionFunderSummary.ts +++ b/webapp/src/app/api/model/institutionFunderSummary.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 @@ -9,18 +9,22 @@ */ import { ProjectType } from './projectType'; -export interface InstitutionFunderSummary { - /** - * The type of funding data (e.g., \'bund\', \'eu\', \'dfg\'). - */ - type: ProjectType; - /** - * A dictionary mapping years to total funding amounts for that year. - */ - funding_per_year?: object; - /** - * The average annual funding over the continuous period covered by the data. - */ - annual_average_over_period?: number; + +export interface InstitutionFunderSummary { + /** + * The type of funding data (e.g., \'bund\', \'eu\', \'dfg\'). + */ + type: ProjectType; + /** + * A dictionary mapping years to total funding amounts for that year. + */ + funding_per_year?: object; + /** + * The average annual funding over the continuous period covered by the data. + */ + annual_average_over_period?: number; } -export namespace InstitutionFunderSummary {} +export namespace InstitutionFunderSummary { +} + + diff --git a/webapp/src/app/api/model/institutionGeo.ts b/webapp/src/app/api/model/institutionGeo.ts index b438d37c..949b73f4 100644 --- a/webapp/src/app/api/model/institutionGeo.ts +++ b/webapp/src/app/api/model/institutionGeo.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 @@ -10,15 +10,17 @@ import { Latitude } from './latitude'; import { Longitude } from './longitude'; + /** * Location information: */ -export interface InstitutionGeo { - city?: string | null; - geonames_city_id?: string | null; - region?: string | null; - country_code?: string | null; - country?: string | null; - latitude?: Latitude | null; - longitude?: Longitude | null; +export interface InstitutionGeo { + city?: string | null; + geonames_city_id?: string | null; + region?: string | null; + country_code?: string | null; + country?: string | null; + latitude?: Latitude | null; + longitude?: Longitude | null; } + diff --git a/webapp/src/app/api/model/institutionIds.ts b/webapp/src/app/api/model/institutionIds.ts index fd952098..93d801e1 100644 --- a/webapp/src/app/api/model/institutionIds.ts +++ b/webapp/src/app/api/model/institutionIds.ts @@ -1,21 +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. */ + /** * External identifiers: */ -export interface InstitutionIds { - openalex?: string | null; - ror?: string | null; - mag?: number | null; - grid?: string | null; - wikipedia?: string | null; - wikidata?: string | null; +export interface InstitutionIds { + openalex?: string | null; + ror?: string | null; + mag?: number | null; + grid?: string | null; + wikipedia?: string | null; + wikidata?: string | null; } + diff --git a/webapp/src/app/api/model/institutionInformation.ts b/webapp/src/app/api/model/institutionInformation.ts index 9e12986d..e287b0fa 100644 --- a/webapp/src/app/api/model/institutionInformation.ts +++ b/webapp/src/app/api/model/institutionInformation.ts @@ -1,20 +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; + +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/institutionNetworkNode.ts b/webapp/src/app/api/model/institutionNetworkNode.ts index 791645b7..a558a8cf 100644 --- a/webapp/src/app/api/model/institutionNetworkNode.ts +++ b/webapp/src/app/api/model/institutionNetworkNode.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 @@ -9,18 +9,22 @@ */ import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType'; -export interface InstitutionNetworkNode { - /** - * 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 interface InstitutionNetworkNode { + /** + * 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 InstitutionNetworkNode {} +export namespace InstitutionNetworkNode { +} + + diff --git a/webapp/src/app/api/model/institutionPage.ts b/webapp/src/app/api/model/institutionPage.ts index b7640651..01267ee3 100644 --- a/webapp/src/app/api/model/institutionPage.ts +++ b/webapp/src/app/api/model/institutionPage.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 @@ -9,21 +9,23 @@ */ import { Institution } from './institution'; -export interface InstitutionPage { - /** - * List of institutions in the current page. - */ - elements?: Array; - /** - * Current page number. (0-indexed) - */ - page?: number; - /** - * Number of institutions per page. - */ - size?: number; - /** - * Total number of institutions matching the search criteria. - */ - total?: number; + +export interface InstitutionPage { + /** + * List of institutions in the current page. + */ + elements?: Array; + /** + * Current page number. (0-indexed) + */ + page?: number; + /** + * Number of institutions per page. + */ + size?: number; + /** + * Total number of institutions matching the search criteria. + */ + total?: number; } + diff --git a/webapp/src/app/api/model/institutionsListResponse.ts b/webapp/src/app/api/model/institutionsListResponse.ts index 0ac2c185..908d72fe 100644 --- a/webapp/src/app/api/model/institutionsListResponse.ts +++ b/webapp/src/app/api/model/institutionsListResponse.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,11 +11,13 @@ import { Meta } from './meta'; import { Institution } from './institution'; import { GroupByResult } from './groupByResult'; + /** * InstitutionsListResponse */ -export interface InstitutionsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +export interface InstitutionsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; } + diff --git a/webapp/src/app/api/model/item.ts b/webapp/src/app/api/model/item.ts index 377f3a81..cc33194a 100644 --- a/webapp/src/app/api/model/item.ts +++ b/webapp/src/app/api/model/item.ts @@ -1,24 +1,26 @@ /** * 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 Item { - /** - * The id of the entity. - */ - id: number; - /** - * The name of the item. - */ - name: string; - /** - * The description of the item. - */ - description: string; + +export interface Item { + /** + * The id of the entity. + */ + id: number; + /** + * The name of the item. + */ + name: string; + /** + * The description of the item. + */ + description: string; } + diff --git a/webapp/src/app/api/model/itemCreate.ts b/webapp/src/app/api/model/itemCreate.ts index 36920a12..608d6910 100644 --- a/webapp/src/app/api/model/itemCreate.ts +++ b/webapp/src/app/api/model/itemCreate.ts @@ -1,20 +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; + +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/itemPage.ts b/webapp/src/app/api/model/itemPage.ts index 53a7140a..56595b8a 100644 --- a/webapp/src/app/api/model/itemPage.ts +++ b/webapp/src/app/api/model/itemPage.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 @@ -9,21 +9,23 @@ */ 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; + +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/keywords.ts b/webapp/src/app/api/model/keywords.ts index d93b5fe0..c65c7600 100644 --- a/webapp/src/app/api/model/keywords.ts +++ b/webapp/src/app/api/model/keywords.ts @@ -1,14 +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. */ + /** * Keywords associated with the project */ -export interface Keywords {} +export interface Keywords { +} + diff --git a/webapp/src/app/api/model/latitude.ts b/webapp/src/app/api/model/latitude.ts index 8fb58a9b..fe6b49aa 100644 --- a/webapp/src/app/api/model/latitude.ts +++ b/webapp/src/app/api/model/latitude.ts @@ -1,11 +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 Latitude {} + +export interface Latitude { +} + diff --git a/webapp/src/app/api/model/location.ts b/webapp/src/app/api/model/location.ts index f92e2ffb..f207d751 100644 --- a/webapp/src/app/api/model/location.ts +++ b/webapp/src/app/api/model/location.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 @@ -9,17 +9,19 @@ */ import { DehydratedSource } from './dehydratedSource'; + /** * Where a work is hosted */ -export interface Location { - is_oa?: boolean | null; - landing_page_url?: string | null; - pdf_url?: string | null; - source?: DehydratedSource | null; - license?: string | null; - license_id?: string | null; - version?: string | null; - is_accepted?: boolean | null; - is_published?: boolean | null; +export interface Location { + is_oa?: boolean | null; + landing_page_url?: string | null; + pdf_url?: string | null; + source?: DehydratedSource | null; + license?: string | null; + license_id?: string | null; + version?: string | null; + is_accepted?: boolean | null; + is_published?: boolean | null; } + diff --git a/webapp/src/app/api/model/longitude.ts b/webapp/src/app/api/model/longitude.ts index d222a6ff..b0d39fce 100644 --- a/webapp/src/app/api/model/longitude.ts +++ b/webapp/src/app/api/model/longitude.ts @@ -1,11 +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 Longitude {} + +export interface Longitude { +} + diff --git a/webapp/src/app/api/model/matchedAuthor.ts b/webapp/src/app/api/model/matchedAuthor.ts index 058da26a..6194df94 100644 --- a/webapp/src/app/api/model/matchedAuthor.ts +++ b/webapp/src/app/api/model/matchedAuthor.ts @@ -1,4 +1,16 @@ -export interface MatchedAuthor { - openalex_author_id: string; - author_name: string; +/** + * 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 MatchedAuthor { + openalex_author_id: string; + author_name: string; } + diff --git a/webapp/src/app/api/model/matchedOfficer.ts b/webapp/src/app/api/model/matchedOfficer.ts index a9f00939..4ad5c354 100644 --- a/webapp/src/app/api/model/matchedOfficer.ts +++ b/webapp/src/app/api/model/matchedOfficer.ts @@ -1,21 +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 MatchedOfficer { - name?: string | null; - firstname?: string | null; - lastname?: string | null; - city?: string | null; - position?: string | null; - start_date?: string | null; - type?: string | null; - flag?: string | null; - is_matched_person?: boolean; + +export interface MatchedOfficer { + name?: string | null; + firstname?: string | null; + lastname?: string | null; + city?: string | null; + position?: string | null; + start_date?: string | null; + type?: string | null; + flag?: string | null; + is_matched_person?: boolean; } + diff --git a/webapp/src/app/api/model/mentionedPerson.ts b/webapp/src/app/api/model/mentionedPerson.ts index dad21357..6141b12a 100644 --- a/webapp/src/app/api/model/mentionedPerson.ts +++ b/webapp/src/app/api/model/mentionedPerson.ts @@ -1,15 +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 MentionedPerson { - name: string; - is_ude?: boolean; - person_id?: string | null; + +export interface MentionedPerson { + name: string; + is_ude?: boolean; + person_id?: string | null; } + diff --git a/webapp/src/app/api/model/meta.ts b/webapp/src/app/api/model/meta.ts index f9f56443..8481062a 100644 --- a/webapp/src/app/api/model/meta.ts +++ b/webapp/src/app/api/model/meta.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 @@ -9,15 +9,17 @@ */ import { CostUsd } from './costUsd'; + /** * Metadata about the query results */ -export interface Meta { - count?: number | null; - db_response_time_ms?: number | null; - page?: number | null; - per_page?: number | null; - next_cursor?: string | null; - groups_count?: number | null; - cost_usd?: CostUsd | null; +export interface Meta { + count?: number | null; + db_response_time_ms?: number | null; + page?: number | null; + per_page?: number | null; + next_cursor?: string | null; + groups_count?: number | null; + cost_usd?: CostUsd | null; } + diff --git a/webapp/src/app/api/model/model2YrMeanCitedness.ts b/webapp/src/app/api/model/model2YrMeanCitedness.ts index d9c3d9df..67ec623c 100644 --- a/webapp/src/app/api/model/model2YrMeanCitedness.ts +++ b/webapp/src/app/api/model/model2YrMeanCitedness.ts @@ -1,11 +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 {} + +export interface Model2YrMeanCitedness { +} + diff --git a/webapp/src/app/api/model/newsPage.ts b/webapp/src/app/api/model/newsPage.ts index bbb74122..da7f26ab 100644 --- a/webapp/src/app/api/model/newsPage.ts +++ b/webapp/src/app/api/model/newsPage.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 @@ -9,9 +9,11 @@ */ import { NewsArticle } from './newsArticle'; -export interface NewsPage { - total: number; - page: number; - page_size: number; - results: Array; + +export interface NewsPage { + total: number; + page: number; + page_size: number; + results: Array; } + diff --git a/webapp/src/app/api/model/openAccess.ts b/webapp/src/app/api/model/openAccess.ts index 40d7b1d0..32a4ddd9 100644 --- a/webapp/src/app/api/model/openAccess.ts +++ b/webapp/src/app/api/model/openAccess.ts @@ -1,19 +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; +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/orgPatentEntry.ts b/webapp/src/app/api/model/orgPatentEntry.ts index 7c4d0ce0..e34f9cfc 100644 --- a/webapp/src/app/api/model/orgPatentEntry.ts +++ b/webapp/src/app/api/model/orgPatentEntry.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 @@ -10,37 +10,39 @@ import { MatchedAuthor } from './matchedAuthor'; import { IpcClassification } from './ipcClassification'; -export interface OrgPatentEntry { - patent_id: string; - source: string; - title?: string | null; - abstract?: string | null; - publication_date?: string | null; - publication_year?: string | null; - application_number?: string | null; - application_date?: string | null; - kind?: string | null; - application_type?: string | null; - number_of_claims?: number | null; - status?: string | null; - inventors?: Array; - assignees?: Array; - ipc?: Array; - ipc_descriptions?: Array; - cpc?: Array; - cpc_descriptions?: Array; - country?: string | null; - institution_id: string; - institution_name?: string | null; - match_type: OrgPatentEntry.MatchTypeEnum; - matched_authors?: Array; + +export interface OrgPatentEntry { + patent_id: string; + source: string; + title?: string | null; + 'abstract'?: string | null; + publication_date?: string | null; + publication_year?: string | null; + application_number?: string | null; + application_date?: string | null; + kind?: string | null; + application_type?: string | null; + number_of_claims?: number | null; + status?: string | null; + inventors?: Array; + assignees?: Array; + ipc?: Array; + ipc_descriptions?: Array; + cpc?: Array; + cpc_descriptions?: Array; + country?: string | null; + institution_id: string; + institution_name?: string | null; + match_type: OrgPatentEntry.MatchTypeEnum; + matched_authors?: Array; } export namespace OrgPatentEntry { - export const MatchTypeEnum = { - Institution: 'institution', - Name: 'name', - Both: 'both', - } as const; - export type MatchTypeEnum = - (typeof MatchTypeEnum)[keyof typeof MatchTypeEnum]; + export const MatchTypeEnum = { + Institution: 'institution', + Name: 'name', + Both: 'both' + } as const; + export type MatchTypeEnum = typeof MatchTypeEnum[keyof typeof MatchTypeEnum]; } + + diff --git a/webapp/src/app/api/model/orgPatentsResponse.ts b/webapp/src/app/api/model/orgPatentsResponse.ts index 68b2be7a..96697088 100644 --- a/webapp/src/app/api/model/orgPatentsResponse.ts +++ b/webapp/src/app/api/model/orgPatentsResponse.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 @@ -9,11 +9,13 @@ */ import { OrgPatentEntry } from './orgPatentEntry'; -export interface OrgPatentsResponse { - institution_id: string; - institution_name?: string | null; - patent_count: number; - page?: number; - size?: number; - patents: Array; + +export interface OrgPatentsResponse { + institution_id: string; + institution_name?: string | null; + patent_count: number; + page?: number; + size?: number; + patents: Array; } + diff --git a/webapp/src/app/api/model/patentsByAuthorResponse.ts b/webapp/src/app/api/model/patentsByAuthorResponse.ts index ed970c7a..eca819ed 100644 --- a/webapp/src/app/api/model/patentsByAuthorResponse.ts +++ b/webapp/src/app/api/model/patentsByAuthorResponse.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 @@ -9,9 +9,11 @@ */ import { PatentEntry } from './patentEntry'; -export interface PatentsByAuthorResponse { - author_id: string; - author_name?: string | null; - patent_count: number; - patents: Array; + +export interface PatentsByAuthorResponse { + author_id: string; + author_name?: string | null; + patent_count: number; + patents: Array; } + diff --git a/webapp/src/app/api/model/patentsByInstitutionResponse.ts b/webapp/src/app/api/model/patentsByInstitutionResponse.ts index 9ecec0b8..b167c48b 100644 --- a/webapp/src/app/api/model/patentsByInstitutionResponse.ts +++ b/webapp/src/app/api/model/patentsByInstitutionResponse.ts @@ -1,8 +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 { PatentEntry } from './patentEntry'; -export interface PatentsByInstitutionResponse { - institution_id: string; - institution_name?: string | null; - patent_count: number; - patents: Array; + +export interface PatentsByInstitutionResponse { + institution_id: string; + institution_name?: string | null; + patent_count: number; + patents: Array; } + diff --git a/webapp/src/app/api/model/personBio.ts b/webapp/src/app/api/model/personBio.ts index b060c9a9..f7291e6f 100644 --- a/webapp/src/app/api/model/personBio.ts +++ b/webapp/src/app/api/model/personBio.ts @@ -1,16 +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; + +export interface PersonBio { + /** + * The generated biography. + */ + bio: string; } + diff --git a/webapp/src/app/api/model/projectType.ts b/webapp/src/app/api/model/projectType.ts index 08df30c4..a01a743c 100644 --- a/webapp/src/app/api/model/projectType.ts +++ b/webapp/src/app/api/model/projectType.ts @@ -1,16 +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 ProjectType = { - Bund: 'bund', - Eu: 'eu', - Dfg: 'dfg', + Bund: 'bund', + Eu: 'eu', + Dfg: 'dfg' } as const; -export type ProjectType = (typeof ProjectType)[keyof typeof ProjectType]; +export type ProjectType = typeof ProjectType[keyof typeof ProjectType]; + diff --git a/webapp/src/app/api/model/projectsFilteringProperties.ts b/webapp/src/app/api/model/projectsFilteringProperties.ts index c0cebe63..7ce7cfc2 100644 --- a/webapp/src/app/api/model/projectsFilteringProperties.ts +++ b/webapp/src/app/api/model/projectsFilteringProperties.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,28 +11,32 @@ import { SortDirection } from './sortDirection'; import { ProjectsSortBy } from './projectsSortBy'; import { ProjectType } from './projectType'; -export interface ProjectsFilteringProperties { - /** - * The type of projects to filter by. - */ - project_type: ProjectType; - /** - * The page number for pagination. - */ - page: number; - /** - * The page size for pagination. - */ - size: number; - raw_oa_institution_id?: string | null; - query?: string | null; - /** - * The field to sort by. - */ - sort_by?: ProjectsSortBy; - /** - * The sort direction (asc or desc). - */ - sort_direction?: SortDirection; + +export interface ProjectsFilteringProperties { + /** + * The type of projects to filter by. + */ + project_type: ProjectType; + /** + * The page number for pagination. + */ + page: number; + /** + * The page size for pagination. + */ + size: number; + raw_oa_institution_id?: string | null; + query?: string | null; + /** + * The field to sort by. + */ + sort_by?: ProjectsSortBy; + /** + * The sort direction (asc or desc). + */ + sort_direction?: SortDirection; } -export namespace ProjectsFilteringProperties {} +export namespace ProjectsFilteringProperties { +} + + diff --git a/webapp/src/app/api/model/projectsSortBy.ts b/webapp/src/app/api/model/projectsSortBy.ts index 26400b22..79824096 100644 --- a/webapp/src/app/api/model/projectsSortBy.ts +++ b/webapp/src/app/api/model/projectsSortBy.ts @@ -1,18 +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. */ + export const ProjectsSortBy = { - Title: 'title', - FundingStart: 'funding_start', - FundingEnd: 'funding_end', - FundingAmount: 'funding_amount', + Title: 'title', + FundingStart: 'funding_start', + FundingEnd: 'funding_end', + FundingAmount: 'funding_amount' } as const; -export type ProjectsSortBy = - (typeof ProjectsSortBy)[keyof typeof ProjectsSortBy]; +export type ProjectsSortBy = typeof ProjectsSortBy[keyof typeof ProjectsSortBy]; + diff --git a/webapp/src/app/api/model/publicationDetailByFunder.ts b/webapp/src/app/api/model/publicationDetailByFunder.ts index 0fd6b7c5..123ded7e 100644 --- a/webapp/src/app/api/model/publicationDetailByFunder.ts +++ b/webapp/src/app/api/model/publicationDetailByFunder.ts @@ -1,43 +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. */ -export interface PublicationDetailByFunder { - id: string; - title: string; - abstract?: string | null; - doi?: string | null; - publication_year?: number | null; - publication_date?: string | null; - publication_type?: string | null; - language?: string | null; - publication_url?: string | null; - pdf_url?: string | null; - source_name?: string | null; - source_type?: string | null; - is_open_access?: boolean | null; - open_access_status?: string | null; - has_fulltext?: boolean | null; - license?: string | null; - cited_by_count?: number | null; - is_retracted?: boolean | null; - primary_topic?: string | null; - topic_field?: string | null; - topic_subfield?: string | null; - topic_domain?: string | null; - author_position?: string | null; - authors?: Array; - funder_names?: Array; - institutions?: Array; - countries?: Array; - topics?: Array; - keywords?: Array; - grant_labels?: Array; - counts_by_year?: Array; + +export interface PublicationDetailByFunder { + id: string; + title: string; + 'abstract'?: string | null; + doi?: string | null; + publication_year?: number | null; + publication_date?: string | null; + publication_type?: string | null; + language?: string | null; + publication_url?: string | null; + pdf_url?: string | null; + source_name?: string | null; + source_type?: string | null; + is_open_access?: boolean | null; + open_access_status?: string | null; + has_fulltext?: boolean | null; + license?: string | null; + cited_by_count?: number | null; + is_retracted?: boolean | null; + primary_topic?: string | null; + topic_field?: string | null; + topic_subfield?: string | null; + topic_domain?: string | null; + author_position?: string | null; + authors?: Array; + funder_names?: Array; + institutions?: Array; + countries?: Array; + topics?: Array; + keywords?: Array; + grant_labels?: Array; + counts_by_year?: Array; } + diff --git a/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts b/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts index d549f8ed..c35050ef 100644 --- a/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts +++ b/webapp/src/app/api/model/publicationIdsByAuthorPosition.ts @@ -1,16 +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; + +export interface PublicationIdsByAuthorPosition { + first?: Array; + middle?: Array; + last?: Array; + unknown?: Array; } + diff --git a/webapp/src/app/api/model/publicationsByAuthorResponse.ts b/webapp/src/app/api/model/publicationsByAuthorResponse.ts index 35333880..5176fe39 100644 --- a/webapp/src/app/api/model/publicationsByAuthorResponse.ts +++ b/webapp/src/app/api/model/publicationsByAuthorResponse.ts @@ -1,19 +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; + +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/rankingResponse.ts b/webapp/src/app/api/model/rankingResponse.ts index 5be090a2..099ec660 100644 --- a/webapp/src/app/api/model/rankingResponse.ts +++ b/webapp/src/app/api/model/rankingResponse.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 @@ -10,7 +10,9 @@ import { UniversityRanking } from './universityRanking'; import { UniversityTopicData } from './universityTopicData'; -export interface RankingResponse { - timeseries: Array; - rankings: Array; + +export interface RankingResponse { + timeseries: Array; + rankings: Array; } + diff --git a/webapp/src/app/api/model/score.ts b/webapp/src/app/api/model/score.ts index 5b0b5935..fac39735 100644 --- a/webapp/src/app/api/model/score.ts +++ b/webapp/src/app/api/model/score.ts @@ -1,11 +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 Score {} + +export interface Score { +} + diff --git a/webapp/src/app/api/model/sortDirection.ts b/webapp/src/app/api/model/sortDirection.ts index 49933995..4f9362f2 100644 --- a/webapp/src/app/api/model/sortDirection.ts +++ b/webapp/src/app/api/model/sortDirection.ts @@ -1,15 +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 const SortDirection = { - Asc: 'asc', - Desc: 'desc', + Asc: 'asc', + Desc: 'desc' } as const; -export type SortDirection = (typeof SortDirection)[keyof typeof SortDirection]; +export type SortDirection = typeof SortDirection[keyof typeof SortDirection]; + diff --git a/webapp/src/app/api/model/topic.ts b/webapp/src/app/api/model/topic.ts index eaac16f6..9fc0ee63 100644 --- a/webapp/src/app/api/model/topic.ts +++ b/webapp/src/app/api/model/topic.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 @@ -12,21 +12,23 @@ import { TopicIds } from './topicIds'; import { TopicSubfield } from './topicSubfield'; import { TopicField } from './topicField'; + /** * A research topic automatically assigned to works */ -export interface Topic { - id?: string | null; - display_name?: string | null; - description?: string | null; - keywords?: Array | null; - subfield?: TopicSubfield | null; - field?: TopicField | null; - domain?: TopicDomain | null; - works_count?: number | null; - cited_by_count?: number | null; - ids?: TopicIds | null; - works_api_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Topic { + id?: string | null; + display_name?: string | null; + description?: string | null; + keywords?: Array | null; + subfield?: TopicSubfield | null; + field?: TopicField | null; + domain?: TopicDomain | null; + works_count?: number | null; + cited_by_count?: number | null; + ids?: TopicIds | null; + works_api_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/topicCount.ts b/webapp/src/app/api/model/topicCount.ts index 1d2abe90..b929a51d 100644 --- a/webapp/src/app/api/model/topicCount.ts +++ b/webapp/src/app/api/model/topicCount.ts @@ -1,31 +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. */ -export interface TopicCount { - id?: string | null; - /** - * The topic display name. - */ - name: string; - /** - * The number of occurrences. - */ - count?: number; - description?: string | null; - subfield_id?: string | null; - subfield_name?: string | null; - subfield_description?: string | null; - field_id?: string | null; - field_name?: string | null; - field_description?: string | null; - domain_id?: string | null; - domain_name?: string | null; - domain_description?: string | null; + +export interface TopicCount { + id?: string | null; + /** + * The topic display name. + */ + name: string; + /** + * The number of occurrences. + */ + count?: number; + description?: string | null; + subfield_id?: string | null; + subfield_name?: string | null; + subfield_description?: string | null; + field_id?: string | null; + field_name?: string | null; + field_description?: string | null; + domain_id?: string | null; + domain_name?: string | null; + domain_description?: string | null; } + diff --git a/webapp/src/app/api/model/topicDomain.ts b/webapp/src/app/api/model/topicDomain.ts index 573bef0d..652b1bca 100644 --- a/webapp/src/app/api/model/topicDomain.ts +++ b/webapp/src/app/api/model/topicDomain.ts @@ -1,17 +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 domain (highest level) containing this topic: */ -export interface TopicDomain { - id?: string | null; - display_name?: string | null; +export interface TopicDomain { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/topicField.ts b/webapp/src/app/api/model/topicField.ts index cd7d08c8..c7351675 100644 --- a/webapp/src/app/api/model/topicField.ts +++ b/webapp/src/app/api/model/topicField.ts @@ -1,17 +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 field (second level) containing this topic: */ -export interface TopicField { - id?: string | null; - display_name?: string | null; +export interface TopicField { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/topicIds.ts b/webapp/src/app/api/model/topicIds.ts index 22ca3343..4aa6738f 100644 --- a/webapp/src/app/api/model/topicIds.ts +++ b/webapp/src/app/api/model/topicIds.ts @@ -1,17 +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. */ + /** * External identifiers: */ -export interface TopicIds { - openalex?: string | null; - wikipedia?: string | null; +export interface TopicIds { + openalex?: string | null; + wikipedia?: string | null; } + diff --git a/webapp/src/app/api/model/topicSubfield.ts b/webapp/src/app/api/model/topicSubfield.ts index 79f3c9c7..53d37842 100644 --- a/webapp/src/app/api/model/topicSubfield.ts +++ b/webapp/src/app/api/model/topicSubfield.ts @@ -1,17 +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 subfield (third level) containing this topic: */ -export interface TopicSubfield { - id?: string | null; - display_name?: string | null; +export interface TopicSubfield { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/topics.ts b/webapp/src/app/api/model/topics.ts index cf40ff1d..44f0eb98 100644 --- a/webapp/src/app/api/model/topics.ts +++ b/webapp/src/app/api/model/topics.ts @@ -1,11 +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 Topics {} + +export interface Topics { +} + diff --git a/webapp/src/app/api/model/topicsByTime.ts b/webapp/src/app/api/model/topicsByTime.ts index 007dc43d..8af7c9bb 100644 --- a/webapp/src/app/api/model/topicsByTime.ts +++ b/webapp/src/app/api/model/topicsByTime.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 @@ -9,25 +9,27 @@ */ import { TopicsByYear } from './topicsByYear'; -export interface TopicsByTime { - /** - * Topics grouped by year. - */ - elements?: Array; - /** - * The number of years. - */ - total?: number; - /** - * True if the timeline contains only a limited subset of the author\'s publications. - */ - is_limited?: boolean; - /** - * The number of publications used to build the timeline. - */ - used_publications?: number; - /** - * The total number of publications found for this author. - */ - total_publications?: number; + +export interface TopicsByTime { + /** + * Topics grouped by year. + */ + elements?: Array; + /** + * The number of years. + */ + total?: number; + /** + * True if the timeline contains only a limited subset of the author\'s publications. + */ + is_limited?: boolean; + /** + * The number of publications used to build the timeline. + */ + used_publications?: number; + /** + * The total number of publications found for this author. + */ + total_publications?: number; } + diff --git a/webapp/src/app/api/model/topicsByYear.ts b/webapp/src/app/api/model/topicsByYear.ts index bb2f1820..fded8da0 100644 --- a/webapp/src/app/api/model/topicsByYear.ts +++ b/webapp/src/app/api/model/topicsByYear.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 @@ -9,21 +9,23 @@ */ 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; + +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/api/model/topicsListResponse.ts b/webapp/src/app/api/model/topicsListResponse.ts index 058b45fd..43f21226 100644 --- a/webapp/src/app/api/model/topicsListResponse.ts +++ b/webapp/src/app/api/model/topicsListResponse.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,11 +11,13 @@ import { Meta } from './meta'; import { GroupByResult } from './groupByResult'; import { Topic } from './topic'; + /** * TopicsListResponse */ -export interface TopicsListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +export interface TopicsListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; } + diff --git a/webapp/src/app/api/model/universityRanking.ts b/webapp/src/app/api/model/universityRanking.ts index 5c9d0d05..3099e73e 100644 --- a/webapp/src/app/api/model/universityRanking.ts +++ b/webapp/src/app/api/model/universityRanking.ts @@ -1,27 +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. */ -export interface UniversityRanking { - rank: number; - university: string; - publications: number; - citations: number; - growth_rate: number; - trend: UniversityRanking.TrendEnum; - is_top_mover: boolean; + +export interface UniversityRanking { + rank: number; + university: string; + publications: number; + citations: number; + growth_rate: number; + trend: UniversityRanking.TrendEnum; + is_top_mover: boolean; } export namespace UniversityRanking { - export const TrendEnum = { - Up: 'up', - Down: 'down', - Stable: 'stable', - } as const; - export type TrendEnum = (typeof TrendEnum)[keyof typeof TrendEnum]; + export const TrendEnum = { + Up: 'up', + Down: 'down', + Stable: 'stable' + } as const; + export type TrendEnum = typeof TrendEnum[keyof typeof TrendEnum]; } + + diff --git a/webapp/src/app/api/model/universityTopicData.ts b/webapp/src/app/api/model/universityTopicData.ts index f5436445..fc517b7c 100644 --- a/webapp/src/app/api/model/universityTopicData.ts +++ b/webapp/src/app/api/model/universityTopicData.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 @@ -9,17 +9,20 @@ */ import { YearlyData } from './yearlyData'; -export interface UniversityTopicData { - university: string; - topic: UniversityTopicData.TopicEnum; - yearly_data: Array; + +export interface UniversityTopicData { + university: string; + topic: UniversityTopicData.TopicEnum; + yearly_data: Array; } export namespace UniversityTopicData { - export const TopicEnum = { - ArtificialIntelligence: 'Artificial Intelligence', - QuantumComputing: 'Quantum Computing', - RenewableEnergy: 'Renewable Energy', - Biotechnology: 'Biotechnology', - } as const; - export type TopicEnum = (typeof TopicEnum)[keyof typeof TopicEnum]; + export const TopicEnum = { + ArtificialIntelligence: 'Artificial Intelligence', + QuantumComputing: 'Quantum Computing', + RenewableEnergy: 'Renewable Energy', + Biotechnology: 'Biotechnology' + } as const; + export type TopicEnum = typeof TopicEnum[keyof typeof TopicEnum]; } + + diff --git a/webapp/src/app/api/model/user.ts b/webapp/src/app/api/model/user.ts index 7e82821c..def604e1 100644 --- a/webapp/src/app/api/model/user.ts +++ b/webapp/src/app/api/model/user.ts @@ -1,43 +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. */ + /** - * An entry in the user configuration file. + * An entry in the user configuration file. */ -export interface User { - /** - * The username of the user. - */ - username: string; - /** - * The password of the user. - */ - password: string; - /** - * The email of the user. - */ - email: string; - /** - * The account id of the user. - */ - account: number; - /** - * The organization id of the user. - */ - organization: number; - /** - * The organization name of the user. - */ - organization_name: string; - /** - * Indicates whether the user is a superadmin. - */ - superadmin?: boolean; +export interface User { + /** + * The username of the user. + */ + username: string; + /** + * The password of the user. + */ + password: string; + /** + * The email of the user. + */ + email: string; + /** + * The account id of the user. + */ + account: number; + /** + * The organization id of the user. + */ + organization: number; + /** + * The organization name of the user. + */ + organization_name: string; + /** + * Indicates whether the user is a superadmin. + */ + superadmin?: boolean; } + diff --git a/webapp/src/app/api/model/validationError.ts b/webapp/src/app/api/model/validationError.ts index 18cd1b61..bdbd57ad 100644 --- a/webapp/src/app/api/model/validationError.ts +++ b/webapp/src/app/api/model/validationError.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 @@ -9,8 +9,10 @@ */ import { ValidationErrorLocInner } from './validationErrorLocInner'; -export interface ValidationError { - loc: Array; - msg: string; - type: string; + +export interface ValidationError { + loc: Array; + msg: string; + type: string; } + diff --git a/webapp/src/app/api/model/validationErrorLocInner.ts b/webapp/src/app/api/model/validationErrorLocInner.ts index 3c1ffa29..d248a9b7 100644 --- a/webapp/src/app/api/model/validationErrorLocInner.ts +++ b/webapp/src/app/api/model/validationErrorLocInner.ts @@ -1,11 +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 {} + +export interface ValidationErrorLocInner { +} + diff --git a/webapp/src/app/api/model/value.ts b/webapp/src/app/api/model/value.ts index 016b21cb..a9fc79ba 100644 --- a/webapp/src/app/api/model/value.ts +++ b/webapp/src/app/api/model/value.ts @@ -1,11 +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 Value {} + +export interface Value { +} + diff --git a/webapp/src/app/api/model/work.ts b/webapp/src/app/api/model/work.ts index 6c6ae99b..07d94a1c 100644 --- a/webapp/src/app/api/model/work.ts +++ b/webapp/src/app/api/model/work.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 @@ -24,46 +24,48 @@ import { WorkHasContent } from './workHasContent'; import { Location } from './location'; import { WorkBiblio } from './workBiblio'; + /** * A scholarly document (article, book, dataset, thesis, etc.) */ -export interface Work { - id?: string | null; - doi?: string | null; - title?: string | null; - display_name?: string | null; - publication_year?: number | null; - publication_date?: string | null; - type?: string | null; - language?: string | null; - cited_by_count?: number | null; - is_retracted?: boolean | null; - is_paratext?: boolean | null; - primary_location?: Location | null; - locations?: Array | null; - best_oa_location?: Location | null; - open_access?: OpenAccess | null; - authorships?: Array | null; - ids?: WorkIds | null; - biblio?: WorkBiblio | null; - abstract_inverted_index?: object | null; - referenced_works?: Array | null; - referenced_works_count?: number | null; - related_works?: Array | null; - topics?: Array | null; - primary_topic?: WorkTopic | null; - keywords?: Array | null; - funders?: Array | null; - awards?: Array | null; - fwci?: Fwci | null; - citation_normalized_percentile?: WorkCitationNormalizedPercentile | null; - cited_by_percentile_year?: WorkCitedByPercentileYear | null; - counts_by_year?: Array | null; - sustainable_development_goals?: Array | null; - mesh?: Array | null; - indexed_in?: Array | null; - has_content?: WorkHasContent | null; - content_url?: string | null; - created_date?: string | null; - updated_date?: string | null; +export interface Work { + id?: string | null; + doi?: string | null; + title?: string | null; + display_name?: string | null; + publication_year?: number | null; + publication_date?: string | null; + type?: string | null; + language?: string | null; + cited_by_count?: number | null; + is_retracted?: boolean | null; + is_paratext?: boolean | null; + primary_location?: Location | null; + locations?: Array | null; + best_oa_location?: Location | null; + open_access?: OpenAccess | null; + authorships?: Array | null; + ids?: WorkIds | null; + biblio?: WorkBiblio | null; + abstract_inverted_index?: object | null; + referenced_works?: Array | null; + referenced_works_count?: number | null; + related_works?: Array | null; + topics?: Array | null; + primary_topic?: WorkTopic | null; + keywords?: Array | null; + funders?: Array | null; + awards?: Array | null; + fwci?: Fwci | null; + citation_normalized_percentile?: WorkCitationNormalizedPercentile | null; + cited_by_percentile_year?: WorkCitedByPercentileYear | null; + counts_by_year?: Array | null; + sustainable_development_goals?: Array | null; + mesh?: Array | null; + indexed_in?: Array | null; + has_content?: WorkHasContent | null; + content_url?: string | null; + created_date?: string | null; + updated_date?: string | null; } + diff --git a/webapp/src/app/api/model/workBiblio.ts b/webapp/src/app/api/model/workBiblio.ts index 65c0a34b..f6d7079b 100644 --- a/webapp/src/app/api/model/workBiblio.ts +++ b/webapp/src/app/api/model/workBiblio.ts @@ -1,19 +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; +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/workCitationNormalizedPercentile.ts b/webapp/src/app/api/model/workCitationNormalizedPercentile.ts index 4a2bc6d4..a587ddf6 100644 --- a/webapp/src/app/api/model/workCitationNormalizedPercentile.ts +++ b/webapp/src/app/api/model/workCitationNormalizedPercentile.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 @@ -9,11 +9,13 @@ */ 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; +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/workCitedByPercentileYear.ts b/webapp/src/app/api/model/workCitedByPercentileYear.ts index 7bcd3c85..5257eb3b 100644 --- a/webapp/src/app/api/model/workCitedByPercentileYear.ts +++ b/webapp/src/app/api/model/workCitedByPercentileYear.ts @@ -1,17 +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; +export interface WorkCitedByPercentileYear { + min?: number | null; + max?: number | null; } + diff --git a/webapp/src/app/api/model/workCountsByYearInner.ts b/webapp/src/app/api/model/workCountsByYearInner.ts index 496a11db..76d97d77 100644 --- a/webapp/src/app/api/model/workCountsByYearInner.ts +++ b/webapp/src/app/api/model/workCountsByYearInner.ts @@ -1,17 +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; +export interface WorkCountsByYearInner { + year?: number | null; + cited_by_count?: number | null; } + diff --git a/webapp/src/app/api/model/workHasContent.ts b/webapp/src/app/api/model/workHasContent.ts index 76871238..44fbe446 100644 --- a/webapp/src/app/api/model/workHasContent.ts +++ b/webapp/src/app/api/model/workHasContent.ts @@ -1,17 +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; +export interface WorkHasContent { + pdf?: boolean | null; + grobid_xml?: boolean | null; } + diff --git a/webapp/src/app/api/model/workIds.ts b/webapp/src/app/api/model/workIds.ts index fe562e40..e8315250 100644 --- a/webapp/src/app/api/model/workIds.ts +++ b/webapp/src/app/api/model/workIds.ts @@ -1,20 +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; +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/workKeyword.ts b/webapp/src/app/api/model/workKeyword.ts index 7270db25..c9c99afb 100644 --- a/webapp/src/app/api/model/workKeyword.ts +++ b/webapp/src/app/api/model/workKeyword.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 @@ -9,11 +9,13 @@ */ import { Score } from './score'; + /** * WorkKeyword */ -export interface WorkKeyword { - id?: string | null; - display_name?: string | null; - score?: Score | null; +export interface WorkKeyword { + id?: string | null; + display_name?: string | null; + score?: Score | null; } + diff --git a/webapp/src/app/api/model/workMeshInner.ts b/webapp/src/app/api/model/workMeshInner.ts index 36a0c569..40633524 100644 --- a/webapp/src/app/api/model/workMeshInner.ts +++ b/webapp/src/app/api/model/workMeshInner.ts @@ -1,20 +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; +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/workNetworkNode.ts b/webapp/src/app/api/model/workNetworkNode.ts index 445cd8ad..abc04a69 100644 --- a/webapp/src/app/api/model/workNetworkNode.ts +++ b/webapp/src/app/api/model/workNetworkNode.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 @@ -10,20 +10,24 @@ import { WorkTopicInformation } from './workTopicInformation'; import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType'; -export interface WorkNetworkNode { - /** - * 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; - publication_year: number | null; - work_topics_information: Set | null; + +export interface WorkNetworkNode { + /** + * 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; + publication_year: number | null; + work_topics_information: Set | null; } -export namespace WorkNetworkNode {} +export namespace WorkNetworkNode { +} + + diff --git a/webapp/src/app/api/model/workPage.ts b/webapp/src/app/api/model/workPage.ts index 285d2065..8490c3ab 100644 --- a/webapp/src/app/api/model/workPage.ts +++ b/webapp/src/app/api/model/workPage.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 @@ -9,25 +9,27 @@ */ 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; + +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/workSustainableDevelopmentGoalsInner.ts b/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts index 8bc67292..c9ecd00f 100644 --- a/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts +++ b/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.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 @@ -9,11 +9,13 @@ */ import { Score } from './score'; + /** * WorkSustainableDevelopmentGoalsInner */ -export interface WorkSustainableDevelopmentGoalsInner { - id?: string | null; - display_name?: string | null; - score?: Score | null; +export interface WorkSustainableDevelopmentGoalsInner { + id?: string | null; + display_name?: string | null; + score?: Score | null; } + diff --git a/webapp/src/app/api/model/workTopic.ts b/webapp/src/app/api/model/workTopic.ts index 4b326824..925ead4f 100644 --- a/webapp/src/app/api/model/workTopic.ts +++ b/webapp/src/app/api/model/workTopic.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 @@ -12,14 +12,16 @@ import { WorkTopicDomain } from './workTopicDomain'; import { WorkTopicSubfield } from './workTopicSubfield'; import { WorkTopicField } from './workTopicField'; + /** * WorkTopic */ -export interface WorkTopic { - id?: string | null; - display_name?: string | null; - score?: Score | null; - subfield?: WorkTopicSubfield | null; - field?: WorkTopicField | null; - domain?: WorkTopicDomain | null; +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/workTopicDomain.ts b/webapp/src/app/api/model/workTopicDomain.ts index 13b227df..1a9879d4 100644 --- a/webapp/src/app/api/model/workTopicDomain.ts +++ b/webapp/src/app/api/model/workTopicDomain.ts @@ -1,17 +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; +export interface WorkTopicDomain { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/workTopicField.ts b/webapp/src/app/api/model/workTopicField.ts index 432b993e..1807cfc1 100644 --- a/webapp/src/app/api/model/workTopicField.ts +++ b/webapp/src/app/api/model/workTopicField.ts @@ -1,17 +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; +export interface WorkTopicField { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/workTopicInformation.ts b/webapp/src/app/api/model/workTopicInformation.ts index 5dbbfc78..ca3b9454 100644 --- a/webapp/src/app/api/model/workTopicInformation.ts +++ b/webapp/src/app/api/model/workTopicInformation.ts @@ -1,20 +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; + +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/workTopicSubfield.ts b/webapp/src/app/api/model/workTopicSubfield.ts index 49c1155b..b6e7278a 100644 --- a/webapp/src/app/api/model/workTopicSubfield.ts +++ b/webapp/src/app/api/model/workTopicSubfield.ts @@ -1,17 +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; +export interface WorkTopicSubfield { + id?: string | null; + display_name?: string | null; } + diff --git a/webapp/src/app/api/model/worksFilterProperties.ts b/webapp/src/app/api/model/worksFilterProperties.ts index fd25fd26..bd6cc9a4 100644 --- a/webapp/src/app/api/model/worksFilterProperties.ts +++ b/webapp/src/app/api/model/worksFilterProperties.ts @@ -1,32 +1,34 @@ /** * 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 WorksFilterProperties { - /** - * The start publication year for the works to include in the collaboration network. - */ - start_year?: number; - /** - * The end publication year for the works to include in the collaboration network. - */ - end_year?: number; - /** - * The list of raw topic IDs to include in the collaboration network. If empty, all topics will be included. - */ - allowed_topics?: Array; - /** - * The minimum number of contributors required for a work to be included in the collaboration network. - */ - min_contributors?: number; - /** - * The maximum number of contributors allowed for a work to be included in the collaboration network. - */ - max_contributors?: number; + +export interface WorksFilterProperties { + /** + * The start publication year for the works to include in the collaboration network. + */ + start_year?: number; + /** + * The end publication year for the works to include in the collaboration network. + */ + end_year?: number; + /** + * The list of raw topic IDs to include in the collaboration network. If empty, all topics will be included. + */ + allowed_topics?: Array; + /** + * The minimum number of contributors required for a work to be included in the collaboration network. + */ + min_contributors?: number; + /** + * The maximum number of contributors allowed for a work to be included in the collaboration network. + */ + max_contributors?: number; } + diff --git a/webapp/src/app/api/model/worksListResponse.ts b/webapp/src/app/api/model/worksListResponse.ts index bc21a41b..a65d3849 100644 --- a/webapp/src/app/api/model/worksListResponse.ts +++ b/webapp/src/app/api/model/worksListResponse.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,11 +11,13 @@ import { Meta } from './meta'; import { Work } from './work'; import { GroupByResult } from './groupByResult'; + /** * WorksListResponse */ -export interface WorksListResponse { - meta?: Meta | null; - results?: Array | null; - group_by?: Array | null; +export interface WorksListResponse { + meta?: Meta | null; + results?: Array | null; + group_by?: Array | null; } + diff --git a/webapp/src/app/api/model/yearlyData.ts b/webapp/src/app/api/model/yearlyData.ts index d473f13e..3272805e 100644 --- a/webapp/src/app/api/model/yearlyData.ts +++ b/webapp/src/app/api/model/yearlyData.ts @@ -1,15 +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 YearlyData { - year: number; - publications: number; - citations: number; + +export interface YearlyData { + year: number; + publications: number; + citations: number; } + diff --git a/webapp/src/app/api/param.ts b/webapp/src/app/api/param.ts index 486c804e..78a2d20a 100644 --- a/webapp/src/app/api/param.ts +++ b/webapp/src/app/api/param.ts @@ -8,7 +8,8 @@ export type StandardParamStyle = | 'simple' | 'spaceDelimited' | 'pipeDelimited' - | 'deepObject'; + | 'deepObject' + ; /** * The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user. @@ -24,12 +25,13 @@ export type ParamLocation = 'query' | 'header' | 'path' | 'cookie'; * Standard types as defined in OpenAPI Specification: Data Types */ export type StandardDataType = - | 'integer' - | 'number' - | 'boolean' - | 'string' - | 'object' - | 'array'; + | "integer" + | "number" + | "boolean" + | "string" + | "object" + | "array" + ; /** * Standard {@link DataType}s plus your own types/classes. @@ -40,15 +42,16 @@ export type DataType = StandardDataType | string; * Standard formats as defined in OpenAPI Specification: Data Types */ export type StandardDataFormat = - | 'int32' - | 'int64' - | 'float' - | 'double' - | 'byte' - | 'binary' - | 'date' - | 'date-time' - | 'password'; + | "int32" + | "int64" + | "float" + | "double" + | "byte" + | "binary" + | "date" + | "date-time" + | "password" + ; export type DataFormat = StandardDataFormat | string; @@ -59,7 +62,7 @@ export interface Param { name: string; value: unknown; in: ParamLocation; - style: ParamStyle; + style: ParamStyle, explode: boolean; dataType: DataType; dataFormat: DataFormat | undefined; diff --git a/webapp/src/app/api/provide-api.ts b/webapp/src/app/api/provide-api.ts index 960132f8..19c762ac 100644 --- a/webapp/src/app/api/provide-api.ts +++ b/webapp/src/app/api/provide-api.ts @@ -1,17 +1,15 @@ -import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core'; +import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core"; import { Configuration, ConfigurationParameters } from './configuration'; import { BASE_PATH } from './variables'; // Returns the service class providers, to be used in the [ApplicationConfig](https://angular.dev/api/core/ApplicationConfig). -export function provideApi( - configOrBasePath: string | ConfigurationParameters, -): EnvironmentProviders { - return makeEnvironmentProviders([ - typeof configOrBasePath === 'string' - ? { provide: BASE_PATH, useValue: configOrBasePath } - : { - provide: Configuration, - useValue: new Configuration({ ...configOrBasePath }), - }, - ]); -} +export function provideApi(configOrBasePath: string | ConfigurationParameters): EnvironmentProviders { + return makeEnvironmentProviders([ + typeof configOrBasePath === "string" + ? { provide: BASE_PATH, useValue: configOrBasePath } + : { + provide: Configuration, + useValue: new Configuration({ ...configOrBasePath }), + }, + ]); +} \ No newline at end of file diff --git a/webapp/src/app/api/variables.ts b/webapp/src/app/api/variables.ts index 2277a9cc..6fe58549 100644 --- a/webapp/src/app/api/variables.ts +++ b/webapp/src/app/api/variables.ts @@ -2,8 +2,8 @@ import { InjectionToken } from '@angular/core'; export const BASE_PATH = new InjectionToken('basePath'); export const COLLECTION_FORMATS = { - csv: ',', - tsv: ' ', - ssv: ' ', - pipes: '|', -}; + 'csv': ',', + 'tsv': ' ', + 'ssv': ' ', + 'pipes': '|' +} -- 2.56.1 From 7e8a7966233b01752cd906b9a26e0cd368ab291c Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 14:06:48 +0200 Subject: [PATCH 30/43] moved getPatentById logic from allPatentsSearchClient to PatentSearchClient --- service/src/main/inse/patents/all/logic.py | 69 ------------- service/src/main/inse/patents/all/service.py | 10 -- .../inse/patents/elastic_search_client.py | 97 ++++++++++++++----- service/src/main/inse/patents/logic.py | 12 ++- service/src/main/inse/patents/service.py | 5 +- 5 files changed, 87 insertions(+), 106 deletions(-) diff --git a/service/src/main/inse/patents/all/logic.py b/service/src/main/inse/patents/all/logic.py index c3e54ed4..f18b6a8d 100644 --- a/service/src/main/inse/patents/all/logic.py +++ b/service/src/main/inse/patents/all/logic.py @@ -18,11 +18,6 @@ from inse.patents.elastic_search_all_patents_client import AllPatentsSearchClien from inse.patents.ipc_search_client import IpcSearchClient from inse.patents.search_client import PatentSearchClient - - -def normalize_patent_date(date_str: str) -> str: - return datetime.strptime(date_str.strip(), "%Y-%m-%d").strftime("%Y%m%d") - async def get_all_patents( page: int = 0, size: int = 10, @@ -88,67 +83,3 @@ async def get_all_patents( size=size, patents=patents, ) - -async def _search_by_id( - client: AllPatentsSearchClient, - patent_id: str, - prefix: str | None = None, - filling_date: str | None = None -) -> list[model.PatentEntry]: - - if prefix == "US": - data = await client.search_uspto(client.uspto_detail_query(patent_id, filling_date=filling_date)) - return parse_uspto_hits(data) - data = await client.search_epo(client.epo_detail_query(patent_id, filling_date=filling_date)) - return parse_epo_hits(data) - - -async def _search_by_title( - client: AllPatentsSearchClient, - title: str, - prefix: str | None = None, - filling_date: str | None = None -) -> list[model.PatentEntry]: - epo_data, uspto_data = await asyncio.gather( - client.search_epo(client.epo_title_query(title, filling_date=filling_date)), - client.search_uspto(client.uspto_title_query(title,filling_date=filling_date)), - ) - return parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) - - -async def get_patent_by_id( - patent_id: str, - title: str | None = None, - prefix: str | None = None, - filling_date: str | None = None, - ipc_client: IpcSearchClient | None = None, -) -> model.PatentEntry: - all_patents_client = AllPatentsSearchClient() - ipc_search_client = ipc_client or IpcSearchClient() - if filling_date: - filling_date = normalize_patent_date(filling_date) - try: - patents = await _search_by_id(all_patents_client, patent_id,prefix=prefix, filling_date=filling_date) - - if not patents: - patents = await _search_by_title(all_patents_client, title,prefix=prefix,filling_date=filling_date) if title else [] - - if not patents: - raise HTTPException( - status_code=HTTP_404_NOT_FOUND, - detail="Patent not found.", - ) - - except MissingApiKeyError as exc: - raise HTTPException( - status_code=HTTP_503_SERVICE_UNAVAILABLE, - detail="Patent search is not configured.", - ) from exc - except httpx.HTTPError as exc: - raise HTTPException( - status_code=HTTP_502_BAD_GATEWAY, - detail="Patent search request failed.", - ) from exc - - await enrich_patents_classifications(patents[:1], ipc_search_client) - return patents[0] \ No newline at end of file diff --git a/service/src/main/inse/patents/all/service.py b/service/src/main/inse/patents/all/service.py index 4716251c..a620c93c 100644 --- a/service/src/main/inse/patents/all/service.py +++ b/service/src/main/inse/patents/all/service.py @@ -33,13 +33,3 @@ async def get_all_patents( year_from=year_from, year_to=year_to, ) - - -@router.get( - "/patents/{patent_id}", - operation_id="getPatentById", - response_model=model.PatentEntry, - summary="Get a single patent by its identifier.", -) -async def get_patent_by_id(patent_id: str, title: str | None = None, prefix: str | None = None, filling_date: str | None = None): - return await logic.get_patent_by_id(patent_id, title=title, prefix=prefix, filling_date=filling_date) \ No newline at end of file diff --git a/service/src/main/inse/patents/elastic_search_client.py b/service/src/main/inse/patents/elastic_search_client.py index 20221efb..4b6d8b02 100644 --- a/service/src/main/inse/patents/elastic_search_client.py +++ b/service/src/main/inse/patents/elastic_search_client.py @@ -6,21 +6,27 @@ from typing import Any from inse.integrations import elasticsearch from inse.model import ESCluster, ESIndex +import httpx import asyncio from .. import config from .name_matching import search_name_variants DEFAULT_SEARCH_SIZE = 100 +def remove_year(patent_number: str) -> str: + """Remove a 4-digit year from the end of a patent number, if present.""" + if len(patent_number) > 4 and patent_number[-4:].isdigit(): + return patent_number[:-4] + return patent_number def _match_name_field(field: str, name: str) -> dict[str, Any]: """Match a name field, including transliterated variants (Müller/Mueller).""" variants = search_name_variants(name) if len(variants) <= 1: - return {"match": {field: variants[0] if variants else name}} + return {"match_phrase": {field: variants[0] if variants else name}} return { "bool": { - "should": [{"match": {field: variant}} for variant in variants], + "should": [{"match_phrase": {field: variant}} for variant in variants], "minimum_should_match": 1, } } @@ -32,9 +38,15 @@ from inse.exceptions import MissingApiKeyError class PatentSearchClient: def __init__( self, + base_url: str | None = None, api_key: str | None = None, + timeout: float = 30.0, + transport: httpx.AsyncBaseTransport | None = None, ): + self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/") self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key + self.timeout = timeout + self.transport = transport def _headers(self) -> dict[str, str]: if not self.api_key: @@ -158,9 +170,11 @@ class PatentSearchClient: } async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]: + print("Searching EPO with payload:", payload) return await self._search(ESIndex.EPO_INDEX, payload) async def search_uspto(self, payload: dict[str, Any]) -> dict[str, Any]: + print("Searching USPTO with payload:", payload) return await self._search(ESIndex.USPTO_INDEX, payload) async def _search(self, index: str, payload: dict[str, Any]) -> dict[str, Any]: @@ -172,9 +186,10 @@ class PatentSearchClient: patent_id: str, prefix: str, title: str, + filling_date: str | None = None, size: int = 1, ) -> dict[str, Any]: - """Search EPO and USPTO by ID; fall back to match_phrase on title if no hits. + """Search EPO and USPTO by ID; fall back to match on title if no hits. Args: patent_id: The raw document/publication number (e.g. "1234567", "US1234567A"). @@ -202,16 +217,28 @@ class PatentSearchClient: return epo_result if epo_hits > 0 else uspto_result if prefix.upper() == "US": - payload = self._uspto_query_by_title(title, size) + payload = self._uspto_query_by_title(title, filling_date, size) return await self.search_uspto(payload) - payload = self._epo_query_by_title(title, size) + payload = self._epo_query_by_title(title,filling_date, size) return await self.search_epo(payload) + #query builders def _epo_query_by_id(self, patent_id: str, size: int) -> dict[str, Any]: """Term query against doc_number; strips a leading 'EP' prefix if present.""" raw_id = patent_id.upper().removeprefix("EP") + query: dict[str, Any] = { + "bool": { + "should": [ + {"term": {"doc_number": raw_id}}, + {"term": {"doc_number": remove_year(raw_id)}}, + {"term": {"application_number": remove_year(raw_id)}}, + {"term": {"application_number": raw_id}}, + ], + "minimum_should_match": 1, + } + } return { "size": size, "_source": [ @@ -220,11 +247,23 @@ class PatentSearchClient: "application_filing_date", "title_en", "title_de", "abstract", "inventors_name", "applicants_name", "ipc", "cpc", ], - "query": {"term": {"doc_number": raw_id}}, + "query": query, } def _uspto_query_by_id(self, patent_id: str, size: int) -> dict[str, Any]: """Term query against publication_number; tries the ID as-is.""" + raw_id = patent_id.upper().removeprefix("US") + query: dict[str, Any] = { + "bool": { + "should": [ + {"term": {"publication_number": raw_id}}, + {"term": {"publication_number": remove_year(raw_id)}}, + {"term": {"application_number": raw_id}}, + {"term": {"application_number": remove_year(raw_id)}}, + ], + "minimum_should_match": 1, + } + } return { "size": size, "track_total_hits": True, @@ -235,11 +274,24 @@ class PatentSearchClient: "application_type", "title", "abstract", "inventors_names", "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", ], - "query": {"term": {"publication_number": patent_id}}, + "query": query, } - def _epo_query_by_title(self, title: str, size: int) -> dict[str, Any]: - """match_phrase fallback on title_en (and title_de as a should clause).""" + def _epo_query_by_title(self, title: str, filling_date: str | None, size: int) -> dict[str, Any]: + """match fallback on title_en (and title_de as a should clause).""" + query: dict[str, Any] = { + "bool": { + "should": [ + {"match_phrase": {"title_en": title}}, + {"match_phrase": {"title_de": title}}, + {"match_phrase": {"title_fr": title}}, + ], + "minimum_should_match": 1, + } + } + if filling_date: + query["bool"]["must"] = [{"term": {"application_filing_date": filling_date}}] + return { "size": size, "_source": [ @@ -248,20 +300,19 @@ class PatentSearchClient: "application_filing_date", "title_en", "title_de", "abstract", "inventors_name", "applicants_name", "ipc", "cpc", ], - "query": { - "bool": { - "should": [ - {"match_phrase": {"title_en": title}}, - {"match_phrase": {"title_de": title}}, - {"match_phrase": {"title_fr": title}}, - ], - "minimum_should_match": 1, - } - }, + "query": query } - def _uspto_query_by_title(self, title: str, size: int) -> dict[str, Any]: - """match_phrase fallback on title.""" + def _uspto_query_by_title(self, title: str, filling_date: str | None, size: int) -> dict[str, Any]: + """match fallback on title.""" + query: dict[str, Any] = { + "bool": { + "should": [{"match_phrase": {"title": title}}], + "minimum_should_match": 1, + } + } + if filling_date: + query["bool"]["must"] = [{"term": {"application_date": filling_date}}] return { "size": size, "_source": [ @@ -270,5 +321,5 @@ class PatentSearchClient: "application_type", "title", "abstract", "inventors_names", "assignees_orgs", "ipcr", "cpc", "number_of_claims", "status", ], - "query": {"match_phrase": {"title": title}}, - } \ No newline at end of file + "query": query, + } diff --git a/service/src/main/inse/patents/logic.py b/service/src/main/inse/patents/logic.py index 434e473f..6d2522c4 100644 --- a/service/src/main/inse/patents/logic.py +++ b/service/src/main/inse/patents/logic.py @@ -1,5 +1,5 @@ """Backward-compatible re-exports.""" -from inse.patents.all.logic import get_all_patents, get_patent_by_id +from inse.patents.all.logic import get_all_patents from inse.patents.authors.logic import get_patents_by_author_id from inse.patents.common.parsing import deduplicate_patents as _deduplicate_patents from inse.patents.institutions.logic import ( @@ -20,22 +20,28 @@ from .elastic_search_all_patents_client import AllPatentsSearchClient from .ipc_search_client import IpcSearchClient from .ipc_lookup import extract_ipc_symbol from .name_matching import name_matches - +from datetime import datetime logger = logging.getLogger(__name__) - +def normalize_patent_date(date_str: str) -> str: + return datetime.strptime(date_str.strip(), "%Y-%m-%d").strftime("%Y%m%d") + async def get_patent( patent_id: str, title: str, prefix: str, + filling_date: str | None = None, client: PatentSearchClient | None = None, ) -> model.PatentEntry: search_client = client or PatentSearchClient() + if filling_date: + filling_date = normalize_patent_date(filling_date) data = await search_client.get_by_id_or_title( patent_id=patent_id, prefix=prefix, title=title, + filling_date=filling_date, ) parse = _parse_uspto_hits if prefix.upper() == "US" else _parse_epo_hits diff --git a/service/src/main/inse/patents/service.py b/service/src/main/inse/patents/service.py index 5c0f2948..39b30968 100644 --- a/service/src/main/inse/patents/service.py +++ b/service/src/main/inse/patents/service.py @@ -40,8 +40,11 @@ async def get_patent_by_identifier( description="Do we want to fallback to title search if ID and DOI dont work?" ), ] = "", + filling_date: Annotated[ + Optional[str], Query(description="Filling date in YYYY-MM-DD format") + ] = "", ) -> model.PatentEntry | None: - return await logic.get_patent(patent_id=identifier, prefix=prefix, title=title) + return await logic.get_patent(patent_id=identifier, prefix=prefix, title=title,filling_date=filling_date) @patents_router.get( -- 2.56.1 From 074e237c84735cbcc6cff7b9ca98fc51db51f3de Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 14:07:37 +0200 Subject: [PATCH 31/43] updated endpoint for patent fetching --- webapp/src/app/modules/patent-detail/patent-detail.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/app/modules/patent-detail/patent-detail.component.ts b/webapp/src/app/modules/patent-detail/patent-detail.component.ts index 891b2965..5052d8db 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.component.ts +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.ts @@ -125,7 +125,7 @@ export class PatentDetailComponent implements OnInit { this.expandedClassificationKeys.clear(); this.patentsService - .getPatentById(patentId, title, prefix, fillingDate) + .getPatentByIdOrTitle(patentId, prefix, title, fillingDate) .pipe(finalize(() => (this.loading = false))) .subscribe({ next: (patent) => { -- 2.56.1 From 7bd8659638b6570966628c7f660146ee42ea4fdc Mon Sep 17 00:00:00 2001 From: genja Date: Wed, 1 Jul 2026 14:08:27 +0200 Subject: [PATCH 32/43] regenerated services --- webapp/src/app/api/.openapi-generator/FILES | 7 + webapp/src/app/api/api/api.ts | 2 + webapp/src/app/api/api/patents.service.ts | 257 ++++ webapp/src/app/api/api/topics.service.ts | 1280 ++++++++++++----- webapp/src/app/api/model/keywordTopicMatch.ts | 15 + .../app/api/model/keywordsTopicsRequest.ts | 16 + .../app/api/model/keywordsTopicsResponse.ts | 17 + webapp/src/app/api/model/models.ts | 8 + 8 files changed, 1225 insertions(+), 377 deletions(-) create mode 100644 webapp/src/app/api/model/keywordTopicMatch.ts create mode 100644 webapp/src/app/api/model/keywordsTopicsRequest.ts create mode 100644 webapp/src/app/api/model/keywordsTopicsResponse.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index c5db7482..baf4dbd8 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -9,6 +9,7 @@ api/companyConnections.service.ts api/funding.service.ts api/iNSEService.service.ts api/institutions.service.ts +api/keywords.service.ts api/news.service.ts api/organization.service.ts api/patents.service.ts @@ -123,8 +124,12 @@ model/institutionNetworkNode.ts model/institutionPage.ts model/institutionsListResponse.ts model/ipcClassification.ts +model/keywordEntry.ts +model/keywordTopicMatch.ts model/keywords.ts model/keywordsRequest.ts +model/keywordsTopicsRequest.ts +model/keywordsTopicsResponse.ts model/latitude.ts model/location.ts model/loginResponse.ts @@ -139,6 +144,8 @@ model/newsArticle.ts model/newsArticleDetail.ts model/newsPage.ts model/openAccess.ts +model/orgPatentEntry.ts +model/orgPatentsResponse.ts model/organizationPage.ts model/patentEntry.ts model/patentsByAuthorResponse.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 562911e2..8ea55e0b 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -27,12 +27,14 @@ import { TopicsService } from './topics.service'; export * from './works.service'; import { WorksService } from './works.service'; export const APIS = [ + AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, KeywordsService, NewsService, + OrganizationService, PatentsService, PersonNetworkService, PersonsService, diff --git a/webapp/src/app/api/api/patents.service.ts b/webapp/src/app/api/api/patents.service.ts index 3eb47897..904279c3 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.service.ts @@ -206,12 +206,158 @@ export class PatentsService extends BaseService { ); } + /** + * Get pre-indexed org patents for an institution. + * @endpoint get /api/inse-service/institutions/{id}/org-patents + * @param id + * @param matchType Filter patents by match type. + * @param page + * @param size + * @param source + * @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 getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getOrgPatentsByInstitution( + id: string, + matchType?: 'institution' | 'name' | 'both' | 'all', + page?: number, + size?: number, + source?: 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 getOrgPatentsByInstitution.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + matchType, + 'match_type', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + page, + 'page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + size, + 'size', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + source, + 'source', + ); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/org-patents`; + 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, + }, + ); + } + /** * Returns one publication by OpenAlex ID or DOI. * @endpoint get /api/inse-service/patents/{identifier} * @param identifier * @param prefix Application Prefix (EP or US) * @param title Do we want to fallback to title search if ID and DOI dont work? + * @param fillingDate Filling date in YYYY-MM-DD format * @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. */ @@ -219,6 +365,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: { @@ -231,6 +378,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: { @@ -243,6 +391,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: { @@ -255,6 +404,7 @@ export class PatentsService extends BaseService { identifier: string, prefix?: string, title?: string, + fillingDate?: string, observe: any = 'body', reportProgress: boolean = false, options?: { @@ -280,6 +430,11 @@ export class PatentsService extends BaseService { title, 'title', ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + fillingDate, + 'filling_date', + ); let localVarHeaders = this.defaultHeaders; @@ -432,4 +587,106 @@ export class PatentsService extends BaseService { }, ); } + + /** + * Get patents matched to an institution by assignee name. + * @endpoint get /api/inse-service/institutions/{id}/patents + * @param 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 getPatentsByInstitution( + id: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getPatentsByInstitution( + id: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getPatentsByInstitution( + id: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getPatentsByInstitution( + id: 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 getPatentsByInstitution.', + ); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } + + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if ( + this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) + ) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`; + 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, + }, + ); + } } diff --git a/webapp/src/app/api/api/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 6f17a01e..5a51e233 100644 --- a/webapp/src/app/api/api/topics.service.ts +++ b/webapp/src/app/api/api/topics.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 @@ -9,428 +9,954 @@ */ /* 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 { AutocompleteResponse } from '../model/autocompleteResponse'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore +import { KeywordsTopicsRequest } from '../model/keywordsTopicsRequest'; +// @ts-ignore +import { KeywordsTopicsResponse } from '../model/keywordsTopicsResponse'; +// @ts-ignore import { TopicsListResponse } from '../model/topicsListResponse'; // @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'; - - @Injectable({ - providedIn: 'root' + providedIn: 'root', }) export class TopicsService extends BaseService { + constructor( + protected httpClient: HttpClient, + @Optional() @Inject(BASE_PATH) basePath: string | string[], + @Optional() configuration?: Configuration, + ) { + super(basePath, configuration); + } - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { - super(basePath, configuration); + /** + * Returns topic options for autocomplete inputs. + * @endpoint get /api/topics/autocomplete + * @param query Topic search text, for example \'machine learning\'. + * @param domainId Optional OpenAlex domain id filter. + * @param fieldId Optional OpenAlex field id filter. + * @param subfieldId Optional OpenAlex subfield id filter. + * @param limit Maximum number of autocomplete options. + * @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 autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public autocompleteTopics( + query: string, + domainId?: string, + fieldId?: string, + subfieldId?: string, + limit?: number, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (query === null || query === undefined) { + throw new Error( + 'Required parameter query was null or undefined when calling autocompleteTopics.', + ); } - /** - * Returns topic options for autocomplete inputs. - * @endpoint get /api/topics/autocomplete - * @param query Topic search text, for example \'machine learning\'. - * @param domainId Optional OpenAlex domain id filter. - * @param fieldId Optional OpenAlex field id filter. - * @param subfieldId Optional OpenAlex subfield id filter. - * @param limit Maximum number of autocomplete options. - * @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 autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (query === null || query === undefined) { - throw new Error('Required parameter query was null or undefined when calling autocompleteTopics.'); - } + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + query, + 'query', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + domainId, + 'domainId', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + fieldId, + 'fieldId', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + subfieldId, + 'subfieldId', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + limit, + 'limit', + ); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - query, 'query'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - domainId, 'domainId'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - fieldId, 'fieldId'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - subfieldId, 'subfieldId'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - limit, 'limit'); + let localVarHeaders = this.defaultHeaders; - let localVarHeaders = this.defaultHeaders; + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); + } - 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 localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + const localVarTransferCache: boolean = options?.transferCache ?? true; - 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/topics/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, + }, + ); + } - 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'; - } - } + /** + * 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 localVarPath = `/api/topics/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 - } + 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', ); + }); } - /** - * 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 localVarHeaders = this.defaultHeaders; - 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 - } - ); + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); } - /** - * 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.'); - } + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - element, 'topic'); - }) - } + const localVarTransferCache: boolean = options?.transferCache ?? true; - 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 - } - ); + 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'; + } } - /** - * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). - * @endpoint get /api/inse-service/topics/hierarchy - * @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 getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + 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, + }, + ); + } - let localVarHeaders = this.defaultHeaders; + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * @endpoint get /api/inse-service/topics/hierarchy + * @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 getTopicHierarchy( + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public getTopicHierarchy( + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getTopicHierarchy( + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public getTopicHierarchy( + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + 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/hierarchy`; - 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 - } - ); + const localVarHttpHeaderAcceptSelected: string | undefined = + options?.httpHeaderAccept ?? + this.configuration.selectHeaderAccept(['application/json']); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set( + 'Accept', + localVarHttpHeaderAcceptSelected, + ); } - /** - * Returns a list of OpenAlex topics. - * @endpoint get /api/topics - * @param search Full-text search, for example \'machine learning\'. - * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. - * @param sort Sort field, for example \'works_count:desc\'. - * @param groupBy OpenAlex group_by field, for example \'domain.id\'. - * @param perPage Results per page. - * @param page Page number. Use cursor for deep pagination. - * @param cursor Cursor pagination token. Use \'*\' to start. - * @param sample Random sample size. Cannot be combined with sort or page. - * @param select Comma-separated fields to return. - * @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 listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + const localVarHttpContext: HttpContext = + options?.context ?? new HttpContext(); - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - search, 'search'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - filter, 'filter'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sort, 'sort'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - groupBy, 'group_by'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - perPage, 'per_page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - page, 'page'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - cursor, 'cursor'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - sample, 'sample'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - select, 'select'); + const localVarTransferCache: boolean = options?.transferCache ?? true; - 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/topics`; - 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 - } - ); + 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'; + } } - /** - * Semantic / vector search for topics using a keyword/sentence. - * @endpoint get /api/topics/vector-search - * @param query Word or sentence to search by similarity. - * @param limit Maximum number of topics to return. - * @param searchType Search approach: \'hybrid\' or \'semantic\'. - * @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 vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public vectorSearchTopics(query: string, limit?: number, searchType?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (query === null || query === undefined) { - throw new Error('Required parameter query was null or undefined when calling vectorSearchTopics.'); - } + let localVarPath = `/api/inse-service/topics/hierarchy`; + 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, + }, + ); + } - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - query, 'query'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - limit, 'limit'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - searchType, 'searchType'); + /** + * Returns a list of OpenAlex topics. + * @endpoint get /api/topics + * @param search Full-text search, for example \'machine learning\'. + * @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'. + * @param sort Sort field, for example \'works_count:desc\'. + * @param groupBy OpenAlex group_by field, for example \'domain.id\'. + * @param perPage Results per page. + * @param page Page number. Use cursor for deep pagination. + * @param cursor Cursor pagination token. Use \'*\' to start. + * @param sample Random sample size. Cannot be combined with sort or page. + * @param select Comma-separated fields to return. + * @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 listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public listTopics( + search?: string, + filter?: string, + sort?: string, + groupBy?: string, + perPage?: number, + page?: number, + cursor?: string, + sample?: number, + select?: string, + 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, + search, + 'search', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + filter, + 'filter', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sort, + 'sort', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + groupBy, + 'group_by', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + perPage, + 'per_page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + page, + 'page', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + cursor, + 'cursor', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + sample, + 'sample', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + select, + 'select', + ); - let localVarHeaders = this.defaultHeaders; + 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/topics/vector-search`; - 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 - } - ); + 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/topics`; + 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, + }, + ); + } + + /** + * Semantic / vector search for topics using a keyword/sentence. + * @endpoint get /api/topics/vector-search + * @param query Word or sentence to search by similarity. + * @param limit Maximum number of topics to return. + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopics( + query: string, + limit?: number, + searchType?: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (query === null || query === undefined) { + throw new Error( + 'Required parameter query was null or undefined when calling vectorSearchTopics.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + query, + 'query', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + limit, + 'limit', + ); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + searchType, + 'searchType', + ); + + 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/topics/vector-search`; + 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, + }, + ); + } + + /** + * Batch semantic / vector search for multiple keywords. + * @endpoint post /api/topics/vector-search/batch + * @param keywordsTopicsRequest + * @param searchType Search approach: \'hybrid\' or \'semantic\'. + * @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 vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe?: 'body', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable; + public vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe?: 'response', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe?: 'events', + reportProgress?: boolean, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable>; + public vectorSearchTopicsBatch( + keywordsTopicsRequest: KeywordsTopicsRequest, + searchType?: string, + observe: any = 'body', + reportProgress: boolean = false, + options?: { + httpHeaderAccept?: 'application/json'; + context?: HttpContext; + transferCache?: boolean; + }, + ): Observable { + if (keywordsTopicsRequest === null || keywordsTopicsRequest === undefined) { + throw new Error( + 'Required parameter keywordsTopicsRequest was null or undefined when calling vectorSearchTopicsBatch.', + ); + } + + let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); + localVarQueryParameters = this.addToHttpParams( + localVarQueryParameters, + searchType, + 'searchType', + ); + + 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/topics/vector-search/batch`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request( + 'post', + `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: keywordsTopicsRequest, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined + ? { transferCache: localVarTransferCache } + : {}), + reportProgress: reportProgress, + }, + ); + } } diff --git a/webapp/src/app/api/model/keywordTopicMatch.ts b/webapp/src/app/api/model/keywordTopicMatch.ts new file mode 100644 index 00000000..ee4c8326 --- /dev/null +++ b/webapp/src/app/api/model/keywordTopicMatch.ts @@ -0,0 +1,15 @@ +/** + * 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 { Topic } from './topic'; + +export interface KeywordTopicMatch { + keyword: string; + topic?: Topic | null; +} diff --git a/webapp/src/app/api/model/keywordsTopicsRequest.ts b/webapp/src/app/api/model/keywordsTopicsRequest.ts new file mode 100644 index 00000000..883ed079 --- /dev/null +++ b/webapp/src/app/api/model/keywordsTopicsRequest.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 KeywordsTopicsRequest { + /** + * List of keywords/sentences to query by similarity. + */ + keywords: Array; +} diff --git a/webapp/src/app/api/model/keywordsTopicsResponse.ts b/webapp/src/app/api/model/keywordsTopicsResponse.ts new file mode 100644 index 00000000..78a2f9d2 --- /dev/null +++ b/webapp/src/app/api/model/keywordsTopicsResponse.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. + */ +import { KeywordTopicMatch } from './keywordTopicMatch'; + +export interface KeywordsTopicsResponse { + /** + * Top matching topics for each keyword in the requested list. + */ + results: Array; +} diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index c0b5826d..282cf11e 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -49,6 +49,8 @@ export * from './euCordisProjectResponse'; export * from './euOrganizationProjectSummary'; export * from './euOrganizationProjectSummaryPage'; export * from './euProjectData'; +export * from './extractedKeywords'; +export * from './extractedKeywordsResponse'; export * from './filterInformation'; export * from './filterProperties'; export * from './fp7EurosciVoc'; @@ -98,8 +100,12 @@ export * from './institutionNetworkNode'; export * from './institutionPage'; export * from './institutionsListResponse'; export * from './ipcClassification'; +export * from './keywordEntry'; +export * from './keywordTopicMatch'; export * from './keywords'; export * from './keywordsRequest'; +export * from './keywordsTopicsRequest'; +export * from './keywordsTopicsResponse'; export * from './latitude'; export * from './location'; export * from './loginResponse'; @@ -113,6 +119,8 @@ export * from './newsArticle'; export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; +export * from './orgPatentEntry'; +export * from './orgPatentsResponse'; export * from './organizationPage'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; -- 2.56.1 From f0173cbf8a4ab1c219764e07b0988354a6b9a713 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:25:16 +0200 Subject: [PATCH 33/43] increased llm response timeout up to 120s --- service/src/main/inse/integrations/llm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index 3d2dc536..39924953 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -9,7 +9,7 @@ def call( model: str = None, json_schema = None, schema_name = None, - timeout: int = 60, + timeout: int = 120, temperature: float = 1.0, top_p: float = 0.95, ) -> str: @@ -66,7 +66,7 @@ async def call_stream( model: str = None, json_schema=None, schema_name=None, - timeout: int = 60, + timeout: int = 120, temperature: float = 1.0, top_p: float = 0.95, ) -> str: -- 2.56.1 From 6db4c80258622354528e50c6e6518dacf96c592b Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:26:07 +0200 Subject: [PATCH 34/43] adden dynamic keywords enriching with openalex topics --- service/src/main/inse/keywords/logic.py | 259 ++++++++++++++++++++-- service/src/main/inse/keywords/model.py | 24 +- service/src/main/inse/keywords/service.py | 59 ++++- 3 files changed, 306 insertions(+), 36 deletions(-) diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py index 81286797..b2017297 100644 --- a/service/src/main/inse/keywords/logic.py +++ b/service/src/main/inse/keywords/logic.py @@ -5,6 +5,7 @@ Business logic for persons / authors. """ import asyncio from typing import Any, Dict, List + import partial_json_parser import json import logging @@ -15,49 +16,88 @@ from pydantic import ValidationError from typing import Awaitable, Callable from inse.keywords.prompts import KeywordsPrompt from inse.integrations import llm -from inse.keywords.model import ExtractedKeywords, ExtractedKeywordsResponse, KeywordEntry, KeywordsWsEvent +from inse.keywords.model import ( + ExtractedKeywords, + ExtractedKeywordsLLM, + ExtractedKeywordsResponse, + KeywordEntry, + KeywordEntryWithTopic, + KeywordsWsEvent, +) +from inse.topics.logic import vector_search_topics_batch logger = logging.getLogger(__name__) EventCallback = Callable[[dict], Awaitable[None]] +LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") -def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: + +def _build_enriched_snapshot( + confirmed: Dict[str, List[KeywordEntryWithTopic]], +) -> ExtractedKeywords: + return ExtractedKeywords.model_validate( + {level: [item.model_dump() for item in confirmed.get(level, [])] for level in LEVELS} + ) + + +async def _enrich_llm_keywords(results: ExtractedKeywordsLLM) -> ExtractedKeywords: + confirmed: Dict[str, List[KeywordEntryWithTopic]] = { + level: [KeywordEntryWithTopic(llm_keyword=item) for item in getattr(results, level)] + for level in LEVELS + } + + keywords: List[str] = [] + positions: List[tuple[str, int]] = [] + for level in LEVELS: + for idx, entry in enumerate(getattr(results, level)): + keywords.append(entry.keyword) + positions.append((level, idx)) + + if keywords: + matches = await vector_search_topics_batch(keywords=keywords, search_type="hybrid") + for (level, idx), match in zip(positions, matches.results): + confirmed[level][idx].topic_mapping = match + + return _build_enriched_snapshot(confirmed) + +async def extract_keywords(query: str, mode: str, limit: int) -> ExtractedKeywordsResponse: """ Extracts keywords from the given text or URL using a language model. """ start_time = time.time() if mode == "url": - text = _get_text_content(query) + text = await _get_text_content(query) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT text = query - - system_prompt + user_prompt = f""" Now analyze the following text and return ONLY the JSON object.\n""" if limit: - user_prompt +="Extract exactly {limit} keywords for each level (broad, coarse, fine) from the text below.\n" + user_prompt +=f"Extract exactly {limit} keywords for each level (broad, coarse, fine) from the text below.\n" user_prompt += f"""Input:{text}""" keywords = llm.call( system_prompt=system_prompt, user_prompt=user_prompt, - json_schema = ExtractedKeywords.model_json_schema(), + json_schema = ExtractedKeywordsLLM.model_json_schema(), schema_name = "extracted_keywords", temperature=0.8, top_p=0.95, ) keywords_json = json.loads(keywords) + validated = ExtractedKeywordsLLM.model_validate(keywords_json) + enriched = await _enrich_llm_keywords(validated) elapsed_time = time.time() - start_time logger.info(f"Keyword extraction took {elapsed_time:.2f} seconds") - return ExtractedKeywordsResponse(results=keywords_json, source=mode, source_url=query if mode == "url" else None, source_content=text) + return ExtractedKeywordsResponse(results=enriched, source=mode, source_url=query if mode == "url" else None, source_content=text, duration=elapsed_time) -def _get_text_content(url: str) -> str: +async def _get_text_content(url: str) -> str: """ Fetches the HTML content from the given URL using httpx and extracts visible text. """ @@ -69,8 +109,8 @@ def _get_text_content(url: str) -> str: "Chrome/91.0.4472.124 Safari/537.36" ) } - with httpx.Client(timeout=30.0) as client: - response = client.get(url, headers=headers) + async with httpx.AsyncClient(timeout=30.0) as client: + response = await client.get(url, headers=headers) response.raise_for_status() soup = BeautifulSoup(response.text, "html.parser") @@ -78,7 +118,6 @@ def _get_text_content(url: str) -> str: element.decompose() text = soup.get_text(separator=" ", strip=True) text = " ".join(text.split()) - print(f"Extracted text from {url}: {text[:200]}...") # Print the first 200 characters of the extracted text return text except httpx.HTTPError as e: @@ -99,14 +138,13 @@ async def extract_keywords_stream( if mode == "url": await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) - text = _get_text_content(query) + text = await _get_text_content(query) await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: text = query await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT - user_prompt = "\nNow analyze the following text and return ONLY the JSON object.\n" if limit: user_prompt += f"\nExtract exactly {limit} keywords for each level (broad, coarse, fine).\n" @@ -120,11 +158,11 @@ async def extract_keywords_stream( confirmed: Dict[str, List[Dict[str, Any]]] = {level: [] for level in LEVELS} async def emit_full_results() -> None: - """Attempt to build and validate the full ExtractedKeywords model and emit it.""" + """Attempt to build and validate the full ExtractedKeywordsLLM model and emit it.""" # Build a dict with all three fields, using empty lists for missing ones data = {level: confirmed.get(level, []) for level in LEVELS} try: - validated = ExtractedKeywords.model_validate(data) + validated = ExtractedKeywordsLLM.model_validate(data) except ValidationError: # Should not happen if all items are valid, but guard against it return @@ -156,7 +194,6 @@ async def extract_keywords_stream( validated_item = KeywordEntry.model_validate(raw_item) except ValidationError: break # item not complete yet - confirmed[level].append(validated_item.model_dump()) idx += 1 grew = True @@ -178,7 +215,7 @@ async def extract_keywords_stream( llm.call_stream( system_prompt=system_prompt, user_prompt=user_prompt, - json_schema=ExtractedKeywords.model_json_schema(), + json_schema=ExtractedKeywordsLLM.model_json_schema(), schema_name="extracted_keywords", temperature=0.8, top_p=0.95, @@ -208,10 +245,10 @@ async def extract_keywords_stream( # Final emission of the full results (in case the last chunk didn't trigger it) final_data = {level: confirmed.get(level, []) for level in LEVELS} try: - final_validated = ExtractedKeywords.model_validate(keywords_json) + final_validated = ExtractedKeywordsLLM.model_validate(keywords_json) except ValidationError: # Fallback: use our confirmed data - final_validated = ExtractedKeywords.model_validate(final_data) + final_validated = ExtractedKeywordsLLM.model_validate(final_data) elapsed_time = time.time() - start_time result = ExtractedKeywordsResponse( @@ -222,4 +259,186 @@ async def extract_keywords_stream( duration=elapsed_time, ) + return result + + +async def extract_keywords_stream_enriched( + query: str, + mode: str, + limit: int, + emit: EventCallback, +) -> ExtractedKeywordsResponse: + start_time = time.time() + timeout_seconds = 120 + await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + + if mode == "url": + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + text = await _get_text_content(query) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT + else: + text = query + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT + + user_prompt = "\nNow analyze the following text.\n" + if limit: + user_prompt += f"\nExtract exactly {limit} keywords for each level.\n" + user_prompt += f"\nInput:\n{text}" + + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + + LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") + + # Holds enriched keyword wrappers for each level + confirmed: Dict[str, List[KeywordEntryWithTopic]] = {level: [] for level in LEVELS} + + # Track background enrichment tasks + enrichment_tasks: List[asyncio.Task] = [] + + async def emit_full_results() -> None: + """Attempt to build and emit the full enriched keyword model.""" + try: + validated = _build_enriched_snapshot(confirmed) + except ValidationError: + return + await emit(KeywordsWsEvent(type="keywords", keywords=validated.model_dump()).model_dump()) + + async def get_openalex_topic(level: str, idx: int, item: KeywordEntry) -> None: + """ + Fetch/enrich metadata for a single keyword. + Runs concurrently without blocking the LLM stream. + """ + try: + topic = await vector_search_topics_batch( + keywords=[item.keyword], + search_type="hybrid", + ) + # Update the shared confirmed list in-place (safe in asyncio) + confirmed[level][idx].topic_mapping = topic.results[0] if topic.results else None + + # Emit the full updated set after each enrichment so the frontend sees progress. + await emit_full_results() + + except asyncio.CancelledError: + # If the whole request is cancelled, we can just re-raise + raise + except Exception as e: + logger.error(f"Error fetching OpenAlex topic for keyword '{item.keyword}': {e}") + await emit_full_results() + + # ---------- on_chunk: parses LLM stream and appends new keywords ---------- + async def on_chunk(event: Dict[str, Any]) -> None: + if event["type"] != "llm_chunk": + await emit(event) + return + + try: + partial = partial_json_parser.loads(event.get("_full_content", "")) + except Exception: + return + + if not isinstance(partial, dict): + return + + grew = False + + for level in LEVELS: + current = partial.get(level) or [] + start_idx = len(confirmed[level]) # Where we start appending + + while len(confirmed[level]) < len(current): + raw_item = current[len(confirmed[level])] + try: + validated_item = KeywordEntry.model_validate(raw_item) + except ValidationError: + break # item not complete yet + + confirmed[level].append(KeywordEntryWithTopic(llm_keyword=validated_item)) + grew = True + + # Launch openalex topic mapping + for idx in range(start_idx, len(confirmed[level])): + keyword_text = confirmed[level][idx].llm_keyword.keyword + await emit( + KeywordsWsEvent( + type="status", + step="enriching", + message=f"Enriching keyword '{keyword_text}' at level '{level}'", + ).model_dump() + ) + task = asyncio.create_task(get_openalex_topic(level, idx, confirmed[level][idx].llm_keyword)) + enrichment_tasks.append(task) + + if grew: + await emit_full_results() + + # ---------- Accumulate full_content for incremental parsing ---------- + full_content_holder = {"value": ""} + + async def emit_wrapper(event: Dict[str, Any]) -> None: + if event["type"] == "llm_chunk": + full_content_holder["value"] += event["content"] + event = {**event, "_full_content": full_content_holder["value"]} + await on_chunk(event) + + # ---------- Call the LLM ---------- + try: + keywords = await asyncio.wait_for( + llm.call_stream( + system_prompt=system_prompt, + user_prompt=user_prompt, + json_schema=ExtractedKeywordsLLM.model_json_schema(), + schema_name="extracted_keywords", + temperature=0.0, + top_p=0.95, + emit=emit_wrapper, + ), + timeout=timeout_seconds, + ) + except asyncio.TimeoutError: + await emit(KeywordsWsEvent(type="error", message=f"LLM call timed out after {timeout_seconds}s").model_dump()) + raise RuntimeError("LLM streaming call timed out") + except asyncio.CancelledError: + # Cancel all pending enrichment tasks to avoid dangling background work + for task in enrichment_tasks: + task.cancel() + if enrichment_tasks: + await asyncio.gather(*enrichment_tasks, return_exceptions=True) + await emit(KeywordsWsEvent(type="error", message="Request cancelled").model_dump()) + raise + + # ---------- Finalize ---------- + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + + try: + keywords_json = json.loads(keywords) + except json.JSONDecodeError as e: + await emit(KeywordsWsEvent(type="error", message=f"Invalid JSON in LLM response: {e}").model_dump()) + raise RuntimeError("LLM response is not valid JSON") + + # ---------- Wait for ALL pending enrichments to complete ---------- + if enrichment_tasks: + await asyncio.gather(*enrichment_tasks, return_exceptions=True) + + await emit_full_results() + + # Build final response + try: + final_validated = _build_enriched_snapshot(confirmed) + except ValidationError: + final_validated = ExtractedKeywords.model_validate( + {level: [item.model_dump() for item in confirmed.get(level, [])] for level in LEVELS} + ) + + elapsed_time = time.time() - start_time + result = ExtractedKeywordsResponse( + results=final_validated, + source=mode, + source_url=query if mode == "url" else None, + source_content=text, + duration=elapsed_time, + ) + return result \ No newline at end of file diff --git a/service/src/main/inse/keywords/model.py b/service/src/main/inse/keywords/model.py index 3e86a01d..d2c9239e 100644 --- a/service/src/main/inse/keywords/model.py +++ b/service/src/main/inse/keywords/model.py @@ -3,10 +3,11 @@ """ Data models for persons / authors. """ -from pydantic import BaseModel -from pydantic import Field -from typing import List +from typing import List, Literal +from pydantic import BaseModel, Field + +from inse.topics.model import KeywordTopicMatch class KeywordsRequest(BaseModel): query: str = Field(description="The input text from which to extract keywords.") mode: str = Field(description="The mode of keyword extraction, e.g., 'url', 'text', or 'keywords'.") @@ -15,14 +16,27 @@ class KeywordsRequest(BaseModel): class KeywordEntry(BaseModel): keyword: str = Field(description="The extracted keyword.") relevance_score: float = Field(description="The relevance score of the keyword.") + +class KeywordEntryWithTopic(BaseModel): + llm_keyword: KeywordEntry = Field(description="The keyword extracted by the LLM.") + topic_mapping: KeywordTopicMatch | None = Field( + default=None, + description="The corresponding OpenAlex topic match for the keyword, if any.", + ) class ExtractedKeywords(BaseModel): + broad_keywords: List[KeywordEntryWithTopic] = Field(description="The extracted broad keywords from text.") + coarse_grained: List[KeywordEntryWithTopic] = Field(description="The extracted coarse-grained keywords from text.") + fine_grained: List[KeywordEntryWithTopic] = Field(description="The extracted fine-grained keywords from text.") + +class ExtractedKeywordsLLM(BaseModel): broad_keywords: List[KeywordEntry] = Field(description="The extracted broad keywords from text.") coarse_grained: List[KeywordEntry] = Field(description="The extracted coarse-grained keywords from text.") fine_grained: List[KeywordEntry] = Field(description="The extracted fine-grained keywords from text.") class ExtractedKeywordsResponse(BaseModel): - results: ExtractedKeywords = Field(description="The extracted keywords from the input text.") + results_llm: ExtractedKeywordsLLM | None = None + results: ExtractedKeywords | None = None source: str = Field(description="The source of the input text, e.g., 'url', 'text', or 'keywords'.") source_url: str | None = Field(default=None, description="The URL from which keywords were extracted, if applicable.") source_content: str = Field(description="The actual content from which keywords were extracted.") @@ -33,7 +47,7 @@ class KeywordsWsEvent(BaseModel): step: str | None = None message: str | None = None result: ExtractedKeywordsResponse | None = None - keywords: ExtractedKeywords | None = None + keywords: ExtractedKeywords | ExtractedKeywordsLLM | None = None duration: float | None = None completed: str | None = None \ No newline at end of file diff --git a/service/src/main/inse/keywords/service.py b/service/src/main/inse/keywords/service.py index bac0eaba..ae207f1c 100644 --- a/service/src/main/inse/keywords/service.py +++ b/service/src/main/inse/keywords/service.py @@ -4,9 +4,11 @@ REST API for persons / authors. """ +import asyncio from typing import Annotated -from fastapi import Body, WebSocket, WebSocketDisconnect -from fastapi import APIRouter + +from fastapi import APIRouter, Body, WebSocket, WebSocketDisconnect + from . import logic from inse.keywords.model import ExtractedKeywordsResponse, KeywordsRequest @@ -24,26 +26,61 @@ async def extract_keywords_ws(websocket: WebSocket): try: raw = await websocket.receive_json() request = KeywordsRequest(**raw) + disconnected = asyncio.Event() async def emit(event: dict): + if disconnected.is_set(): + return await websocket.send_json(event) - result = await logic.extract_keywords_stream( - query=request.query, - mode=request.mode, - limit=request.limit, - emit=emit, + async def watch_disconnect() -> None: + while True: + message = await websocket.receive() + if message["type"] == "websocket.disconnect": + disconnected.set() + return + + extraction_task = asyncio.create_task( + logic.extract_keywords_stream_enriched( + query=request.query, + mode=request.mode, + limit=request.limit, + emit=emit, + ) ) + disconnect_task = asyncio.create_task(watch_disconnect()) + + done, pending = await asyncio.wait( + {extraction_task, disconnect_task}, + return_when=asyncio.FIRST_COMPLETED, + ) + + if disconnect_task in done: + disconnected.set() + extraction_task.cancel() + try: + await extraction_task + except asyncio.CancelledError: + pass + return + + disconnect_task.cancel() + try: + await disconnect_task + except asyncio.CancelledError: + pass + result = extraction_task.result() await websocket.send_json({"type": "completed", "result": result.model_dump()}) except WebSocketDisconnect: - print("WebSocket disconnected.?") + print("WebSocket disconnected.") pass except Exception as e: await websocket.send_json({"type": "error", "message": str(e)}) finally: - await websocket.close() + if websocket.application_state.name != "DISCONNECTED": + await websocket.close() # @router.post( # "/keywords/extract", @@ -73,11 +110,11 @@ async def extract_keywords_ws(websocket: WebSocket): summary="Extracts keywords from text.", response_model_exclude_none=True, ) -def extract_keywords( +async def extract_keywords( request: Annotated[ KeywordsRequest, Body(description="Input text for keyword extraction") ], ): - return logic.extract_keywords(query=request.query, mode=request.mode, limit=request.limit) + return await logic.extract_keywords(query=request.query, mode=request.mode, limit=request.limit) -- 2.56.1 From f38395254797fbe07bb7c08610c9d3f771329c26 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:26:19 +0200 Subject: [PATCH 35/43] simple prompts for testing added --- service/src/main/inse/keywords/prompts.py | 257 ++++++++++------------ 1 file changed, 118 insertions(+), 139 deletions(-) diff --git a/service/src/main/inse/keywords/prompts.py b/service/src/main/inse/keywords/prompts.py index 292630c2..f60c8fc3 100644 --- a/service/src/main/inse/keywords/prompts.py +++ b/service/src/main/inse/keywords/prompts.py @@ -104,7 +104,7 @@ class KeywordsPrompt(StrEnum): Guidelines: * Scores must be between 0.0 and 1.0. - * Use decimal precision up to 2 digits. + * Use decimal precision up to 3 digits. * Rank keywords by importance. * The most important keywords should appear first. * Broad keywords generally receive higher scores than secondary topics. @@ -128,26 +128,6 @@ class KeywordsPrompt(StrEnum): Return ONLY valid JSON. - { - "broad_keywords": [ - { - "keyword": "string", - "relevance_score": 0.0 - } - ], - "coarse_grained": [ - { - "keyword": "string", - "relevance_score": 0.0 - } - ], - "fine_grained": [ - { - "keyword": "string", - "relevance_score": 0.0 - } - ] - } --- @@ -159,66 +139,7 @@ class KeywordsPrompt(StrEnum): Output: - { - "broad_keywords": [ - { - "keyword": "Artificial Intelligence", - "relevance_score": 0.98 - }, - { - "keyword": "Manufacturing", - "relevance_score": 0.94 - }, - { - "keyword": "Industrial Automation", - "relevance_score": 0.90 - } - ], - "coarse_grained": [ - { - "keyword": "Machine Learning", - "relevance_score": 0.96 - }, - { - "keyword": "Predictive Maintenance", - "relevance_score": 0.95 - }, - { - "keyword": "Smart Factories", - "relevance_score": 0.88 - }, - { - "keyword": "Sensor Fusion", - "relevance_score": 0.86 - }, - { - "keyword": "Anomaly Detection", - "relevance_score": 0.85 - }, - { - "keyword": "Time-Series Forecasting", - "relevance_score": 0.83 - } - ], - "fine_grained": [ - { - "keyword": "Transformer Architecture", - "relevance_score": 0.95 - }, - { - "keyword": "Industrial Sensors", - "relevance_score": 0.84 - }, - { - "keyword": "Multimodal Data Fusion", - "relevance_score": 0.82 - }, - { - "keyword": "Predictive Analytics", - "relevance_score": 0.80 - } - ] - } + {"broad_keywords":[{"keyword":"ArtificialIntelligence","relevance_score":0.98},{"keyword":"Manufacturing","relevance_score":0.94},{"keyword":"IndustrialAutomation","relevance_score":0.90}],"coarse_grained":[{"keyword":"MachineLearning","relevance_score":0.96},{"keyword":"PredictiveMaintenance","relevance_score":0.95},{"keyword":"SmartFactories","relevance_score":0.88},{"keyword":"SensorFusion","relevance_score":0.86},{"keyword":"AnomalyDetection","relevance_score":0.85},{"keyword":"Time-SeriesForecasting","relevance_score":0.83}],"fine_grained":[{"keyword":"TransformerArchitecture","relevance_score":0.95},{"keyword":"IndustrialSensors","relevance_score":0.84},{"keyword":"MultimodalDataFusion","relevance_score":0.82},{"keyword":"PredictiveAnalytics","relevance_score":0.80}]} --- @@ -230,60 +151,8 @@ class KeywordsPrompt(StrEnum): Output: - { - "broad_keywords": [ - { - "keyword": "Healthcare", - "relevance_score": 0.97 - }, - { - "keyword": "Artificial Intelligence", - "relevance_score": 0.95 - }, - { - "keyword": "Digital Health", - "relevance_score": 0.89 - } - ], - "coarse_grained": [ - { - "keyword": "Large Language Models", - "relevance_score": 0.96 - }, - { - "keyword": "Clinical Decision Support", - "relevance_score": 0.92 - }, - { - "keyword": "Medical Record Analysis", - "relevance_score": 0.90 - }, - { - "keyword": "Natural Language Processing", - "relevance_score": 0.88 - } - ], - "fine_grained": [ - { - "keyword": "Retrieval-Augmented Generation", - "relevance_score": 0.95 - }, - { - "keyword": "Patient Record Summarization", - "relevance_score": 0.91 - }, - { - "keyword": "Clinical Documentation", - "relevance_score": 0.86 - }, - { - "keyword": "Medical Text Processing", - "relevance_score": 0.84 - } - ] - } - - --- + {"broad_keywords":[{"keyword":"Healthcare","relevance_score":0.97},{"keyword":"ArtificialIntelligence","relevance_score":0.95},{"keyword":"DigitalHealth","relevance_score":0.89}],"coarse_grained":[{"keyword":"LargeLanguageModels","relevance_score":0.96},{"keyword":"ClinicalDecisionSupport","relevance_score":0.92},{"keyword":"MedicalRecordAnalysis","relevance_score":0.90},{"keyword":"NaturalLanguageProcessing","relevance_score":0.88}],"fine_grained":[{"keyword":"Retrieval-AugmentedGeneration","relevance_score":0.95},{"keyword":"PatientRecordSummarization","relevance_score":0.91},{"keyword":"ClinicalDocumentation","relevance_score":0.86},{"keyword":"MedicalTextProcessing","relevance_score":0.84}]} + Return ONLY valid JSON matching the schema provided by the API. """ @@ -480,11 +349,121 @@ class KeywordsPrompt(StrEnum): * Remove duplicates across hierarchy levels whenever possible. * Rank keywords by importance. + --- + # Example 3 — News Article + + ## Input + + Apple announced a new generation of custom AI chips designed for on-device inference. The chips will power future iPhone and Mac devices, improving privacy, latency, and energy efficiency for generative AI applications. + + ## Output + + ```json{"broad_keywords":[{"keyword":"Technology","relevance_score":0.98},{"keyword":"ArtificialIntelligence","relevance_score":0.97},{"keyword":"ConsumerElectronics","relevance_score":0.92}],"coarse_grained":[{"keyword":"AIHardware","relevance_score":0.96},{"keyword":"SemiconductorDesign","relevance_score":0.93},{"keyword":"EdgeComputing","relevance_score":0.90},{"keyword":"GenerativeAI","relevance_score":0.88}],"fine_grained":[{"keyword":"On-DeviceInference","relevance_score":0.95},{"keyword":"CustomAIChips","relevance_score":0.94},{"keyword":"InferenceAcceleration","relevance_score":0.89},{"keyword":"Low-LatencyProcessing","relevance_score":0.86}]}``` + + --- + + # Example 4 — Product Page + + ## Input + + The Sony WH-1000XM6 wireless headphones feature adaptive noise cancellation, Bluetooth 5.4 connectivity, 40-hour battery life, multipoint device pairing, and spatial audio support. + + ## Output + + ```json{"broad_keywords":[{"keyword":"ConsumerElectronics","relevance_score":0.98},{"keyword":"AudioTechnology","relevance_score":0.95}],"coarse_grained":[{"keyword":"WirelessHeadphones","relevance_score":0.97},{"keyword":"NoiseCancellation","relevance_score":0.95},{"keyword":"BluetoothAudio","relevance_score":0.92}],"fine_grained":[{"keyword":"AdaptiveNoiseCancellation","relevance_score":0.96},{"keyword":"Bluetooth5.4","relevance_score":0.94},{"keyword":"MultipointPairing","relevance_score":0.89},{"keyword":"SpatialAudio","relevance_score":0.87}]}``` + + --- + + # Example 5 — Technical Documentation + + ## Input + + FastAPI is a modern Python web framework for building APIs. It provides automatic OpenAPI schema generation, dependency injection, asynchronous request handling, and data validation through Pydantic models. + + ## Output + + ```json{"broad_keywords":[{"keyword":"SoftwareDevelopment","relevance_score":0.98},{"keyword":"WebDevelopment","relevance_score":0.95}],"coarse_grained":[{"keyword":"PythonFrameworks","relevance_score":0.97},{"keyword":"APIDevelopment","relevance_score":0.95},{"keyword":"BackendEngineering","relevance_score":0.91}],"fine_grained":[{"keyword":"FastAPI","relevance_score":0.99},{"keyword":"OpenAPI","relevance_score":0.95},{"keyword":"DependencyInjection","relevance_score":0.90},{"keyword":"Pydantic","relevance_score":0.89},{"keyword":"AsynchronousRequestHandling","relevance_score":0.87}]}``` + + --- + + # Example 6 — Company Website + + ## Input + + Stripe provides online payment infrastructure for businesses. Its platform supports payment processing, subscription billing, fraud prevention, financial reporting, and global commerce operations. + + ## Output + + ```json{"broad_keywords":[{"keyword":"FinancialTechnology","relevance_score":0.98},{"keyword":"BusinessServices","relevance_score":0.91}],"coarse_grained":[{"keyword":"PaymentProcessing","relevance_score":0.97},{"keyword":"DigitalPayments","relevance_score":0.95},{"keyword":"SubscriptionManagement","relevance_score":0.90}],"fine_grained":[{"keyword":"StripePlatform","relevance_score":0.99},{"keyword":"FraudPrevention","relevance_score":0.91},{"keyword":"RecurringBilling","relevance_score":0.89},{"keyword":"GlobalPaymentInfrastructure","relevance_score":0.87}]}``` + --- Return ONLY valid JSON matching the schema provided by the API. - - The following text was extracted from a webpage: - - {{PAGE_CONTENT}} """ + + SIMPLE_TEXT_PROMPT = """ +You are a scientific and technology intelligence expert. Extract keywords from the given text into three hierarchical levels. Each keyword must include a relevance_score (0.0–1.0) indicating centrality. + +**Levels:** +- **broad_keywords** – high‑level domains/industries (e.g., Artificial Intelligence, Healthcare, Renewable Energy). +- **coarse_grained** – mid‑level technologies/methods/applications (e.g., Machine Learning, Drug Discovery, Smart Manufacturing). +- **fine_grained** – specific technical concepts, algorithms, materials, protocols (e.g., Transformer Architecture, CRISPR‑Cas9, Retrieval‑Augmented Generation). + +**Guidelines:** +- Prioritize scientific, technical, and research‑oriented terminology. +- Avoid generic business fluff: "solution", "platform", "improvement", "service", "performance" – unless they are explicit searchable concepts. +- Prefer noun phrases; avoid complete sentences. +- Extract 5–15 keywords per level when possible. +- Rank by importance (higher scores first). + +**Relevance scores:** +- 1.0 = central topic +- 0.9 = extremely important +- 0.8 = highly relevant +- 0.7 = supporting concept +- 0.6 = secondary +- Below 0.6 – use sparingly. + +**Output schema (JSON only):** +{ + "broad_keywords": [{"keyword": "string", "relevance_score": 0.0}, ...], + "coarse_grained": [...], + "fine_grained": [...] +} + +**Example:** +Input: Researchers developed a transformer-based ML framework for predictive maintenance in smart factories using sensor fusion and anomaly detection. +Output: +{ + "broad_keywords": [{"keyword": "Artificial Intelligence", "relevance_score": 0.98}, {"keyword": "Manufacturing", "relevance_score": 0.94}], + "coarse_grained": [{"keyword": "Predictive Maintenance", "relevance_score": 0.95}, {"keyword": "Anomaly Detection", "relevance_score": 0.85}], + "fine_grained": [{"keyword": "Transformer Architecture", "relevance_score": 0.95}, {"keyword": "Sensor Fusion", "relevance_score": 0.82}] +} + +Return ONLY the JSON object, nothing else. +""" + SIMPLE_WEBSITE_PROMPT = """ +You are a technology scout and scientific analyst. The input is text scraped from a webpage (using BeautifulSoup or similar). Your goal: extract keywords into three hierarchical levels, just like the text prompt, but with extra care to ignore website boilerplate. + +**Ignore:** +- Navigation menus, headers/footers, cookie banners, legal disclaimers, copyright notices. +- Generic marketing language, calls-to-action, contact details, login/signup content. +- Repeated site templates or boilerplate. + +**Focus only on:** +- Technologies, research areas, scientific methods, products, applications, industrial sectors, materials, standards, diseases, engineering disciplines, innovation domains. +- Prefer canonical scientific terms over marketing buzzwords (e.g., "Large Language Models" instead of "AI Assistant"). + +**Hierarchy and relevance scores** are the same as in the text prompt (broad → coarse → fine, scores 0.0–1.0). + +**Output schema (JSON only):** +'''{"broad_keywords": [{"keyword": "string", "relevance_score": 0.0}, ...],"coarse_grained": [...],"fine_grained": [...]}''' + +**Example (company website):** +Input: Stripe provides payment infrastructure for businesses, supporting processing, billing, fraud prevention, and global commerce. +Output: +{"broad_keywords": [{"keyword": "Financial Technology", "relevance_score": 0.98}, {"keyword": "Business Services", "relevance_score": 0.91}],"coarse_grained": [{"keyword": "Payment Processing", "relevance_score": 0.97}, {"keyword": "Digital Payments", "relevance_score": 0.95}],"fine_grained": [{"keyword": "Stripe Platform", "relevance_score": 0.99}, {"keyword": "Fraud Prevention", "relevance_score": 0.91}]} + +**Return ONLY the JSON object, nothing else.** +- Nno leading/trailing spaces, newlines, or any text before or after. NO IDENTATION, justa stringified JSON +""" \ No newline at end of file -- 2.56.1 From 42ecebb27f96568c9b6b6088c024759cb8d4caa8 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:26:51 +0200 Subject: [PATCH 36/43] regenerated services --- webapp/src/app/api/.openapi-generator/FILES | 2 ++ webapp/src/app/api/model/extractedKeywords.ts | 8 ++--- .../src/app/api/model/extractedKeywordsLLM.ts | 27 +++++++++++++++ .../api/model/extractedKeywordsResponse.ts | 33 +++++++++---------- .../app/api/model/keywordEntryWithTopic.ts | 21 ++++++++++++ webapp/src/app/api/model/models.ts | 2 ++ 6 files changed, 71 insertions(+), 22 deletions(-) create mode 100644 webapp/src/app/api/model/extractedKeywordsLLM.ts create mode 100644 webapp/src/app/api/model/keywordEntryWithTopic.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index baf4dbd8..99b72add 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -74,6 +74,7 @@ model/euOrganizationProjectSummary.ts model/euOrganizationProjectSummaryPage.ts model/euProjectData.ts model/extractedKeywords.ts +model/extractedKeywordsLLM.ts model/extractedKeywordsResponse.ts model/filterInformation.ts model/filterProperties.ts @@ -125,6 +126,7 @@ model/institutionPage.ts model/institutionsListResponse.ts model/ipcClassification.ts model/keywordEntry.ts +model/keywordEntryWithTopic.ts model/keywordTopicMatch.ts model/keywords.ts model/keywordsRequest.ts diff --git a/webapp/src/app/api/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts index 81a2bc3c..8e74c6e0 100644 --- a/webapp/src/app/api/model/extractedKeywords.ts +++ b/webapp/src/app/api/model/extractedKeywords.ts @@ -7,21 +7,21 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { KeywordEntry } from './keywordEntry'; +import { KeywordEntryWithTopic } from './keywordEntryWithTopic'; export interface ExtractedKeywords { /** * The extracted broad keywords from text. */ - broad_keywords: Array; + broad_keywords: Array; /** * The extracted coarse-grained keywords from text. */ - coarse_grained: Array; + coarse_grained: Array; /** * The extracted fine-grained keywords from text. */ - fine_grained: Array; + fine_grained: Array; } diff --git a/webapp/src/app/api/model/extractedKeywordsLLM.ts b/webapp/src/app/api/model/extractedKeywordsLLM.ts new file mode 100644 index 00000000..b12957f6 --- /dev/null +++ b/webapp/src/app/api/model/extractedKeywordsLLM.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 { KeywordEntry } from './keywordEntry'; + + +export interface ExtractedKeywordsLLM { + /** + * The extracted broad keywords from text. + */ + broad_keywords: Array; + /** + * The extracted coarse-grained keywords from text. + */ + coarse_grained: Array; + /** + * The extracted fine-grained keywords from text. + */ + fine_grained: Array; +} + diff --git a/webapp/src/app/api/model/extractedKeywordsResponse.ts b/webapp/src/app/api/model/extractedKeywordsResponse.ts index 65a4087b..8fe10a5f 100644 --- a/webapp/src/app/api/model/extractedKeywordsResponse.ts +++ b/webapp/src/app/api/model/extractedKeywordsResponse.ts @@ -1,29 +1,26 @@ /** * 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 { ExtractedKeywordsLLM } from './extractedKeywordsLLM'; import { ExtractedKeywords } from './extractedKeywords'; - -export interface ExtractedKeywordsResponse { - /** - * The extracted keywords from the input text. - */ - results: ExtractedKeywords; - /** - * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. - */ - source: string; - source_url?: string | null; - /** - * The actual content from which keywords were extracted. - */ - source_content: string; - duration?: number | null; +export interface ExtractedKeywordsResponse { + results_llm?: ExtractedKeywordsLLM | null; + results?: ExtractedKeywords | null; + /** + * The source of the input text, e.g., \'url\', \'text\', or \'keywords\'. + */ + source: string; + source_url?: string | null; + /** + * The actual content from which keywords were extracted. + */ + source_content: string; + duration?: number | null; } - diff --git a/webapp/src/app/api/model/keywordEntryWithTopic.ts b/webapp/src/app/api/model/keywordEntryWithTopic.ts new file mode 100644 index 00000000..6680e773 --- /dev/null +++ b/webapp/src/app/api/model/keywordEntryWithTopic.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 { KeywordEntry } from './keywordEntry'; +import { KeywordTopicMatch } from './keywordTopicMatch'; + + +export interface KeywordEntryWithTopic { + /** + * The keyword extracted by the LLM. + */ + llm_keyword: KeywordEntry; + topic_mapping?: KeywordTopicMatch | null; +} + diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 282cf11e..8e381ef2 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -50,6 +50,7 @@ export * from './euOrganizationProjectSummary'; export * from './euOrganizationProjectSummaryPage'; export * from './euProjectData'; export * from './extractedKeywords'; +export * from './extractedKeywordsLLM'; export * from './extractedKeywordsResponse'; export * from './filterInformation'; export * from './filterProperties'; @@ -101,6 +102,7 @@ export * from './institutionPage'; export * from './institutionsListResponse'; export * from './ipcClassification'; export * from './keywordEntry'; +export * from './keywordEntryWithTopic'; export * from './keywordTopicMatch'; export * from './keywords'; export * from './keywordsRequest'; -- 2.56.1 From 2603580587084b0b7a38e984f26e6886d90f5a68 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:27:13 +0200 Subject: [PATCH 37/43] ui adjusted --- .../keywords-search.component.html | 354 ++++++++------- .../keywords-search.component.scss | 413 +++++++++++++----- .../keywords-search.component.ts | 86 +++- 3 files changed, 553 insertions(+), 300 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 02aab57c..958783a6 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -1,117 +1,75 @@
- - - -
- - Füge eine URL ein, um Keywords zu extrahieren - - -
-
- - -
- - Schreibe einen Text, um Keywords zu extrahieren - - -
-
- - -
- - Definieren Sie Ihre eigene Keywords - - - -
-
-
- -
- @if (form.controls.selectedInputType.value !== 'keywords') { - - } -
- - -
- - - - -
- Eigene Keywords - @if (manualKeywords().length > 0) { - - @for (keyword of manualKeywords(); track keyword) { - {{ keyword }} - } - - } @else { -

Keine manuell hinzugefügten Keywords.

- } + +
+ + +
+ + Füge eine URL ein, um Keywords zu extrahieren + + +
+ +
- - @if (sourceContent().length > 0) { - - - - Quellentext: {{ sourceUrl() }} - -
{{ sourceContent() }}
-
- } - - -
- Extrahierte Keywords - @if (extractedKeywordsExist()) { -
- - @if (broadKeywords().length > 0) { -
-

Breite Keywords

+ + + +
+ + Schreibe einen Text, um Keywords zu extrahieren + + +
+ +
+
+
+ + + +
+ + + +
+ +
+
Breite Keywords
+
Coarse Keywords
+
Fine Keywords
+
Eigene Keywords
+
+ + +
+
+ @if (broadKeywords().length > 0) { {{ keyword }} + class="compact-chip broad-chip"> + {{ keyword }} + } -
- } - - @if (coarseKeywords().length > 0) { -
-

Coarse Keywords

+ } @else { +

–

+ } +
+ +
+ @if (coarseKeywords().length > 0) { @for (keyword of coarseKeywords(); track keyword) { {{ keyword }} + class="compact-chip coarse-chip"> + {{ keyword }} + } -
- } - - @if (fineKeywords().length > 0) { -
-

Fine Keywords

+ } @else { +

–

+ } +
+ +
+ @if (fineKeywords().length > 0) { @for (keyword of fineKeywords(); track keyword) { {{ keyword }} + class="compact-chip fine-chip"> + {{ keyword }} + } -
- } -
+ } @else { +

–

+ } +
- +
+ +
+ + z. B. Knowledge Graphs + + + +
+ @if (manualKeywords().length > 0) { + @for (keyword of manualKeywords(); track keyword) { + + {{ keyword }} + cancel + + } + } +
+
+
+
+ + + @if (extractedKeywordsExist()) {
- @if (areAllExtractedSelected()) {
- } @else { + } + + @if (isExtracting()) { +
+ + +
{{ statusMessage() }}
+
+ } @else if ( + !extractedKeywordsExist() && manualKeywords().length === 0 + ) {

- Keine extrahierten Keywords vorhanden. Extrahiere Keywords, um sie - hier zu sehen oder füge sie manuell hinzu. + Keine Keywords vorhanden. Extrahiere Keywords oder füge eigene + hinzu.

} -
+ + @if (sourceContent().length > 0) { + + + + Quellentext: {{ sourceUrl() }} + +
{{ sourceContent() }}
+
+ } + + +
- @if (isExtracting()) { -
- - -
{{ statusMessage() }}
-
- } - - -
- - -
- + +
+ +
diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.scss b/webapp/src/app/modules/keywords-search/keywords-search.component.scss index daf9bb39..c0e8d744 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -7,21 +7,18 @@ .tab-content { padding: 0.5rem 0; + display: grid; + grid-template-columns: 5fr 1fr; + gap: 0.5rem; } .full-width { width: 100%; } -.keyword-input-row { - display: flex; - align-items: flex-start; - gap: 0.75rem; -} - .actions { display: flex; - justify-content: flex-end; + justify-content: center; } .extraction-grid { @@ -43,32 +40,231 @@ } } -.category-grid { - display: grid; - grid-template-columns: 1fr; - gap: 0.75rem 1.5rem; +/* === Table-like keyword grid === */ +.keyword-table { + display: flex; + flex-direction: column; + gap: 0.5rem; + margin: 0.5rem 0; } -.category-section { - h4 { - margin: 0 0 0.25rem 0; - font-weight: 500; - color: var(--sg-text-secondary); - font-size: 0.75rem; - text-transform: uppercase; - letter-spacing: 0.05em; +.table-head { + display: grid; + grid-template-columns: repeat(3, 1fr) 1.3fr; + grid-template-rows: auto; + column-gap: 1rem; + border-bottom: 2px solid var(--sg-divider, rgba(0, 0, 0, 0.12)); + padding-bottom: 0.5rem; +} + +.head-cell { + min-width: 0; + text-align: center; /* Center header text */ +} + +.extracted-header { + grid-column: 1 / span 3; + grid-row: 0; + font-size: 0.95rem; + font-weight: 600; + color: var(--sg-text-primary); + align-self: end; +} + +.own-header { + grid-column: 4; + grid-row: 1 / span 2; + display: flex; + flex-direction: column; + gap: 0.35rem; +} + +.own-header-title { + font-size: 0.95rem; + font-weight: 600; + color: var(--sg-text-primary); + text-align: center; /* Center own header title */ +} + +.sub-cell { + font-weight: 500; + color: var(--sg-text-secondary); + font-size: 1rem; + text-transform: uppercase; + letter-spacing: 0.05em; + align-self: end; + grid-row: 2; + text-align: center; /* Center sub-cell text */ +} + +.broad-sub { + grid-column: 1; +} +.coarse-sub { + grid-column: 2; +} +.fine-sub { + grid-column: 3; +} +.manual-sub { + grid-column: 4; +} +.keyword-input-row { + margin-left: 0.5rem; + width: 100%; + display: grid; + grid-column: 1 / span 4; + display: flex; + align-items: center; + gap: 0.35rem; + + &.compact { + .small-field { + flex: 10; + // collapse the outline field to a compact, chip-like height + ::ng-deep .mat-mdc-text-field-wrapper { + padding: 0 0.6rem; + } + + ::ng-deep .mat-mdc-form-field-flex { + min-height: 8px; + align-items: center; + } + + ::ng-deep .mat-mdc-form-field-infix { + min-height: 8px; + padding: 1rem 0; + } + + // hide the hint/error subscript strip to remove extra height + ::ng-deep .mat-mdc-form-field-subscript-wrapper { + display: none; + } + + ::ng-deep input.mat-mdc-input-element { + font-size: 0.8rem; + } + + ::ng-deep .mat-mdc-form-field-label, + ::ng-deep mat-label { + font-size: 1rem; + } + } + + button.mat-mdc-icon-button { + width: 28px; + height: 28px; + padding: 0; + line-height: 28px; + flex: 1; + + .mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + line-height: 18px; + } + + ::ng-deep .mat-mdc-button-touch-target { + width: 28px; + height: 28px; + } + } + } +} + +.table-body { + display: grid; + grid-template-columns: repeat(3, 1fr) 1.3fr; + column-gap: 1rem; + row-gap: 0.4rem; + align-items: start; + border-left: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); /* Left border for columns */ +} + +/* Add vertical separators between columns */ +.table-col { + display: flex; + min-width: 0; + padding: 0.5rem; + height: 100%; + border-right: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); /* Right border for columns */ + + &:last-child { + border-right: none; /* Remove border from last column */ + } + &:nth-child(3) { + border-right: 5px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); /* Right border for third column */ } mat-chip-listbox { width: 100%; } + + /* force chips into a single vertical column so rows line up across columns */ + ::ng-deep .mdc-evolution-chip-set__chips { + flex-direction: column; + align-items: flex-start; + gap: 0.35rem; + } } +/* Make chips removable and add hover effect */ .compact-chip { - font-size: 0.8rem; + font-size: 1rem; padding: 0.2rem 0.6rem; min-height: 28px; line-height: 1.2; + width: 80%; + box-sizing: border-box; + animation: popIn 0.2s ease-in-out; + cursor: default; + + // Add removable indicator and hover effect + &.mat-mdc-chip-option { + .mat-mdc-chip-action { + padding: 0 4px; + + .mat-mdc-chip-action-label { + padding: 0 4px; + display: flex; + align-items: center; + gap: 4px; + } + } + + // Show remove button on hover for removable chips + &:hover { + ::ng-deep .mat-mdc-chip-remove { + opacity: 1; + } + } + } + + // Style for removable chips + ::ng-deep .mat-mdc-chip-remove { + opacity: 0; + transition: opacity 0.2s ease; + cursor: pointer; + + .mat-icon { + font-size: 16px; + width: 16px; + height: 16px; + line-height: 16px; + } + } +} + +@keyframes popIn { + from { + opacity: 0; + transform: scale(0.9); + } + to { + opacity: 1; + transform: scale(1); + } } ::ng-deep .mat-mdc-chip-option.compact-chip { @@ -80,115 +276,90 @@ } } -/* Selected keywords buttons */ -.selected-keywords { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; -} - -.selected-keyword { - display: inline-flex; - align-items: center; - gap: 0.15rem; - font-size: 0.8rem; - padding: 0.2rem 0.6rem; - min-height: 28px; - - .mat-icon { - font-size: 18px; - width: 18px; - height: 18px; - line-height: 18px; - } -} -.section-title { - margin: 0.5rem 0 0.25rem 0; - font-size: 1rem; - font-weight: 500; - color: var(--sg-text-primary); -} - -.extracted-section, -.manual-section { - margin-bottom: 0.5rem; -} -.manual-section { - margin-top: 0.5rem; -} -.mat-divider { - margin: 0.5rem 0; -} -.select-all-container { - display: flex; - justify-content: flex-end; - margin-top: 0.5rem; - - button { - font-size: 0.75rem; - padding: 0 12px; - line-height: 30px; - mat-icon { - font-size: 18px; - width: 18px; - height: 18px; - } - } -} -.select-all-container { - display: flex; - flex-wrap: wrap; - gap: 0.5rem; - justify-content: flex-end; - margin-top: 0.5rem; - - button { - font-size: 0.75rem; - padding: 0 12px; - line-height: 30px; - mat-icon { - font-size: 18px; - width: 18px; - height: 18px; - } - } -} .empty-state { + text-align: center; color: var(--sg-text-secondary); margin: 0; - font-size: 0.9rem; - padding: 0.5rem 0; + font-size: 0.85rem; + padding: 0.35rem 0; + + &.small { + opacity: 0.6; + } +} + +.select-all-container { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; + justify-content: flex-end; + margin-top: 0.5rem; + + button { + font-size: 0.75rem; + padding: 0 12px; + line-height: 30px; + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } + } } -/* NEW: Search button container */ .search-container { display: flex; justify-content: flex-end; margin-top: 0.5rem; } -/* Responsive: stack on small screens */ +/* Responsive: stack columns on small screens */ @media (max-width: 768px) { - .extraction-grid { + .table-head, + .table-body { grid-template-columns: 1fr; } - .category-grid { - grid-template-columns: 1fr; - gap: 0.75rem; + .extracted-header { + grid-column: 1; + grid-row: 1; } - .keyword-input-row { - flex-direction: column; + .own-header { + grid-column: 1; + grid-row: 2; + } + + .broad-sub { + grid-column: 1; + grid-row: 3; + } + .coarse-sub { + grid-column: 1; + grid-row: 4; + } + .fine-sub { + grid-column: 1; + grid-row: 5; } .actions { + align-self: center; justify-content: flex-start; } .search-container { justify-content: flex-start; } + + .table-col { + border-right: none; /* Remove column borders on mobile */ + border-bottom: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08)); + + &:last-child { + border-bottom: none; + } + } } /* Source expansion panel */ .source-expansion { @@ -225,23 +396,22 @@ ::ng-deep .mat-expansion-panel-body { padding: 0 0.75rem 0.75rem 0.75rem; - max-height: 350px; // scrollable if content is long + max-height: 350px; overflow-y: auto; - white-space: pre-wrap; // preserve line breaks + white-space: pre-wrap; word-break: break-word; } - // Remove the default Material box-shadow for a cleaner outline look ::ng-deep .mat-expansion-panel { box-shadow: none !important; background: transparent; } - // Ripple effect on header – keep it subtle ::ng-deep .mat-expansion-panel-header:hover { background: rgba(0, 0, 0, 0.03); } } + .progress-container { margin-top: 1rem; padding: 0.5rem 0; @@ -249,6 +419,8 @@ mat-progress-bar { height: 8px; border-radius: 4px; + overflow: hidden; + animation: progressPulse 1.8s ease-in-out infinite; } .status-message { @@ -257,5 +429,32 @@ color: var(--sg-text-secondary); text-align: center; font-weight: 500; + + animation: fadeSlideIn 0.4s ease-out; + } +} + +@keyframes fadeSlideIn { + from { + opacity: 0; + transform: translateY(6px); + } + + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes progressPulse { + 0%, + 100% { + transform: scaleY(1); + opacity: 1; + } + + 50% { + transform: scaleY(1.08); + opacity: 0.9; } } diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index 1b7d6979..ec7b5f34 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -18,6 +18,7 @@ import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResp import { DestroyRef } from '@angular/core'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { KeywordWebSocketService, WsEvent } from './keywords-websocket.service'; +import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic'; type InputMode = 'url' | 'text' | 'keywords'; @Component({ @@ -92,7 +93,7 @@ export class KeywordsSearchComponent { private readonly websocketService: KeywordWebSocketService, ) { this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((event) => { - console.log('Component received event:', event); + //console.log('Component received event:', event); this.restoreStateFromQueryParams(); }); @@ -127,13 +128,6 @@ export class KeywordsSearchComponent { if (event.keywords) this.addExtractedKeyword(event.keywords); break; - // case 'result': - // console.log('RESULT:', event.result); - // this.processExtractedKeywords( - // event.result as ExtractedKeywordsResponse, - // ); - // this.isExtracting.set(false); - // break; case 'completed': console.log('COMPLETED:', event.result); this.processExtractedKeywords( @@ -167,13 +161,14 @@ export class KeywordsSearchComponent { default: console.warn('Unknown event type:', event); } - this.destroyRef.onDestroy(() => { - this.websocketService.close(); - }); + // this.destroyRef.onDestroy(() => { + // this.websocketService.close(); + // }); }); // Clear session storage on component destroy this.destroyRef.onDestroy(() => { + this.websocketService.close(); const nav = this.router.lastSuccessfulNavigation; const isReload = nav === null; if (!isReload) { @@ -306,6 +301,14 @@ export class KeywordsSearchComponent { isSearchDisabled(): boolean { return this.selectedKeywords().length === 0 || this.isExtracting(); } + onExtractKeywordsClick(): void { + if (this.isExtracting()) { + this.cancelKeywordExtraction(); + return; + } + + void this.extractKeywords(); + } addExtractedKeyword(keywords: ExtractedKeywords): void { const broad = this.extractKeywordStrings(keywords.broad_keywords); const coarse = this.extractKeywordStrings(keywords.coarse_grained); @@ -315,11 +318,42 @@ export class KeywordsSearchComponent { this.coarseKeywords.set(coarse); this.fineKeywords.set(fine); } + onKeywordRemoved( + category: 'broad' | 'coarse' | 'fine' | 'manual', + keyword: string, + ): void { + // Remove from the category list + const categoryKeywords = this.getCategoryKeywords(category); + const updatedCategoryKeywords = categoryKeywords.filter( + (k) => k !== keyword, + ); + switch (category) { + case 'broad': + this.broadKeywords.set(updatedCategoryKeywords); + break; + case 'coarse': + this.coarseKeywords.set(updatedCategoryKeywords); + break; + case 'fine': + this.fineKeywords.set(updatedCategoryKeywords); + break; + case 'manual': + this.manualKeywords.set(updatedCategoryKeywords); + break; + } + + // Remove from selected keywords if it was selected + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => k !== keyword), + ); + + this.updateQueryParams(); + } + processExtractedKeywords(result: ExtractedKeywordsResponse): void { - if (result === undefined) { + if (result === undefined || !result.results) { return; } - console.log('Processing extracted keywords:', result); const { results, source, source_content, source_url } = result; const broad = this.extractKeywordStrings(results.broad_keywords); @@ -333,13 +367,6 @@ export class KeywordsSearchComponent { this.extractionSource.set(source as InputMode); this.sourceUrl.set(source_url ?? ''); this.saveSourceToSession(); - - console.log('Extracted keywords:', { - broad, - coarse, - fine, - manual: this.manualKeywords(), - }); // Keep only selected keywords that still exist in any category (including manual) const allExtracted = [ ...broad, @@ -381,15 +408,29 @@ export class KeywordsSearchComponent { } } + cancelKeywordExtraction(): void { + this.websocketService.close(); + this.isExtracting.set(false); + this.progress.set(0); + this.statusMessage.set('Extraktion abgebrochen'); + } + search(): void { console.log('searching for keywords:', this.selectedKeywords()); // e.g. navigate to search results page // this.router.navigate(['/search'], { queryParams: { keywords: this.selectedKeywords().join(',') } }); } - private extractKeywordStrings(items: any[] | undefined): string[] { + private extractKeywordStrings(items: KeywordEntryWithTopic[]): string[] { return this.uniqueKeywords( - (items ?? []).map((kw) => kw.keyword?.trim() ?? '').filter((kw) => !!kw), + (items ?? []) + .map((item) => { + const openalexKeyword = (item as any).topic_mapping?.keyword?.trim(); + const llmKeyword = (item as any).llm_keyword?.keyword?.trim(); + // return openalexKeyword || llmKeyword || ''; + return openalexKeyword || ''; + }) + .filter((kw) => !!kw), ); } @@ -454,7 +495,6 @@ export class KeywordsSearchComponent { sourceContent: this.sourceContent(), sourceUrl: this.sourceUrl(), }; - console.log(data); sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); } -- 2.56.1 From 647eb55a8875b08c73764231a8fbb0a9c1c6c1f2 Mon Sep 17 00:00:00 2001 From: genja Date: Thu, 2 Jul 2026 10:27:56 +0200 Subject: [PATCH 38/43] hardcoded basePath (temporary) --- .../app/modules/keywords-search/keywords-websocket.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts index b1989c5c..86622360 100644 --- a/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts +++ b/webapp/src/app/modules/keywords-search/keywords-websocket.service.ts @@ -34,7 +34,7 @@ export class KeywordWebSocketService extends BaseService { ) { super(basePath, configuration); this.url = - `${this.configuration?.basePath ?? 'http://localhost:8000'}/api/inse-service/keywords/extract/ws`.replace( + `${'http://localhost:8000'}/api/inse-service/keywords/extract/ws`.replace( /^http/, 'ws', ); -- 2.56.1 From aaab04596d80065f8f67bc4b88b8e71c8e7293e0 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:53:52 +0200 Subject: [PATCH 39/43] translated status messaged on german --- service/src/main/inse/keywords/logic.py | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/service/src/main/inse/keywords/logic.py b/service/src/main/inse/keywords/logic.py index b2017297..904b1e31 100644 --- a/service/src/main/inse/keywords/logic.py +++ b/service/src/main/inse/keywords/logic.py @@ -134,23 +134,23 @@ async def extract_keywords_stream( ) -> ExtractedKeywordsResponse: start_time = time.time() timeout_seconds = 60 # configurable - await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + await emit(KeywordsWsEvent(type="status", step="started", message="Starte Keyword-Extraktion").model_dump()) if mode == "url": - await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump()) text = await _get_text_content(query) - await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: text = query - await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Empfangen {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT user_prompt = "\nNow analyze the following text and return ONLY the JSON object.\n" if limit: user_prompt += f"\nExtract exactly {limit} keywords for each level (broad, coarse, fine).\n" user_prompt += f"\nInput:\n{text}" - await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extrahiere Keywords...").model_dump()) LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") @@ -234,7 +234,7 @@ async def extract_keywords_stream( await emit(KeywordsWsEvent(type="error", message="LLM call failed or returned no content").model_dump()) raise RuntimeError("LLM streaming call returned empty content") - await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Bearbeite Ergebnisse").model_dump()) try: keywords_json = json.loads(keywords) @@ -270,16 +270,16 @@ async def extract_keywords_stream_enriched( ) -> ExtractedKeywordsResponse: start_time = time.time() timeout_seconds = 120 - await emit(KeywordsWsEvent(type="status", step="started", message="Starting keyword extraction").model_dump()) + await emit(KeywordsWsEvent(type="status", step="started", message="Starte Keyword-Extraktion").model_dump()) if mode == "url": - await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Fetching content from {query}").model_dump()) + await emit(KeywordsWsEvent(type="status", step="fetching_url", message=f"Extrahiere Inhalt von {query}").model_dump()) text = await _get_text_content(query) - await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extracted {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="content_extracted", message=f"Extrahiert {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_WEBSITE_KEYWORDS_PROMPT else: text = query - await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Received {len(text)} characters").model_dump()) + await emit(KeywordsWsEvent(type="status", step="text_received", message=f"Empfangen {len(text)} Zeichen").model_dump()) system_prompt = KeywordsPrompt.EXTRACT_KEYWORDS_TEXT_PROMPT user_prompt = "\nNow analyze the following text.\n" @@ -287,7 +287,7 @@ async def extract_keywords_stream_enriched( user_prompt += f"\nExtract exactly {limit} keywords for each level.\n" user_prompt += f"\nInput:\n{text}" - await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extracting keywords...").model_dump()) + await emit(KeywordsWsEvent(type="status", step="calling_llm", message="Extrahiere Keywords...").model_dump()) LEVELS = ("broad_keywords", "coarse_grained", "fine_grained") @@ -365,7 +365,7 @@ async def extract_keywords_stream_enriched( KeywordsWsEvent( type="status", step="enriching", - message=f"Enriching keyword '{keyword_text}' at level '{level}'", + message=f"Bearbeite keyword'{keyword_text}'", ).model_dump() ) task = asyncio.create_task(get_openalex_topic(level, idx, confirmed[level][idx].llm_keyword)) @@ -410,7 +410,7 @@ async def extract_keywords_stream_enriched( raise # ---------- Finalize ---------- - await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Parsing response").model_dump()) + await emit(KeywordsWsEvent(type="status", step="parsing_response", message="Bearbeite Ergebnisse").model_dump()) try: keywords_json = json.loads(keywords) -- 2.56.1 From f19059164ebbd14bd4d48a332bab7201e84ddc84 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:54:21 +0200 Subject: [PATCH 40/43] added simple shared topic autocompletion component --- .../topic-autocomplete.component.html | 59 +++++++++ .../topic-autocomplete.component.scss | 16 +++ .../topic-autocomplete.component.ts | 123 ++++++++++++++++++ 3 files changed, 198 insertions(+) create mode 100644 webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html create mode 100644 webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss create mode 100644 webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html new file mode 100644 index 00000000..e7a2f20f --- /dev/null +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.html @@ -0,0 +1,59 @@ +
+ + {{ label() }} + + + @if (searchControl.value.trim()) { + + } + + @if (searchControl.value) { + + } + + + @if (loading()) { + + + Lade Themen... + + } + + @for (topic of topics(); track topic) { + {{ topic }} + } + + @if ( + !loading() && + searchControl.value.trim().length >= minCharacters() && + topics().length === 0 + ) { + Keine passenden Themen gefunden. + } + + +
diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss new file mode 100644 index 00000000..e8769993 --- /dev/null +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.scss @@ -0,0 +1,16 @@ +:host { + width: 100%; +} + +.topic-autocomplete { + width: 100%; +} + +mat-form-field { + width: 100%; +} + +.topic-field { + width: 100%; + min-width: 320px; +} diff --git a/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts new file mode 100644 index 00000000..6b14edd7 --- /dev/null +++ b/webapp/src/app/shared/ui/topic-autocomplete/topic-autocomplete.component.ts @@ -0,0 +1,123 @@ +import { CommonModule } from '@angular/common'; +import { Component, DestroyRef, input, output, signal } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatButtonModule } from '@angular/material/button'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatIconModule } from '@angular/material/icon'; +import { MatInputModule } from '@angular/material/input'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { TopicsService } from '../../../api/api/topics.service'; +import { EventEmitter } from '@angular/core'; +import { + catchError, + debounceTime, + distinctUntilChanged, + finalize, + map, + of, + switchMap, +} from 'rxjs'; + +@Component({ + selector: 'app-topic-autocomplete', + standalone: true, + imports: [ + CommonModule, + ReactiveFormsModule, + MatAutocompleteModule, + MatButtonModule, + MatFormFieldModule, + MatIconModule, + MatInputModule, + MatProgressSpinnerModule, + ], + templateUrl: './topic-autocomplete.component.html', + styleUrl: './topic-autocomplete.component.scss', +}) +export class TopicAutocompleteComponent { + readonly label = input('Thema'); + readonly placeholder = input('Thema suchen oder eintippen...'); + readonly minCharacters = input(2); + readonly limit = input(12); + + readonly topicSelected = output(); + + readonly searchControl = new FormControl('', { nonNullable: true }); + readonly topics = signal([]); + readonly loading = signal(false); + + constructor( + private readonly topicsService: TopicsService, + private readonly destroyRef: DestroyRef, + ) { + this.searchControl.valueChanges + .pipe( + debounceTime(250), + distinctUntilChanged(), + switchMap((query) => { + const normalizedQuery = query.trim(); + if (normalizedQuery.length < this.minCharacters()) { + this.loading.set(false); + return of([] as string[]); + } + + this.loading.set(true); + return this.topicsService + .autocompleteTopics( + normalizedQuery, + undefined, + undefined, + undefined, + this.limit(), + ) + .pipe( + map((response) => + Array.from( + new Set( + (response.results ?? []) + .map((topic) => topic.display_name?.trim() ?? '') + .filter((topic) => !!topic), + ), + ), + ), + catchError((error) => { + console.error( + 'Error fetching topic autocomplete options:', + error, + ); + return of([] as string[]); + }), + finalize(() => this.loading.set(false)), + ); + }), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe((topics) => { + this.topics.set(topics); + }); + } + + selectTopic(topic: string): void { + this.searchControl.setValue('', { emitEvent: false }); + this.topics.set([]); + this.topicSelected.emit(topic); + } + onKeydownTab(event: KeyboardEvent): void { + event.preventDefault(); + this.searchControl.setValue(this.topics()[0], { emitEvent: false }); + } + submitCurrentValue(): void { + const topic = this.searchControl.value.trim(); + if (!topic) return; + this.searchControl.setValue('', { emitEvent: false }); + this.topics.set([]); + this.topicSelected.emit(topic); + } + + clear(): void { + this.searchControl.setValue(''); + this.topics.set([]); + } +} -- 2.56.1 From f8228c5ea7d61ba5f249b8bc516c60e6d3594cc5 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:54:56 +0200 Subject: [PATCH 41/43] added click event on keywords to navigate to keywords component --- .../app/modules/news-detail/news-detail.component.html | 9 ++++++--- .../src/app/modules/news-detail/news-detail.component.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/webapp/src/app/modules/news-detail/news-detail.component.html b/webapp/src/app/modules/news-detail/news-detail.component.html index cdb886cf..d1bd9864 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.html +++ b/webapp/src/app/modules/news-detail/news-detail.component.html @@ -116,9 +116,12 @@ track keyword; let i = $index ) { - {{ - keyword - }} + {{ keyword }} } } @else {

Keine Schlüsselwörter gefunden.

diff --git a/webapp/src/app/modules/news-detail/news-detail.component.ts b/webapp/src/app/modules/news-detail/news-detail.component.ts index e93ec298..8f721f20 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.ts +++ b/webapp/src/app/modules/news-detail/news-detail.component.ts @@ -6,7 +6,7 @@ import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; - +import { Router } from '@angular/router'; import { WorksService } from '../../api'; interface MentionedPerson { @@ -45,6 +45,7 @@ export class NewsDetailComponent implements OnInit { private readonly httpClient = inject(HttpClient); private readonly worksService = inject(WorksService); private readonly location = inject(Location); + private readonly router = inject(Router); article: NewsArticleDetail | null = null; loading = false; @@ -70,7 +71,11 @@ export class NewsDetailComponent implements OnInit { navigateBack(): void { this.location.back(); } - + onKeywordClick(keyword: string): void { + this.router.navigate(['/keywords'], { + queryParams: { selected: keyword, manual: keyword }, + }); + } formatDate(dateStr?: string | null): string { if (!dateStr) return '-'; const date = new Date(dateStr); -- 2.56.1 From 25988d6c46abd0c8d56b91fe5e4e3b286c297927 Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:56:43 +0200 Subject: [PATCH 42/43] added keywords enrichment, refactored --- .../keywords-search.component.ts | 724 ++++++++++++------ 1 file changed, 491 insertions(+), 233 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.ts b/webapp/src/app/modules/keywords-search/keywords-search.component.ts index ec7b5f34..cbe0cce0 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -1,4 +1,10 @@ -import { Component, signal, computed } from '@angular/core'; +import { + Component, + computed, + signal, + Signal, + WritableSignal, +} from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; @@ -18,8 +24,13 @@ import { ExtractedKeywordsResponse } from '../../api/model/extractedKeywordsResp import { DestroyRef } from '@angular/core'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { KeywordWebSocketService, WsEvent } from './keywords-websocket.service'; +import { TopicsService } from '../../api/api/topics.service'; +import { KeywordsTopicsRequest } from '../../api/model/keywordsTopicsRequest'; import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic'; -type InputMode = 'url' | 'text' | 'keywords'; +import { TopicAutocompleteComponent } from '../../shared/ui/topic-autocomplete/topic-autocomplete.component'; + +type InputMode = 'url' | 'text'; +type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual'; @Component({ selector: 'app-keywords-search', @@ -35,6 +46,7 @@ type InputMode = 'url' | 'text' | 'keywords'; MatCardModule, MatExpansionModule, MatProgressBarModule, + TopicAutocompleteComponent, ], templateUrl: './keywords-search.component.html', styleUrl: './keywords-search.component.scss', @@ -44,33 +56,61 @@ export class KeywordsSearchComponent { selectedInputType: 'url' as InputMode, urlInput: '', textInput: '', - keywordInput: '', }); private readonly SESSION_KEY = 'keywords-search-source'; - // Category signals - readonly broadKeywords = signal([]); - readonly coarseKeywords = signal([]); - readonly fineKeywords = signal([]); - readonly manualKeywords = signal([]); + + // Category signals - the full backend entries are the source of truth; + // the *Keywords() computed signals below just project the label out of them. + private readonly broadKeywordEntries = signal([]); + private readonly coarseKeywordEntries = signal([]); + private readonly fineKeywordEntries = signal([]); + private readonly manualKeywordEntries = signal([]); + + readonly broadKeywords = computed(() => + this.broadKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); + readonly coarseKeywords = computed(() => + this.coarseKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); + readonly fineKeywords = computed(() => + this.fineKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); + readonly manualKeywords = computed(() => + this.manualKeywordEntries().map((item) => this.getKeywordLabel(item)), + ); readonly selectedKeywords = signal([]); readonly isExtracting = signal(false); - readonly extractionSource = signal(null); - readonly selectedBroadKeywords = computed(() => - this.selectedKeywords().filter((k) => this.broadKeywords().includes(k)), - ); - readonly selectedCoarseKeywords = computed(() => - this.selectedKeywords().filter((k) => this.coarseKeywords().includes(k)), - ); - readonly selectedFineKeywords = computed(() => - this.selectedKeywords().filter((k) => this.fineKeywords().includes(k)), - ); - readonly selectedManualKeywords = computed(() => - this.selectedKeywords().filter((k) => this.manualKeywords().includes(k)), - ); + // Single place mapping a category name to its label signal and its + // backing entries signal. Replaces four near-identical computed()s and + // a category switch statement that used to live below. + private readonly categoryKeywordsMap: Record< + KeywordCategory, + Signal + > = { + broad: this.broadKeywords, + coarse: this.coarseKeywords, + fine: this.fineKeywords, + manual: this.manualKeywords, + }; + private readonly categoryEntriesMap: Record< + KeywordCategory, + WritableSignal + > = { + broad: this.broadKeywordEntries, + coarse: this.coarseKeywordEntries, + fine: this.fineKeywordEntries, + manual: this.manualKeywordEntries, + }; + + readonly selectedBroadKeywords = this.selectedInCategory('broad'); + readonly selectedCoarseKeywords = this.selectedInCategory('coarse'); + readonly selectedFineKeywords = this.selectedInCategory('fine'); + readonly selectedManualKeywords = this.selectedInCategory('manual'); + readonly extractedKeywordsExist = computed( () => this.broadKeywords().length > 0 || @@ -83,126 +123,224 @@ export class KeywordsSearchComponent { private isRestoringState = false; + // Set right before we call router.navigate() ourselves (from + // updateQueryParams()). Lets the queryParamMap subscription below tell + // "we just wrote this URL" apart from "someone else navigated here" (a + // fresh mount, a deep link such as ?selected=x&manual=y from another + // page, a manual URL edit, browser back/forward). Only the latter should + // trigger a full restoreStateFromQueryParams(). + private isOwnNavigation = false; + readonly progress = signal(0); readonly statusMessage = signal(''); + constructor( private readonly formBuilder: FormBuilder, private readonly route: ActivatedRoute, private readonly router: Router, private readonly destroyRef: DestroyRef, private readonly websocketService: KeywordWebSocketService, + private readonly topicsService: TopicsService, ) { - this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((event) => { - //console.log('Component received event:', event); + this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe(() => { + if (this.isOwnNavigation) { + // This emission is just the router confirming the navigation we + // triggered ourselves in updateQueryParams(); our signals are + // already correct, so skip re-deriving state from the URL. + this.isOwnNavigation = false; + return; + } this.restoreStateFromQueryParams(); }); this.form.controls.selectedInputType.valueChanges .pipe(distinctUntilChanged(), takeUntilDestroyed()) - .subscribe(() => { - this.updateQueryParams(); - }); + .subscribe(() => this.updateQueryParams()); this.form.controls.urlInput.valueChanges .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) - .subscribe(() => { - this.updateQueryParams(); - }); + .subscribe(() => this.updateQueryParams()); this.form.controls.textInput.valueChanges .pipe(debounceTime(400), distinctUntilChanged(), takeUntilDestroyed()) - .subscribe(() => { - this.updateQueryParams(); - }); + .subscribe(() => this.updateQueryParams()); - //get streamed data - this.websocketService.getMessages().subscribe((event: WsEvent) => { - switch (event.type) { - case 'status': - console.log('STATUS:', event.step, event.message); - this.statusMessage.set(event.message || ''); - this.progress.set(this.getProgressForStep(event.step || '')); - break; - case 'keywords': - console.log('KEYWORDS:', event.keywords); - if (event.keywords) this.addExtractedKeyword(event.keywords); - break; + this.websocketService + .getMessages() + .subscribe((event: WsEvent) => this.handleWsEvent(event)); - case 'completed': - console.log('COMPLETED:', event.result); - this.processExtractedKeywords( - event.result as ExtractedKeywordsResponse, - ); - this.isExtracting.set(false); - this.progress.set(100); - this.statusMessage.set('Fertig!'); - this.websocketService.close(); - this.isExtracting.set(false); - break; - - case 'error': - console.error('ERROR:', event.message); - this.progress.set(0); - this.statusMessage.set('Fehler: ' + event.message); - this.broadKeywords.set([]); - this.coarseKeywords.set([]); - this.fineKeywords.set([]); - this.websocketService.close(); - this.isExtracting.set(false); - // Keep manual, but remove selected that are not in manual - this.selectedKeywords.set( - this.selectedKeywords().filter((k) => - this.manualKeywords().includes(k), - ), - ); - // extractionSource stays as it was (or reset? we keep it) - this.updateQueryParams(); - break; - default: - console.warn('Unknown event type:', event); - } - // this.destroyRef.onDestroy(() => { - // this.websocketService.close(); - // }); - }); - - // Clear session storage on component destroy + // Clear session storage on component destroy, unless this is a page + // reload (in which case we want the cache to survive). this.destroyRef.onDestroy(() => { this.websocketService.close(); - const nav = this.router.lastSuccessfulNavigation; - const isReload = nav === null; + const isReload = this.router.lastSuccessfulNavigation === null; if (!isReload) { this.clearSourceFromSession(); } }); } + // --- Websocket event handling --------------------------------------- + + private handleWsEvent(event: WsEvent): void { + switch (event.type) { + case 'status': + this.handleStatusEvent(event); + break; + case 'keywords': + if (event.keywords) this.addExtractedKeyword(event.keywords); + break; + case 'completed': + this.handleCompletedEvent(event); + break; + case 'error': + this.handleErrorEvent(event); + break; + } + } + + private handleStatusEvent(event: WsEvent): void { + this.statusMessage.set(event.message || ''); + this.progress.set(this.getProgressForStep(event.step || '')); + } + + private handleCompletedEvent(event: WsEvent): void { + this.processExtractedKeywords(event.result as ExtractedKeywordsResponse); + this.progress.set(100); + this.statusMessage.set('Fertig!'); + this.websocketService.close(); + this.isExtracting.set(false); + } + + private handleErrorEvent(event: WsEvent): void { + this.progress.set(0); + this.statusMessage.set('Fehler: ' + event.message); + this.broadKeywordEntries.set([]); + this.coarseKeywordEntries.set([]); + this.fineKeywordEntries.set([]); + this.websocketService.close(); + this.isExtracting.set(false); + // Keep manual, but remove selected that are not in manual + this.selectedKeywords.set( + this.selectedKeywords().filter((k) => this.manualKeywords().includes(k)), + ); + this.updateQueryParams(); + } + + // --- Topic enrichment -------------------------------------------------- + + enrichManualKeywordsWithTopics(keywords: string[]): void { + if (keywords.length === 0) return; + + const currentEntries = this.manualKeywordEntries(); + const entriesByKeyword = new Map( + currentEntries.map((e) => [ + this.normalizeKeyword(e.llm_keyword.keyword), + e, + ]), + ); + + const toEnrich = keywords.filter((k) => { + const entry = entriesByKeyword.get(this.normalizeKeyword(k)); + return entry && !entry.topic_mapping?.topic; + }); + if (toEnrich.length === 0) return; + + const request: KeywordsTopicsRequest = { keywords: toEnrich }; + + this.topicsService.vectorSearchTopicsBatch(request).subscribe({ + next: ({ results }) => { + const current = this.manualKeywordEntries(); + const resultMap = new Map( + results.map((r) => [this.normalizeKeyword(r.keyword), r]), + ); + + const updated = current.map((entry) => { + const normalized = this.normalizeKeyword(entry.llm_keyword.keyword); + const enriched = resultMap.get(normalized); + if (enriched && !entry.topic_mapping?.topic) { + return { + ...entry, + topic_mapping: { + keyword: entry.llm_keyword.keyword, + topic: enriched.topic, + }, + }; + } + return entry; + }); + + this.manualKeywordEntries.set(updated); + this.updateQueryParams(); + }, + error: (error) => { + console.error('Error enriching topics:', error); + }, + }); + } + + // --- Tabs --------------------------------------------------------------- + selectedTabIndex(): number { - const mode = this.form.controls.selectedInputType.value; - if (mode === 'text') return 1; - if (mode === 'keywords') return 2; - return 0; + return this.form.controls.selectedInputType.value === 'text' ? 1 : 0; } onTabChange(index: number): void { - const nextMode: InputMode = - index === 1 ? 'text' : index === 2 ? 'keywords' : 'url'; + const nextMode: InputMode = index === 1 ? 'text' : 'url'; this.form.controls.selectedInputType.setValue(nextMode); } - // Add manually from Keywords tab - addKeywordFromInput(): void { - const keyword = this.form.controls.keywordInput.value.trim(); - if (!keyword) return; + // --- Keyword selection & manual entry ------------------------------------ - this.manualKeywords.set( - this.uniqueKeywords([...this.manualKeywords(), keyword]), - ); - this.selectedKeywords.set( - this.uniqueKeywords([...this.selectedKeywords(), keyword]), - ); - this.form.controls.keywordInput.setValue(''); - this.updateQueryParams(); + private keywordExists(keyword: string): boolean { + const normalized = this.normalizeKeyword(keyword); + return [ + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), + ...this.manualKeywords(), + ].some((k) => this.normalizeKeyword(k) === normalized); + } + + // Add manually from Keywords tab + addKeywordFromInput(keyword: string): void { + const normalizedKeyword = keyword.trim(); + if (!normalizedKeyword) return; + + if (this.keywordExists(normalizedKeyword)) { + this.statusMessage.set(`"${normalizedKeyword}" ist bereits vorhanden.`); + return; + } + + this.topicsService.vectorSearchTopics(normalizedKeyword).subscribe({ + next: ({ results }) => { + const newEntry: KeywordEntryWithTopic = { + llm_keyword: { + keyword: normalizedKeyword, + relevance_score: 1, + }, + topic_mapping: { + keyword: normalizedKeyword, + topic: results?.[0], + }, + }; + + const updated = this.uniqueKeywordEntries([ + ...this.manualKeywordEntries(), + newEntry, + ]); + + this.manualKeywordEntries.set(updated); + this.selectedKeywords.set([ + ...this.selectedKeywords(), + normalizedKeyword, + ]); + + // Explicit enrichment trigger for new keywords + this.enrichManualKeywordsWithTopics([normalizedKeyword]); + this.updateQueryParams(); + }, + }); } removeSelectedKeyword(keyword: string): void { @@ -213,15 +351,15 @@ export class KeywordsSearchComponent { } onCategoryChange( - category: 'broad' | 'coarse' | 'fine' | 'manual', + category: KeywordCategory, event: MatChipListboxChange, ): void { const newSelection = (event.value as string[]) || []; - const otherCategories = ['broad', 'coarse', 'fine', 'manual'].filter( - (c) => c !== category, - ); + const otherCategories = ( + Object.keys(this.categoryKeywordsMap) as KeywordCategory[] + ).filter((c) => c !== category); const otherSelected = otherCategories.flatMap((c) => { - const keywords = this.getCategoryKeywords(c); + const keywords = this.categoryKeywordsMap[c](); return this.selectedKeywords().filter((k) => keywords.includes(k)); }); const updated = [...otherSelected, ...newSelection]; @@ -229,21 +367,6 @@ export class KeywordsSearchComponent { this.updateQueryParams(); } - private getCategoryKeywords(category: string): string[] { - switch (category) { - case 'broad': - return this.broadKeywords(); - case 'coarse': - return this.coarseKeywords(); - case 'fine': - return this.fineKeywords(); - case 'manual': - return this.manualKeywords(); - default: - return []; - } - } - selectAllExtracted(): void { const all = [ ...this.selectedManualKeywords(), @@ -256,18 +379,19 @@ export class KeywordsSearchComponent { } deselectAllExtracted(): void { - const manual = this.selectedManualKeywords(); - this.selectedKeywords.set(this.uniqueKeywords(manual)); + this.selectedKeywords.set( + this.uniqueKeywords(this.selectedManualKeywords()), + ); this.updateQueryParams(); } clearExtractedKeywords(): void { - this.broadKeywords.set([]); - this.coarseKeywords.set([]); - this.fineKeywords.set([]); + this.broadKeywordEntries.set([]); + this.coarseKeywordEntries.set([]); + this.fineKeywordEntries.set([]); this.sourceContent.set(''); this.sourceUrl.set(null); - this.clearSourceFromSession(); + // Keep only selected keywords that are in the manual list const manualSet = new Set(this.manualKeywords()); this.selectedKeywords.set( @@ -277,6 +401,9 @@ export class KeywordsSearchComponent { // Reset the extraction source (no extracted keywords left) this.extractionSource.set(null); + // updateQueryParams() persists this cleared state to sessionStorage too + // (see saveSourceToSession() call inside it), so there's no need to + // separately wipe the session key here. this.updateQueryParams(); } @@ -288,110 +415,70 @@ export class KeywordsSearchComponent { ]; return allExtracted.every((k) => this.selectedKeywords().includes(k)); } - // isExtractionSourceMatch() { - // console.log( - // this.extractionSource(), - // this.form.controls.selectedInputType.value, - // ); - // return ( - // this.form.controls.selectedInputType.value === this.extractionSource() || - // this.form.controls.selectedInputType.value === 'keywords' - // ); - // } + isSearchDisabled(): boolean { return this.selectedKeywords().length === 0 || this.isExtracting(); } + onExtractKeywordsClick(): void { if (this.isExtracting()) { this.cancelKeywordExtraction(); return; } - void this.extractKeywords(); } + addExtractedKeyword(keywords: ExtractedKeywords): void { - const broad = this.extractKeywordStrings(keywords.broad_keywords); - const coarse = this.extractKeywordStrings(keywords.coarse_grained); - const fine = this.extractKeywordStrings(keywords.fine_grained); - - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); + this.applyExtractedKeywords(keywords); } - onKeywordRemoved( - category: 'broad' | 'coarse' | 'fine' | 'manual', - keyword: string, - ): void { - // Remove from the category list - const categoryKeywords = this.getCategoryKeywords(category); - const updatedCategoryKeywords = categoryKeywords.filter( - (k) => k !== keyword, - ); - switch (category) { - case 'broad': - this.broadKeywords.set(updatedCategoryKeywords); - break; - case 'coarse': - this.coarseKeywords.set(updatedCategoryKeywords); - break; - case 'fine': - this.fineKeywords.set(updatedCategoryKeywords); - break; - case 'manual': - this.manualKeywords.set(updatedCategoryKeywords); - break; - } - // Remove from selected keywords if it was selected + onKeywordRemoved(category: KeywordCategory, keyword: string): void { + const entries = this.categoryEntriesMap[category]; + entries.set(this.filterKeywordEntries(entries(), keyword)); + this.selectedKeywords.set( this.selectedKeywords().filter((k) => k !== keyword), ); - this.updateQueryParams(); } processExtractedKeywords(result: ExtractedKeywordsResponse): void { - if (result === undefined || !result.results) { - return; - } + if (result === undefined || !result.results) return; + const { results, source, source_content, source_url } = result; - const broad = this.extractKeywordStrings(results.broad_keywords); - const coarse = this.extractKeywordStrings(results.coarse_grained); - const fine = this.extractKeywordStrings(results.fine_grained); - - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); + this.applyExtractedKeywords(results); this.sourceContent.set(source_content); this.extractionSource.set(source as InputMode); this.sourceUrl.set(source_url ?? ''); - this.saveSourceToSession(); + // Keep only selected keywords that still exist in any category (including manual) const allExtracted = [ - ...broad, - ...coarse, - ...fine, + ...this.broadKeywords(), + ...this.coarseKeywords(), + ...this.fineKeywords(), ...this.manualKeywords(), ]; this.selectedKeywords.set( this.selectedKeywords().filter((k) => allExtracted.includes(k)), ); + // updateQueryParams() also calls saveSourceToSession() - no need to call + // it separately here. this.updateQueryParams(); } + async extractKeywords(): Promise { this.clearExtractedKeywords(); const query = this.getCurrentExtractionQuery(); if (!query) return; - // Reset progress and status this.progress.set(0); this.statusMessage.set('Starte Extraktion...'); const currentMode = this.form.controls.selectedInputType.value; const keywordsRequest: KeywordsRequest = { - query: query, + query, mode: currentMode, limit: undefined, }; @@ -416,56 +503,168 @@ export class KeywordsSearchComponent { } search(): void { - console.log('searching for keywords:', this.selectedKeywords()); - // e.g. navigate to search results page - // this.router.navigate(['/search'], { queryParams: { keywords: this.selectedKeywords().join(',') } }); + const payload = { + extractedKeywords: this.getSelectedExtractedKeywordEntries(), + manualKeywords: this.getSelectedManualKeywordEntries(), + keywords: this.selectedKeywords(), + }; + + console.log('searching for keywords:', payload); + // e.g. navigate to search results page with the full payload in navigation state + // this.router.navigate(['/search'], { state: payload }); } - private extractKeywordStrings(items: KeywordEntryWithTopic[]): string[] { - return this.uniqueKeywords( - (items ?? []) - .map((item) => { - const openalexKeyword = (item as any).topic_mapping?.keyword?.trim(); - const llmKeyword = (item as any).llm_keyword?.keyword?.trim(); - // return openalexKeyword || llmKeyword || ''; - return openalexKeyword || ''; - }) - .filter((kw) => !!kw), + // --- Helpers -------------------------------------------------------------- + + private selectedInCategory(category: KeywordCategory): Signal { + return computed(() => + this.selectedKeywords().filter((k) => + this.categoryKeywordsMap[category]().includes(k), + ), ); } - // State restoration from URL + private applyExtractedKeywords(keywords: ExtractedKeywords): void { + const seenKeywords = new Set( + this.manualKeywords().map((keyword) => this.normalizeKeyword(keyword)), + ); + this.broadKeywordEntries.set( + this.uniqueKeywordEntries(keywords.broad_keywords, seenKeywords), + ); + this.coarseKeywordEntries.set( + this.uniqueKeywordEntries(keywords.coarse_grained, seenKeywords), + ); + this.fineKeywordEntries.set( + this.uniqueKeywordEntries(keywords.fine_grained, seenKeywords), + ); + } + + private getSelectedExtractedKeywordEntries(): KeywordEntryWithTopic[] { + const selected = new Set( + this.selectedKeywords().map((k) => this.normalizeKeyword(k)), + ); + return [ + ...this.broadKeywordEntries(), + ...this.coarseKeywordEntries(), + ...this.fineKeywordEntries(), + ].filter((item) => + selected.has(this.normalizeKeyword(this.getKeywordLabel(item))), + ); + } + + private getSelectedManualKeywordEntries(): KeywordEntryWithTopic[] { + const selected = new Set( + this.selectedKeywords().map((k) => this.normalizeKeyword(k)), + ); + return this.manualKeywordEntries().filter((item) => + selected.has(this.normalizeKeyword(this.getKeywordLabel(item))), + ); + } + + private filterKeywordEntries( + items: KeywordEntryWithTopic[], + keyword: string, + ): KeywordEntryWithTopic[] { + const normalized = this.normalizeKeyword(keyword); + return items.filter( + (item) => + this.normalizeKeyword(this.getKeywordLabel(item)) !== normalized, + ); + } + + private getKeywordLabel(item: KeywordEntryWithTopic): string { + return item.llm_keyword.keyword.trim(); + } + + private keywordEntriesFromStrings( + keywords: string[], + seenKeywords: Set = new Set(), + ): KeywordEntryWithTopic[] { + const entries: KeywordEntryWithTopic[] = []; + + for (const keyword of this.uniqueKeywords(keywords)) { + const normalized = this.normalizeKeyword(keyword); + if (!normalized || seenKeywords.has(normalized)) continue; + + seenKeywords.add(normalized); + entries.push({ + llm_keyword: { keyword, relevance_score: 0 }, + topic_mapping: null, + }); + } + + return entries; + } + + private uniqueKeywordEntries( + items: KeywordEntryWithTopic[], + seenKeywords: Set = new Set(), + ): KeywordEntryWithTopic[] { + const uniqueItems: KeywordEntryWithTopic[] = []; + for (const item of items ?? []) { + const normalized = this.normalizeKeyword(this.getKeywordLabel(item)); + if (!normalized || seenKeywords.has(normalized)) continue; + + seenKeywords.add(normalized); + uniqueItems.push(item); + } + return uniqueItems; + } + + // --- URL <-> state sync ----------------------------------------------- + restoreStateFromQueryParams(): void { const queryParams = this.route.snapshot.queryParamMap; const mode = this.parseMode(queryParams.get('mode')); const urlInput = queryParams.get('url') ?? ''; const textInput = queryParams.get('text') ?? ''; - const broad = this.parseKeywordList(queryParams.get('broad')); - const coarse = this.parseKeywordList(queryParams.get('coarse')); - const fine = this.parseKeywordList(queryParams.get('fine')); const manual = this.parseKeywordList(queryParams.get('manual')); const selected = this.parseKeywordList(queryParams.get('selected')); const source = queryParams.get('source') ?? ''; + this.isRestoringState = true; + this.form.patchValue( - { - selectedInputType: mode, - urlInput, - textInput, - }, + { selectedInputType: mode, urlInput, textInput }, { emitEvent: false }, ); - this.broadKeywords.set(broad); - this.coarseKeywords.set(coarse); - this.fineKeywords.set(fine); - this.manualKeywords.set(manual); - this.selectedKeywords.set(this.uniqueKeywords(selected)); + this.extractionSource.set(source as InputMode); this.restoreSourceFromSession(); + + const merged = this.uniqueKeywordEntries([ + ...this.manualKeywordEntries(), // session restored entries + ...this.keywordEntriesFromStrings(manual), // query param entries + ]); + this.manualKeywordEntries.set(merged); + + // enrich only newly added keywords that have no topic yet + this.enrichManualKeywordsWithTopics(manual); + + // User intent (the current selection): the URL is always authoritative + // here, deliberately overriding whatever the session cache had. This + // is what makes a deep link like ?selected=foo&manual=bar from another + // page reliably preselect keywords, instead of getting merged with (or + // hidden behind) leftover state from a previous visit in the same tab. + + // clean up the selection to only include keywords that actually exist in + const manualKeywordSet = new Set( + this.manualKeywords().map((k) => this.normalizeKeyword(k)), + ); + const validSelected = selected.filter((k) => + manualKeywordSet.has(this.normalizeKeyword(k)), + ); + const selectionWasTrimmed = validSelected.length !== selected.length; + + this.selectedKeywords.set(this.uniqueKeywords(validSelected)); + this.isRestoringState = false; + + if (selectionWasTrimmed) { + this.updateQueryParams(); + } } - // Update URL query params updateQueryParams(): void { if (this.isRestoringState) return; @@ -480,42 +679,84 @@ export class KeywordsSearchComponent { selected: this.serializeKeywords(this.selectedKeywords()), }; - this.router.navigate([], { - relativeTo: this.route, - queryParams, - queryParamsHandling: 'merge', - replaceUrl: true, - }); + this.isOwnNavigation = true; + this.router + .navigate([], { + relativeTo: this.route, + queryParams, + queryParamsHandling: 'merge', + replaceUrl: true, + }) + .then((navigated) => { + // If Angular decided there was nothing to navigate (e.g. the URL + // would be identical), queryParamMap never emits, so the flag would + // otherwise stay stuck `true` and incorrectly swallow the *next* + // real external navigation. Reset it defensively in that case. + if (!navigated) { + this.isOwnNavigation = false; + } + }); + + // IMPORTANT: every state mutation flows through here, so this is also + // the single place that keeps sessionStorage in sync. Previously the + // session cache was only saved after a full extraction completed, so + // adding a manual keyword (or removing one, etc.) never updated it. The + // *next* query-param change then triggered restoreStateFromQueryParams() + // -> restoreSourceFromSession(), which overwrote the fresh manual + // keyword with that stale snapshot - making manually added keywords + // seem to vanish immediately. Saving here fixes that race. + this.saveSourceToSession(); } - // Save to sessionStorage private saveSourceToSession(): void { const data = { source: this.extractionSource(), sourceContent: this.sourceContent(), sourceUrl: this.sourceUrl(), + broadKeywordEntries: this.broadKeywordEntries(), + coarseKeywordEntries: this.coarseKeywordEntries(), + fineKeywordEntries: this.fineKeywordEntries(), + manualKeywordEntries: this.manualKeywordEntries(), }; - sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); + + try { + sessionStorage.setItem(this.SESSION_KEY, JSON.stringify(data)); + } catch (error) { + console.error('Failed to persist keyword search state:', error); + } } - // Restore from sessionStorage private restoreSourceFromSession(): void { const raw = sessionStorage.getItem(this.SESSION_KEY); if (!raw) return; + try { - const { source, sourceContent, sourceUrl } = JSON.parse(raw); + const { + source, + sourceContent, + sourceUrl, + broadKeywordEntries, + coarseKeywordEntries, + fineKeywordEntries, + manualKeywordEntries, + } = JSON.parse(raw); + this.extractionSource.set(source as InputMode); this.sourceContent.set(sourceContent ?? ''); this.sourceUrl.set(sourceUrl ?? null); + this.broadKeywordEntries.set(broadKeywordEntries ?? []); + this.coarseKeywordEntries.set(coarseKeywordEntries ?? []); + this.fineKeywordEntries.set(fineKeywordEntries ?? []); + this.manualKeywordEntries.set(manualKeywordEntries ?? []); } catch { sessionStorage.removeItem(this.SESSION_KEY); } } - // Clear sessionStorage private clearSourceFromSession(): void { sessionStorage.removeItem(this.SESSION_KEY); } + private getCurrentExtractionQuery(): string { const mode = this.form.controls.selectedInputType.value; if (mode === 'url') return this.form.controls.urlInput.value.trim(); @@ -524,8 +765,7 @@ export class KeywordsSearchComponent { } private parseMode(mode: string | null): InputMode { - if (mode === 'text' || mode === 'keywords') return mode; - return 'url'; + return mode === 'text' ? 'text' : 'url'; } private parseKeywordList(rawValue: string | null): string[] { @@ -544,23 +784,41 @@ export class KeywordsSearchComponent { } private uniqueKeywords(values: string[]): string[] { - return Array.from(new Set(values.map((v) => v.trim()).filter(Boolean))); + const uniqueValues: string[] = []; + const seenKeywords = new Set(); + + for (const value of values) { + const normalized = this.normalizeKeyword(value); + if (!normalized || seenKeywords.has(normalized)) continue; + + seenKeywords.add(normalized); + uniqueValues.push(value.trim()); + } + + return uniqueValues; + } + + private normalizeKeyword(value: string): string { + return value.trim().toLowerCase(); } private toNullableParam(value: string): string | null { const normalized = value.trim(); return normalized.length ? normalized : null; } + private getProgressForStep(step: string): number { switch (step) { case 'started': return 10; case 'fetching_url': - return 30; + return 20; case 'content_extracted': - return 60; + return 30; case 'calling_llm': - return 80; + return 40; + case 'enriching': + return 60; default: return 50; // fallback for unknown steps } -- 2.56.1 From 6dd57bfe2b2e22ea8ec88f47ded09096580ab4dd Mon Sep 17 00:00:00 2001 From: genja Date: Fri, 3 Jul 2026 10:56:51 +0200 Subject: [PATCH 43/43] ui adjusments --- .../keywords-search.component.html | 45 ++++-------- .../keywords-search.component.scss | 73 +++++++++---------- 2 files changed, 50 insertions(+), 68 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/keywords-search.component.html b/webapp/src/app/modules/keywords-search/keywords-search.component.html index 958783a6..8eb10128 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -13,16 +13,16 @@ placeholder="https://example.com/article" [formControl]="form.controls.urlInput" /> -
- -
+
@@ -126,31 +126,14 @@
+ -
- - z. B. Knowledge Graphs - - - -
@if (manualKeywords().length > 0) { @for (keyword of manualKeywords(); track keyword) {