diff --git a/service/README.md b/service/README.md index ca09165c..25961c24 100644 --- a/service/README.md +++ b/service/README.md @@ -15,3 +15,34 @@ This mounts the source directory into the container and enables uvicorn hot-relo ## Testing Run tests: `./gradlew :service:test` + +## Scripts + +### index_org_patents.py + +Builds the `org_patents` Elasticsearch index for a given institution: fetches its +OpenAlex authors, searches EPO/USPTO for patents matched via institution assignee +and/or inventor name, and reindexes. Each patent is tagged with a `match_type` +(`institution`, `name`, or `both`, the latter being highest confidence). For common +inventor names, a name match is only kept if the assignee is the institution itself or +the person, to avoid pulling in unrelated patents via a shared name. + +```bash +python scripts/index_org_patents.py --institution-id +``` + +**Example — University of Duisburg-Essen:** + +```bash +python scripts/index_org_patents.py --institution-id I62318514 +``` + +The OpenAlex institution ID appears in the app URL, e.g. `/institution/I62318514/overview`. + +**Runtime:** ~30–40 minutes for large institutions (author count is the main driver). +Re-running is safe — existing documents for the institution are deleted (via search + +`_bulk` delete-by-id, not `_delete_by_query`, which the patent-cluster API key rejects) +before reindexing, so stale documents don't linger. + +**Note:** This script is intended to be integrated into an Admin Panel in a later sprint, +so that organisation admins can trigger the indexing as a background job via the UI. diff --git a/service/scripts/build_patents_openalex_keywords.py b/service/scripts/build_patents_openalex_keywords.py new file mode 100644 index 00000000..606660a3 --- /dev/null +++ b/service/scripts/build_patents_openalex_keywords.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 +""" +build_patents_openalex_keywords.py — Build IPC/CPC → OpenAlex topic/keyword matches. + +Fetches IPC/CPC metadata from the `ipc` index, matches labels against OpenAlex topics +(from topic_hierarchy_cache.json) and keywords (from openalex-topics) using +SentenceTransformer embeddings, then writes results to the patents_openalex_keywords +Elasticsearch index and a local JSON backup. + +Usage: + python scripts/build_patents_openalex_keywords.py + python scripts/build_patents_openalex_keywords.py --top-k 3 --min-score 0.55 + python scripts/build_patents_openalex_keywords.py --levels section class subclass + python scripts/build_patents_openalex_keywords.py --skip-keywords + +Requires src/main/inse/.env with PATENT_ELASTICSEARCH credentials (INSE) and, unless +--skip-keywords is set, NES Elasticsearch credentials for openalex-topics. +""" +from __future__ import annotations + +import argparse +import asyncio +import json +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 inse.patents.patents_openalex_keywords.client import PatentsOpenAlexKeywordsClient +from inse.patents.patents_openalex_keywords.ipc_entries import ( + DEFAULT_BUILD_LEVELS, + fetch_unique_ipc_entries, +) +from inse.patents.patents_openalex_keywords.matching import ( + TopicVectorsMatcher, + build_documents_from_topicvectors, + documents_to_json_mapping, +) + +logger = logging.getLogger(__name__) + + +async def run(args: argparse.Namespace) -> None: + levels = tuple(args.levels) + + ipc_entries = await fetch_unique_ipc_entries(levels=levels) + counts = {level: len(ipc_entries.get(level, {})) for level in levels} + logger.info("Fetched unique IPC/CPC symbols: %s", counts) + + if args.skip_keywords: + logger.info("--skip-keywords is ignored in topicvectors mode") + if args.topic_cache: + logger.info("--topic-cache is ignored in topicvectors mode") + if args.batch_size != 64: + logger.info("--batch-size is ignored in topicvectors mode") + + matcher = TopicVectorsMatcher(min_score=args.min_score) + logger.info("Matching IPC/CPC labels against topicvectors index...") + documents = await build_documents_from_topicvectors( + ipc_entries, matcher, levels=levels, top_k=args.top_k + ) + logger.info("Built %d IPC/CPC mapping documents", len(documents)) + + if args.output: + output_path = Path(args.output) + output_path.parent.mkdir(parents=True, exist_ok=True) + mapping = documents_to_json_mapping(documents) + output_path.write_text( + json.dumps(mapping, indent=2, ensure_ascii=True), + encoding="utf-8", + ) + logger.info("Wrote local JSON backup to %s", output_path) + + if not args.dry_run: + client = PatentsOpenAlexKeywordsClient(timeout=60.0) + await client.ensure_index() + await client.bulk_index(documents) + logger.info("Indexed %d documents into patents_openalex_keywords", len(documents)) + else: + logger.info("Dry run — skipped Elasticsearch indexing") + + +def main() -> None: + parser = argparse.ArgumentParser( + description="Build IPC/CPC → OpenAlex topic/keyword matches with SentenceTransformer.", + ) + parser.add_argument( + "--output", + default=str( + current_dir.parent / "src" / "data" / "patents_openalex_keywords_mapping.json" + ), + help="Local JSON backup path", + ) + parser.add_argument( + "--topic-cache", + default=None, + help="Deprecated in topicvectors mode (kept for CLI compatibility)", + ) + parser.add_argument( + "--levels", + nargs="+", + default=list(DEFAULT_BUILD_LEVELS), + choices=list(DEFAULT_BUILD_LEVELS), + help="IPC/CPC hierarchy levels to map", + ) + parser.add_argument( + "--top-k", + type=int, + default=3, + help="Number of top topic/keyword matches per IPC/CPC code", + ) + parser.add_argument( + "--min-score", + type=float, + default=0.5, + help="Minimum cosine similarity for a match", + ) + parser.add_argument( + "--batch-size", + type=int, + default=64, + help="Deprecated in topicvectors mode (kept for CLI compatibility)", + ) + parser.add_argument( + "--skip-keywords", + action="store_true", + help="Deprecated in topicvectors mode (kept for CLI compatibility)", + ) + parser.add_argument( + "--dry-run", + action="store_true", + help="Build matches locally without indexing into Elasticsearch", + ) + args = parser.parse_args() + + logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s") + asyncio.run(run(args)) + + +if __name__ == "__main__": + main() diff --git a/service/scripts/index_org_patents.py b/service/scripts/index_org_patents.py index 7eb03cef..f315f2f9 100644 --- a/service/scripts/index_org_patents.py +++ b/service/scripts/index_org_patents.py @@ -1,5 +1,23 @@ #!/usr/bin/env python3 -"""Index org_patents for an institution.""" +""" +index_org_patents.py — Build the org_patents Elasticsearch index for one institution. + +Fetches all OpenAlex authors affiliated with the institution, searches EPO/USPTO for +patents matched via institution assignee and/or author name (match_type: "institution", +"name", or "both"), deletes existing documents for the institution, and reindexes. + +Usage: + python scripts/index_org_patents.py --institution-id + +Example (University of Duisburg-Essen): + python scripts/index_org_patents.py --institution-id I62318514 + +Requires src/main/inse/.env with PATENT_ELASTICSEARCH_URL/API_KEY (and OpenAlex ES +credentials for author lookup). Runtime scales with author count (~30-40 min for UDE's +4,740 authors). Re-running is safe: existing documents are deleted before reindexing. + +Future: integrate into an Admin Panel so admins can trigger this via the UI. +""" from __future__ import annotations import argparse @@ -22,16 +40,21 @@ logger = logging.getLogger(__name__) async def main() -> None: - parser = argparse.ArgumentParser(description="Index org_patents for an institution.") + parser = argparse.ArgumentParser( + description="Build the org_patents index for one institution.", + formatter_class=argparse.RawDescriptionHelpFormatter, + epilog="Example: python scripts/index_org_patents.py --institution-id I62318514", + ) parser.add_argument( "--institution-id", required=True, - help="OpenAlex institution ID, e.g. I62318514", + help="OpenAlex institution ID, e.g. I62318514 (University of Duisburg-Essen)", ) args = parser.parse_args() + logger.info("Starting org_patents indexing for institution %s ...", args.institution_id) count = await index_org_patents_for_institution(args.institution_id) - logger.info("Finished indexing %d patents for institution %s", count, args.institution_id) + logger.info("Done. Indexed %d patents for institution %s.", count, args.institution_id) if __name__ == "__main__": diff --git a/service/src/main/inse/bookmarks/__init__.py b/service/src/main/inse/bookmarks/__init__.py new file mode 100644 index 00000000..113b6d73 --- /dev/null +++ b/service/src/main/inse/bookmarks/__init__.py @@ -0,0 +1 @@ +"""User bookmark feature.""" diff --git a/service/src/main/inse/bookmarks/model.py b/service/src/main/inse/bookmarks/model.py new file mode 100644 index 00000000..ab1f6846 --- /dev/null +++ b/service/src/main/inse/bookmarks/model.py @@ -0,0 +1,36 @@ +import uuid +from datetime import datetime, timezone + +from pydantic import BaseModel, Field as PydanticField +from sqlalchemy import UniqueConstraint +from sqlmodel import Field, SQLModel + + +class PersonBookmark(SQLModel, table=True): + __tablename__ = "person_bookmark" + __table_args__ = ( + UniqueConstraint( + "account_id", "person_id", name="uq_person_bookmark_account_person" + ), + ) + + id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True) + account_id: uuid.UUID = Field( + foreign_key="account.id", nullable=False, index=True + ) + person_id: str = Field(nullable=False, index=True) + person_name: str | None = Field(default=None) + created_at: datetime = Field( + default_factory=lambda: datetime.now(timezone.utc), nullable=False, index=True + ) + + +class CreatePersonBookmark(BaseModel): + person_name: str | None = PydanticField(default=None, max_length=500) + + +class PersonBookmarkResponse(BaseModel): + person_id: str + person_name: str | None + created_at: datetime + diff --git a/service/src/main/inse/bookmarks/router.py b/service/src/main/inse/bookmarks/router.py new file mode 100644 index 00000000..5f12e547 --- /dev/null +++ b/service/src/main/inse/bookmarks/router.py @@ -0,0 +1,47 @@ +from fastapi import APIRouter, Response, status + +from inse.auth import service as auth_service +from inse.auth.model import AccessTokenMetadata +from inse.database import SessionDep + +from . import service +from .model import CreatePersonBookmark, PersonBookmarkResponse + + +router = APIRouter(prefix="/api/bookmarks", tags=["Bookmarks"]) + + +@router.get("/persons", operation_id="listPersonBookmarks") +def list_person_bookmarks( + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, +) -> list[PersonBookmarkResponse]: + return service.list_person_bookmarks(session, access_token.effective_account_id) + + +@router.put("/persons/{person_id}", operation_id="bookmarkPerson") +def bookmark_person( + person_id: str, + payload: CreatePersonBookmark, + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, +) -> PersonBookmarkResponse: + return service.create_person_bookmark( + session, access_token.effective_account_id, person_id, payload + ) + + +@router.delete( + "/persons/{person_id}", + operation_id="removePersonBookmark", + status_code=status.HTTP_204_NO_CONTENT, +) +def remove_person_bookmark( + person_id: str, + session: SessionDep, + access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep, +) -> Response: + service.delete_person_bookmark( + session, access_token.effective_account_id, person_id + ) + return Response(status_code=status.HTTP_204_NO_CONTENT) diff --git a/service/src/main/inse/bookmarks/service.py b/service/src/main/inse/bookmarks/service.py new file mode 100644 index 00000000..f89bcc09 --- /dev/null +++ b/service/src/main/inse/bookmarks/service.py @@ -0,0 +1,81 @@ +import uuid + +from fastapi import HTTPException, status +from sqlmodel import Session, select + +from .model import CreatePersonBookmark, PersonBookmark, PersonBookmarkResponse + + +def normalize_person_id(person_id: str) -> str: + normalized = person_id.strip().rstrip("/").split("/")[-1] + if not normalized: + raise HTTPException( + status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, + detail="A person ID is required.", + ) + return normalized + + +def list_person_bookmarks( + session: Session, account_id: uuid.UUID +) -> list[PersonBookmarkResponse]: + bookmarks = session.exec( + select(PersonBookmark) + .where(PersonBookmark.account_id == account_id) + .order_by(PersonBookmark.created_at.desc()) + ).all() + return [ + PersonBookmarkResponse( + person_id=bookmark.person_id, + person_name=bookmark.person_name, + created_at=bookmark.created_at, + ) + for bookmark in bookmarks + ] + + +def create_person_bookmark( + session: Session, + account_id: uuid.UUID, + person_id: str, + payload: CreatePersonBookmark, +) -> PersonBookmarkResponse: + normalized_id = normalize_person_id(person_id) + bookmark = session.exec( + select(PersonBookmark).where( + PersonBookmark.account_id == account_id, + PersonBookmark.person_id == normalized_id, + ) + ).first() + if bookmark is None: + bookmark = PersonBookmark( + account_id=account_id, + person_id=normalized_id, + person_name=payload.person_name, + ) + session.add(bookmark) + elif payload.person_name: + bookmark.person_name = payload.person_name + + session.commit() + session.refresh(bookmark) + return PersonBookmarkResponse( + person_id=bookmark.person_id, + person_name=bookmark.person_name, + created_at=bookmark.created_at, + ) + + +def delete_person_bookmark( + session: Session, account_id: uuid.UUID, person_id: str +) -> None: + normalized_id = normalize_person_id(person_id) + bookmark = session.exec( + select(PersonBookmark).where( + PersonBookmark.account_id == account_id, + PersonBookmark.person_id == normalized_id, + ) + ).first() + if bookmark is not None: + session.delete(bookmark) + session.commit() diff --git a/service/src/main/inse/bookmarks/test_service.py b/service/src/main/inse/bookmarks/test_service.py new file mode 100644 index 00000000..6e892f57 --- /dev/null +++ b/service/src/main/inse/bookmarks/test_service.py @@ -0,0 +1,71 @@ +import uuid + +from sqlmodel import Session, SQLModel, create_engine + +from inse.auth.model import Account, Organization + +from .model import CreatePersonBookmark +from .service import ( + create_person_bookmark, + delete_person_bookmark, + list_person_bookmarks, +) + + +def _session_with_account(): + engine = create_engine( + "sqlite:///:memory:", connect_args={"check_same_thread": False} + ) + SQLModel.metadata.create_all(engine) + session = Session(engine) + organization = Organization(name="Bookmark Test Org") + session.add(organization) + session.flush() + account = Account( + email="bookmarks@example.org", + name="Bookmark Tester", + password_hash="not-used", + organization_id=organization.id, + ) + session.add(account) + session.commit() + return session, account.id + + +def test_person_bookmarks_are_idempotent_and_normalize_openalex_ids(): + session, account_id = _session_with_account() + assert isinstance(account_id, uuid.UUID) + + create_person_bookmark( + session, + account_id, + "https://openalex.org/A123", + CreatePersonBookmark(person_name="Ada Example"), + ) + create_person_bookmark( + session, + account_id, + "A123", + CreatePersonBookmark(person_name="Ada Updated"), + ) + + bookmarks = list_person_bookmarks(session, account_id) + assert len(bookmarks) == 1 + assert bookmarks[0].person_id == "A123" + assert bookmarks[0].person_name == "Ada Updated" + + +def test_deleting_a_person_bookmark_is_idempotent(): + session, account_id = _session_with_account() + assert isinstance(account_id, uuid.UUID) + create_person_bookmark( + session, + account_id, + "A123", + CreatePersonBookmark(person_name="Ada Example"), + ) + + delete_person_bookmark(session, account_id, "A123") + delete_person_bookmark(session, account_id, "A123") + + assert list_person_bookmarks(session, account_id) == [] diff --git a/service/src/main/inse/dashboard/__init__.py b/service/src/main/inse/dashboard/__init__.py new file mode 100644 index 00000000..29a4b72f --- /dev/null +++ b/service/src/main/inse/dashboard/__init__.py @@ -0,0 +1 @@ +"""Dashboard statistics package.""" diff --git a/service/src/main/inse/dashboard/model.py b/service/src/main/inse/dashboard/model.py new file mode 100644 index 00000000..c59f8028 --- /dev/null +++ b/service/src/main/inse/dashboard/model.py @@ -0,0 +1,52 @@ +from pydantic import BaseModel + + +class DashboardStatistics(BaseModel): + institution_id: str + organization_name: str + publications: int + persons: int + projects: int + dfg_projects: int + eu_projects: int + bmbf_projects: int + + +class DashboardStatisticValue(BaseModel): + institution_id: str + organization_name: str + value: int + + +class TopAuthor(BaseModel): + id: str | None = None + name: str + count: int + + +class TopAuthorStatistics(BaseModel): + institution_id: str + works: list[TopAuthor] + projects: list[TopAuthor] + patents: list[TopAuthor] + news: list[TopAuthor] + + +class TopicHeatmapValue(BaseModel): + year: int + count: int + share: float + + +class TopicHeatmapField(BaseModel): + id: str + name: str + total: int + values: list[TopicHeatmapValue] + + +class TopicHeatmap(BaseModel): + institution_id: str + organization_name: str + years: list[int] + fields: list[TopicHeatmapField] diff --git a/service/src/main/inse/dashboard/router.py b/service/src/main/inse/dashboard/router.py new file mode 100644 index 00000000..0012bff3 --- /dev/null +++ b/service/src/main/inse/dashboard/router.py @@ -0,0 +1,168 @@ +from typing import Literal + +from fastapi import APIRouter, Depends, Query +from sqlmodel import Session + +from inse.auth import service as auth_service +from inse.auth.model import AccessToken +from inse.database import get_session +from inse.tags import Tags + +from .model import ( + DashboardStatisticValue, + DashboardStatistics, + TopAuthorStatistics, + TopicHeatmap, +) +from .service import ( + get_dashboard_bmbf_projects, + get_dashboard_dfg_projects, + get_dashboard_eu_projects, + get_dashboard_organization, + get_dashboard_persons, + get_dashboard_publications, + get_dashboard_statistics, + get_top_authors, + get_topic_heatmap, +) + +router = APIRouter(prefix="/api/dashboard", tags=[Tags.DASHBOARD]) + + +@router.get( + "/statistics", + operation_id="getDashboardStatistics", + response_model=DashboardStatistics, +) +async def dashboard_statistics( + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> DashboardStatistics: + organization = get_dashboard_organization(session, access_token) + return await get_dashboard_statistics( + organization.openalex_institution_id, + organization.name, + ) + + +@router.get( + "/statistics/publications", + operation_id="getDashboardPublications", + response_model=DashboardStatisticValue, +) +async def dashboard_publications( + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> DashboardStatisticValue: + organization = get_dashboard_organization(session, access_token) + return await get_dashboard_publications( + organization.openalex_institution_id, + organization.name, + ) + + +@router.get( + "/statistics/persons", + operation_id="getDashboardPersons", + response_model=DashboardStatisticValue, +) +async def dashboard_persons( + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> DashboardStatisticValue: + organization = get_dashboard_organization(session, access_token) + return await get_dashboard_persons( + organization.openalex_institution_id, + organization.name, + ) + + +@router.get( + "/statistics/projects/eu", + operation_id="getDashboardEuProjects", + response_model=DashboardStatisticValue, +) +async def dashboard_eu_projects( + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> DashboardStatisticValue: + organization = get_dashboard_organization(session, access_token) + return await get_dashboard_eu_projects( + organization.openalex_institution_id, + organization.name, + ) + + +@router.get( + "/statistics/projects/bmbf", + operation_id="getDashboardBmbfProjects", + response_model=DashboardStatisticValue, +) +async def dashboard_bmbf_projects( + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> DashboardStatisticValue: + organization = get_dashboard_organization(session, access_token) + return await get_dashboard_bmbf_projects( + organization.openalex_institution_id, + organization.name, + ) + + +@router.get( + "/statistics/projects/dfg", + operation_id="getDashboardDfgProjects", + response_model=DashboardStatisticValue, +) +async def dashboard_dfg_projects( + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> DashboardStatisticValue: + organization = get_dashboard_organization(session, access_token) + return await get_dashboard_dfg_projects( + organization.openalex_institution_id, + organization.name, + ) + + +@router.get( + "/top-authors", + operation_id="getDashboardTopAuthors", + response_model=TopAuthorStatistics, +) +async def dashboard_top_authors( + works_period: Literal["all_time", "last_5_years"] = Query( + default="all_time", + pattern="^(all_time|last_5_years)$", + ), + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> TopAuthorStatistics: + organization = get_dashboard_organization(session, access_token) + return await get_top_authors( + organization.openalex_institution_id, + organization.name, + works_period=works_period, + ) + + +@router.get( + "/topic-heatmap", + operation_id="getDashboardTopicHeatmap", + response_model=TopicHeatmap, +) +async def dashboard_topic_heatmap( + from_year: int | None = Query(default=None, ge=1900, le=2100), + to_year: int | None = Query(default=None, ge=1900, le=2100), + limit: int = Query(default=25, ge=1, le=50), + session: Session = Depends(get_session), + access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep, +) -> TopicHeatmap: + organization = get_dashboard_organization(session, access_token) + return await get_topic_heatmap( + institution_id=organization.openalex_institution_id, + organization_name=organization.name, + from_year=from_year, + to_year=to_year, + limit=limit, + ) diff --git a/service/src/main/inse/dashboard/service.py b/service/src/main/inse/dashboard/service.py new file mode 100644 index 00000000..0fa30e5d --- /dev/null +++ b/service/src/main/inse/dashboard/service.py @@ -0,0 +1,734 @@ +import asyncio +import logging +from datetime import datetime +from typing import Any, Literal + +from fastapi import HTTPException, status +from sqlmodel import Session + +from inse import config +from inse.auth.model import AccessToken, Organization +from inse.integrations import elasticsearch +from inse.institutions.institutions_search_client import InstitutionsSearchClient +from inse.model import ESCluster, ESIndex +from inse.patents.org.elastic_search_client import OrgPatentsSearchClient + +from .model import ( + DashboardStatisticValue, + DashboardStatistics, + TopAuthor, + TopAuthorStatistics, + TopicHeatmap, + TopicHeatmapField, + TopicHeatmapValue, +) + +TOP_AUTHOR_LIMIT = 10 +TOPIC_HEATMAP_LIMIT = 25 +TOPIC_HEATMAP_YEARS = 5 +WorksPeriod = Literal["all_time", "last_5_years"] +logger = logging.getLogger(__name__) + +DFG_INSTITUTION_FIELDS = [ + "Antragstellende Institution", + "Mitantragstellende Institution", + "Beteiligte Einrichtung", + "Beteiligte Hochschule", + "Beteiligte Institution", + "IGK-Partnerinstitution", + "Partnerorganisation", + "Unternehmen", +] + + +def _total(response: dict[str, Any]) -> int: + total = response.get("hits", {}).get("total", 0) + if isinstance(total, dict): + return int(total.get("value", 0)) + return int(total or 0) + + +def get_dashboard_organization( + session: Session, + access_token: AccessToken, +) -> Organization: + organization = session.get(Organization, access_token.effective_organization_id) + if organization is None or organization.deleted: + raise HTTPException( + status_code=status.HTTP_404_NOT_FOUND, + detail="Organization not found.", + ) + if not organization.openalex_institution_id: + raise HTTPException( + status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, + detail="Organization has no OpenAlex institution ID configured.", + ) + return organization + + +async def get_dashboard_statistics( + institution_id: str, + organization_name: str, +) -> DashboardStatistics: + normalized_id = _normalize_institution_id(institution_id) + publications, persons, eu_projects, bmbf_projects, dfg_projects = ( + await asyncio.gather( + get_dashboard_publications(institution_id, organization_name), + get_dashboard_persons(institution_id, organization_name), + get_dashboard_eu_projects(institution_id, organization_name), + get_dashboard_bmbf_projects(institution_id, organization_name), + get_dashboard_dfg_projects(institution_id, organization_name), + ) + ) + return DashboardStatistics( + institution_id=normalized_id, + organization_name=organization_name, + publications=publications.value, + persons=persons.value, + projects=eu_projects.value + bmbf_projects.value + dfg_projects.value, + dfg_projects=dfg_projects.value, + eu_projects=eu_projects.value, + bmbf_projects=bmbf_projects.value, + ) + + +async def get_dashboard_publications( + institution_id: str, + organization_name: str, +) -> DashboardStatisticValue: + normalized_id = _normalize_institution_id(institution_id) + response = await elasticsearch.search( + index=config.settings.openalex_works_search_index, + query=_institution_works_query(normalized_id), + size=0, + track_total_hits=True, + cluster=ESCluster.NES, + ) + return _dashboard_statistic_value(normalized_id, organization_name, response) + + +async def get_dashboard_persons( + institution_id: str, + organization_name: str, +) -> DashboardStatisticValue: + normalized_id = _normalize_institution_id(institution_id) + response = await elasticsearch.search( + index=ESIndex.OPENALEX_AUTHORS, + query={ + "nested": { + "path": "affiliations", + "query": {"term": {"affiliations.institution.id": normalized_id}}, + } + }, + size=0, + track_total_hits=True, + cluster=ESCluster.NES, + ) + return _dashboard_statistic_value(normalized_id, organization_name, response) + + +async def get_dashboard_eu_projects( + institution_id: str, + organization_name: str, +) -> DashboardStatisticValue: + normalized_id = _normalize_institution_id(institution_id) + aliases = await _institution_aliases(normalized_id, organization_name) + response = await elasticsearch.search( + index=ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD, + body={ + "size": 0, + "query": _eu_organization_query(aliases), + "aggs": { + "projects": { + "cardinality": { + "field": "projectID", + } + } + }, + }, + cluster=ESCluster.INSE, + ) + return DashboardStatisticValue( + institution_id=normalized_id, + organization_name=organization_name, + value=int( + response.get("aggregations", {}) + .get("projects", {}) + .get("value", 0) + ), + ) + + +async def get_dashboard_bmbf_projects( + institution_id: str, + organization_name: str, +) -> DashboardStatisticValue: + normalized_id = _normalize_institution_id(institution_id) + aliases = await _institution_aliases(normalized_id, organization_name) + response = await elasticsearch.search( + index=ESIndex.PROJECTS_BUND_V1, + query=_alias_match_query("Zuwendungsempfänger", aliases), + size=0, + track_total_hits=True, + cluster=ESCluster.INSE, + ) + return _dashboard_statistic_value(normalized_id, organization_name, response) + + +async def get_dashboard_dfg_projects( + institution_id: str, + organization_name: str, +) -> DashboardStatisticValue: + normalized_id = _normalize_institution_id(institution_id) + aliases = await _institution_aliases(normalized_id, organization_name) + response = await elasticsearch.search( + index=ESIndex.PROJECTS_DFG_ALL, + query=_dfg_institution_query(aliases), + size=0, + track_total_hits=True, + cluster=ESCluster.INSE, + ) + return _dashboard_statistic_value(normalized_id, organization_name, response) + + +def _dashboard_statistic_value( + institution_id: str, + organization_name: str, + response: dict[str, Any], +) -> DashboardStatisticValue: + return DashboardStatisticValue( + institution_id=institution_id, + organization_name=organization_name, + value=_total(response), + ) + + +async def _institution_aliases( + institution_id: str, + organization_name: str, +) -> list[str]: + aliases = await InstitutionsSearchClient().get_institution_aliases_by_oa_institution_id( + _raw_institution_id(institution_id) + ) + return sorted( + { + alias.strip() + for alias in [organization_name, *aliases] + if alias and alias.strip() + } + ) + + +def _eu_organization_query(aliases: list[str]) -> dict[str, Any]: + return { + "terms": { + "name.keyword": [alias.upper() for alias in aliases], + } + } + + +def _alias_match_query(field: str, aliases: list[str]) -> dict[str, Any]: + return { + "bool": { + "should": [ + { + "match": { + field: { + "query": alias, + "operator": "and", + } + } + } + for alias in aliases + ], + "minimum_should_match": 1, + } + } + + +def _dfg_institution_query(aliases: list[str]) -> dict[str, Any]: + return { + "bool": { + "should": [ + _alias_match_query(field, aliases) + for field in DFG_INSTITUTION_FIELDS + ], + "minimum_should_match": 1, + } + } + + +async def get_top_authors( + institution_id: str, + organization_name: str, + works_period: WorksPeriod = "all_time", +) -> TopAuthorStatistics: + normalized_id = _normalize_institution_id(institution_id) + authors = await _safe_institution_authors(normalized_id) + works = _top_work_authors(authors, works_period) + aliases = await _safe_institution_aliases(normalized_id, organization_name) + projects = await _safe_top_authors( + "projects", + _top_project_authors(authors, aliases), + ) + patents = await _safe_top_authors( + "patents", + _top_patent_authors(normalized_id), + ) + news = await _safe_top_authors( + "news", + _top_news_authors(authors), + ) + return TopAuthorStatistics( + institution_id=normalized_id, + works=works, + projects=projects, + patents=patents, + news=news, + ) + + +async def get_topic_heatmap( + institution_id: str, + organization_name: str, + from_year: int | None = None, + to_year: int | None = None, + limit: int = TOPIC_HEATMAP_LIMIT, +) -> TopicHeatmap: + normalized_id = _normalize_institution_id(institution_id) + current_year = datetime.now().year + effective_to_year = to_year or current_year + effective_from_year = from_year or (effective_to_year - TOPIC_HEATMAP_YEARS + 1) + if effective_from_year > effective_to_year: + raise HTTPException( + status_code=status.HTTP_422_UNPROCESSABLE_ENTITY, + detail="from_year must be less than or equal to to_year.", + ) + years = list(range(effective_from_year, effective_to_year + 1)) + + response = await elasticsearch.search( + index=config.settings.openalex_works_search_index, + body={ + "size": 0, + "query": { + "bool": { + "must": [_institution_works_query(normalized_id)], + "filter": [ + { + "range": { + "publication_year": { + "gte": effective_from_year, + "lte": effective_to_year, + } + } + } + ], + } + }, + "aggs": { + "publication_years": { + "terms": { + "field": "publication_year", + "size": len(years), + "order": {"_key": "asc"}, + } + }, + "topics_nested": { + "nested": {"path": "topics"}, + "aggs": { + "fields": { + "terms": { + "field": "topics.field.id", + "size": limit, + "order": [ + {"works": "desc"}, + {"_key": "asc"}, + ], + }, + "aggs": { + "field_name": { + "terms": { + "field": "topics.field.display_name.keyword", + "size": 1, + } + }, + "works": { + "reverse_nested": {}, + "aggs": { + "by_year": { + "terms": { + "field": "publication_year", + "size": len(years), + "order": {"_key": "asc"}, + } + } + }, + } + }, + } + }, + }, + }, + }, + cluster=ESCluster.NES, + ) + year_totals = _year_totals(response) + buckets = ( + response.get("aggregations", {}) + .get("topics_nested", {}) + .get("fields", {}) + .get("buckets", []) + ) + field_names = await _field_names([bucket.get("key") for bucket in buckets]) + + return TopicHeatmap( + institution_id=normalized_id, + organization_name=organization_name, + years=years, + fields=[ + _topic_heatmap_field(bucket, years, year_totals, field_names) + for bucket in buckets + if bucket.get("key") + ], + ) + + +async def _safe_top_authors( + source: str, operation: Any +) -> list[TopAuthor]: + try: + return await operation + except Exception: + logger.exception("Dashboard top-author aggregation failed for %s.", source) + return [] + + +def _normalize_institution_id(value: str) -> str: + short_id = value.replace("https://openalex.org/", "").strip().upper() + return f"https://openalex.org/{short_id}" + + +def _raw_institution_id(value: str) -> str: + return value.replace("https://openalex.org/", "").strip().upper() + + +def _institution_works_query(institution_id: str) -> dict[str, Any]: + return { + "nested": { + "path": "authorships.institutions", + "query": {"term": {"authorships.institutions.id": institution_id}}, + } + } + + +def _year_totals(response: dict[str, Any]) -> dict[int, int]: + buckets = ( + response.get("aggregations", {}) + .get("publication_years", {}) + .get("buckets", []) + ) + return { + int(bucket["key"]): int(bucket.get("doc_count", 0)) + for bucket in buckets + if bucket.get("key") is not None + } + + +async def _field_names(field_ids: list[str | None]) -> dict[str, str]: + ids = [field_id for field_id in field_ids if field_id] + if not ids: + return {} + try: + response = await elasticsearch.search( + index="openalex-fields", + query={"terms": {"id": ids}}, + source=["id", "display_name"], + size=len(ids), + cluster=ESCluster.NES, + ) + except Exception: + logger.exception("Could not load dashboard field names.") + return {} + + return { + source["id"]: source["display_name"] + for hit in response.get("hits", {}).get("hits", []) + if (source := hit.get("_source", {})).get("id") + and source.get("display_name") + } + + +def _topic_heatmap_field( + bucket: dict[str, Any], + years: list[int], + year_totals: dict[int, int], + field_names: dict[str, str], +) -> TopicHeatmapField: + field_id = str(bucket["key"]) + by_year = { + int(year_bucket["key"]): int(year_bucket.get("doc_count", 0)) + for year_bucket in ( + bucket.get("works", {}).get("by_year", {}).get("buckets", []) + ) + if year_bucket.get("key") is not None + } + values = [] + for year in years: + count = by_year.get(year, 0) + total = year_totals.get(year, 0) + values.append( + TopicHeatmapValue( + year=year, + count=count, + share=(count / total) if total else 0, + ) + ) + + return TopicHeatmapField( + id=field_id, + name=_field_name(bucket, field_names.get(field_id, field_id)), + total=int(bucket.get("works", {}).get("doc_count", 0)), + values=values, + ) + + +def _field_name(bucket: dict[str, Any], fallback: str) -> str: + name_buckets = bucket.get("field_name", {}).get("buckets", []) + if name_buckets and name_buckets[0].get("key"): + return str(name_buckets[0]["key"]) + return fallback + + +def _short_author_id(value: str) -> str: + return value.replace("https://openalex.org/", "").strip().upper() + + +def _top_work_authors( + authors: list[dict[str, Any]], + works_period: WorksPeriod, +) -> list[TopAuthor]: + if works_period == "last_5_years": + from_year = datetime.now().year - 4 + ranked_authors = sorted( + ( + { + **author, + "selected_works_count": _works_count_since(author, from_year), + } + for author in authors + ), + key=lambda author: author["selected_works_count"], + reverse=True, + ) + else: + ranked_authors = [ + {**author, "selected_works_count": author["works_count"]} + for author in authors + ] + + return [ + TopAuthor( + id=_short_author_id(author["id"]), + name=author["name"], + count=author["selected_works_count"], + ) + for author in ranked_authors[:TOP_AUTHOR_LIMIT] + if author["selected_works_count"] > 0 + ] + + +def _works_count_since(author: dict[str, Any], from_year: int) -> int: + return sum( + int(item.get("works_count", 0) or 0) + for item in author.get("counts_by_year", []) + if int(item.get("year", 0) or 0) >= from_year + ) + + +async def _safe_institution_authors(institution_id: str) -> list[dict[str, Any]]: + try: + return await _institution_authors(institution_id) + except Exception: + logger.exception("Could not load authors for institution %s.", institution_id) + return [] + + +async def _safe_institution_aliases( + institution_id: str, + organization_name: str, +) -> list[str]: + try: + return await _institution_aliases(institution_id, organization_name) + except Exception: + logger.exception("Could not load aliases for institution %s.", institution_id) + return [organization_name] + + +async def _institution_authors(institution_id: str) -> list[dict[str, Any]]: + response = await elasticsearch.search( + index=ESIndex.OPENALEX_AUTHORS, + query={ + "nested": { + "path": "last_known_institutions", + "query": {"term": {"last_known_institutions.id": institution_id}}, + } + }, + source=["id", "display_name", "works_count", "counts_by_year"], + size=10000, + sort=[{"works_count": {"order": "desc", "missing": "_last"}}], + cluster=ESCluster.NES, + ) + return [ + { + "id": str(source["id"]), + "name": str(source["display_name"]), + "works_count": int(source.get("works_count", 0)), + "counts_by_year": source.get("counts_by_year", []) or [], + } + for hit in response.get("hits", {}).get("hits", []) + if (source := hit.get("_source", {})).get("id") + and source.get("display_name") + ] + + +async def _top_project_authors( + authors: list[dict[str, Any]], + aliases: list[str], +) -> list[TopAuthor]: + if not aliases: + return [] + counts: dict[str, int] = {} + names: dict[str, str] = {} + for bucket in await _top_bund_project_author_buckets(aliases): + key = str(bucket.get("key", "")).strip() + if key: + normalized_key = key.casefold() + names[normalized_key] = key + counts[normalized_key] = counts.get(normalized_key, 0) + int( + bucket.get("doc_count", 0) + ) + + institution_authors = {author["name"].casefold(): author for author in authors} + ranked = sorted( + ( + (name, count) + for name, count in counts.items() + if count > 0 + ), + key=lambda item: (-item[1], names[item[0]].casefold()), + ) + return [ + TopAuthor( + id=( + _short_author_id(institution_authors[name]["id"]) + if name in institution_authors + else None + ), + name=( + institution_authors[name]["name"] + if name in institution_authors + else names[name] + ), + count=count, + ) + for name, count in ranked[:TOP_AUTHOR_LIMIT] + ] + + +async def _top_bund_project_author_buckets( + aliases: list[str], +) -> list[dict[str, Any]]: + response = await elasticsearch.search( + index=ESIndex.PROJECTS_BUND_V1, + body={ + "size": 0, + "query": _alias_match_query("Zuwendungsempfänger", aliases), + "aggs": { + "people": { + "terms": { + "script": { + "lang": "painless", + "source": _bund_persons_script(), + }, + "size": 10000, + } + } + }, + }, + cluster=ESCluster.INSE, + ) + return ( + response.get("aggregations", {}).get("people", {}).get("buckets", []) + ) + + +def _bund_persons_script() -> str: + return ( + "def names = new HashSet(); " + "if (params['_source'].containsKey('Arb') && params['_source']['Arb'] != null) { " + " for (entry in params['_source']['Arb'].entrySet()) { " + " def value = entry.getValue(); " + " if (value instanceof String && value.length() > 0) { " + " if (value.contains(';')) { " + " for (name in value.splitOnToken(';')) { names.add(name.trim()); } " + " } else { names.add(value.trim()); } " + " } " + " } " + "} " + "return new ArrayList(names);" + ) + + +async def _top_patent_authors(institution_id: str) -> list[TopAuthor]: + client = OrgPatentsSearchClient() + authors = await client.top_authors_by_institution( + institution_id=institution_id, + size=TOP_AUTHOR_LIMIT, + ) + return [ + TopAuthor( + id=_short_author_id(author["id"]), + name=author["name"], + count=author["count"], + ) + for author in authors + ] + + +async def _top_news_authors(authors: list[dict[str, Any]]) -> list[TopAuthor]: + if not authors: + return [] + + author_names = [author["name"] for author in authors] + response = await elasticsearch.search( + index="aktuell_postproc", + body={ + "size": 0, + "query": {"terms": {"authors.keyword": author_names}}, + "aggs": { + "authors": { + "terms": { + "field": "authors.keyword", + "size": 10000, + "order": [ + {"_count": "desc"}, + {"_key": "asc"}, + ], + } + } + }, + }, + cluster=ESCluster.INSE, + ) + buckets = response.get("aggregations", {}).get("authors", {}).get("buckets", []) + institution_authors = {author["name"].casefold(): author for author in authors} + + return [ + TopAuthor( + id=_short_author_id(institution_authors[str(bucket["key"]).casefold()]["id"]), + name=institution_authors[str(bucket["key"]).casefold()]["name"], + count=int(bucket.get("doc_count", 0)), + ) + for bucket in buckets + if str(bucket.get("key", "")).casefold() in institution_authors + ][:TOP_AUTHOR_LIMIT] diff --git a/service/src/main/inse/dashboard/test_service.py b/service/src/main/inse/dashboard/test_service.py new file mode 100644 index 00000000..8cfd4e7e --- /dev/null +++ b/service/src/main/inse/dashboard/test_service.py @@ -0,0 +1,531 @@ +from unittest.mock import AsyncMock, patch +from datetime import datetime + +import pytest +from fastapi import HTTPException +from sqlmodel import Session, SQLModel, create_engine + +from inse import config +from inse.auth.model import AccessToken, Organization, UserRole +from inse.dashboard.service import ( + get_dashboard_organization, + get_dashboard_statistics, + get_top_authors, + get_topic_heatmap, +) +from inse.model import ESCluster, ESIndex + +ORG_INSTITUTION_ID = "https://openalex.org/I123" + + +@pytest.fixture +def anyio_backend(): + return "asyncio" + + +@pytest.mark.anyio +async def test_dashboard_statistics_counts_organization_data_and_all_projects(): + async def search(**kwargs): + index = kwargs["index"] + if index == config.settings.openalex_works_search_index: + return {"hits": {"total": {"value": 120}}} + if index == ESIndex.OPENALEX_AUTHORS: + return {"hits": {"total": {"value": 35}}} + if index == ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD: + return {"aggregations": {"projects": {"value": 10}}} + if index == ESIndex.PROJECTS_BUND_V1: + return {"hits": {"total": {"value": 5}}} + return {"hits": {"total": {"value": 3}}} + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ) as mocked_search, patch( + "inse.dashboard.service.InstitutionsSearchClient.get_institution_aliases_by_oa_institution_id", + new=AsyncMock(return_value=["Example University", "Example Uni"]), + ): + result = await get_dashboard_statistics(ORG_INSTITUTION_ID, "Example Org") + + assert result.model_dump() == { + "institution_id": ORG_INSTITUTION_ID, + "organization_name": "Example Org", + "publications": 120, + "persons": 35, + "projects": 18, + "dfg_projects": 3, + "eu_projects": 10, + "bmbf_projects": 5, + } + calls = mocked_search.await_args_list + assert calls[0].kwargs["index"] == config.settings.openalex_works_search_index + assert calls[0].kwargs["query"]["nested"]["query"]["term"] == { + "authorships.institutions.id": ORG_INSTITUTION_ID + } + assert calls[1].kwargs["query"]["nested"]["query"]["term"] == { + "affiliations.institution.id": ORG_INSTITUTION_ID + } + assert all(call.kwargs["cluster"] == ESCluster.INSE for call in calls[2:]) + assert [call.kwargs["index"] for call in calls[2:]] == [ + ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD, + ESIndex.PROJECTS_BUND_V1, + ESIndex.PROJECTS_DFG_ALL, + ] + assert calls[2].kwargs["body"]["query"] == { + "terms": { + "name.keyword": [ + "EXAMPLE ORG", + "EXAMPLE UNI", + "EXAMPLE UNIVERSITY", + ] + } + } + assert calls[3].kwargs["query"]["bool"]["minimum_should_match"] == 1 + assert calls[3].kwargs["query"]["bool"]["should"][0]["match"] == { + "Zuwendungsempfänger": { + "query": "Example Org", + "operator": "and", + } + } + assert calls[4].kwargs["query"]["bool"]["minimum_should_match"] == 1 + assert calls[4].kwargs["query"]["bool"]["should"][0]["bool"]["should"][0][ + "match" + ] == { + "Antragstellende Institution": { + "query": "Example Org", + "operator": "and", + } + } + + +@pytest.mark.anyio +async def test_top_authors_maps_works_and_bund_project_aggregations(): + async def search(**kwargs): + if kwargs["index"] == ESIndex.OPENALEX_AUTHORS: + return { + "hits": { + "hits": [ + { + "_source": { + "id": "https://openalex.org/A1", + "display_name": "Ada Example", + "works_count": 42, + "counts_by_year": [], + } + }, + { + "_source": { + "id": "https://openalex.org/A2", + "display_name": "Grace Example", + "works_count": 12, + "counts_by_year": [], + } + }, + ] + } + } + if kwargs["index"] == "aktuell_postproc": + return { + "aggregations": { + "authors": { + "buckets": [{"key": "Ada Example", "doc_count": 6}] + } + } + } + if kwargs["index"] == ESIndex.PROJECTS_BUND_V1: + return { + "aggregations": { + "people": { + "buckets": [{"key": "Grace Example", "doc_count": 3}] + } + } + } + return {"aggregations": {"people": {"buckets": []}}} + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ) as mocked_search, patch( + "inse.dashboard.service.InstitutionsSearchClient.get_institution_aliases_by_oa_institution_id", + new=AsyncMock(return_value=["Example University"]), + ), patch( + "inse.dashboard.service.OrgPatentsSearchClient.top_authors_by_institution", + new=AsyncMock( + return_value=[ + {"id": "A1", "name": "Ada Example", "count": 4}, + ] + ), + ): + result = await get_top_authors(ORG_INSTITUTION_ID, "Example Org") + + assert result.works[0].model_dump() == { + "id": "A1", + "name": "Ada Example", + "count": 42, + } + assert result.projects[0].model_dump() == { + "id": "A2", + "name": "Grace Example", + "count": 3, + } + assert result.patents[0].model_dump() == { + "id": "A1", + "name": "Ada Example", + "count": 4, + } + assert result.news[0].model_dump() == { + "id": "A1", + "name": "Ada Example", + "count": 6, + } + project_calls = [ + call + for call in mocked_search.await_args_list + if call.kwargs["index"] + in {ESIndex.PROJECTS_DFG_ALL, ESIndex.PROJECTS_BUND_V1} + ] + assert len(project_calls) == 1 + assert project_calls[0].kwargs["index"] == ESIndex.PROJECTS_BUND_V1 + assert project_calls[0].kwargs["body"]["query"]["bool"]["should"][0]["match"] == { + "Zuwendungsempfänger": { + "query": "Example Org", + "operator": "and", + } + } + + +@pytest.mark.anyio +async def test_top_authors_keeps_bund_project_authors_without_openalex_match(): + async def search(**kwargs): + if kwargs["index"] == ESIndex.OPENALEX_AUTHORS: + return {"hits": {"hits": []}} + if kwargs["index"] == ESIndex.PROJECTS_BUND_V1: + return { + "aggregations": { + "people": { + "buckets": [{"key": "Project Person", "doc_count": 9}] + } + } + } + return {"aggregations": {"people": {"buckets": []}}} + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ), patch( + "inse.dashboard.service.InstitutionsSearchClient.get_institution_aliases_by_oa_institution_id", + new=AsyncMock(return_value=["Example University"]), + ), patch( + "inse.dashboard.service.OrgPatentsSearchClient.top_authors_by_institution", + new=AsyncMock(return_value=[]), + ): + result = await get_top_authors(ORG_INSTITUTION_ID, "Example Org") + + assert result.projects[0].model_dump() == { + "id": None, + "name": "Project Person", + "count": 9, + } + + +@pytest.mark.anyio +async def test_top_authors_returns_top_ten_bund_project_people_by_project_count(): + async def search(**kwargs): + if kwargs["index"] == ESIndex.OPENALEX_AUTHORS: + return {"hits": {"hits": []}} + if kwargs["index"] == ESIndex.PROJECTS_BUND_V1: + return { + "aggregations": { + "people": { + "buckets": [ + {"key": f"Project Person {count}", "doc_count": count} + for count in range(1, 12) + ] + } + } + } + return {"aggregations": {"people": {"buckets": []}}} + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ), patch( + "inse.dashboard.service.InstitutionsSearchClient.get_institution_aliases_by_oa_institution_id", + new=AsyncMock(return_value=["Example University"]), + ), patch( + "inse.dashboard.service.OrgPatentsSearchClient.top_authors_by_institution", + new=AsyncMock(return_value=[]), + ): + result = await get_top_authors(ORG_INSTITUTION_ID, "Example Org") + + assert [author.count for author in result.projects] == list(range(11, 1, -1)) + assert result.projects[0].name == "Project Person 11" + assert len(result.projects) == 10 + + +@pytest.mark.anyio +async def test_top_authors_returns_partial_response_when_one_source_fails(): + async def search(**kwargs): + if kwargs["index"] == ESIndex.OPENALEX_AUTHORS: + return { + "hits": { + "hits": [ + { + "_source": { + "id": "https://openalex.org/A1", + "display_name": "Ada Example", + "works_count": 42, + "counts_by_year": [], + } + } + ] + } + } + raise RuntimeError("projects unavailable") + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ), patch( + "inse.dashboard.service.InstitutionsSearchClient.get_institution_aliases_by_oa_institution_id", + new=AsyncMock(return_value=["Example University"]), + ), patch( + "inse.dashboard.service.OrgPatentsSearchClient.top_authors_by_institution", + new=AsyncMock(return_value=[]), + ): + result = await get_top_authors(ORG_INSTITUTION_ID, "Example Org") + + assert result.works[0].name == "Ada Example" + assert result.projects == [] + assert result.patents == [] + assert result.news == [] + + +@pytest.mark.anyio +async def test_top_authors_can_rank_works_by_last_five_years(): + current_year = datetime.now().year + + async def search(**kwargs): + if kwargs["index"] == ESIndex.OPENALEX_AUTHORS: + return { + "hits": { + "hits": [ + { + "_source": { + "id": "https://openalex.org/A1", + "display_name": "Ada Example", + "works_count": 100, + "counts_by_year": [ + {"year": current_year - 6, "works_count": 90}, + {"year": current_year - 1, "works_count": 2}, + ], + } + }, + { + "_source": { + "id": "https://openalex.org/A2", + "display_name": "Grace Example", + "works_count": 50, + "counts_by_year": [ + {"year": current_year - 1, "works_count": 12}, + {"year": current_year, "works_count": 4}, + ], + } + }, + ] + } + } + return {"aggregations": {"people": {"buckets": []}}} + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ), patch( + "inse.dashboard.service.InstitutionsSearchClient.get_institution_aliases_by_oa_institution_id", + new=AsyncMock(return_value=["Example University"]), + ), patch( + "inse.dashboard.service.OrgPatentsSearchClient.top_authors_by_institution", + new=AsyncMock(return_value=[]), + ): + result = await get_top_authors( + ORG_INSTITUTION_ID, + "Example Org", + works_period="last_5_years", + ) + + assert result.works[0].model_dump() == { + "id": "A2", + "name": "Grace Example", + "count": 16, + } + assert result.works[1].model_dump() == { + "id": "A1", + "name": "Ada Example", + "count": 2, + } + + +@pytest.mark.anyio +async def test_topic_heatmap_maps_field_year_counts_and_shares(): + async def search(**kwargs): + if kwargs["index"] == config.settings.openalex_works_search_index: + return { + "aggregations": { + "publication_years": { + "buckets": [ + {"key": 2023, "doc_count": 10}, + {"key": 2024, "doc_count": 20}, + ] + }, + "topics_nested": { + "fields": { + "buckets": [ + { + "key": "https://openalex.org/fields/17", + "field_name": { + "buckets": [ + { + "key": "Computer Science", + "doc_count": 12, + } + ] + }, + "works": { + "doc_count": 12, + "by_year": { + "buckets": [ + {"key": 2023, "doc_count": 4}, + {"key": 2024, "doc_count": 8}, + ] + }, + }, + } + ] + } + }, + } + } + return { + "hits": { + "hits": [ + { + "_source": { + "id": "https://openalex.org/fields/17", + "display_name": "Computer Science", + } + } + ] + } + } + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ) as mocked_search: + result = await get_topic_heatmap( + institution_id=ORG_INSTITUTION_ID, + organization_name="Example Org", + from_year=2023, + to_year=2024, + limit=10, + ) + + assert result.institution_id == ORG_INSTITUTION_ID + assert result.organization_name == "Example Org" + assert result.years == [2023, 2024] + assert result.fields[0].model_dump() == { + "id": "https://openalex.org/fields/17", + "name": "Computer Science", + "total": 12, + "values": [ + {"year": 2023, "count": 4, "share": 0.4}, + {"year": 2024, "count": 8, "share": 0.4}, + ], + } + body = mocked_search.await_args_list[0].kwargs["body"] + assert body["query"]["bool"]["must"][0]["nested"]["query"]["term"] == { + "authorships.institutions.id": ORG_INSTITUTION_ID + } + assert ( + body["aggs"]["topics_nested"]["aggs"]["fields"]["terms"]["field"] + == "topics.field.id" + ) + + +@pytest.mark.anyio +async def test_topic_heatmap_defaults_to_last_five_years(): + async def search(**kwargs): + if kwargs["index"] == config.settings.openalex_works_search_index: + return { + "aggregations": { + "publication_years": {"buckets": []}, + "topics_nested": {"fields": {"buckets": []}}, + } + } + return {"hits": {"hits": []}} + + with patch( + "inse.dashboard.service.elasticsearch.search", + new=AsyncMock(side_effect=search), + ) as mocked_search: + result = await get_topic_heatmap( + institution_id=ORG_INSTITUTION_ID, + organization_name="Example Org", + ) + + current_year = datetime.now().year + assert result.years == list(range(current_year - 4, current_year + 1)) + body = mocked_search.await_args_list[0].kwargs["body"] + assert body["query"]["bool"]["filter"][0]["range"]["publication_year"] == { + "gte": current_year - 4, + "lte": current_year, + } + + +def test_get_dashboard_organization_uses_effective_organization(): + engine = create_engine("sqlite://", connect_args={"check_same_thread": False}) + SQLModel.metadata.create_all(engine) + + with Session(engine) as session: + organization = Organization( + name="Example University", + openalex_institution_id="I456", + ) + session.add(organization) + session.commit() + session.refresh(organization) + + token = _access_token(organization.id) + + result = get_dashboard_organization(session, token) + + assert result.id == organization.id + assert result.openalex_institution_id == "I456" + + +def test_get_dashboard_organization_rejects_missing_openalex_id(): + engine = create_engine("sqlite://", connect_args={"check_same_thread": False}) + SQLModel.metadata.create_all(engine) + + with Session(engine) as session: + organization = Organization(name="Example University") + session.add(organization) + session.commit() + session.refresh(organization) + + with pytest.raises(HTTPException) as exc_info: + get_dashboard_organization(session, _access_token(organization.id)) + + assert exc_info.value.status_code == 422 + + +def _access_token(organization_id): + return AccessToken( + real_account_id=organization_id, + effective_account_id=organization_id, + effective_role=UserRole.USER, + effective_organization_id=organization_id, + expires_at="2099-01-01T00:00:00Z", + epoch=0, + user_fingerprint_hash="hash", + raw_token="token", + ) diff --git a/service/src/main/inse/database.py b/service/src/main/inse/database.py index 39a7c24b..077f7faa 100644 --- a/service/src/main/inse/database.py +++ b/service/src/main/inse/database.py @@ -16,9 +16,72 @@ engine = create_engine( ) +def _migrate_secret_table(): + """Upgrade the legacy login-only secret table without losing its data.""" + columns = {column["name"] for column in inspect(engine).get_columns("secret")} + required_columns = { + "purpose", + "request_count", + "request_window_started_at", + } + if required_columns.issubset(columns): + return + + # SQLite cannot alter a UNIQUE constraint in place. Rebuild the table so an + # account can hold both a login OTK and a password-reset secret. + with engine.begin() as connection: + connection.execute(text("ALTER TABLE secret RENAME TO secret_legacy")) + connection.execute( + text( + """ + CREATE TABLE secret ( + id CHAR(32) NOT NULL PRIMARY KEY, + account_id CHAR(32) NOT NULL, + purpose VARCHAR NOT NULL, + secret_value VARCHAR NOT NULL, + expires_at DATETIME NOT NULL, + request_count INTEGER NOT NULL DEFAULT 0, + request_window_started_at DATETIME, + CONSTRAINT uq_secret_account_purpose + UNIQUE (account_id, purpose), + FOREIGN KEY(account_id) REFERENCES account (id) + ) + """ + ) + ) + connection.execute( + text( + """ + INSERT INTO secret ( + id, account_id, purpose, secret_value, expires_at, + request_count, request_window_started_at + ) + SELECT id, account_id, 'LOGIN_OTK', secret_value, expires_at, + 0, NULL + FROM secret_legacy + """ + ) + ) + connection.execute(text("DROP TABLE secret_legacy")) + connection.execute( + text("CREATE INDEX ix_secret_account_id ON secret (account_id)") + ) + connection.execute(text("CREATE INDEX ix_secret_purpose ON secret (purpose)")) + connection.execute( + text("CREATE INDEX ix_secret_expires_at ON secret (expires_at)") + ) + connection.execute( + text( + "CREATE INDEX ix_secret_request_window_started_at " + "ON secret (request_window_started_at)" + ) + ) + + def create_db_and_tables(): """Creates the database and tables based on the SQLModel metadata.""" SQLModel.metadata.create_all(engine) + _migrate_secret_table() columns = {column["name"] for column in inspect(engine).get_columns("account")} if "activated" not in columns: with engine.begin() as connection: diff --git a/service/src/main/inse/institutions/institutions_search_client.py b/service/src/main/inse/institutions/institutions_search_client.py index 975d6c4d..1c3a060f 100644 --- a/service/src/main/inse/institutions/institutions_search_client.py +++ b/service/src/main/inse/institutions/institutions_search_client.py @@ -224,6 +224,7 @@ class InstitutionsSearchClient: "wildcard": { "display_name.keyword": { "value": f"*{stripped}*", + "case_insensitive": True, "boost": 2, } } @@ -232,6 +233,7 @@ class InstitutionsSearchClient: "wildcard": { "display_name_alternatives.keyword": { "value": f"*{stripped}*", + "case_insensitive": True, "boost": 2, } } @@ -240,6 +242,7 @@ class InstitutionsSearchClient: "wildcard": { "display_name_acronyms.keyword": { "value": f"*{stripped.upper()}*", + "case_insensitive": True, "boost": 10, } } diff --git a/service/src/main/inse/integrations/elasticsearch.py b/service/src/main/inse/integrations/elasticsearch.py index 803aa212..3ff5dc53 100644 --- a/service/src/main/inse/integrations/elasticsearch.py +++ b/service/src/main/inse/integrations/elasticsearch.py @@ -23,6 +23,7 @@ def get_client() -> httpx.AsyncClient: global _client, _loop try: import asyncio + current_loop = asyncio.get_running_loop() except RuntimeError: current_loop = None @@ -45,7 +46,7 @@ def _cluster_credentials(cluster: ESCluster) -> Tuple[str, str]: Returns: Tuple[str, str]: The Elasticsearch URL and API key for the specified cluster. """ - + if cluster == ESCluster.NES: if ( not config.settings.elasticsearch_url @@ -54,7 +55,7 @@ def _cluster_credentials(cluster: ESCluster) -> Tuple[str, str]: raise MissingApiKeyError( "Elasticsearch URL and API key must be set in the configuration for cluster 'nes'" ) - + return config.settings.elasticsearch_url, config.settings.elasticsearch_api_key elif cluster == ESCluster.INSE: if ( @@ -108,8 +109,12 @@ def _index_to_cluster(index: ESIndex) -> Optional[ESCluster]: def _wrap_exception(e: Exception) -> Exception: if isinstance(e, httpx.HTTPStatusError): if e.response.status_code == 404: - return ElasticsearchNotFoundException(f"Elasticsearch resource not found: {e}") - return ElasticsearchException(f"Elasticsearch returned status {e.response.status_code}: {e}") + return ElasticsearchNotFoundException( + f"Elasticsearch resource not found: {e}" + ) + return ElasticsearchException( + f"Elasticsearch returned status {e.response.status_code}: {e}" + ) elif isinstance(e, httpx.RequestError): return ElasticsearchConnectionException(f"Elasticsearch connection error: {e}") return ElasticsearchException(f"Unexpected Elasticsearch error: {e}") @@ -211,7 +216,9 @@ async def search( raise _wrap_exception(exc) from exc -async def open_point_in_time(index: str, keep_alive: str = "1m", cluster: str = "nes") -> str: +async def open_point_in_time( + index: str, keep_alive: str = "1m", cluster: str = "nes" +) -> str: """Opens a point-in-time on the given index and returns its id.""" elasticsearch_url, api_key = _cluster_credentials(cluster) headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"} @@ -256,7 +263,7 @@ async def scan( cluster: str = "nes", ) -> AsyncIterator[Dict[str, Any]]: """Yields every hit matching ``query`` using a point-in-time + ``search_after``. - + Unlike ``from``/``size`` pagination, this is not bounded by ``index.max_result_window``, so it can stream result sets larger than 10k. """ @@ -316,6 +323,9 @@ async def get( cluster: ESCluster = ESCluster.NES, ) -> dict[str, Any]: + if isinstance(index, ESIndex): + cluster = _index_to_cluster(index) or cluster + elasticsearch_url, api_key = _cluster_credentials(cluster) headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"} diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index 24969bb8..56b300c4 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -25,6 +25,8 @@ from inse.exceptions import ( from inse.funders.service import router as funders_service_router from inse.projects.router import router as projects_router from inse.university_ranking.service import router as university_ranking_router +from inse.keywords.service import router as keywords_service_router +from inse.patents.keywords.service import router as keywords_patents_router # caching from inse.middleware.etag_cache import ETagCacheMiddleware @@ -32,13 +34,11 @@ from inse.persons.service import router as persons_service_router from inse.topics.service import router as topics_service_router from inse.works.service import router as works_service_router from inse.news.service import router as news_service_router -from inse.patents.service import router as patents_service_router -from inse.keywords.service import router as keywords_service_router - from inse.auth.router import router as auth_router from inse.account_management.router import router as account_management_router from inse.organization_management.router import router as organization_management_router - +from inse.dashboard.router import router as dashboard_router +from inse.bookmarks.router import router as bookmarks_router from inse.institutions.router import router as institutions_router from inse.database import create_db_and_tables, get_session @@ -53,6 +53,8 @@ from inse.patents.service import ( router as patents_service_router, ) +from inse.works.purpose_router import router as works_purpose_router + logger = logging.getLogger(__name__) ### startup @@ -83,6 +85,7 @@ 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_purpose_router) app.include_router(works_service_router) app.include_router(persons_service_router) app.include_router(funders_service_router) @@ -93,12 +96,15 @@ app.include_router(university_ranking_router) app.include_router(projects_router) app.include_router(patents_all_router) app.include_router(keywords_service_router) +app.include_router(keywords_patents_router) app.include_router(service_router) app.include_router(auth_router) app.include_router(account_management_router) app.include_router(organization_management_router) +app.include_router(dashboard_router) +app.include_router(bookmarks_router) app.add_middleware( ETagCacheMiddleware, @@ -116,6 +122,7 @@ app.add_middleware( # exception handlers + @app.exception_handler(NotFoundException) async def handle_not_found(request: Request, exc: NotFoundException): return JSONResponse(status_code=404, content={"message": str(exc)}) @@ -124,13 +131,18 @@ async def handle_not_found(request: Request, exc: NotFoundException): @app.exception_handler(ElasticsearchException) async def handle_elasticsearch_error(request: Request, exc: ElasticsearchException): logger.error("Elasticsearch integration error: %s", str(exc)) - return JSONResponse(status_code=502, content={"message": "Search service temporarily unavailable"}) + return JSONResponse( + status_code=502, content={"message": "Search service temporarily unavailable"} + ) @app.exception_handler(MissingApiKeyError) async def handle_missing_api_key(request: Request, exc: MissingApiKeyError): logger.error("Configuration error: %s", str(exc)) - return JSONResponse(status_code=503, content={"message": str(exc) or "Search service is not configured"}) + return JSONResponse( + status_code=503, + content={"message": str(exc) or "Search service is not configured"}, + ) @app.exception_handler(UpstreamAPIException) diff --git a/service/src/main/inse/middleware/etag_cache.py b/service/src/main/inse/middleware/etag_cache.py index 3bc9f9a7..e9d605c0 100644 --- a/service/src/main/inse/middleware/etag_cache.py +++ b/service/src/main/inse/middleware/etag_cache.py @@ -1,74 +1,79 @@ -# middleware/etag_cache.py -import hashlib -import json -import time - -from starlette.middleware.base import BaseHTTPMiddleware -from starlette.requests import Request -from starlette.responses import Response - - -class ETagCacheMiddleware(BaseHTTPMiddleware): - def __init__(self, app, ttl: int = 60): - super().__init__(app) - self.ttl = ttl # timeout in seconds - self.cache: dict[str, dict] = {} # key → {body, etag, expires} - - def _cache_key(self, request: Request) -> str: - # Include query params and relevant headers in the key - return f"{request.url.path}?{request.url.query}" - - def _content_type(self, response: Response) -> str | None: - return response.headers.get("content-type") - - async def dispatch(self, request: Request, call_next): - if request.method != "GET": - return await call_next(request) - - if request.url.path.startswith(("/api/auth", "/api/accounts")): - return await call_next(request) - - if request.headers.get("authorization"): - return await call_next(request) - - key = self._cache_key(request) - entry = self.cache.get(key) - client_etag = request.headers.get("if-none-match") - - # Cache hit + not expired - if entry and time.time() < entry["expires"]: - if client_etag == entry["etag"]: - headers = {"ETag": entry["etag"]} - if entry.get("content_type"): - headers["Content-Type"] = entry["content_type"] - return Response(status_code=304, headers=headers) - - # Client has stale ETag - return fresh cached body - headers = {"ETag": entry["etag"], "Cache-Control": f"max-age={self.ttl}"} - if entry.get("content_type"): - headers["Content-Type"] = entry["content_type"] - return Response( - content=entry["body"], - headers=headers, - ) - - # Cache miss or expired → hit the actual route - response = await call_next(request) - body = b"".join([chunk async for chunk in response.body_iterator]) - etag = f'"{hashlib.md5(body).hexdigest()}"' - content_type = self._content_type(response) - - self.cache[key] = { - "body": body, - "etag": etag, - "expires": time.time() + self.ttl, - "content_type": content_type, - } - headers = {"ETag": etag, "Cache-Control": f"max-age={self.ttl}"} - if content_type: - headers["Content-Type"] = content_type - return Response( - content=body, - status_code=response.status_code, - headers=headers, - ) +# middleware/etag_cache.py +import hashlib +import json +import time + +from starlette.middleware.base import BaseHTTPMiddleware +from starlette.requests import Request +from starlette.responses import Response + + +class ETagCacheMiddleware(BaseHTTPMiddleware): + def __init__(self, app, ttl: int = 60): + super().__init__(app) + self.ttl = ttl # timeout in seconds + self.cache: dict[str, dict] = {} # key → {body, etag, expires} + + def _cache_key(self, request: Request) -> str: + # Include query params and relevant headers in the key + return f"{request.url.path}?{request.url.query}" + + def _content_type(self, response: Response) -> str | None: + return response.headers.get("content-type") + + async def dispatch(self, request: Request, call_next): + if request.method != "GET": + return await call_next(request) + + if request.url.path.startswith( + ("/api/auth", "/api/accounts", "/api/bookmarks") + ): + return await call_next(request) + + if request.headers.get("authorization"): + return await call_next(request) + + key = self._cache_key(request) + entry = self.cache.get(key) + client_etag = request.headers.get("if-none-match") + + # Cache hit + not expired + if entry and time.time() < entry["expires"]: + if client_etag == entry["etag"]: + headers = {"ETag": entry["etag"]} + if entry.get("content_type"): + headers["Content-Type"] = entry["content_type"] + return Response(status_code=304, headers=headers) + + # Client has stale ETag - return fresh cached body + headers = {"ETag": entry["etag"], "Cache-Control": f"max-age={self.ttl}"} + if entry.get("content_type"): + headers["Content-Type"] = entry["content_type"] + return Response( + content=entry["body"], + status_code=entry.get("status_code", 200), + headers=headers, + ) + + # Cache miss or expired → hit the actual route + response = await call_next(request) + body = b"".join([chunk async for chunk in response.body_iterator]) + etag = f'"{hashlib.md5(body).hexdigest()}"' + content_type = self._content_type(response) + + if response.status_code < 400: + self.cache[key] = { + "body": body, + "etag": etag, + "expires": time.time() + self.ttl, + "status_code": response.status_code, + "content_type": content_type, + } + headers = {"ETag": etag, "Cache-Control": f"max-age={self.ttl}"} + if content_type: + headers["Content-Type"] = content_type + return Response( + content=body, + status_code=response.status_code, + headers=headers, + ) diff --git a/service/src/main/inse/model.py b/service/src/main/inse/model.py index bf2b23cb..72a27008 100644 --- a/service/src/main/inse/model.py +++ b/service/src/main/inse/model.py @@ -5,7 +5,16 @@ This module defines the model classes returned from our api using pydantic. """ -from enum import StrEnum +import sys + +if sys.version_info >= (3, 11): + from enum import StrEnum +else: + from enum import Enum + + class StrEnum(str, Enum): + def __str__(self) -> str: + return self.value from pydantic import BaseModel from pydantic import Field diff --git a/service/src/main/inse/patents/all/logic.py b/service/src/main/inse/patents/all/logic.py index f18b6a8d..76defc74 100644 --- a/service/src/main/inse/patents/all/logic.py +++ b/service/src/main/inse/patents/all/logic.py @@ -1,6 +1,8 @@ """Business logic for global patent listing.""" import asyncio +import logging from datetime import datetime + import httpx from fastapi import HTTPException from starlette.status import HTTP_404_NOT_FOUND @@ -11,13 +13,17 @@ from inse.patents.common import model from inse.patents.common.elastic_search_client import MissingApiKeyError from inse.patents.common.parsing import ( enrich_patents_classifications, + enrich_patents_openalex_topics, 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.patents_openalex_keywords.client import PatentsOpenAlexKeywordsClient from inse.patents.search_client import PatentSearchClient +logger = logging.getLogger(__name__) + async def get_all_patents( page: int = 0, size: int = 10, @@ -76,6 +82,14 @@ async def get_all_patents( ) from exc await enrich_patents_classifications(patents, ipc_search_client) + try: + await enrich_patents_openalex_topics( + patents, PatentsOpenAlexKeywordsClient() + ) + except Exception: + logger.warning( + "Failed to enrich patents with OpenAlex topics", exc_info=True + ) return model.AllPatentsResponse( total=total, @@ -83,3 +97,115 @@ async def get_all_patents( size=size, patents=patents, ) + + +def _normalize_patent_date(date_str: str) -> str: + return datetime.strptime(date_str.strip(), "%Y-%m-%d").strftime("%Y%m%d") + + +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 _search_by_id( + client: AllPatentsSearchClient, + patent_id: str, + filling_date: str | None = None, +) -> 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, filling_date)) + return parse_epo_hits(data) + data = await client.search_uspto(client.uspto_detail_query(number, filling_date)) + return parse_uspto_hits(data) + + +async def _search_by_title( + client: AllPatentsSearchClient, + title: str, + filling_date: str | None = None, + prefix: str | None = None, +) -> list[model.PatentEntry]: + if prefix and prefix.upper() == "US": + data = await client.search_uspto(client.uspto_title_query(title, filling_date)) + return parse_uspto_hits(data) + if prefix and prefix.upper() == "EP": + data = await client.search_epo(client.epo_title_query(title, filling_date)) + return parse_epo_hits(data) + + epo_data, uspto_data = await asyncio.gather( + client.search_epo(client.epo_title_query(title, filling_date)), + client.search_uspto(client.uspto_title_query(title, filling_date)), + ) + return parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) + + +async def get_patent_by_id( + patent_id: str, + prefix: str | None = None, + title: 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() + normalized_filling_date = ( + _normalize_patent_date(filling_date) if filling_date else None + ) + + lookup_id = patent_id + if prefix and not patent_id.upper().startswith(prefix.upper()): + lookup_id = f"{prefix.upper()}{patent_id}" + + try: + patents = await _search_by_id( + all_patents_client, lookup_id, normalized_filling_date + ) + + if not patents and title: + patents = await _search_by_title( + all_patents_client, + title, + normalized_filling_date, + prefix, + ) + + 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) + try: + await enrich_patents_openalex_topics( + patents[:1], PatentsOpenAlexKeywordsClient() + ) + except Exception: + logger.warning( + "Failed to enrich patent with OpenAlex topics", exc_info=True + ) + return patents[0] diff --git a/service/src/main/inse/patents/all/service.py b/service/src/main/inse/patents/all/service.py index a620c93c..2126fc29 100644 --- a/service/src/main/inse/patents/all/service.py +++ b/service/src/main/inse/patents/all/service.py @@ -33,3 +33,23 @@ async def get_all_patents( year_from=year_from, year_to=year_to, ) + + +@router.get( + "/patents/{identifier}", + operation_id="getPatentByIdOrTitle", + response_model=model.PatentEntry, + summary="Get a single patent by identifier with optional title fallback.", +) +async def get_patent_by_identifier( + identifier: str, + prefix: str | None = None, + title: str | None = None, + filling_date: str | None = None, +): + return await logic.get_patent_by_id( + patent_id=identifier, + prefix=prefix, + title=title, + filling_date=filling_date, + ) diff --git a/service/src/main/inse/patents/authors/identity.py b/service/src/main/inse/patents/authors/identity.py new file mode 100644 index 00000000..320ce506 --- /dev/null +++ b/service/src/main/inse/patents/authors/identity.py @@ -0,0 +1,137 @@ +"""Identity signals used to decide whether a patent really belongs to a person. + +These are the *strong* signals (name specificity, institution/assignee overlap) +that distinguish one same-named person from another. +""" +from __future__ import annotations + +from inse.models.openalex.author import Author +from inse.patents.authors.name_matching import ( + first_name_match_kind_for_person, + name_matches_person, +) +from inse.patents.authors.name_variants import parse_person_name +from inse.patents.common import model +from inse.patents.institutions.name_matching import assignee_matches_institution_name + +# Ambiguity is derived purely from data that already exists in the project (the +# number of patent hits for the name and the number of same-named authors in the +# local OpenAlex index) — no external name database is used. +# +# Thresholds are starting values and should be validated against a handful of +# test persons. +PATENT_HIT_COUNT_THRESHOLD = 300 +OPENALEX_FULL_NAME_COUNT_THRESHOLD = 2 +OPENALEX_LAST_NAME_COUNT_THRESHOLD = 100 + + +def is_ambiguous_name( + display_name: str | None, + *, + patent_hit_count: int = 0, + openalex_full_name_count: int | None = None, + openalex_last_name_count: int | None = None, +) -> bool: + """Decide whether a name is ambiguous using only internal project data. + + A name is treated as ambiguous (and therefore handled strictly) when: + - it is a mononym / cannot be parsed into given + family name, or + - several authors in the local OpenAlex index share the exact name, or + - many authors in the local OpenAlex index share the family name, or + - the patent name search returns a very large number of hits. + + Ambiguous names need a strong identity signal (institution/assignee or a + full given-name match with a matching research field) before a patent is + attributed to the person. + """ + parsed = parse_person_name(display_name) + if parsed is None or parsed.is_single_token: + return True + + if ( + openalex_full_name_count is not None + and openalex_full_name_count >= OPENALEX_FULL_NAME_COUNT_THRESHOLD + ): + return True + + if ( + openalex_last_name_count is not None + and openalex_last_name_count >= OPENALEX_LAST_NAME_COUNT_THRESHOLD + ): + return True + + if patent_hit_count >= PATENT_HIT_COUNT_THRESHOLD: + return True + + return False + + +def author_institution_names(author: Author) -> list[str]: + names: list[str] = [] + seen: set[str] = set() + + def _add(display_name: str | None) -> None: + if not display_name or not display_name.strip(): + return + key = display_name.casefold() + if key in seen: + return + seen.add(key) + names.append(display_name.strip()) + + for institution in author.last_known_institutions or []: + _add(getattr(institution, "display_name", None)) + + for affiliation in author.affiliations or []: + institution = getattr(affiliation, "institution", None) + if institution is not None: + _add(getattr(institution, "display_name", None)) + + return names + + +def patent_institution_match( + patent: model.PatentEntry, + institution_names: list[str], +) -> bool: + if not institution_names: + return False + for assignee in patent.assignees: + if not assignee: + continue + for institution_name in institution_names: + if assignee_matches_institution_name(assignee, institution_name): + return True + return False + + +def patent_personal_assignee_match( + patent: model.PatentEntry, + display_name: str, +) -> bool: + """True when the person themselves is listed as an applicant/assignee. + + Being the personal applicant of a patent is a strong identity signal + (organisation assignees like companies/universities will not match a + full person name). + """ + if not display_name or not display_name.strip(): + return False + for assignee in patent.assignees: + if assignee and name_matches_person(assignee, display_name): + return True + return False + + +def best_name_match_kind(patent: model.PatentEntry, display_name: str) -> str: + """Best given-name match across all inventors: 'full' > 'initial' > 'none'.""" + best = "none" + for inventor in patent.inventors: + if not inventor: + continue + kind = first_name_match_kind_for_person(inventor, display_name) + if kind == "full": + return "full" + if kind == "initial": + best = "initial" + return best diff --git a/service/src/main/inse/patents/authors/ipc_openalex_mapping.py b/service/src/main/inse/patents/authors/ipc_openalex_mapping.py new file mode 100644 index 00000000..11619c3e --- /dev/null +++ b/service/src/main/inse/patents/authors/ipc_openalex_mapping.py @@ -0,0 +1,586 @@ +"""Precomputed IPC/CPC symbol → OpenAlex topic lookups (1:1 per hierarchy level).""" +from __future__ import annotations + +import json +import os +from dataclasses import dataclass +from functools import lru_cache +from typing import Any + +from inse.models.openalex.author import Author +from inse.patents.common import model +from inse.patents.ipc_lookup import extract_ipc_symbol, parse_ipc_symbol + +MAPPING_FILENAME = "ipc_openalex_topic_mapping.json" +TOPIC_CACHE_FILENAME = "topic_hierarchy_cache.json" +LEVELS = ("section", "class", "subclass", "group", "subgroup") +MATCH_LEVELS = ("subgroup", "group", "subclass") + +# High-frequency IPC subclasses missing from the ES-built mapping file. +SUBCLASS_TOPIC_OVERRIDES: dict[str, str] = { + "A61B": "Cardiac electrophysiology and arrhythmias", + "A61K": "Pharmaceutical studies and practices", + "A61P": "Cancer Immunotherapy and Biomarkers", + "C07K": "Cancer Immunotherapy and Biomarkers", + "C12N": "Biotechnology and Related Fields", + "C12Q": "Cancer Immunotherapy and Biomarkers", + "G01N": "Analytical Methods in Pharmaceuticals", +} + +_TOPIC_LABEL_STOPWORDS = frozenset({ + "and", + "the", + "for", + "of", + "in", + "with", + "their", + "from", + "into", + "via", + "disease", + "diseases", + "treatment", + "treatments", + "therapy", + "therapies", + "application", + "applications", + "studies", + "study", + "research", + "methods", + "method", + "systems", + "system", + "analysis", + "molecular", + "compounds", + "compound", + "interactions", + "interaction", + "effects", + "properties", + "based", + "related", + "advanced", + "novel", + "using", + "use", + "field", + "fields", + "engineering", + "natural", + "human", + "clinical", + "medical", + "medicine", + "health", + "general", + "other", + "various", + "specific", + "particular", +}) + + +def _meaningful_topic_tokens(label: str) -> set[str]: + return { + token + for token in label.casefold().split() + if len(token) > 3 and token not in _TOPIC_LABEL_STOPWORDS + } + + +@dataclass(frozen=True) +class MappedOpenAlexTopic: + topic_id: str + topic_display_name: str | None = None + subfield_id: str | None = None + field_id: str | None = None + domain_id: str | None = None + subfield_name: str | None = None + field_name: str | None = None + domain_name: str | None = None + ipc_level: str | None = None + ipc_symbol: str | None = None + + +@dataclass(frozen=True) +class OpenAlexTopicRefs: + topic_ids: frozenset[str] + subfield_ids: frozenset[str] + field_ids: frozenset[str] + domain_ids: frozenset[str] + + +def normalize_openalex_id(value: str | None) -> str | None: + if not value or not str(value).strip(): + return None + cleaned = str(value).strip() + if cleaned.startswith("https://openalex.org/"): + return cleaned.rsplit("/", 1)[-1] + return cleaned + + +def _data_dir() -> str: + for base in ( + "/data", + os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "data") + ), + ): + if os.path.isdir(base): + return base + return os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "data") + ) + + +def _mapping_path() -> str: + return os.path.join(_data_dir(), MAPPING_FILENAME) + + +@lru_cache(maxsize=1) +def _load_topic_cache() -> dict[str, dict[str, str]]: + path = os.path.join(_data_dir(), TOPIC_CACHE_FILENAME) + try: + with open(path, encoding="utf-8") as handle: + raw = json.load(handle) + except (OSError, json.JSONDecodeError): + return {} + if not isinstance(raw, dict): + return {} + return { + display_name: { + "topic_id": str(info.get("topic_id", "")), + "subfield": info.get("subfield"), + "field": info.get("field"), + "domain": info.get("domain"), + } + for display_name, info in raw.items() + if isinstance(info, dict) and info.get("topic_id") + } + + +def _enrich_mapped_topic(mapped: MappedOpenAlexTopic) -> MappedOpenAlexTopic: + cache = _load_topic_cache() + topic_name = mapped.topic_display_name or "" + info = cache.get(topic_name) + if info is None: + for candidate in cache.values(): + if candidate.get("topic_id") == mapped.topic_id: + info = candidate + break + if info is None: + return mapped + return MappedOpenAlexTopic( + topic_id=mapped.topic_id, + topic_display_name=mapped.topic_display_name or topic_name, + subfield_id=mapped.subfield_id, + field_id=mapped.field_id, + domain_id=mapped.domain_id, + subfield_name=info.get("subfield"), + field_name=info.get("field"), + domain_name=info.get("domain"), + ipc_level=mapped.ipc_level, + ipc_symbol=mapped.ipc_symbol, + ) + + +def _mapped_from_topic_name( + topic_display_name: str, + *, + ipc_level: str, + ipc_symbol: str, +) -> MappedOpenAlexTopic | None: + cache = _load_topic_cache() + info = cache.get(topic_display_name) + if info is None: + return None + return _enrich_mapped_topic( + MappedOpenAlexTopic( + topic_id=info["topic_id"], + topic_display_name=topic_display_name, + ipc_level=ipc_level, + ipc_symbol=ipc_symbol, + ) + ) + + +def _apply_subclass_overrides( + parsed: dict[str, dict[str, MappedOpenAlexTopic]], +) -> None: + for symbol, topic_name in SUBCLASS_TOPIC_OVERRIDES.items(): + mapped = _mapped_from_topic_name( + topic_name, + ipc_level="subclass", + ipc_symbol=_normalize_symbol(symbol), + ) + if mapped is not None: + parsed["subclass"][_normalize_symbol(symbol)] = mapped + + +@lru_cache(maxsize=1) +def load_ipc_openalex_mapping() -> dict[str, dict[str, MappedOpenAlexTopic]]: + path = _mapping_path() + try: + with open(path, encoding="utf-8") as handle: + raw = json.load(handle) + except (OSError, json.JSONDecodeError): + raw = {} + + parsed: dict[str, dict[str, MappedOpenAlexTopic]] = {level: {} for level in LEVELS} + for level in LEVELS: + for symbol, entry in (raw.get(level) or {}).items(): + if not isinstance(entry, dict): + continue + topic_id = entry.get("topic_id") + if not topic_id: + continue + normalized_symbol = _normalize_symbol(symbol) + mapped = _enrich_mapped_topic( + MappedOpenAlexTopic( + topic_id=str(topic_id), + topic_display_name=entry.get("topic_display_name"), + subfield_id=entry.get("subfield_id"), + field_id=entry.get("field_id"), + domain_id=entry.get("domain_id"), + subfield_name=entry.get("subfield"), + field_name=entry.get("field"), + domain_name=entry.get("domain"), + ipc_level=level, + ipc_symbol=normalized_symbol, + ) + ) + parsed[level][normalized_symbol] = mapped + _apply_subclass_overrides(parsed) + return parsed + + +def clear_mapping_cache() -> None: + load_ipc_openalex_mapping.cache_clear() + _load_topic_cache.cache_clear() + from inse.patents.patents_openalex_keywords.resolver import clear_resolver_caches + + clear_resolver_caches() + + +def _normalize_symbol(symbol: str | None) -> str: + if not symbol: + return "" + return symbol.strip().upper().replace(" ", "") + + +def _entry_from_raw(entry: dict[str, Any]) -> MappedOpenAlexTopic | None: + topic_id = entry.get("topic_id") + if not topic_id: + return None + return MappedOpenAlexTopic( + topic_id=str(topic_id), + topic_display_name=entry.get("topic_display_name"), + subfield_id=entry.get("subfield_id"), + field_id=entry.get("field_id"), + domain_id=entry.get("domain_id"), + ipc_level=entry.get("ipc_level"), + ipc_symbol=entry.get("ipc_symbol"), + ) + + +def lookup_mapped_topic( + mapping: dict[str, dict[str, MappedOpenAlexTopic]], + level: str, + symbol: str | None, +) -> MappedOpenAlexTopic | None: + if not symbol: + return None + return mapping.get(level, {}).get(_normalize_symbol(symbol)) + + +def hierarchy_keys_for_symbol(raw_code: str): + return parse_ipc_symbol(extract_ipc_symbol(raw_code)) + + +def resolve_mapped_topics_for_code( + raw_code: str, + mapping: dict[str, dict[str, MappedOpenAlexTopic]] | None = None, +) -> list[MappedOpenAlexTopic]: + table = mapping if mapping is not None else load_ipc_openalex_mapping() + keys = hierarchy_keys_for_symbol(raw_code) + if keys is None: + return [] + + candidates: list[tuple[str, str | None]] = [ + ("subgroup", keys.subgroup or keys.normalized), + ("group", keys.main_group or keys.normalized), + ("subclass", keys.subclass), + ] + for level, symbol in candidates: + if not symbol: + continue + mapped = lookup_mapped_topic(table, level, symbol) + if mapped is not None: + return [mapped] + return [] + + +def resolve_mapped_topics_for_patent( + patent: model.PatentEntry, + mapping: dict[str, dict[str, MappedOpenAlexTopic]] | None = None, +) -> list[MappedOpenAlexTopic]: + table = mapping if mapping is not None else load_ipc_openalex_mapping() + seen: set[str] = set() + resolved: list[MappedOpenAlexTopic] = [] + for raw_code in (*patent.ipc, *patent.cpc): + for mapped in resolve_mapped_topics_for_code(raw_code, table): + topic_key = normalize_openalex_id(mapped.topic_id) or mapped.topic_id + if topic_key in seen: + continue + seen.add(topic_key) + resolved.append(mapped) + return resolved + + +def author_openalex_topic_refs(author: Author) -> OpenAlexTopicRefs: + topic_ids: set[str] = set() + subfield_ids: set[str] = set() + field_ids: set[str] = set() + domain_ids: set[str] = set() + + for topic in author.topics or []: + topic_id = normalize_openalex_id(getattr(topic, "id", None)) + if topic_id: + topic_ids.add(topic_id) + subfield = getattr(topic, "subfield", None) + if subfield is not None: + subfield_id = normalize_openalex_id(getattr(subfield, "id", None)) + if subfield_id: + subfield_ids.add(subfield_id) + field = getattr(topic, "var_field", None) or getattr(topic, "field", None) + if field is not None: + field_id = normalize_openalex_id(getattr(field, "id", None)) + if field_id: + field_ids.add(field_id) + domain = getattr(topic, "domain", None) + if domain is not None: + domain_id = normalize_openalex_id(getattr(domain, "id", None)) + if domain_id: + domain_ids.add(domain_id) + + return OpenAlexTopicRefs( + topic_ids=frozenset(topic_ids), + subfield_ids=frozenset(subfield_ids), + field_ids=frozenset(field_ids), + domain_ids=frozenset(domain_ids), + ) + + +def author_topic_labels(author: Author) -> set[str]: + labels: set[str] = set() + for topic in author.topics or []: + if topic.display_name: + labels.add(topic.display_name.casefold()) + subfield = getattr(topic, "subfield", None) + if subfield is not None and getattr(subfield, "display_name", None): + labels.add(subfield.display_name.casefold()) + field = getattr(topic, "var_field", None) or getattr(topic, "field", None) + if field is not None and getattr(field, "display_name", None): + labels.add(field.display_name.casefold()) + return labels + + +def _topic_labels_match( + mapped: MappedOpenAlexTopic, + author: Author, + *, + strict: bool = False, +) -> bool: + mapped_label = (mapped.topic_display_name or "").casefold() + if not mapped_label: + return False + + author_labels = author_topic_labels(author) + if mapped_label in author_labels: + return True + + if strict: + mapped_tokens = _meaningful_topic_tokens(mapped_label) + if not mapped_tokens: + return False + for label in author_labels: + if len(mapped_tokens & _meaningful_topic_tokens(label)) >= 2: + return True + return False + + mapped_tokens = {token for token in mapped_label.split() if len(token) > 2} + for label in author_labels: + if mapped_label in label or label in mapped_label: + return True + label_tokens = {token for token in label.split() if len(token) > 2} + if len(mapped_tokens & label_tokens) >= 2: + return True + return False + + +def mapped_topic_refs(mapped: MappedOpenAlexTopic) -> OpenAlexTopicRefs: + topic_id = normalize_openalex_id(mapped.topic_id) + return OpenAlexTopicRefs( + topic_ids=frozenset({topic_id}) if topic_id else frozenset(), + subfield_ids=frozenset( + {normalize_openalex_id(mapped.subfield_id)} + if normalize_openalex_id(mapped.subfield_id) + else set() + ), + field_ids=frozenset( + {normalize_openalex_id(mapped.field_id)} + if normalize_openalex_id(mapped.field_id) + else set() + ), + domain_ids=frozenset( + {normalize_openalex_id(mapped.domain_id)} + if normalize_openalex_id(mapped.domain_id) + else set() + ), + ) + + +def _hierarchy_names_overlap(mapped: MappedOpenAlexTopic, author: Author) -> bool: + mapped_names = { + name.casefold() + for name in (mapped.subfield_name, mapped.field_name, mapped.domain_name) + if name + } + if not mapped_names: + return False + return bool(mapped_names & author_topic_labels(author)) + + +def refs_overlap(left: OpenAlexTopicRefs, right: OpenAlexTopicRefs) -> bool: + if left.topic_ids & right.topic_ids: + return True + if left.subfield_ids & right.subfield_ids: + return True + if left.field_ids & right.field_ids: + return True + return False + + +def strict_refs_overlap(left: OpenAlexTopicRefs, right: OpenAlexTopicRefs) -> bool: + """Topic/subfield overlap only — used for ambiguous inventor names.""" + if left.topic_ids & right.topic_ids: + return True + if left.subfield_ids & right.subfield_ids: + return True + return False + + +def mapped_topics_match_author_strict( + mapped_topics: list[MappedOpenAlexTopic], + author: Author, +) -> bool: + author_refs = author_openalex_topic_refs(author) + if not any((author_refs.topic_ids, author_refs.subfield_ids)): + return True + if not mapped_topics: + return False + return any( + strict_refs_overlap(mapped_topic_refs(mapped), author_refs) + for mapped in mapped_topics + ) + + +def mapped_topics_match_author_for_ambiguous( + patent: model.PatentEntry, + author: Author, + keywords_mapped: list[MappedOpenAlexTopic], + mapping: dict[str, dict[str, MappedOpenAlexTopic]] | None = None, +) -> bool: + """Topic match for same-named inventors without hierarchy/field false positives.""" + from inse.patents.authors.identity import best_name_match_kind + + table = mapping if mapping is not None else load_ipc_openalex_mapping() + legacy_mapped = resolve_mapped_topics_for_patent(patent, table) + + if mapped_topics_match_author_strict(keywords_mapped, author): + return True + if mapped_topics_match_author_strict(legacy_mapped, author): + return True + if any( + _topic_labels_match(mapped, author, strict=True) + for mapped in keywords_mapped + ): + return True + if best_name_match_kind(patent, author.display_name or "") != "full": + return False + return _legacy_primary_field_name_matches_author(patent, author, table) + + +def _primary_legacy_mapped_topics( + patent: model.PatentEntry, + mapping: dict[str, dict[str, MappedOpenAlexTopic]] | None = None, +) -> list[MappedOpenAlexTopic]: + table = mapping if mapping is not None else load_ipc_openalex_mapping() + for raw_code in patent.ipc or []: + mapped = resolve_mapped_topics_for_code(raw_code, table) + if mapped: + return mapped + return [] + + +def _legacy_primary_field_name_matches_author( + patent: model.PatentEntry, + author: Author, + mapping: dict[str, dict[str, MappedOpenAlexTopic]] | None = None, +) -> bool: + if not patent.ipc: + return False + keys = parse_ipc_symbol(extract_ipc_symbol(patent.ipc[0])) + if keys is None: + return False + section = (keys.section or "").upper() + subclass = (keys.subclass or "")[:3].upper() + if section == "B": + return False + if section not in {"A", "C"}: + return False + if section == "C" and subclass not in {"C07", "C12"}: + return False + + primary = _primary_legacy_mapped_topics(patent, mapping) + if not primary: + return False + author_labels = author_topic_labels(author) + return any( + (mapped.field_name or "").casefold() in author_labels + for mapped in primary + if mapped.field_name + ) + + +def mapped_topics_match_author( + mapped_topics: list[MappedOpenAlexTopic], + author: Author, +) -> bool: + author_refs = author_openalex_topic_refs(author) + if not any((author_refs.topic_ids, author_refs.subfield_ids, author_refs.field_ids)): + return True + if not mapped_topics: + return False + return any( + refs_overlap(mapped_topic_refs(mapped), author_refs) + or _topic_labels_match(mapped, author) + or _hierarchy_names_overlap(mapped, author) + for mapped in mapped_topics + ) + + +def patent_topics_match_author( + patent: model.PatentEntry, + author: Author, + mapping: dict[str, dict[str, MappedOpenAlexTopic]] | None = None, + *, + mapped_topics: list[MappedOpenAlexTopic] | None = None, +) -> bool: + if mapped_topics is None: + mapped_topics = resolve_mapped_topics_for_patent(patent, mapping) + return mapped_topics_match_author(mapped_topics, author) diff --git a/service/src/main/inse/patents/authors/logic.py b/service/src/main/inse/patents/authors/logic.py index 0dc34be1..8b2df53a 100644 --- a/service/src/main/inse/patents/authors/logic.py +++ b/service/src/main/inse/patents/authors/logic.py @@ -7,12 +7,17 @@ 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.authors.identity import is_ambiguous_name +from inse.patents.authors.name_matching import filter_patents_by_author_name +from inse.patents.authors.name_variants import parse_person_name +from inse.patents.authors.topic_filter import filter_patents_by_ipc_topic_mapping +from inse.patents.patents_openalex_keywords.resolver import PatentOpenAlexMappingResolver 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, + expand_matched_epo_application_families, parse_epo_hits, parse_uspto_hits, ) @@ -23,7 +28,6 @@ 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, @@ -32,7 +36,7 @@ async def get_patents_by_author_id( search_client = client or PatentSearchClient() ipc_search_client = ipc_client or IpcSearchClient() - author = _get_author(author_id) + author = await _get_author(author_id) if not author: return model.PatentsByAuthorResponse( author_id=author_id, @@ -42,10 +46,7 @@ async def get_patents_by_author_id( ) author_name = author.display_name - last_name = _extract_last_name(author_name) - first_name = _extract_first_name(author_name) - - if not last_name: + if not author_name or not author_name.strip(): return model.PatentsByAuthorResponse( author_id=author_id, author_name=author_name, @@ -54,9 +55,7 @@ async def get_patents_by_author_id( ) try: - epo_data, uspto_data = await _search_both_indices( - search_client, last_name, first_name - ) + epo_data, uspto_data = await _search_both_indices(search_client, author_name) except MissingApiKeyError as exc: raise HTTPException( status_code=HTTP_503_SERVICE_UNAVAILABLE, @@ -69,54 +68,84 @@ async def get_patents_by_author_id( ) 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) + patent_hit_count = len(all_patents) + matched_patents = filter_patents_by_author_name(all_patents, author_name) + try: + matched_patents = await expand_matched_epo_application_families( + matched_patents, + search_client, + ) + except Exception: + logger.exception( + "EPO family expansion failed for %s; continuing with name-matched patents only", + author_name, + ) + + if not matched_patents: + return model.PatentsByAuthorResponse( + author_id=author_id, + author_name=author_name, + patent_count=0, + patents=[], + ) + + await enrich_patents_classifications(matched_patents, ipc_search_client) + + full_name_count = await person_logic.count_authors_by_display_name(author_name) + parsed_for_last = parse_person_name(author_name) + last_name_count: int | None = None + if parsed_for_last and not parsed_for_last.is_single_token: + last_name_count = await person_logic.count_authors_by_last_name( + parsed_for_last.last_name + ) + is_ambiguous = is_ambiguous_name( + author_name, + patent_hit_count=patent_hit_count, + openalex_full_name_count=full_name_count, + openalex_last_name_count=last_name_count, + ) + + patent_topic_map = None + try: + resolver = PatentOpenAlexMappingResolver() + patent_topic_map = await resolver.resolve_topics_for_patents(matched_patents) + except Exception: + logger.exception( + "OpenAlex topic resolution failed for %s; falling back to legacy mapping", + author_name, + ) + + filtered = filter_patents_by_ipc_topic_mapping( + matched_patents, + author, + is_ambiguous=is_ambiguous, + patent_topic_map=patent_topic_map, + ) + + logger.info( + "patents_openalex_keywords mapping for %s: ambiguous=%s, %d name-matched, %d after topic filter", + author_name, + is_ambiguous, + len(matched_patents), + len(filtered), + ) return model.PatentsByAuthorResponse( author_id=author_id, author_name=author_name, - patent_count=len(all_patents), - patents=all_patents, + patent_count=len(filtered), + patents=[item.patent for item in filtered], ) - -async def _search_both_indices(client, last_name, first_name): +async def _search_both_indices(client, display_name: str): 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)), + client.search_epo(client.epo_query_by_inventor(display_name)), + client.search_uspto(client.uspto_query_by_inventor(display_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: +async 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) + result = await 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 index 369c44ab..f55ff54f 100644 --- a/service/src/main/inse/patents/authors/name_matching.py +++ b/service/src/main/inse/patents/authors/name_matching.py @@ -1,10 +1,17 @@ """Inventor name normalization and matching.""" -import re +from inse.patents.authors.name_variants import ( + ParsedPersonName, + parse_inventor_name, + parse_person_name, + _initials_from_tokens, +) +from inse.patents.common import model from inse.patents.common.text_normalization import ( name_token_variants, normalize_name_part, patent_transliteration_expansions, + strip_person_titles, ) @@ -49,7 +56,10 @@ def _initial_tokens_match(left: str | None, right: str | None) -> bool: return False -def _inventor_first_token(inventor_name: str) -> str: +def inventor_first_token(inventor_name: str) -> str: + parsed = parse_inventor_name(inventor_name) + if parsed and parsed.primary_given_name: + return parsed.primary_given_name if "," in inventor_name: _, first_part = [p.strip() for p in inventor_name.split(",", 1)] return first_part.split()[0] if first_part else "" @@ -57,18 +67,111 @@ def _inventor_first_token(inventor_name: str) -> str: return parts[0] if parts else "" +def inventor_search_phrases(display_name: str) -> list[str]: + parsed = parse_person_name(display_name) + if parsed is None: + return [] + + if parsed.is_single_token: + return search_name_variants(parsed.last_name) + + seen: set[str] = set() + phrases: list[str] = [] + + def _add(phrase: str) -> None: + phrase = phrase.strip() + if not phrase: + return + key = phrase.casefold() + if key in seen: + return + seen.add(key) + phrases.append(phrase) + + given_names = list(parsed.given_names) + last_name = parsed.last_name + compound_last = parsed.compound_last_name + full_given = " ".join(given_names) + + _add(f"{full_given} {last_name}") + if compound_last and compound_last != last_name: + _add(f"{full_given} {compound_last}") + + for given_name in given_names: + _add(f"{given_name} {last_name}") + if compound_last and compound_last != last_name: + _add(f"{given_name} {compound_last}") + + initials = _initials_from_tokens(given_names) + if initials: + _add(f"{initials} {last_name}") + if compound_last and compound_last != last_name: + _add(f"{initials} {compound_last}") + dotted = ".".join(char for char in initials) + "." + _add(f"{dotted} {last_name}") + if compound_last and compound_last != last_name: + _add(f"{dotted} {compound_last}") + + _add(f"{last_name}, {full_given}") + for given_name in given_names: + _add(f"{last_name}, {given_name}") + if compound_last and compound_last != last_name: + _add(f"{compound_last}, {full_given}") + + expanded: list[str] = [] + expanded_seen: set[str] = set() + for phrase in phrases: + for variant in search_name_variants(phrase): + key = variant.casefold() + if key in expanded_seen: + continue + expanded_seen.add(key) + expanded.append(variant) + + return expanded + + +def name_matches_person(inventor_name: str, person_display_name: str) -> bool: + author = parse_person_name(person_display_name) + inventor = parse_inventor_name(strip_person_titles(inventor_name)) + if author is None or inventor is None: + return False + + if author.is_single_token: + return _family_name_matches(author, inventor) + + if not _family_name_matches(author, inventor): + return False + if not _given_name_matches(author, inventor): + return False + return _author_middle_initials_corroborated(author, inventor) + + +def first_name_match_kind_for_person( + inventor_name: str, + person_display_name: str, +) -> str: + if not name_matches_person(inventor_name, person_display_name): + return "none" + if _given_names_full_match( + parse_person_name(person_display_name), + parse_inventor_name(inventor_name), + ): + return "full" + return "initial" + + 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" + if first_name: + return first_name_match_kind_for_person( + inventor_name, + f"{first_name} {last_name}", + ) + return first_name_match_kind_for_person(inventor_name, last_name) def search_name_variants(value: str | None) -> list[str]: @@ -105,24 +208,158 @@ def search_name_variants(value: str | None) -> list[str]: def name_matches(inventor_name: str, first_name: str, last_name: str) -> bool: if not inventor_name or not last_name: return False + if first_name: + return name_matches_person(inventor_name, f"{first_name} {last_name}") + return name_matches_person(inventor_name, last_name) - 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) +def inventor_last_name(inventor_name: str) -> str | None: + parsed = parse_inventor_name(inventor_name) + return parsed.last_name if parsed else None + + +def filter_patents_by_author_name( + patents: list[model.PatentEntry], + display_name: str, +) -> list[model.PatentEntry]: + parsed = parse_person_name(display_name) + if parsed and parsed.is_single_token: + last_name = parsed.last_name + return [ + patent + for patent in patents + if any( + tokens_equal(inventor_last_name(inventor), last_name, allow_initial=False) + for inventor in patent.inventors + ) + ] + + return [ + patent + for patent in patents + if any( + name_matches_person(inventor, display_name) + for inventor in patent.inventors ) + or any( + name_matches_person(assignee, display_name) + for assignee in patent.assignees + ) + ] - parts = name.split() - if len(parts) < 2: + +def _family_name_matches(author: ParsedPersonName, inventor: ParsedPersonName) -> bool: + author_candidates = _family_name_candidates(author) + inventor_candidates = _family_name_candidates(inventor) + return any( + tokens_equal(author_name, inventor_name, allow_initial=False) + for author_name in author_candidates + for inventor_name in inventor_candidates + ) + + +def _family_name_candidates(parsed: ParsedPersonName) -> set[str]: + candidates = {parsed.last_name} + if parsed.compound_last_name: + candidates.add(parsed.compound_last_name) + return candidates + + +def _given_name_matches(author: ParsedPersonName, inventor: ParsedPersonName) -> bool: + if not author.given_names: + return True + if not inventor.given_names: return False - return ( - tokens_equal(parts[-1], last_name, allow_initial=False) - and bool(first_name) - and tokens_equal(parts[0], first_name) + # Accept immediately when at least one inventor given-name token matches + # one of the author's given names as a full token (not only initial), + # e.g. "Maria Schmidt" vs "Anna Maria Schmidt". This only counts if at + # least one side is a spelled-out name, not a bare initial — two + # coincidentally identical single-letter tokens (e.g. both just "K.") + # are far too weak a signal on their own and would otherwise match + # anyone sharing that one middle initial regardless of their actual + # first name (e.g. "Mahendra K. Sharma" incorrectly matching inventor + # "Vivek K." or "Virender K." on an unrelated patent). + if any( + any( + tokens_equal(author_given, inventor_given, allow_initial=False) + and not (_initial_letter(author_given) and _initial_letter(inventor_given)) + for author_given in author.given_names + ) + for inventor_given in inventor.given_names + ): + return True + + inventor_tokens_full = [ + token for token in inventor.given_names + if _initial_letter(token) is None + ] + + # Prevent false positives like "Karem C Weber" for "Christian Weber": + # if inventor has full given-name tokens but none matches the author, + # we reject even if one initial overlaps. + if inventor_tokens_full: + return False + + # Initials-only inventor names (e.g. "C. Weber", "P. J. Marrón") + # are considered a match only when every initial maps to one of + # the author's given names. + return all( + any( + tokens_equal(author_given, inventor_given, allow_initial=True) + for author_given in author.given_names + ) + for inventor_given in inventor.given_names ) + + +def _given_names_full_match( + author: ParsedPersonName | None, + inventor: ParsedPersonName | None, +) -> bool: + if author is None or inventor is None or not author.given_names: + return False + if not inventor.given_names: + return False + + primary = author.primary_given_name + if not primary: + return False + + if not any( + tokens_equal(primary, inventor_given, allow_initial=False) + for inventor_given in inventor.given_names + ): + return False + + for inventor_given in inventor.given_names: + if _initial_letter(inventor_given) and not any( + tokens_equal(author_given, inventor_given, allow_initial=False) + for author_given in author.given_names + ): + return False + + return _author_middle_initials_corroborated(author, inventor) + + +def _author_middle_initials_corroborated( + author: ParsedPersonName, + inventor: ParsedPersonName, +) -> bool: + """Require middle initials in the author name to appear on the inventor side. + + Prevents false positives such as attributing patents for "Schmitz, Oliver" + to the distinct person "Oliver J. Schmitz". + """ + if len(author.given_names) <= 1: + return True + + for author_given in author.given_names[1:]: + if _initial_letter(author_given) is None: + continue + if not any( + tokens_equal(author_given, inventor_given, allow_initial=True) + for inventor_given in inventor.given_names + ): + return False + return True diff --git a/service/src/main/inse/patents/authors/name_variants.py b/service/src/main/inse/patents/authors/name_variants.py new file mode 100644 index 00000000..c1f7a5e0 --- /dev/null +++ b/service/src/main/inse/patents/authors/name_variants.py @@ -0,0 +1,111 @@ +"""Parse person names and build search/match variants for multi-part names.""" +from __future__ import annotations + +import re +from dataclasses import dataclass + +from inse.patents.common.text_normalization import normalize_name_part + +_NAME_SUFFIXES = frozenset({ + "dr", "prof", "mr", "mrs", "ms", "phd", "ph", "md", "jr", "sr", +}) + + +@dataclass(frozen=True) +class ParsedPersonName: + raw: str + tokens: tuple[str, ...] + given_names: tuple[str, ...] + last_name: str + compound_last_name: str | None + + @property + def is_single_token(self) -> bool: + return len(self.tokens) == 1 + + @property + def primary_given_name(self) -> str | None: + return self.given_names[0] if self.given_names else None + + +def parse_person_name(display_name: str | None) -> ParsedPersonName | None: + if not display_name or not display_name.strip(): + return None + + cleaned = _strip_name_suffixes(display_name.strip()) + tokens = tuple(part for part in cleaned.split() if part) + if not tokens: + return None + + if len(tokens) == 1: + return ParsedPersonName( + raw=display_name.strip(), + tokens=tokens, + given_names=(), + last_name=tokens[0], + compound_last_name=None, + ) + + given_names = tokens[:-1] + last_name = tokens[-1] + compound_last_name = " ".join(tokens[-2:]) if len(tokens) >= 3 else None + + return ParsedPersonName( + raw=display_name.strip(), + tokens=tokens, + given_names=given_names, + last_name=last_name, + compound_last_name=compound_last_name, + ) + + +def parse_inventor_name(inventor_name: str | None) -> ParsedPersonName | None: + if not inventor_name or not inventor_name.strip(): + return None + + cleaned = _strip_name_suffixes(inventor_name.strip()) + if "," in cleaned: + last_part, first_part = [part.strip() for part in cleaned.split(",", 1)] + family_tokens = tuple(token for token in last_part.split() if token) + given_tokens = tuple(token for token in first_part.split() if token) + if not family_tokens: + return None + tokens = given_tokens + family_tokens + return ParsedPersonName( + raw=inventor_name.strip(), + tokens=tokens, + given_names=given_tokens, + last_name=family_tokens[-1], + compound_last_name=( + " ".join(family_tokens) + if len(family_tokens) > 1 + else None + ), + ) + + return parse_person_name(cleaned) + + +def _strip_name_suffixes(name: str) -> str: + parts = [part.strip() for part in name.split(",")] + while len(parts) > 1 and _is_name_suffix(parts[-1]): + parts = parts[:-1] + return ", ".join(parts).strip() + + +def _is_name_suffix(value: str) -> bool: + normalized = normalize_name_part(value).rstrip(".") + return normalized in _NAME_SUFFIXES + + +def _initials_from_tokens(tokens: list[str]) -> str: + initials = "" + for token in tokens: + normalized = normalize_name_part(token) + if not normalized: + continue + if len(normalized) == 1: + initials += normalized.upper() + else: + initials += normalized[0].upper() + return initials diff --git a/service/src/main/inse/patents/authors/search_queries.py b/service/src/main/inse/patents/authors/search_queries.py index 2149fa98..af67bf1d 100644 --- a/service/src/main/inse/patents/authors/search_queries.py +++ b/service/src/main/inse/patents/authors/search_queries.py @@ -1,7 +1,8 @@ """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.authors.name_matching import inventor_search_phrases, search_name_variants +from inse.patents.authors.name_variants import parse_person_name from inse.patents.common.elastic_search_client import DEFAULT_SEARCH_SIZE @@ -17,32 +18,51 @@ def _match_name_field(field: str, name: str) -> dict[str, Any]: } +def _match_any_phrase_field(field: str, phrases: list[str]) -> dict[str, Any]: + if not phrases: + return {"match_none": {}} + if len(phrases) == 1: + return {"match": {field: phrases[0]}} + return { + "bool": { + "should": [{"match": {field: phrase}} for phrase in phrases], + "minimum_should_match": 1, + } + } + + class InventorSearchQueries: def epo_query_by_inventor( self, - last_name: str, + display_name: str, first_name: str | None = None, size: int = DEFAULT_SEARCH_SIZE, ) -> dict[str, Any]: - if first_name: + if first_name and display_name and " " not in display_name.strip(): + display_name = f"{first_name} {display_name}".strip() + + parsed = parse_person_name(display_name) + if parsed is None: + query = {"match_none": {}} + elif parsed.is_single_token: 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), - ] - } - }, + "query": _match_name_field( + "inventors_name_nested.inventor", + parsed.last_name, + ), } } else: + phrases = inventor_search_phrases(display_name) query = { "nested": { "path": "inventors_name_nested", - "query": _match_name_field("inventors_name_nested.inventor", last_name), + "query": _match_any_phrase_field( + "inventors_name_nested.inventor", + phrases, + ), } } @@ -73,31 +93,73 @@ class InventorSearchQueries: "query": query, } + def epo_query_by_application_number( + self, + application_number: str, + size: int = 20, + ) -> dict[str, Any]: + variants = _application_number_variants(application_number) + if not variants: + return {"size": 0, "query": {"match_none": {}}} + + should = [{"term": {"application_number": variant}} for variant in variants] + query: dict[str, Any] = ( + should[0] + if len(should) == 1 + else {"bool": {"should": should, "minimum_should_match": 1}} + ) + + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"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, + display_name: str, first_name: str | None = None, size: int = DEFAULT_SEARCH_SIZE, ) -> dict[str, Any]: - if first_name: + if first_name and display_name and " " not in display_name.strip(): + display_name = f"{first_name} {display_name}".strip() + + parsed = parse_person_name(display_name) + if parsed is None: + query = {"match_none": {}} + elif parsed.is_single_token: query = { "nested": { "path": "inventors", - "query": { - "bool": { - "must": [ - _match_name_field("inventors.name", last_name), - _match_name_field("inventors.name", first_name), - ] - } - }, + "query": _match_name_field("inventors.name", parsed.last_name), } } else: + phrases = inventor_search_phrases(display_name) query = { "nested": { "path": "inventors", - "query": _match_name_field("inventors.name", last_name), + "query": _match_any_phrase_field("inventors.name", phrases), } } @@ -128,3 +190,23 @@ class InventorSearchQueries: ], "query": query, } + + +def _application_number_variants(application_number: str) -> list[str]: + cleaned = application_number.strip() + if not cleaned: + return [] + + seen: set[str] = set() + variants: list[str] = [] + + def _add(value: str) -> None: + value = value.strip() + if value and value not in seen: + seen.add(value) + variants.append(value) + + _add(cleaned) + if cleaned.upper().startswith("EP"): + _add(cleaned[2:]) + return variants diff --git a/service/src/main/inse/patents/authors/test_identity.py b/service/src/main/inse/patents/authors/test_identity.py new file mode 100644 index 00000000..a4ac8a05 --- /dev/null +++ b/service/src/main/inse/patents/authors/test_identity.py @@ -0,0 +1,51 @@ +from inse.patents.authors.identity import ( + OPENALEX_FULL_NAME_COUNT_THRESHOLD, + OPENALEX_LAST_NAME_COUNT_THRESHOLD, + PATENT_HIT_COUNT_THRESHOLD, + is_ambiguous_name, +) + + +def test_mononym_is_always_ambiguous() -> None: + assert is_ambiguous_name("Weber") is True + assert is_ambiguous_name("") is True + assert is_ambiguous_name(None) is True + + +def test_two_token_name_not_ambiguous_without_signals() -> None: + assert is_ambiguous_name("Pedro Marrón") is False + + +def test_full_name_collision_makes_name_ambiguous() -> None: + assert ( + is_ambiguous_name( + "Christian Weber", + openalex_full_name_count=OPENALEX_FULL_NAME_COUNT_THRESHOLD, + ) + is True + ) + # A single OpenAlex author with that exact name is not a collision. + assert ( + is_ambiguous_name("Christian Weber", openalex_full_name_count=1) is False + ) + + +def test_last_name_collision_makes_name_ambiguous() -> None: + assert ( + is_ambiguous_name( + "Christian Weber", + openalex_last_name_count=OPENALEX_LAST_NAME_COUNT_THRESHOLD, + ) + is True + ) + assert ( + is_ambiguous_name("Christian Weber", openalex_last_name_count=10) is False + ) + + +def test_many_patent_hits_make_name_ambiguous() -> None: + assert ( + is_ambiguous_name("Christian Weber", patent_hit_count=PATENT_HIT_COUNT_THRESHOLD) + is True + ) + assert is_ambiguous_name("Christian Weber", patent_hit_count=5) is False diff --git a/service/src/main/inse/patents/authors/test_ipc_openalex_mapping.py b/service/src/main/inse/patents/authors/test_ipc_openalex_mapping.py new file mode 100644 index 00000000..c7a7467f --- /dev/null +++ b/service/src/main/inse/patents/authors/test_ipc_openalex_mapping.py @@ -0,0 +1,224 @@ +from inse.models.openalex.author import Author +from inse.models.openalex.work_topic import WorkTopic +from inse.models.openalex.work_topic_domain import WorkTopicDomain +from inse.models.openalex.work_topic_field import WorkTopicField +from inse.models.openalex.work_topic_subfield import WorkTopicSubfield +from inse.patents.authors import ipc_openalex_mapping as mapping_module +from inse.patents.authors.ipc_openalex_mapping import ( + clear_mapping_cache, + load_ipc_openalex_mapping, + mapped_topics_match_author, + patent_topics_match_author, + resolve_mapped_topics_for_code, +) +from inse.patents.authors.topic_filter import filter_patents_by_ipc_topic_mapping +from inse.patents.common import model + + +def _author_with_topic( + topic_id: str, + display_name: str, + *, + subfield_id: str = "https://openalex.org/subfields/2208", + field_id: str = "https://openalex.org/fields/22", + domain_id: str = "https://openalex.org/domains/3", +) -> Author: + return Author( + display_name="Test Author", + topics=[ + WorkTopic( + id=topic_id, + display_name=display_name, + score=1.0, + subfield=WorkTopicSubfield( + id=subfield_id, + display_name="Subfield", + ), + var_field=WorkTopicField( + id=field_id, + display_name="Field", + ), + domain=WorkTopicDomain( + id=domain_id, + display_name="Domain", + ), + ) + ], + ) + + +def _patent(ipc_codes: list[str]) -> model.PatentEntry: + return model.PatentEntry( + patent_id="EP1", + source="EPO", + ipc=ipc_codes, + ) + + +def _custom_mapping() -> dict[str, dict[str, mapping_module.MappedOpenAlexTopic]]: + table: dict[str, dict[str, mapping_module.MappedOpenAlexTopic]] = { + level: {} for level in ("section", "class", "subclass", "group", "subgroup") + } + table["subclass"]["H01L"] = mapping_module.MappedOpenAlexTopic( + topic_id="https://openalex.org/T99999", + topic_display_name="Semiconductor materials and devices", + ipc_level="subclass", + ipc_symbol="H01L", + ) + table["subclass"]["A61B"] = mapping_module.MappedOpenAlexTopic( + topic_id="https://openalex.org/T10217", + topic_display_name="Cardiac electrophysiology and arrhythmias", + ipc_level="subclass", + ipc_symbol="A61B", + ) + return table + + +def test_resolve_mapped_topics_uses_subclass_mapping() -> None: + custom = _custom_mapping() + mapped = resolve_mapped_topics_for_code("H01L 21/02", custom) + assert mapped + assert mapped[0].topic_id.endswith("T99999") + + +def test_patent_topics_match_author_on_topic_id() -> None: + custom = _custom_mapping() + author = _author_with_topic( + "https://openalex.org/T99999", + "Semiconductor materials and devices", + ) + patent = _patent(["H01L 21/02"]) + assert patent_topics_match_author(patent, author, custom) is True + + +def test_patent_topics_do_not_match_unrelated_author() -> None: + custom = _custom_mapping() + author = _author_with_topic( + "https://openalex.org/T10217", + "Cardiac electrophysiology and arrhythmias", + subfield_id="https://openalex.org/subfields/2705", + field_id="https://openalex.org/fields/27", + domain_id="https://openalex.org/domains/4", + ) + patent = _patent(["H01L 21/02"]) + assert patent_topics_match_author(patent, author, custom) is False + + +def test_filter_rejects_ambiguous_name_without_topic_match() -> None: + custom = _custom_mapping() + author = _author_with_topic( + "https://openalex.org/T10217", + "Cardiac electrophysiology and arrhythmias", + subfield_id="https://openalex.org/subfields/2705", + field_id="https://openalex.org/fields/27", + domain_id="https://openalex.org/domains/4", + ) + patents = [ + _patent(["H01L 21/02"]), + _patent(["A61B 5/00"]), + ] + filtered = filter_patents_by_ipc_topic_mapping( + patents, + author, + is_ambiguous=True, + mapping=custom, + ) + assert len(filtered) == 1 + assert filtered[0].patent.ipc == ["A61B 5/00"] + + +def test_filter_rejects_rare_name_on_topic_conflict() -> None: + custom = _custom_mapping() + author = _author_with_topic( + "https://openalex.org/T10217", + "Cardiac electrophysiology and arrhythmias", + subfield_id="https://openalex.org/subfields/2705", + field_id="https://openalex.org/fields/27", + domain_id="https://openalex.org/domains/4", + ) + patents = [_patent(["H01L 21/02"])] + filtered = filter_patents_by_ipc_topic_mapping( + patents, + author, + is_ambiguous=False, + mapping=custom, + ) + assert filtered == [] + + +def test_filter_rejects_ambiguous_name_on_fuzzy_label_only_match() -> None: + author = _author_with_topic( + "https://openalex.org/T12345", + "Atherosclerosis and Cardiovascular Diseases", + subfield_id="https://openalex.org/subfields/2705", + field_id="https://openalex.org/fields/27", + domain_id="https://openalex.org/domains/4", + ) + tire_patent = model.PatentEntry( + patent_id="US12508845", + source="USPTO", + title="Vehicle pneumatic tyre and rubber mixture for a tread", + ipc=["B60C 1/00"], + inventors=["Christian Weber"], + ) + spurious_cardiac = mapping_module.MappedOpenAlexTopic( + topic_id="https://openalex.org/T99901", + topic_display_name="Cardiac Valve Diseases and Treatments", + subfield_id="https://openalex.org/subfields/9999", + field_id="https://openalex.org/fields/27", + field_name="Medicine", + ) + filtered = filter_patents_by_ipc_topic_mapping( + [tire_patent], + author, + is_ambiguous=True, + patent_topic_map={"USPTO:US12508845": [spurious_cardiac]}, + ) + assert filtered == [] + + +def test_filter_keeps_ambiguous_name_on_legacy_ipc_subclass_match() -> None: + custom = _custom_mapping() + custom["subclass"]["C07K"] = mapping_module.MappedOpenAlexTopic( + topic_id="https://openalex.org/T10158", + topic_display_name="Cancer Immunotherapy and Biomarkers", + ipc_level="subclass", + ipc_symbol="C07K", + ) + author = _author_with_topic( + "https://openalex.org/T10158", + "Cancer Immunotherapy and Biomarkers", + subfield_id="https://openalex.org/subfields/2705", + field_id="https://openalex.org/fields/27", + domain_id="https://openalex.org/domains/4", + ) + patent = model.PatentEntry( + patent_id="EP1555271", + source="EPO", + title="Peptides useful for diagnosis and therapy of TRP-2+ tumors", + ipc=["C07K 14/705"], + inventors=["Schadendorf, Dirk"], + ) + spurious = mapping_module.MappedOpenAlexTopic( + topic_id="https://openalex.org/T99999", + topic_display_name="Antimicrobial Peptides and Activities", + field_name="Medicine", + ) + filtered = filter_patents_by_ipc_topic_mapping( + [patent], + author, + is_ambiguous=True, + mapping=custom, + patent_topic_map={"EPO:EP1555271": [spurious]}, + ) + assert len(filtered) == 1 + + +def test_custom_mapping_table() -> None: + custom = _custom_mapping() + author = Author( + display_name="Custom", + topics=[WorkTopic(id="https://openalex.org/T99999", display_name="Semiconductor materials and devices")], + ) + patent = _patent(["H01L 21/02"]) + assert patent_topics_match_author(patent, author, custom) is True diff --git a/service/src/main/inse/patents/authors/topic_filter.py b/service/src/main/inse/patents/authors/topic_filter.py new file mode 100644 index 00000000..4ded689c --- /dev/null +++ b/service/src/main/inse/patents/authors/topic_filter.py @@ -0,0 +1,161 @@ +"""Filter name-matched patents using precomputed IPC/CPC → OpenAlex topic mappings.""" +from __future__ import annotations + +from dataclasses import dataclass + +from inse.models.openalex.author import Author +from inse.patents.authors.identity import ( + patent_institution_match, + patent_personal_assignee_match, +) +from inse.patents.authors.ipc_openalex_mapping import ( + MappedOpenAlexTopic, + author_openalex_topic_refs, + load_ipc_openalex_mapping, + mapped_topics_match_author, + mapped_topics_match_author_for_ambiguous, + patent_topics_match_author, + resolve_mapped_topics_for_patent, +) +from inse.patents.common import model +from inse.patents.common.parsing import patent_map_key + + +@dataclass(frozen=True) +class TopicFilterResult: + patent: model.PatentEntry + decision: str + matched_via_mapping: bool + institution_match: bool + personal_assignee_match: bool + + +def _author_has_topic_profile(author: Author) -> bool: + refs = author_openalex_topic_refs(author) + return bool(refs.topic_ids or refs.subfield_ids or refs.field_ids) + + +def _patent_has_mapped_topics( + mapped_topics: list[MappedOpenAlexTopic], +) -> bool: + return bool(mapped_topics) + + +def _topic_conflict( + mapped_topics: list[MappedOpenAlexTopic], + author: Author, +) -> bool: + if not _author_has_topic_profile(author): + return False + if not _patent_has_mapped_topics(mapped_topics): + return False + return not mapped_topics_match_author(mapped_topics, author) + + +def _resolve_patent_topics( + patent: model.PatentEntry, + mapping, + patent_topic_map: dict[str, list[MappedOpenAlexTopic]] | None, +) -> list[MappedOpenAlexTopic]: + if patent_topic_map is not None: + return patent_topic_map.get(patent_map_key(patent), []) + return resolve_mapped_topics_for_patent(patent, mapping) + + +def filter_patents_by_ipc_topic_mapping( + patents: list[model.PatentEntry], + author: Author, + *, + is_ambiguous: bool = False, + mapping=None, + patent_topic_map: dict[str, list[MappedOpenAlexTopic]] | None = None, +) -> list[TopicFilterResult]: + table = mapping if mapping is not None else load_ipc_openalex_mapping() + institution_names = [ + name + for institution in author.last_known_institutions or [] + if (name := getattr(institution, "display_name", None)) + ] + for affiliation in author.affiliations or []: + institution = getattr(affiliation, "institution", None) + if institution is not None and (name := getattr(institution, "display_name", None)): + institution_names.append(name) + + display_name = author.display_name or "" + filtered: list[TopicFilterResult] = [] + + for patent in patents: + institution_match = patent_institution_match(patent, institution_names) + personal_assignee_match = patent_personal_assignee_match(patent, display_name) + strong_identity = institution_match or personal_assignee_match + mapped_topics = _resolve_patent_topics(patent, table, patent_topic_map) + if is_ambiguous: + matched_via_mapping = mapped_topics_match_author_for_ambiguous( + patent, + author, + mapped_topics, + table, + ) + elif patent_topic_map is not None: + matched_via_mapping = mapped_topics_match_author(mapped_topics, author) + else: + matched_via_mapping = patent_topics_match_author(patent, author, table) + + if strong_identity: + filtered.append( + TopicFilterResult( + patent=patent, + decision="keep", + matched_via_mapping=matched_via_mapping, + institution_match=institution_match, + personal_assignee_match=personal_assignee_match, + ) + ) + continue + + if is_ambiguous: + if matched_via_mapping: + filtered.append( + TopicFilterResult( + patent=patent, + decision="keep", + matched_via_mapping=True, + institution_match=False, + personal_assignee_match=False, + ) + ) + continue + + if _topic_conflict(mapped_topics, author): + continue + + filtered.append( + TopicFilterResult( + patent=patent, + decision="keep", + matched_via_mapping=matched_via_mapping, + institution_match=False, + personal_assignee_match=False, + ) + ) + + filtered.sort( + key=lambda item: ( + not item.matched_via_mapping, + not (item.institution_match or item.personal_assignee_match), + item.patent.publication_date or "", + ), + reverse=False, + ) + return filtered + + +def finest_mapped_topic_label( + patent: model.PatentEntry, + mapping=None, +) -> str | None: + table = mapping if mapping is not None else load_ipc_openalex_mapping() + mapped = resolve_mapped_topics_for_patent(patent, table) + if not mapped: + return None + return mapped[0].topic_display_name or mapped[0].topic_id diff --git a/service/src/main/inse/patents/common/model.py b/service/src/main/inse/patents/common/model.py index b3cc97a4..e9e9bb26 100644 --- a/service/src/main/inse/patents/common/model.py +++ b/service/src/main/inse/patents/common/model.py @@ -12,6 +12,13 @@ class IpcClassification(BaseModel): model_config = ConfigDict(populate_by_name=True) +class OpenAlexTopicTag(BaseModel): + topic_id: str | None = None + topic_display_name: str + field_name: str | None = None + domain_name: str | None = None + + class PatentEntry(BaseModel): patent_id: str source: str @@ -32,6 +39,7 @@ class PatentEntry(BaseModel): cpc: list[str] = Field(default_factory=list) cpc_descriptions: list[IpcClassification] = Field(default_factory=list) country: str | None = None + openalex_topics: list[OpenAlexTopicTag] = Field(default_factory=list) class PatentsByAuthorResponse(BaseModel): diff --git a/service/src/main/inse/patents/common/parsing.py b/service/src/main/inse/patents/common/parsing.py index 0b3cdf3b..314ca6fa 100644 --- a/service/src/main/inse/patents/common/parsing.py +++ b/service/src/main/inse/patents/common/parsing.py @@ -1,4 +1,5 @@ """Shared patent hit parsing, deduplication, and classification enrichment.""" +import asyncio import logging import httpx @@ -7,10 +8,21 @@ 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 +from inse.patents.patents_openalex_keywords.client import ( + PatentsOpenAlexKeywordsClient, + candidate_doc_ids, +) logger = logging.getLogger(__name__) +def parse_search_total(data: dict) -> int: + total = data.get("hits", {}).get("total") + if isinstance(total, dict): + return int(total.get("value", 0)) + return int(total or 0) + + def parse_epo_hits(data: dict) -> list[model.PatentEntry]: patents = [] for hit in data.get("hits", {}).get("hits", []): @@ -91,6 +103,67 @@ def patent_dedup_key(patent: model.PatentEntry) -> tuple[str, str, str, str]: ) +def patent_map_key(patent: model.PatentEntry) -> str: + source, patent_id, publication_date, stage = patent_dedup_key(patent) + return f"{source}:{patent_id}:{publication_date}:{stage}" + + +async def expand_matched_epo_application_families( + matched_patents: list[model.PatentEntry], + search_client, +) -> list[model.PatentEntry]: + """Include other EPO publication stages for already matched applications. + + EPO patents are often published multiple times (e.g. A1 application, later B1 + grant). Inventor nested search may only return one stage, so once a publication + is matched to an author we fetch sibling publications by application number. + """ + application_numbers = sorted( + { + patent.application_number.strip() + for patent in matched_patents + if patent.source == "EPO" + and patent.application_number + and patent.application_number.strip() + } + ) + if not application_numbers: + return matched_patents + + existing_keys = {patent_dedup_key(patent) for patent in matched_patents} + extra: list[model.PatentEntry] = [] + + async def _fetch_family(application_number: str) -> list[model.PatentEntry]: + try: + data = await search_client.search_epo( + search_client.epo_query_by_application_number(application_number) + ) + except (MissingApiKeyError, httpx.HTTPError) as exc: + logger.warning( + "EPO family expansion failed for application %s: %s", + application_number, + exc, + ) + return [] + return parse_epo_hits(data) + + family_results = await asyncio.gather( + *(_fetch_family(application_number) for application_number in application_numbers) + ) + for family_patents in family_results: + for patent in family_patents: + key = patent_dedup_key(patent) + if key in existing_keys: + continue + existing_keys.add(key) + extra.append(patent) + + if not extra: + return matched_patents + + return deduplicate_patents(matched_patents + extra) + + async def enrich_patents_classifications( patents: list[model.PatentEntry], ipc_client: IpcSearchClient, @@ -120,6 +193,68 @@ async def enrich_patents_classifications( patent.cpc_descriptions = _descriptions_for_raw_codes(patent.cpc, resolved) +async def enrich_patents_openalex_topics( + patents: list[model.PatentEntry], + keywords_client: PatentsOpenAlexKeywordsClient, +) -> None: + """Attaches OpenAlex topic labels matched to each patent's ipc/cpc codes. + + Resolves every unique symbol across all patents in a single _search + request against patents_openalex_keywords, then fans the results back + out per patent. Doing this per-symbol (even in parallel) instead of as + one batch added seconds of latency to endpoints enriching many patents + at once, like get_all_patents. + """ + symbols = list(dict.fromkeys( + extract_ipc_symbol(raw) + for patent in patents + for raw in (*patent.ipc, *patent.cpc) + if raw + )) + if not symbols: + return + + candidate_ids_by_symbol = {symbol: candidate_doc_ids(symbol) for symbol in symbols} + all_doc_ids = list(dict.fromkeys( + doc_id + for candidate_ids in candidate_ids_by_symbol.values() + for doc_id in candidate_ids + )) + + try: + docs_by_id = await keywords_client.lookup_ids(all_doc_ids) + except Exception: + logger.warning("patents_openalex_keywords batch lookup failed", exc_info=True) + return + + topics_by_symbol: dict[str, list[model.OpenAlexTopicTag]] = {} + for symbol, candidate_ids in candidate_ids_by_symbol.items(): + doc = next((docs_by_id[doc_id] for doc_id in candidate_ids if doc_id in docs_by_id), None) + if not doc: + continue + topics_by_symbol[symbol] = [ + model.OpenAlexTopicTag( + topic_id=match.get("topic_id"), + topic_display_name=match["topic_display_name"], + field_name=match.get("field"), + domain_name=match.get("domain"), + ) + for match in doc.get("topic_matches") or [] + if match.get("topic_display_name") + ] + + for patent in patents: + seen: set[str] = set() + topics: list[model.OpenAlexTopicTag] = [] + for raw in (*patent.ipc, *patent.cpc): + for tag in topics_by_symbol.get(extract_ipc_symbol(raw), []): + dedup_key = tag.topic_id or tag.topic_display_name + if dedup_key not in seen: + seen.add(dedup_key) + topics.append(tag) + patent.openalex_topics = topics[:6] + + def _to_classification_strings(value) -> list[str]: if not value: return [] diff --git a/service/src/main/inse/patents/common/test_parsing.py b/service/src/main/inse/patents/common/test_parsing.py new file mode 100644 index 00000000..225f1be5 --- /dev/null +++ b/service/src/main/inse/patents/common/test_parsing.py @@ -0,0 +1,133 @@ +import asyncio + +from inse.patents.common.model import PatentEntry +from inse.patents.common.parsing import enrich_patents_openalex_topics + + +class _FakeKeywordsClient: + def __init__(self, docs_by_id: dict[str, dict]): + self.docs_by_id = docs_by_id + self.lookup_ids_calls: list[list[str]] = [] + + async def lookup_ids(self, doc_ids: list[str]) -> dict[str, dict]: + self.lookup_ids_calls.append(doc_ids) + return { + doc_id: self.docs_by_id[doc_id] + for doc_id in doc_ids + if doc_id in self.docs_by_id + } + + +def _patent(patent_id: str, ipc: list[str], cpc: list[str] | None = None) -> PatentEntry: + return PatentEntry(patent_id=patent_id, source="EPO", ipc=ipc, cpc=cpc or []) + + +def test_enrich_patents_openalex_topics_attaches_field_and_domain() -> None: + client = _FakeKeywordsClient( + { + "subgroup:C07K11/02": { + "topic_matches": [ + { + "topic_id": "https://openalex.org/T1", + "topic_display_name": "Peptide Chemistry", + "field": "Chemistry", + "domain": "Physical Sciences", + }, + ] + }, + "subgroup:A61K38/00": { + "topic_matches": [ + { + "topic_id": "https://openalex.org/T3", + "topic_display_name": "Drug Delivery", + "field": "Pharmacology, Toxicology and Pharmaceutics", + "domain": "Health Sciences", + }, + ] + }, + } + ) + patent = _patent("EP1", ipc=["C07K 11/02 20060101AFI", "A61K 38/00 20060101ALI"]) + + asyncio.run(enrich_patents_openalex_topics([patent], client)) + + assert [t.topic_display_name for t in patent.openalex_topics] == [ + "Peptide Chemistry", + "Drug Delivery", + ] + assert patent.openalex_topics[0].field_name == "Chemistry" + assert patent.openalex_topics[0].domain_name == "Physical Sciences" + + +def test_enrich_patents_openalex_topics_dedupes_by_topic_id() -> None: + client = _FakeKeywordsClient( + { + "subgroup:C07K11/02": { + "topic_matches": [ + {"topic_id": "https://openalex.org/T1", "topic_display_name": "Peptide Chemistry"}, + {"topic_id": "https://openalex.org/T1", "topic_display_name": "Peptide Chemistry"}, + ] + }, + } + ) + patent = _patent("EP1", ipc=["C07K 11/02 20060101AFI"]) + + asyncio.run(enrich_patents_openalex_topics([patent], client)) + + assert len(patent.openalex_topics) == 1 + + +def test_enrich_patents_openalex_topics_skips_unmatched_symbols() -> None: + client = _FakeKeywordsClient({}) + patent = _patent("EP2", ipc=["Z99Z 99/99"]) + + asyncio.run(enrich_patents_openalex_topics([patent], client)) + + assert patent.openalex_topics == [] + + +def test_enrich_patents_openalex_topics_resolves_all_patents_in_one_batch_call() -> None: + """A single lookup_ids() call must cover every unique symbol across all + patents — per-symbol requests (even in parallel) previously added + seconds of latency on endpoints enriching many patents at once.""" + client = _FakeKeywordsClient( + { + "subgroup:C07K11/02": { + "topic_matches": [ + {"topic_id": "https://openalex.org/T1", "topic_display_name": "Peptide Chemistry"}, + ] + }, + } + ) + patents = [ + _patent("EP1", ipc=["C07K 11/02 20060101AFI"]), + _patent("EP2", ipc=["C07K 11/02 20060101ALI"]), + ] + + asyncio.run(enrich_patents_openalex_topics(patents, client)) + + assert len(client.lookup_ids_calls) == 1 + assert patents[0].openalex_topics[0].topic_display_name == "Peptide Chemistry" + assert patents[1].openalex_topics[0].topic_display_name == "Peptide Chemistry" + + +def test_enrich_patents_openalex_topics_prefers_more_specific_level() -> None: + client = _FakeKeywordsClient( + { + "subgroup:C07K11/02": { + "topic_matches": [ + {"topic_id": "https://openalex.org/T1", "topic_display_name": "Specific Match"}, + ] + }, + "class:C07": { + "topic_matches": [ + {"topic_id": "https://openalex.org/T2", "topic_display_name": "Broad Match"}, + ] + }, + } + ) + patent = _patent("EP1", ipc=["C07K 11/02 20060101AFI"]) + + asyncio.run(enrich_patents_openalex_topics([patent], client)) + + assert patent.openalex_topics[0].topic_display_name == "Specific Match" diff --git a/service/src/main/inse/patents/common/text_normalization.py b/service/src/main/inse/patents/common/text_normalization.py index a5f3f22b..06bac0ef 100644 --- a/service/src/main/inse/patents/common/text_normalization.py +++ b/service/src/main/inse/patents/common/text_normalization.py @@ -35,6 +35,23 @@ _PATENT_VOWEL_EXPANSIONS: tuple[tuple[str, str], ...] = ( (r"a([lmnrt])", r"ae\1"), ) +# Titles that can appear before a person's name in patent inventor fields +_PERSON_TITLE_PATTERN = re.compile( + r"^\s*(?:" + r"Prof\.?|Dr\.?|Dipl\.?(?:-Ing\.?|-Math\.?|-Phys\.?|-Inform\.?)?|" + r"M\.Sc\.?|B\.Sc\.?|M\.Eng\.?|PhD\.?|Ing\.?|" + r"Prof\.?\s+Dr\.?|Dr\.?-Ing\.?|Dr\.?\s+rer\.?\s+nat\.?" + r")[.,]?\s+", + re.IGNORECASE, +) + + +def strip_person_titles(value: str | None) -> str: + """Remove academic/professional titles from the start of a person name string.""" + if not value: + return "" + return _PERSON_TITLE_PATTERN.sub("", value).strip() + def normalize_name_part(value: str | None) -> str: if not value: diff --git a/service/src/main/inse/patents/elastic_search_client.py b/service/src/main/inse/patents/elastic_search_client.py index 4b6d8b02..840ac21e 100644 --- a/service/src/main/inse/patents/elastic_search_client.py +++ b/service/src/main/inse/patents/elastic_search_client.py @@ -1,325 +1,2 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - HTTP client for patent searches in EPO and USPTO Elasticsearch indices. -""" -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_phrase": {field: variants[0] if variants else name}} - return { - "bool": { - "should": [{"match_phrase": {field: variant}} for variant in variants], - "minimum_should_match": 1, - } - } - - -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: - 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, - } - - 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]: - response = await elasticsearch.search(index=index, body=payload, cluster=ESCluster.INSE) - return response - - async def get_by_id_or_title( - self, - 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 on title if no hits. - - Args: - patent_id: The raw document/publication number (e.g. "1234567", "US1234567A"). - prefix: "EP" routes the title fallback to EPO; "US" routes it to USPTO. - Both indices are always queried for the ID lookup. - title: Used only when the ID lookup returns zero hits. - size: Maximum number of results to return. - """ - epo_id_payload = self._epo_query_by_id(patent_id, size) - uspto_id_payload = self._uspto_query_by_id(patent_id, size) - - epo_result, uspto_result = await asyncio.gather( - self.search_epo(epo_id_payload), - self.search_uspto(uspto_id_payload), - ) - - epo_hits = epo_result.get("hits", {}).get("total", {}).get("value", 0) - uspto_hits = uspto_result.get("hits", {}).get("total", {}).get("value", 0) - - if epo_hits > 0 or uspto_hits > 0: - if prefix.upper() == "EP" and epo_hits > 0: - return epo_result - if prefix.upper() == "US" and uspto_hits > 0: - return uspto_result - return epo_result if epo_hits > 0 else uspto_result - - if prefix.upper() == "US": - payload = self._uspto_query_by_title(title, filling_date, size) - return await self.search_uspto(payload) - - 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": [ - "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_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, - "sort": [{"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 _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": [ - "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_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": [ - "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, - } +"""Backward-compatible re-exports.""" +from inse.patents.search_client import * # noqa: F403 diff --git a/service/src/main/inse/patents/institutions/logic.py b/service/src/main/inse/patents/institutions/logic.py index e01ed75f..9575c38d 100644 --- a/service/src/main/inse/patents/institutions/logic.py +++ b/service/src/main/inse/patents/institutions/logic.py @@ -39,7 +39,7 @@ async def get_patents_by_institution_id( institution_client = institutions_client or InstitutionsSearchClient() short_id = institution_id.replace("https://openalex.org/", "") - institution = institution_client.get_institution_by_id(short_id) + institution = await institution_client.get_institution_by_id(short_id) search_names = _institution_search_names(institution) if not search_names: diff --git a/service/src/main/inse/patents/institutions/name_matching.py b/service/src/main/inse/patents/institutions/name_matching.py index bb5f1aba..132b85cb 100644 --- a/service/src/main/inse/patents/institutions/name_matching.py +++ b/service/src/main/inse/patents/institutions/name_matching.py @@ -57,9 +57,12 @@ def institution_search_variants(value: str | None) -> list[str]: def _significant_institution_tokens(text: str) -> set[str]: + # Normalize hyphens to spaces so "Duisburg-Essen" splits into "duisburg" + "essen", + # matching both hyphenated and space-separated forms in patent databases. + normalized = normalize_name_part(text).replace("-", " ") return { token - for token in normalize_name_part(text).split() + for token in normalized.split() if len(token) >= MIN_INSTITUTION_VARIANT_LEN and token not in _INSTITUTION_GENERIC_TOKENS } @@ -72,13 +75,16 @@ def assignee_matches_institution_name(assignee: str, institution_name: str) -> b return False original = institution_name.strip() - assignee_tokens = set(norm_assignee.split()) + # Normalize hyphens to spaces for consistent token splitting across patent databases + norm_assignee_flat = norm_assignee.replace("-", " ") + norm_name_flat = norm_name.replace("-", " ") + assignee_tokens = set(norm_assignee_flat.split()) if len(original) <= 6 and " " not in original: - return norm_name in assignee_tokens + return norm_name_flat in assignee_tokens - if len(norm_name) >= MIN_INSTITUTION_SUBSTRING_LEN: - if norm_name in norm_assignee or norm_assignee in norm_name: + if len(norm_name_flat) >= MIN_INSTITUTION_SUBSTRING_LEN: + if norm_name_flat in norm_assignee_flat or norm_assignee_flat in norm_name_flat: return True significant = _significant_institution_tokens(institution_name) diff --git a/service/src/main/inse/patents/keywords/__init__.py b/service/src/main/inse/patents/keywords/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/service/src/main/inse/patents/keywords/logic.py b/service/src/main/inse/patents/keywords/logic.py new file mode 100644 index 00000000..28d95c6e --- /dev/null +++ b/service/src/main/inse/patents/keywords/logic.py @@ -0,0 +1,809 @@ +"""Find patents for extracted OpenAlex keywords via patents_openalex_keywords index.""" +from __future__ import annotations + +import asyncio +import logging +import math +import re + +import httpx + +from inse.patents.authors.ipc_openalex_mapping import ( + MappedOpenAlexTopic, + normalize_openalex_id, +) +from inse.patents.common import model +from inse.patents.common.elastic_search_client import ( + BasePatentSearchClient, + MissingApiKeyError, +) +from inse.patents.common.parsing import ( + deduplicate_patents, + enrich_patents_classifications, + parse_epo_hits, + parse_uspto_hits, + patent_map_key, +) +from inse.patents.ipc_lookup import ( + extract_ipc_symbol, + parse_ipc_symbol, +) +from inse.patents.ipc_search_client import IpcSearchClient +from inse.patents.keywords.model import ( + KeywordPatentMatch, + KeywordPatentSearchItem, + PatentsByKeywordsRequest, + PatentsByKeywordsResponse, +) +from inse.patents.keywords.reverse_lookup import IpcCodeMatch, KeywordIpcReverseLookup +from inse.patents.keywords.search_queries import IpcPatentSearchQueries +from inse.patents.patents_openalex_keywords.ipc_entries import infer_subclass, normalize_symbol +from inse.patents.patents_openalex_keywords.resolver import PatentOpenAlexMappingResolver + +logger = logging.getLogger(__name__) + +_MAX_PATENTS = 100 +_MAX_IPC_CODES = 20 +_MAX_IPC_CODES_PER_KEYWORD = 2 +_MAX_PATENT_SEARCH_TERMS = 10 +_MAX_SEARCH_KEYWORDS = 10 +_MIN_KEYWORD_RELEVANCE = 0.0 +_MIN_IPC_MATCH_SCORE = 0.65 +_MIN_PATENT_MATCH_SCORE = 0.50 +_SEARCHABLE_IPC_LEVELS = frozenset({"subgroup", "group", "subclass"}) +# Soft field overlap for natural-science / engineering patent domains. +_SOFT_MATCH_FIELD_NAMES = frozenset( + { + "engineering", + "computer science", + "physical sciences", + "physics and astronomy", + "materials science", + "environmental science", + "chemical engineering", + "chemistry", + "earth and planetary sciences", + "medicine", + "biochemistry, genetics and molecular biology", + "immunology and microbiology", + } +) +_PREFERRED_KEYWORD_LEVELS = frozenset({"coarse", "fine", "custom"}) +_NON_TECHNICAL_FIELD_NAMES = frozenset( + { + "social sciences", + "arts and humanities", + "law", + "business, management and accounting", + } +) +_COMPATIBLE_FIELDS: dict[str, frozenset[str]] = { + "chemistry": frozenset( + {"chemistry", "chemical engineering", "materials science"} + ), + "chemical engineering": frozenset( + {"chemical engineering", "chemistry", "materials science"} + ), + "materials science": frozenset( + {"materials science", "chemistry", "chemical engineering", "engineering"} + ), + "computer science": frozenset({"computer science", "engineering"}), + "engineering": frozenset( + {"engineering", "computer science", "materials science"} + ), + "physical sciences": frozenset( + {"physical sciences", "physics and astronomy", "chemistry", "materials science"} + ), + "physics and astronomy": frozenset( + {"physics and astronomy", "physical sciences", "materials science"} + ), + "biochemistry, genetics and molecular biology": frozenset( + { + "biochemistry, genetics and molecular biology", + "chemistry", + "medicine", + } + ), + "medicine": frozenset( + { + "medicine", + "biochemistry, genetics and molecular biology", + "immunology and microbiology", + } + ), +} +_TEXT_STOPWORDS = frozenset( + { + "and", + "the", + "of", + "in", + "for", + "und", + "der", + "die", + "das", + "von", + "medicine", + "medical", + "science", + "sciences", + } +) + + +def _ipc_section(symbol: str) -> str: + normalized = normalize_symbol(symbol) + return normalized[:1] if normalized else "" + + +def _dominant_ipc_sections(ipc_matches: list[IpcCodeMatch], limit: int = 2) -> set[str]: + weights: dict[str, float] = {} + for match in ipc_matches: + section = _ipc_section(match.ipc_symbol) + if not section: + continue + weights[section] = weights.get(section, 0.0) + match.match_score + ranked = sorted(weights.items(), key=lambda item: item[1], reverse=True) + return {section for section, _ in ranked[:limit]} + + +def _prefer_searchable_ipc_levels(ipc_matches: list[IpcCodeMatch]) -> list[IpcCodeMatch]: + searchable = [ + match for match in ipc_matches if match.ipc_level in _SEARCHABLE_IPC_LEVELS + ] + return searchable if searchable else ipc_matches + + +def _filter_ipc_matches_for_search(ipc_matches: list[IpcCodeMatch]) -> list[IpcCodeMatch]: + if not ipc_matches: + return [] + + ipc_matches = _prefer_searchable_ipc_levels(ipc_matches) + ranked = sorted(ipc_matches, key=lambda match: match.match_score, reverse=True) + strong = [ + match + for match in ranked + if match.match_score >= _MIN_IPC_MATCH_SCORE + ] + if not strong: + return [] + + dominant_sections = _dominant_ipc_sections(strong) + filtered: list[IpcCodeMatch] = [] + seen: set[tuple[str, str]] = set() + for match in strong: + key = (match.ipc_level, match.ipc_symbol) + if key in seen: + continue + if match.match_score >= 0.8: + filtered.append(match) + seen.add(key) + continue + if _ipc_section(match.ipc_symbol) in dominant_sections: + filtered.append(match) + seen.add(key) + + return filtered + + +def _limit_matches_per_keyword( + matches: list[IpcCodeMatch], + limit: int = _MAX_IPC_CODES_PER_KEYWORD, +) -> list[IpcCodeMatch]: + grouped: dict[str, list[IpcCodeMatch]] = {} + for match in matches: + grouped.setdefault(match.source_keyword.casefold(), []).append(match) + + result: list[IpcCodeMatch] = [] + for keyword_matches in grouped.values(): + keyword_matches.sort(key=lambda match: match.match_score, reverse=True) + result.extend(keyword_matches[:limit]) + + return sorted(result, key=lambda match: match.match_score, reverse=True) + + +def _term_from_ipc_match(match: IpcCodeMatch) -> str | None: + symbol = normalize_symbol(match.ipc_symbol) + if not symbol: + return None + + return infer_subclass(symbol) + + +def _patent_search_terms(ipc_matches: list[IpcCodeMatch]) -> list[str]: + filtered = _filter_ipc_matches_for_search(ipc_matches) + filtered = sorted(filtered, key=lambda match: match.match_score, reverse=True) + terms: list[str] = [] + seen: set[str] = set() + for match in filtered: + if match.ipc_level not in _SEARCHABLE_IPC_LEVELS: + continue + term = _term_from_ipc_match(match) + if not term or term in seen: + continue + seen.add(term) + terms.append(term) + if len(terms) >= _MAX_PATENT_SEARCH_TERMS: + break + return terms + + +def _normalize_ipc_code(code: str) -> str: + extracted = extract_ipc_symbol(code) or code + return normalize_symbol(extracted) + + +def _ipc_main_group(symbol: str) -> str | None: + parsed = parse_ipc_symbol(symbol) + if parsed is None or not parsed.main_group: + return None + + return normalize_symbol(parsed.main_group) + + +def _ipc_hierarchy_quality( + patent_code: str, + mapped_symbol: str, +) -> float: + normalized_patent = _normalize_ipc_code(patent_code) + normalized_mapped = _normalize_ipc_code(mapped_symbol) + + if not normalized_patent or not normalized_mapped: + return 0.0 + + if normalized_patent == normalized_mapped: + return 1.0 + + patent_group = _ipc_main_group(normalized_patent) + mapped_group = _ipc_main_group(normalized_mapped) + + if patent_group and mapped_group and patent_group == mapped_group: + return 0.90 + + patent_subclass = infer_subclass(normalized_patent) + mapped_subclass = infer_subclass(normalized_mapped) + + if ( + patent_subclass + and mapped_subclass + and patent_subclass == mapped_subclass + ): + return 0.75 + + return 0.0 + + +def _ipc_hierarchy_level( + patent_code: str, + mapped_symbol: str, +) -> str | None: + quality = _ipc_hierarchy_quality(patent_code, mapped_symbol) + if quality >= 1.0: + return "exact" + if quality >= 0.90: + return "main_group" + if quality >= 0.75: + return "subclass" + return None + + +def _keyword_level(item: KeywordPatentSearchItem) -> str: + return (item.keyword_level or "").strip().casefold() + + +def _keyword_is_patent_searchable(item: KeywordPatentSearchItem) -> bool: + if not item.keyword.strip(): + return False + + topic_id = normalize_openalex_id(item.topic_id) + if not topic_id: + return False + + field_name = _normalized_field_name(item.field_name) + if field_name in _NON_TECHNICAL_FIELD_NAMES: + return False + + return True + + +def _sort_and_limit_keywords( + items: list[KeywordPatentSearchItem], +) -> list[KeywordPatentSearchItem]: + ranked = sorted(items, key=lambda item: item.relevance_score, reverse=True) + return ranked[:_MAX_SEARCH_KEYWORDS] + + +def _filter_keywords_for_patent_search( + items: list[KeywordPatentSearchItem], +) -> list[KeywordPatentSearchItem]: + """Prefer coarse/fine/custom keywords; ignore broad when specifics exist.""" + searchable = [item for item in items if _keyword_is_patent_searchable(item)] + if not searchable: + return [] + + preferred = [ + item + for item in searchable + if _keyword_level(item) in _PREFERRED_KEYWORD_LEVELS + ] + if preferred: + return _sort_and_limit_keywords(preferred) + + non_broad = [ + item for item in searchable if _keyword_level(item) != "broad" + ] + if non_broad: + return _sort_and_limit_keywords(non_broad) + + return _sort_and_limit_keywords(searchable) + + +def _normalized_field_name(name: str | None) -> str: + return (name or "").strip().casefold() + + +def _patent_has_g06_code(patent: model.PatentEntry) -> bool: + for code in (*patent.ipc, *patent.cpc): + symbol = normalize_symbol(extract_ipc_symbol(code) or code) + if symbol.startswith("G06"): + return True + return False + + +def _compatible_patent_fields(keyword_field: str) -> frozenset[str]: + return _COMPATIBLE_FIELDS.get(keyword_field, frozenset({keyword_field})) + + +def _keyword_overlap_criteria( + items: list[KeywordPatentSearchItem], +) -> tuple[frozenset[str], frozenset[str], frozenset[str]]: + topic_ids: set[str] = set() + subfield_names: set[str] = set() + soft_field_names: set[str] = set() + for item in items: + topic_id = normalize_openalex_id(item.topic_id) + if topic_id: + topic_ids.add(topic_id) + subfield_name = (item.subfield_name or "").strip() + if subfield_name: + subfield_names.add(subfield_name.casefold()) + field_name = _normalized_field_name(item.field_name) + if field_name in _SOFT_MATCH_FIELD_NAMES: + soft_field_names.add(field_name) + return ( + frozenset(topic_ids), + frozenset(subfield_names), + frozenset(soft_field_names), + ) + + +def _topics_overlap_keywords( + patent_topics: list[MappedOpenAlexTopic], + keyword_topic_ids: frozenset[str], + keyword_subfield_names: frozenset[str], + keyword_soft_field_names: frozenset[str], + *, + patent: model.PatentEntry | None = None, +) -> bool: + if ( + not keyword_topic_ids + and not keyword_subfield_names + and not keyword_soft_field_names + ): + return True + + if not patent_topics: + return False + + patent_topic_ids = { + topic_id + for mapped in patent_topics + if (topic_id := normalize_openalex_id(mapped.topic_id)) + } + if keyword_topic_ids & patent_topic_ids: + return True + + patent_subfield_names = { + (mapped.subfield_name or "").strip().casefold() + for mapped in patent_topics + if (mapped.subfield_name or "").strip() + } + if keyword_subfield_names & patent_subfield_names: + return True + + if keyword_soft_field_names: + patent_field_names = { + _normalized_field_name(mapped.field_name) + for mapped in patent_topics + if mapped.field_name + } + for keyword_field in keyword_soft_field_names: + if patent_field_names & _compatible_patent_fields(keyword_field): + return True + if ( + patent is not None + and _patent_has_g06_code(patent) + and keyword_soft_field_names & {"engineering", "computer science"} + ): + return True + + return False + + +def _text_search_terms(items: list[KeywordPatentSearchItem]) -> list[str]: + terms: list[str] = [] + seen: set[str] = set() + + for item in items: + for value in ( + item.keyword, + item.topic_display_name, + item.subfield_name, + ): + normalized = (value or "").strip().casefold() + if not normalized: + continue + + words = re.findall(r"[a-zäöüß]{4,}", normalized) + + for word in words: + if word in _TEXT_STOPWORDS or word in seen: + continue + seen.add(word) + terms.append(word) + + return terms + + +def _text_overlap_score( + patent: model.PatentEntry, + search_terms: list[str], +) -> float: + text = " ".join( + part + for part in [patent.title or "", patent.abstract or ""] + if part + ).casefold() + + if not search_terms or not text.strip(): + return 0.0 + + hits = sum(1 for term in search_terms if term in text) + return min(hits / 3, 1.0) + + +def _patent_passes_relevance_gate( + patent_topics: list[MappedOpenAlexTopic], + *, + keyword_topic_ids: frozenset[str], + keyword_subfield_names: frozenset[str], + keyword_soft_field_names: frozenset[str], + patent: model.PatentEntry, + text_score: float, +) -> bool: + has_topic_match = bool(patent_topics) and _topics_overlap_keywords( + patent_topics, + keyword_topic_ids, + keyword_subfield_names, + keyword_soft_field_names, + patent=patent, + ) + return has_topic_match or text_score > 0.0 + + +def _compute_final_score( + ipc_score: float, + topic_score: float, + text_score: float, +) -> float: + return round( + 0.60 * ipc_score + + 0.25 * topic_score + + 0.15 * text_score, + 4, + ) + + +def _score_ipc_match( + patent: model.PatentEntry, + ipc_matches: list[IpcCodeMatch], +) -> tuple[float, list[str], list[str]] | None: + searchable_matches = [ + match + for match in ipc_matches + if match.ipc_level in _SEARCHABLE_IPC_LEVELS + ] or ipc_matches + + best_score = 0.0 + best_keywords: set[str] = set() + best_symbols: set[str] = set() + + patent_codes = [ + normalized + for code in (*patent.ipc, *patent.cpc) + if (normalized := _normalize_ipc_code(code)) + ] + + for ipc_match in searchable_matches: + for patent_code in patent_codes: + hierarchy_quality = _ipc_hierarchy_quality( + patent_code, + ipc_match.ipc_symbol, + ) + if hierarchy_quality <= 0: + continue + + candidate_score = ipc_match.match_score * hierarchy_quality + + if candidate_score > best_score: + best_score = candidate_score + best_keywords = {ipc_match.source_keyword} + best_symbols = {ipc_match.ipc_symbol} + elif math.isclose( + candidate_score, + best_score, + rel_tol=1e-9, + abs_tol=1e-9, + ): + best_keywords.add(ipc_match.source_keyword) + best_symbols.add(ipc_match.ipc_symbol) + + if best_score <= 0: + return None + + return ( + round(best_score, 4), + sorted(best_keywords), + sorted(best_symbols), + ) + + +def _score_patent( + patent: model.PatentEntry, + ipc_matches: list[IpcCodeMatch], + *, + patent_topics: list[MappedOpenAlexTopic] | None = None, + keyword_topic_ids: frozenset[str] | None = None, + keyword_subfield_names: frozenset[str] | None = None, + keyword_soft_field_names: frozenset[str] | None = None, + search_keywords: list[KeywordPatentSearchItem] | None = None, +) -> tuple[float, list[str], list[str]] | None: + ipc_result = _score_ipc_match(patent, ipc_matches) + if ipc_result is None: + return None + ipc_score, matched_keywords, matched_symbols = ipc_result + + text_score = 0.0 + if search_keywords is not None: + text_score = _text_overlap_score( + patent, + _text_search_terms(search_keywords), + ) + + has_topic_match = bool(patent_topics) and _topics_overlap_keywords( + patent_topics or [], + keyword_topic_ids or frozenset(), + keyword_subfield_names or frozenset(), + keyword_soft_field_names or frozenset(), + patent=patent, + ) + + if not has_topic_match and text_score == 0.0: + return None + + topic_score = 1.0 if has_topic_match else 0.0 + + return ( + _compute_final_score(ipc_score, topic_score, text_score), + matched_keywords, + matched_symbols, + ) + + +async def get_patents_by_keywords( + request: PatentsByKeywordsRequest, + *, + reverse_lookup: KeywordIpcReverseLookup | None = None, + search_client: BasePatentSearchClient | None = None, + ipc_client: IpcSearchClient | None = None, + mapping_resolver: PatentOpenAlexMappingResolver | None = None, +) -> PatentsByKeywordsResponse: + lookup = reverse_lookup or KeywordIpcReverseLookup() + client = search_client or BasePatentSearchClient() + ipc_search = ipc_client or IpcSearchClient() + resolver = mapping_resolver or PatentOpenAlexMappingResolver() + queries = IpcPatentSearchQueries() + + search_keywords = _filter_keywords_for_patent_search(request.keywords) + if not search_keywords: + logger.info( + "Keyword patent search: no searchable keywords in %s", + [item.keyword for item in request.keywords], + ) + return PatentsByKeywordsResponse(patent_count=0, patents=[]) + + logger.info( + "Keyword patent search: using keywords=%s (from %d requested)", + [ + { + "keyword": item.keyword, + "level": item.keyword_level, + "relevance_score": item.relevance_score, + "field_name": item.field_name, + } + for item in search_keywords + ], + len(request.keywords), + ) + keyword_topic_ids, keyword_subfield_names, keyword_soft_field_names = ( + _keyword_overlap_criteria(search_keywords) + ) + + ipc_matches = await lookup.lookup_ipc_codes( + search_keywords, + max_codes=_MAX_IPC_CODES, + ) + ipc_matches = _filter_ipc_matches_for_search(ipc_matches) + ipc_matches = _limit_matches_per_keyword(ipc_matches) + logger.info( + "Keyword patent search: search_keywords=%s ipc_matches=%s", + [item.keyword for item in search_keywords], + [ + { + "symbol": match.ipc_symbol, + "level": match.ipc_level, + "score": match.match_score, + "keyword": match.source_keyword, + } + for match in ipc_matches + ], + ) + if not ipc_matches: + logger.info( + "Keyword patent search: no IPC codes after filtering for keywords %s", + [item.keyword for item in search_keywords], + ) + return PatentsByKeywordsResponse(patent_count=0, patents=[]) + + symbols = _patent_search_terms(ipc_matches) + text_search_terms = _text_search_terms(search_keywords) + logger.info("Keyword patent search: patent_search_terms=%s", symbols) + if not symbols: + return PatentsByKeywordsResponse(patent_count=0, patents=[]) + + try: + epo_data, uspto_data = await asyncio.gather( + client.search_epo( + queries.epo_query_by_ipc_symbols(symbols, size=_MAX_PATENTS) + ), + client.search_uspto( + queries.uspto_query_by_ipc_symbols(symbols, size=_MAX_PATENTS) + ), + ) + except MissingApiKeyError: + logger.warning("Patent search skipped: Elasticsearch API key not configured.") + return PatentsByKeywordsResponse(patent_count=0, patents=[]) + except httpx.HTTPError as exc: + logger.warning("Patent search failed: %s", exc) + return PatentsByKeywordsResponse(patent_count=0, patents=[]) + + raw_patents = deduplicate_patents( + parse_epo_hits(epo_data) + parse_uspto_hits(uspto_data) + ) + logger.info("Keyword patent search: raw_patents=%d", len(raw_patents)) + patent_topics_by_key = await resolver.resolve_topics_for_patents(raw_patents) + + scored: list[KeywordPatentMatch] = [] + filtered_by_ipc = 0 + filtered_by_relevance_gate = 0 + filtered_by_min_score = 0 + for patent in raw_patents: + patent_topics = patent_topics_by_key.get(patent_map_key(patent), []) + ipc_result = _score_ipc_match(patent, ipc_matches) + if ipc_result is None: + filtered_by_ipc += 1 + continue + ipc_score, matched_keywords, matched_symbols = ipc_result + + has_topic_match = bool(patent_topics) and _topics_overlap_keywords( + patent_topics, + keyword_topic_ids, + keyword_subfield_names, + keyword_soft_field_names, + patent=patent, + ) + + text_score = _text_overlap_score(patent, text_search_terms) + + if not has_topic_match and text_score == 0.0: + filtered_by_relevance_gate += 1 + continue + + topic_score = 1.0 if has_topic_match else 0.0 + + score = _compute_final_score(ipc_score, topic_score, text_score) + if score < _MIN_PATENT_MATCH_SCORE: + filtered_by_min_score += 1 + continue + + hierarchy_levels = sorted( + { + level + for symbol in matched_symbols + for code in (*patent.ipc, *patent.cpc) + if (level := _ipc_hierarchy_level(code, symbol)) + } + ) + logger.info( + "Patent candidate: id=%s title=%s ipc_score=%.4f " + "topic_score=%.4f text_score=%.4f final_score=%.4f " + "hierarchy_levels=%s matched_keywords=%s matched_symbols=%s", + patent.patent_id, + patent.title, + ipc_score, + topic_score, + text_score, + score, + hierarchy_levels, + matched_keywords, + matched_symbols, + ) + scored.append( + KeywordPatentMatch( + patent=patent, + match_score=score, + matched_keywords=matched_keywords, + matched_ipc_symbols=matched_symbols, + ) + ) + + logger.info( + "Keyword patent search: filtered_by_ipc=%d filtered_by_relevance_gate=%d " + "filtered_by_min_score=%d final_patents=%d", + filtered_by_ipc, + filtered_by_relevance_gate, + filtered_by_min_score, + len(scored), + ) + + scored.sort( + key=lambda item: ( + item.match_score, + item.patent.publication_date or "", + item.patent.patent_id, + ), + reverse=True, + ) + scored = scored[:_MAX_PATENTS] + + patents = [item.patent for item in scored] + await enrich_patents_classifications(patents, ipc_search) + + return PatentsByKeywordsResponse( + patent_count=len(scored), + patents=scored, + ) + + +def keyword_items_from_entries( + entries: list[dict], +) -> list[KeywordPatentSearchItem]: + """Helper for tests – build search items from serialized keyword entries.""" + items: list[KeywordPatentSearchItem] = [] + for entry in entries: + llm = entry.get("llm_keyword") or {} + topic_mapping = entry.get("topic_mapping") or {} + topic = topic_mapping.get("topic") or {} + items.append( + KeywordPatentSearchItem( + keyword=str(llm.get("keyword") or "").strip(), + keyword_level=entry.get("keyword_level"), + topic_id=topic.get("id"), + topic_display_name=topic.get("display_name"), + subfield_name=(topic.get("subfield") or {}).get("display_name"), + field_name=(topic.get("field") or {}).get("display_name"), + relevance_score=float(llm.get("relevance_score") or 1.0), + ) + ) + return [item for item in items if item.keyword] diff --git a/service/src/main/inse/patents/keywords/model.py b/service/src/main/inse/patents/keywords/model.py new file mode 100644 index 00000000..fe274cad --- /dev/null +++ b/service/src/main/inse/patents/keywords/model.py @@ -0,0 +1,54 @@ +from typing import Literal + +from pydantic import BaseModel, Field + +from inse.patents.common.model import PatentEntry + +KeywordPatentLevel = Literal["broad", "coarse", "fine", "custom"] + + +class KeywordPatentSearchItem(BaseModel): + keyword: str = Field(description="Extracted keyword text.") + keyword_level: KeywordPatentLevel | None = Field( + default=None, + description="Keyword granularity from extraction UI: broad, coarse, fine, or custom.", + ) + topic_id: str | None = Field( + default=None, + description="OpenAlex topic id from keyword enrichment, if available.", + ) + topic_display_name: str | None = Field( + default=None, + description="OpenAlex topic display name from enrichment, if available.", + ) + subfield_name: str | None = Field( + default=None, + description="OpenAlex subfield name from enrichment, if available.", + ) + field_name: str | None = Field( + default=None, + description="OpenAlex field name from enrichment, if available.", + ) + relevance_score: float = Field( + default=1.0, + description="LLM relevance score for the keyword.", + ) + + +class PatentsByKeywordsRequest(BaseModel): + keywords: list[KeywordPatentSearchItem] = Field( + min_length=1, + description="Keywords to match against patents_openalex_keywords.", + ) + + +class KeywordPatentMatch(BaseModel): + patent: PatentEntry + match_score: float = Field(description="Combined match quality score.") + matched_keywords: list[str] = Field(default_factory=list) + matched_ipc_symbols: list[str] = Field(default_factory=list) + + +class PatentsByKeywordsResponse(BaseModel): + patent_count: int + patents: list[KeywordPatentMatch] diff --git a/service/src/main/inse/patents/keywords/reverse_lookup.py b/service/src/main/inse/patents/keywords/reverse_lookup.py new file mode 100644 index 00000000..60806eba --- /dev/null +++ b/service/src/main/inse/patents/keywords/reverse_lookup.py @@ -0,0 +1,411 @@ +"""Reverse lookup: OpenAlex keywords/topics → IPC/CPC codes via patents_openalex_keywords.""" +from __future__ import annotations + +import logging +from dataclasses import dataclass +from functools import lru_cache +from typing import Any + +import httpx + +from inse.patents.authors.ipc_openalex_mapping import ( + _load_topic_cache, + normalize_openalex_id, +) +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.keywords.model import KeywordPatentSearchItem +from inse.patents.patents_openalex_keywords.client import PatentsOpenAlexKeywordsClient +from inse.patents.patents_openalex_keywords.ipc_entries import normalize_symbol +from inse.patents.patents_openalex_keywords.mapping import PATENTS_OPENALEX_KEYWORDS_INDEX +from inse.patents.patents_openalex_keywords.resolver import load_patents_openalex_keywords_json + +logger = logging.getLogger(__name__) + +_LEVEL_WEIGHTS = { + "subgroup": 1.0, + "group": 0.92, + "subclass": 0.85, + "class": 0.75, + "section": 0.6, +} + + +@dataclass(frozen=True) +class IpcCodeMatch: + ipc_level: str + ipc_symbol: str + match_score: float + source_keyword: str + match_type: str + + +def _keyword_variants(keyword: str) -> list[str]: + normalized = keyword.strip().casefold() + if not normalized: + return [] + return list(dict.fromkeys([normalized, keyword.strip()])) + + +def _topic_id_variants(topic_id: str | None) -> list[str]: + if not topic_id or not str(topic_id).strip(): + return [] + raw = str(topic_id).strip() + short = normalize_openalex_id(raw) + variants = [raw] + if short: + variants.append(short) + variants.append(f"https://openalex.org/{short}") + return list(dict.fromkeys(variants)) + + +def _topic_id_variants_for_item(item: KeywordPatentSearchItem) -> list[str]: + variants = _topic_id_variants(item.topic_id) + if variants: + return variants + + display_name = (item.topic_display_name or "").strip() + if display_name: + info = _load_topic_cache().get(display_name) + if info and info.get("topic_id"): + return _topic_id_variants(str(info["topic_id"])) + + return [] + + +def _weighted_score( + ipc_level: str, + base_score: float, + relevance_score: float, +) -> float: + """Combine IPC mapping confidence with IPC hierarchy level. + + LLM keyword relevance is not applied here: broad keywords often carry + relevance_score 0.0 while still mapping to valid OpenAlex topics. + """ + _ = relevance_score + level_weight = _LEVEL_WEIGHTS.get(ipc_level, 0.7) + return round(base_score * level_weight, 4) + + +@lru_cache(maxsize=1) +def _build_json_inverted_index() -> tuple[ + dict[str, list[tuple[str, str, float, str, str]]], + dict[str, list[tuple[str, str, float, str, str]]], +]: + """keyword/topic_id -> list of (level, symbol, score, source_keyword, match_type).""" + by_keyword: dict[str, list[tuple[str, str, float, str, str]]] = {} + by_topic: dict[str, list[tuple[str, str, float, str, str]]] = {} + + table = load_patents_openalex_keywords_json() + for level, entries in table.items(): + for symbol, doc in entries.items(): + for match in doc.get("keyword_matches") or []: + keyword = str(match.get("keyword") or "").strip() + if not keyword: + continue + key = keyword.casefold() + entry = ( + level, + symbol, + float(match.get("match_score") or 0.0), + keyword, + "keyword", + ) + by_keyword.setdefault(key, []).append(entry) + topic_id = match.get("topic_id") + if topic_id: + for variant in _topic_id_variants(str(topic_id)): + by_topic.setdefault(variant, []).append(entry) + + for match in doc.get("topic_matches") or []: + topic_id = match.get("topic_id") + if not topic_id: + continue + entry = ( + level, + symbol, + float(match.get("match_score") or 0.0), + str(match.get("topic_display_name") or topic_id), + "topic", + ) + for variant in _topic_id_variants(str(topic_id)): + by_topic.setdefault(variant, []).append(entry) + + return by_keyword, by_topic + + +def clear_reverse_lookup_caches() -> None: + _build_json_inverted_index.cache_clear() + + +def _merge_ipc_match( + matches: dict[tuple[str, str], IpcCodeMatch], + level: str, + symbol: str, + score: float, + source_keyword: str, + match_type: str, +) -> None: + key = (level, normalize_symbol(symbol)) + existing = matches.get(key) + if existing is None or score > existing.match_score: + matches[key] = IpcCodeMatch( + ipc_level=level, + ipc_symbol=normalize_symbol(symbol), + match_score=score, + source_keyword=source_keyword, + match_type=match_type, + ) + + +def _matches_from_doc( + doc: dict[str, Any], + item: KeywordPatentSearchItem, +) -> list[IpcCodeMatch]: + ipc_level = str(doc.get("ipc_level") or "") + ipc_symbol = normalize_symbol(str(doc.get("ipc_symbol") or "")) + if not ipc_level or not ipc_symbol: + return [] + + keyword_variants = set(_keyword_variants(item.keyword)) + topic_variants = set(_topic_id_variants_for_item(item)) + topic_name = (item.topic_display_name or "").strip().casefold() + found: list[IpcCodeMatch] = [] + + for match in doc.get("keyword_matches") or []: + match_keyword = str(match.get("keyword") or "").strip() + if match_keyword.casefold() not in keyword_variants: + match_topic = match.get("topic_id") + if not match_topic or str(match_topic) not in topic_variants: + continue + score = _weighted_score( + ipc_level, + float(match.get("match_score") or 0.0), + item.relevance_score, + ) + found.append( + IpcCodeMatch( + ipc_level=ipc_level, + ipc_symbol=ipc_symbol, + match_score=score, + source_keyword=item.keyword, + match_type="keyword", + ) + ) + break + + for match in doc.get("topic_matches") or []: + match_topic = match.get("topic_id") + match_name = str(match.get("topic_display_name") or "").strip().casefold() + topic_hit = match_topic and str(match_topic) in topic_variants + name_hit = topic_name and match_name == topic_name + if not topic_hit and not name_hit: + continue + score = _weighted_score( + ipc_level, + float(match.get("match_score") or 0.0), + item.relevance_score, + ) + found.append( + IpcCodeMatch( + ipc_level=ipc_level, + ipc_symbol=ipc_symbol, + match_score=score, + source_keyword=item.keyword, + match_type="topic", + ) + ) + break + + return found + + +def _json_lookup(items: list[KeywordPatentSearchItem]) -> list[IpcCodeMatch]: + by_keyword, by_topic = _build_json_inverted_index() + merged: dict[tuple[str, str], IpcCodeMatch] = {} + + for item in items: + for level, symbol, base_score, source_keyword, match_type in by_keyword.get( + item.keyword.strip().casefold(), [] + ): + score = _weighted_score(level, base_score, item.relevance_score) + _merge_ipc_match( + merged, level, symbol, score, item.keyword, match_type + ) + + for variant in _topic_id_variants_for_item(item): + for level, symbol, base_score, source_keyword, match_type in by_topic.get( + variant, [] + ): + score = _weighted_score(level, base_score, item.relevance_score) + _merge_ipc_match( + merged, level, symbol, score, item.keyword, match_type + ) + + return sorted(merged.values(), key=lambda match: match.match_score, reverse=True) + + +def _dedupe_ipc_matches(matches: list[IpcCodeMatch]) -> list[IpcCodeMatch]: + merged: dict[tuple[str, str], IpcCodeMatch] = {} + for match in matches: + _merge_ipc_match( + merged, + match.ipc_level, + match.ipc_symbol, + match.match_score, + match.source_keyword, + match.match_type, + ) + return sorted(merged.values(), key=lambda match: match.match_score, reverse=True) + + +def _build_es_should_clauses(items: list[KeywordPatentSearchItem]) -> list[dict[str, Any]]: + should: list[dict[str, Any]] = [] + seen: set[str] = set() + + for item in items: + for keyword in _keyword_variants(item.keyword): + if keyword in seen: + continue + seen.add(keyword) + should.append( + { + "nested": { + "path": "keyword_matches", + "query": {"term": {"keyword_matches.keyword": keyword}}, + } + } + ) + + for topic_id in _topic_id_variants_for_item(item): + if topic_id in seen: + continue + seen.add(topic_id) + should.extend( + [ + { + "nested": { + "path": "keyword_matches", + "query": {"term": {"keyword_matches.topic_id": topic_id}}, + } + }, + { + "nested": { + "path": "topic_matches", + "query": {"term": {"topic_matches.topic_id": topic_id}}, + } + }, + ] + ) + + topic_name = (item.topic_display_name or "").strip() + if topic_name and topic_name not in seen: + seen.add(topic_name) + should.append( + { + "nested": { + "path": "topic_matches", + "query": { + "term": {"topic_matches.topic_display_name": topic_name} + }, + } + } + ) + + return should + + +class KeywordIpcReverseLookup: + def __init__(self, client: PatentsOpenAlexKeywordsClient | None = None): + self.client = client or PatentsOpenAlexKeywordsClient() + self._elasticsearch_checked = False + self._elasticsearch_enabled = False + + async def _elasticsearch_enabled_for_request(self) -> bool: + if self._elasticsearch_checked: + return self._elasticsearch_enabled + self._elasticsearch_checked = True + try: + self._elasticsearch_enabled = await self.client.index_exists() + except Exception as exc: + logger.warning("patents_openalex_keywords index check failed: %s", exc) + self._elasticsearch_enabled = False + return self._elasticsearch_enabled + + async def lookup_ipc_codes( + self, + items: list[KeywordPatentSearchItem], + *, + max_codes: int = 40, + ) -> list[IpcCodeMatch]: + if not items: + return [] + + matches: list[IpcCodeMatch] = [] + if await self._elasticsearch_enabled_for_request(): + try: + matches = await self._lookup_via_elasticsearch(items) + except (MissingApiKeyError, httpx.HTTPError) as exc: + logger.warning("Keyword IPC ES lookup failed, using JSON fallback: %s", exc) + self._elasticsearch_enabled = False + + if not matches: + matches = _json_lookup(items) + + if not matches: + logger.info( + "No IPC codes resolved for keywords: %s; " + "build patents_openalex_keywords for better coverage.", + [item.keyword for item in items], + ) + + matches = _dedupe_ipc_matches(matches) + return matches[:max_codes] + + async def _lookup_via_elasticsearch( + self, + items: list[KeywordPatentSearchItem], + ) -> list[IpcCodeMatch]: + should = _build_es_should_clauses(items) + if not should: + return [] + + payload = { + "size": 200, + "query": {"bool": {"should": should, "minimum_should_match": 1}}, + "_source": [ + "ipc_level", + "ipc_symbol", + "topic_matches", + "keyword_matches", + ], + } + + async with httpx.AsyncClient( + base_url=self.client.base_url, + timeout=self.client.timeout, + transport=self.client.transport, + ) as client: + response = await client.post( + f"/{PATENTS_OPENALEX_KEYWORDS_INDEX}/_search", + headers=self.client._headers(), + json=payload, + ) + response.raise_for_status() + data = response.json() + + merged: dict[tuple[str, str], IpcCodeMatch] = {} + for hit in data.get("hits", {}).get("hits", []): + doc = hit.get("_source", {}) + for item in items: + for match in _matches_from_doc(doc, item): + _merge_ipc_match( + merged, + match.ipc_level, + match.ipc_symbol, + match.match_score, + match.source_keyword, + match.match_type, + ) + + return sorted(merged.values(), key=lambda match: match.match_score, reverse=True) diff --git a/service/src/main/inse/patents/keywords/search_queries.py b/service/src/main/inse/patents/keywords/search_queries.py new file mode 100644 index 00000000..86a3ce9b --- /dev/null +++ b/service/src/main/inse/patents/keywords/search_queries.py @@ -0,0 +1,166 @@ +"""Elasticsearch query builders for IPC-based patent search.""" +from __future__ import annotations + +from typing import Any + +from inse.patents.common.elastic_search_client import DEFAULT_SEARCH_SIZE +from inse.patents.ipc_lookup import parse_ipc_symbol +from inse.patents.patents_openalex_keywords.ipc_entries import infer_subclass, normalize_symbol + +_PATENT_SOURCE_FIELDS = [ + "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", +] + +_USPTO_SOURCE_FIELDS = [ + "publication_number", + "country", + "publication_date", + "publication_year", + "application_number", + "application_date", + "application_type", + "number_of_claims", + "status", + "title", + "abstract", + "inventors_names", + "assignees_orgs", + "ipcr", + "cpc", +] + +_MIN_MATCH_TERM_LEN = 4 + + +def _search_terms_for_symbol(symbol: str) -> list[str]: + """Derive EPO/USPTO `match` terms from an IPC/CPC symbol. + + Patent indices store IPC values like ``B60L 53/14 20060101AFI...``. + Wildcard/prefix on normalized symbols (``B60L*``) does not match; ``match`` + on subclass codes (``B60L``) does. + """ + normalized = normalize_symbol(symbol) + if not normalized: + return [] + + terms: list[str] = [] + subclass = infer_subclass(normalized) + if subclass and len(subclass) >= _MIN_MATCH_TERM_LEN: + terms.append(subclass) + + keys = parse_ipc_symbol(normalized) + if keys is not None: + if keys.subclass and len(keys.subclass) >= _MIN_MATCH_TERM_LEN: + terms.append(normalize_symbol(keys.subclass)) + if keys.main_group and len(normalize_symbol(keys.main_group)) >= _MIN_MATCH_TERM_LEN: + terms.append(normalize_symbol(keys.main_group)) + + if len(normalized) >= _MIN_MATCH_TERM_LEN: + prefix = normalized[:_MIN_MATCH_TERM_LEN] + if prefix not in terms: + terms.append(prefix) + + return list(dict.fromkeys(term for term in terms if len(term) >= _MIN_MATCH_TERM_LEN)) + + +def _ipc_match_clauses(field: str, terms: list[str]) -> list[dict[str, Any]]: + clauses: list[dict[str, Any]] = [] + seen: set[tuple[str, str]] = set() + for term in terms: + if len(term) < _MIN_MATCH_TERM_LEN: + continue + key = (field, term) + if key in seen: + continue + seen.add(key) + clauses.append({"match": {field: term}}) + return clauses + + +class IpcPatentSearchQueries: + def epo_query_by_ipc_terms( + self, + terms: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + should = _ipc_match_clauses("ipc", terms) + _ipc_match_clauses("cpc", terms) + query: dict[str, Any] = ( + {"match_none": {}} + if not should + else {"bool": {"should": should, "minimum_should_match": 1}} + ) + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"date_publication": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": _PATENT_SOURCE_FIELDS, + "query": query, + } + + def uspto_query_by_ipc_terms( + self, + terms: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + should = _ipc_match_clauses("ipcr", terms) + _ipc_match_clauses("cpc", terms) + query: dict[str, Any] = ( + {"match_none": {}} + if not should + else {"bool": {"should": should, "minimum_should_match": 1}} + ) + return { + "size": size, + "track_total_hits": True, + "sort": [ + {"publication_date": {"order": "desc", "missing": "_last"}}, + "_doc", + ], + "_source": _USPTO_SOURCE_FIELDS, + "query": query, + } + + def epo_query_by_ipc_symbols( + self, + symbols: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + terms: list[str] = [] + seen: set[str] = set() + for symbol in symbols: + for term in _search_terms_for_symbol(symbol): + if term in seen: + continue + seen.add(term) + terms.append(term) + return self.epo_query_by_ipc_terms(terms, size=size) + + def uspto_query_by_ipc_symbols( + self, + symbols: list[str], + size: int = DEFAULT_SEARCH_SIZE, + ) -> dict[str, Any]: + terms: list[str] = [] + seen: set[str] = set() + for symbol in symbols: + for term in _search_terms_for_symbol(symbol): + if term in seen: + continue + seen.add(term) + terms.append(term) + return self.uspto_query_by_ipc_terms(terms, size=size) diff --git a/service/src/main/inse/patents/keywords/service.py b/service/src/main/inse/patents/keywords/service.py new file mode 100644 index 00000000..8aac2ea4 --- /dev/null +++ b/service/src/main/inse/patents/keywords/service.py @@ -0,0 +1,23 @@ +from typing import Annotated + +from fastapi import APIRouter, Body + +from inse.patents.keywords import logic +from inse.patents.keywords.model import PatentsByKeywordsRequest, PatentsByKeywordsResponse + +router = APIRouter(prefix="/api/inse-service/keywords", tags=["Keywords"]) + + +@router.post( + "/patents", + operation_id="getPatentsByKeywords", + response_model=PatentsByKeywordsResponse, + summary="Find patents matching extracted OpenAlex keywords.", +) +async def get_patents_by_keywords( + request: Annotated[ + PatentsByKeywordsRequest, + Body(description="Keywords enriched with OpenAlex topics."), + ], +): + return await logic.get_patents_by_keywords(request) diff --git a/service/src/main/inse/patents/keywords/test_logic.py b/service/src/main/inse/patents/keywords/test_logic.py new file mode 100644 index 00000000..cb6dda70 --- /dev/null +++ b/service/src/main/inse/patents/keywords/test_logic.py @@ -0,0 +1,672 @@ +"""Tests for keyword-based patent search.""" +from __future__ import annotations + +import asyncio +from unittest.mock import AsyncMock, patch + +from inse.patents.authors.ipc_openalex_mapping import MappedOpenAlexTopic +from inse.patents.common import model +from inse.patents.keywords.logic import ( + _compute_final_score, + _filter_keywords_for_patent_search, + _ipc_hierarchy_quality, + _keyword_is_patent_searchable, + _limit_matches_per_keyword, + _patent_passes_relevance_gate, + _patent_search_terms, + _score_ipc_match, + _score_patent, + _term_from_ipc_match, + _text_overlap_score, + _text_search_terms, + _topics_overlap_keywords, + get_patents_by_keywords, +) +from inse.patents.keywords.reverse_lookup import ( + IpcCodeMatch, + _json_lookup, + _weighted_score, + clear_reverse_lookup_caches, +) +from inse.patents.keywords.model import KeywordPatentSearchItem, PatentsByKeywordsRequest +from inse.patents.keywords.search_queries import IpcPatentSearchQueries, _search_terms_for_symbol + + +def test_ipc_hierarchy_quality_exact_match() -> None: + assert _ipc_hierarchy_quality("C07C243/08", "C07C243/08") == 1.0 + + +def test_ipc_hierarchy_quality_same_main_group() -> None: + assert _ipc_hierarchy_quality("C07C243/086", "C07C243/088") == 0.90 + + +def test_ipc_hierarchy_quality_same_subclass() -> None: + assert _ipc_hierarchy_quality("C07C243/08", "C07C31/20") == 0.75 + + +def test_ipc_hierarchy_quality_no_match() -> None: + assert _ipc_hierarchy_quality("C07C243/08", "C08F110/10") == 0.0 + + +def test_ipc_hierarchy_quality_invalid_code() -> None: + assert _ipc_hierarchy_quality("", "C07C243/08") == 0.0 + assert _ipc_hierarchy_quality("C07", "C07C243/08") == 0.0 + + +def test_term_from_ipc_match_returns_subclass() -> None: + match = IpcCodeMatch("subgroup", "C07C243/08", 0.9, "Organic Chemistry", "keyword") + assert _term_from_ipc_match(match) == "C07C" + + +def test_term_from_ipc_match_skips_class_level() -> None: + match = IpcCodeMatch("class", "C07", 0.7, "Chemistry", "topic") + assert _term_from_ipc_match(match) is None + + +def test_patent_search_terms_deduplicates_chemistry_subclasses() -> None: + ipc_matches = [ + IpcCodeMatch("subgroup", "C25B3/03", 0.9037, "Anorganische Chemie", "keyword"), + IpcCodeMatch("subgroup", "C07C243/08", 0.8989, "Anorganische Chemie", "keyword"), + IpcCodeMatch("subgroup", "C09B68/48", 0.8885, "Chemische Reaktionen", "keyword"), + IpcCodeMatch("subgroup", "D06L4/17", 0.8745, "Technische Chemie", "keyword"), + IpcCodeMatch("subgroup", "C09B43/34", 0.8738, "Chemische Reaktionen", "keyword"), + IpcCodeMatch("subgroup", "C02F1/285", 0.8698, "Organische Chemie", "keyword"), + IpcCodeMatch("subgroup", "B01J2219/00709", 0.8679, "Organische Chemie", "keyword"), + ] + terms = _patent_search_terms(ipc_matches) + assert terms == ["C25B", "C07C", "C09B", "D06L", "C02F", "B01J"] + + +def test_score_ipc_match_returns_only_best_evidence() -> None: + patent = model.PatentEntry( + patent_id="EP123", + source="EPO", + ipc=["C07C243/08"], + ) + ipc_matches = [ + IpcCodeMatch("subgroup", "C07C243/08", 0.8989, "Anorganische Chemie", "keyword"), + IpcCodeMatch("subgroup", "C09B68/48", 0.8885, "Chemische Reaktionen", "keyword"), + ] + result = _score_ipc_match(patent, ipc_matches) + assert result is not None + score, keywords, symbols = result + assert score == 0.8989 + assert keywords == ["Anorganische Chemie"] + assert symbols == ["C07C243/08"] + + +def test_score_ipc_match_keeps_equal_best_matches() -> None: + patent = model.PatentEntry( + patent_id="EP123", + source="EPO", + ipc=["C07C243/08"], + ) + ipc_matches = [ + IpcCodeMatch("subgroup", "C07C243/08", 0.8989, "Anorganische Chemie", "keyword"), + IpcCodeMatch("subgroup", "C07C243/08", 0.8989, "Organische Chemie", "keyword"), + ] + result = _score_ipc_match(patent, ipc_matches) + assert result is not None + _, keywords, symbols = result + assert keywords == ["Anorganische Chemie", "Organische Chemie"] + assert symbols == ["C07C243/08"] + + +def test_score_patent_uses_best_ipc_match() -> None: + patent = model.PatentEntry( + patent_id="EP123", + source="EPO", + ipc=["G01S 5/02"], + title="Wireless localization system", + ) + ipc_matches = [ + IpcCodeMatch("subclass", "G01S", 0.9, "localization", "keyword"), + IpcCodeMatch("class", "G01", 0.5, "wireless", "topic"), + ] + result = _score_patent( + patent, + ipc_matches, + patent_topics=[ + MappedOpenAlexTopic( + topic_id="https://openalex.org/T12345", + subfield_name="Remote Sensing", + ) + ], + keyword_topic_ids=frozenset({"T12345"}), + search_keywords=[ + KeywordPatentSearchItem( + keyword="wireless localization", + topic_id="https://openalex.org/T12345", + relevance_score=1.0, + ) + ], + ) + assert result is not None + score, keywords, symbols = result + assert score == _compute_final_score(0.675, 1.0, 2 / 3) + assert "localization" in keywords + assert "G01S" in symbols + + +def test_score_patent_requires_topic_overlap() -> None: + patent = model.PatentEntry( + patent_id="EP123", + source="EPO", + ipc=["G01S 5/02"], + ) + ipc_matches = [ + IpcCodeMatch("subclass", "G01S", 0.9, "localization", "keyword"), + ] + patent_topics = [ + MappedOpenAlexTopic( + topic_id="https://openalex.org/T99999", + subfield_name="Oncology", + ) + ] + result = _score_patent( + patent, + ipc_matches, + patent_topics=patent_topics, + keyword_topic_ids=frozenset({"T12345"}), + keyword_subfield_names=frozenset({"law"}), + ) + assert result is None + + +def test_score_patent_accepts_compatible_engineering_and_computer_science() -> None: + patent = model.PatentEntry( + patent_id="EP456", + source="EPO", + ipc=["G06N 3/08"], + title="Deep learning classifier", + abstract="A neural network for classification tasks.", + ) + ipc_matches = [ + IpcCodeMatch("subclass", "G06N", 0.9, "Deep Learning", "keyword"), + ] + result = _score_patent( + patent, + ipc_matches, + patent_topics=[ + MappedOpenAlexTopic( + topic_id="https://openalex.org/T12072", + field_name="Computer Science", + ) + ], + keyword_topic_ids=frozenset({"T10653"}), + keyword_subfield_names=frozenset({"control and systems engineering"}), + keyword_soft_field_names=frozenset({"engineering"}), + search_keywords=[ + KeywordPatentSearchItem( + keyword="Deep Learning", + topic_id="https://openalex.org/T10653", + field_name="Engineering", + relevance_score=0.9, + ) + ], + ) + assert result is not None + + +def test_filter_keywords_for_patent_search_prefers_coarse_and_fine_over_broad() -> None: + items = [ + KeywordPatentSearchItem( + keyword="Naturwissenschaft", + keyword_level="broad", + relevance_score=1.0, + topic_id="https://openalex.org/T14329", + field_name="Environmental Science", + ), + KeywordPatentSearchItem( + keyword="Thermodynamik", + keyword_level="coarse", + relevance_score=0.8, + topic_id="https://openalex.org/T12345", + field_name="Physics and Astronomy", + subfield_name="Statistical and Nonlinear Physics", + ), + KeywordPatentSearchItem( + keyword="noise", + keyword_level="coarse", + relevance_score=0.0, + ), + ] + filtered = _filter_keywords_for_patent_search(items) + assert [item.keyword for item in filtered] == ["Thermodynamik"] + + +def test_filter_keywords_for_patent_search_allows_zero_relevance_with_topic() -> None: + item = KeywordPatentSearchItem( + keyword="Deep Learning", + keyword_level="fine", + relevance_score=0.0, + topic_id="https://openalex.org/T12072", + field_name="Computer Science", + subfield_name="Artificial Intelligence", + ) + assert _keyword_is_patent_searchable(item) + + +def test_filter_keywords_for_patent_search_allows_high_relevance_with_technical_topic() -> None: + items = [ + KeywordPatentSearchItem( + keyword="Deep Learning", + keyword_level="fine", + relevance_score=0.9, + topic_id="https://openalex.org/T12072", + field_name="Computer Science", + subfield_name="Artificial Intelligence", + ), + ] + filtered = _filter_keywords_for_patent_search(items) + assert [item.keyword for item in filtered] == ["Deep Learning"] + + +def test_topics_overlap_keywords_soft_match_engineering_and_computer_science() -> None: + patent = model.PatentEntry(patent_id="EP1", source="EPO", ipc=["G06N 3/08"]) + patent_topics = [ + MappedOpenAlexTopic( + topic_id="https://openalex.org/T12072", + field_name="Computer Science", + ) + ] + assert _topics_overlap_keywords( + patent_topics, + frozenset({"T10653"}), + frozenset({"control and systems engineering"}), + frozenset({"engineering"}), + patent=patent, + ) + + +def test_score_patent_accepts_matching_topic_id() -> None: + patent = model.PatentEntry( + patent_id="EP123", + source="EPO", + ipc=["G01S 5/02"], + ) + ipc_matches = [ + IpcCodeMatch("subclass", "G01S", 0.9, "localization", "keyword"), + ] + patent_topics = [ + MappedOpenAlexTopic( + topic_id="https://openalex.org/T12345", + subfield_name="Remote Sensing", + ) + ] + result = _score_patent( + patent, + ipc_matches, + patent_topics=patent_topics, + keyword_topic_ids=frozenset({"T12345"}), + ) + assert result is not None + + +def test_topics_overlap_keywords_uses_subfield_name_not_field() -> None: + patent_topics = [ + MappedOpenAlexTopic( + topic_id="https://openalex.org/T99999", + subfield_name="Chemistry", + field_name="Physical Sciences", + ) + ] + assert not _topics_overlap_keywords( + patent_topics, + frozenset(), + frozenset({"law"}), + frozenset(), + ) + assert _topics_overlap_keywords( + patent_topics, + frozenset(), + frozenset({"chemistry"}), + frozenset(), + ) + assert _topics_overlap_keywords( + patent_topics, + frozenset(), + frozenset(), + frozenset({"physical sciences"}), + ) + assert not _topics_overlap_keywords( + patent_topics, + frozenset(), + frozenset(), + frozenset({"engineering"}), + ) + + +def test_topics_overlap_keywords_rejects_patents_without_topics() -> None: + assert not _topics_overlap_keywords( + [], + frozenset({"T12345"}), + frozenset(), + frozenset({"chemistry"}), + ) + + +def test_limit_matches_per_keyword() -> None: + matches = [ + IpcCodeMatch("subclass", "C07C", 0.95, "Organic Chemistry", "keyword"), + IpcCodeMatch("group", "C07C31", 0.9, "Organic Chemistry", "keyword"), + IpcCodeMatch("subclass", "C01B", 0.88, "Inorganic Chemistry", "keyword"), + IpcCodeMatch("subclass", "C01C", 0.87, "Inorganic Chemistry", "keyword"), + ] + limited = _limit_matches_per_keyword(matches, limit=2) + assert len(limited) == 4 + organic = [match for match in limited if match.source_keyword == "Organic Chemistry"] + inorganic = [match for match in limited if match.source_keyword == "Inorganic Chemistry"] + assert len(organic) == 2 + assert len(inorganic) == 2 + assert organic[0].ipc_symbol == "C07C" + assert inorganic[0].ipc_symbol == "C01B" + + +def test_text_overlap_score_uses_title_and_abstract() -> None: + patent = model.PatentEntry( + patent_id="EP1", + source="EPO", + title="Organic chemistry synthesis", + abstract="A method for catalytic reactions.", + ) + score = _text_overlap_score( + patent, + ["organic", "chemistry", "catalytic", "reactions", "unrelated"], + ) + assert score == 1.0 + + +def test_patent_passes_relevance_gate_with_text_but_no_topics() -> None: + patent = model.PatentEntry( + patent_id="EP1", + source="EPO", + title="Diagnostic imaging device", + abstract="Medical diagnosis using imaging.", + ) + assert _patent_passes_relevance_gate( + [], + keyword_topic_ids=frozenset({"T99999"}), + keyword_subfield_names=frozenset(), + keyword_soft_field_names=frozenset({"medicine"}), + patent=patent, + text_score=_text_overlap_score(patent, ["diagnostic", "imaging", "diagnosis"]), + ) + + +def test_patent_passes_relevance_gate_rejects_ipc_only() -> None: + patent = model.PatentEntry( + patent_id="EP1", + source="EPO", + title="Humidifier system", + abstract="Water exchange membrane.", + ) + assert not _patent_passes_relevance_gate( + [], + keyword_topic_ids=frozenset({"T99999"}), + keyword_subfield_names=frozenset(), + keyword_soft_field_names=frozenset({"medicine"}), + patent=patent, + text_score=0.0, + ) + + +def test_compute_final_score_weights_ipc_topic_and_text() -> None: + assert _compute_final_score(0.9, 1.0, 1.0) == round( + 0.60 * 0.9 + 0.25 * 1.0 + 0.15 * 1.0, + 4, + ) + assert _compute_final_score(0.6742, 0.0, 0.0) == round(0.60 * 0.6742, 4) + + +def test_score_patent_rejects_subclass_only_without_topic_or_text() -> None: + patent = model.PatentEntry( + patent_id="EP1", + source="EPO", + ipc=["C07C31/20"], + title="Humidifier system", + abstract="Water exchange membrane.", + ) + ipc_matches = [ + IpcCodeMatch("subgroup", "C07C243/08", 0.8989, "Organische Chemie", "keyword"), + ] + result = _score_patent( + patent, + ipc_matches, + patent_topics=[], + keyword_topic_ids=frozenset({"T99999"}), + keyword_soft_field_names=frozenset({"chemistry"}), + search_keywords=[ + KeywordPatentSearchItem( + keyword="Organische Chemie", + topic_id="https://openalex.org/T99999", + field_name="Chemistry", + relevance_score=1.0, + ) + ], + ) + assert result is None + + +def test_get_patents_by_keywords_uses_symbol_queries() -> None: + queries = IpcPatentSearchQueries() + captured: list[str] = [] + + async def fake_search_epo(query): + captured.append("epo") + assert "query" in query + return {"hits": {"hits": []}} + + async def fake_search_uspto(query): + captured.append("uspto") + return {"hits": {"hits": []}} + + request = PatentsByKeywordsRequest( + keywords=[ + KeywordPatentSearchItem( + keyword="Organische Chemie", + keyword_level="coarse", + topic_id="https://openalex.org/T13859", + field_name="Chemistry", + relevance_score=1.0, + ) + ] + ) + + with patch( + "inse.patents.keywords.logic.KeywordIpcReverseLookup.lookup_ipc_codes", + new=AsyncMock( + return_value=[ + IpcCodeMatch( + "subgroup", + "C07C243/08", + 0.8989, + "Organische Chemie", + "keyword", + ) + ] + ), + ), patch( + "inse.patents.keywords.logic.BasePatentSearchClient.search_epo", + new=AsyncMock(side_effect=fake_search_epo), + ), patch( + "inse.patents.keywords.logic.BasePatentSearchClient.search_uspto", + new=AsyncMock(side_effect=fake_search_uspto), + ), patch( + "inse.patents.keywords.logic.PatentOpenAlexMappingResolver.resolve_topics_for_patents", + new=AsyncMock(return_value={}), + ), patch( + "inse.patents.keywords.logic.enrich_patents_classifications", + new=AsyncMock(), + ), patch.object( + IpcPatentSearchQueries, + "epo_query_by_ipc_symbols", + wraps=queries.epo_query_by_ipc_symbols, + ) as epo_symbols, patch.object( + IpcPatentSearchQueries, + "uspto_query_by_ipc_symbols", + wraps=queries.uspto_query_by_ipc_symbols, + ) as uspto_symbols: + asyncio.run(get_patents_by_keywords(request)) + + epo_symbols.assert_called_once() + uspto_symbols.assert_called_once() + assert epo_symbols.call_args.args[0] == ["C07C"] + assert captured == ["epo", "uspto"] + + +def test_text_search_terms_include_topic_metadata() -> None: + items = [ + KeywordPatentSearchItem( + keyword="Organische Chemie", + topic_display_name="Organic Chemistry", + subfield_name="Organic Chemistry", + field_name="Chemistry", + relevance_score=0.9, + topic_id="https://openalex.org/T1", + ) + ] + terms = _text_search_terms(items) + assert "organische" in terms + assert "organic" in terms + assert "chemistry" in terms + + +def test_weighted_score_applies_level_not_llm_relevance() -> None: + score_high = _weighted_score("subclass", 0.8, 1.0) + score_zero = _weighted_score("subclass", 0.8, 0.0) + assert score_high == round(0.8 * 0.85, 4) + assert score_zero == score_high + + +def test_search_terms_use_subclass_prefix() -> None: + assert "B60R" in _search_terms_for_symbol("B60R2300/8086") + assert "G06N" in _search_terms_for_symbol("G06N") + + +def test_json_lookup_returns_empty_without_mapping(monkeypatch) -> None: + clear_reverse_lookup_caches() + monkeypatch.setattr( + "inse.patents.keywords.reverse_lookup.load_patents_openalex_keywords_json", + lambda: {}, + ) + clear_reverse_lookup_caches() + + items = [KeywordPatentSearchItem(keyword="Medizin", relevance_score=1.0)] + assert _json_lookup(items) == [] + + +def test_json_lookup_finds_ipc_for_keyword(monkeypatch) -> None: + clear_reverse_lookup_caches() + monkeypatch.setattr( + "inse.patents.keywords.reverse_lookup.load_patents_openalex_keywords_json", + lambda: { + "subclass": { + "G01S": { + "ipc_level": "subclass", + "ipc_symbol": "G01S", + "keyword_matches": [ + { + "keyword": "wireless localization", + "match_score": 0.91, + "topic_id": "https://openalex.org/T12345", + } + ], + "topic_matches": [], + } + } + }, + ) + clear_reverse_lookup_caches() + + items = [ + KeywordPatentSearchItem( + keyword="wireless localization", + topic_id="https://openalex.org/T12345", + relevance_score=1.0, + ) + ] + matches = _json_lookup(items) + assert len(matches) == 1 + assert matches[0].ipc_symbol == "G01S" + assert matches[0].match_score > 0 + + +def test_json_lookup_finds_ipc_for_topic_id(monkeypatch) -> None: + clear_reverse_lookup_caches() + monkeypatch.setattr( + "inse.patents.keywords.reverse_lookup.load_patents_openalex_keywords_json", + lambda: { + "subclass": { + "G06N": { + "ipc_level": "subclass", + "ipc_symbol": "G06N", + "keyword_matches": [], + "topic_matches": [ + { + "topic_id": "https://openalex.org/T12072", + "topic_display_name": "Machine Learning and Algorithms", + "match_score": 0.88, + } + ], + } + } + }, + ) + clear_reverse_lookup_caches() + + items = [ + KeywordPatentSearchItem( + keyword="Klassifikation", + topic_id="https://openalex.org/T12072", + topic_display_name="Machine Learning and Algorithms", + relevance_score=1.0, + ) + ] + matches = _json_lookup(items) + assert len(matches) == 1 + assert matches[0].ipc_symbol == "G06N" + assert matches[0].match_type == "topic" + + +def test_json_lookup_resolves_topic_id_from_display_name(monkeypatch) -> None: + clear_reverse_lookup_caches() + monkeypatch.setattr( + "inse.patents.keywords.reverse_lookup.load_patents_openalex_keywords_json", + lambda: { + "subclass": { + "G01N": { + "ipc_level": "subclass", + "ipc_symbol": "G01N", + "keyword_matches": [], + "topic_matches": [ + { + "topic_id": "https://openalex.org/T14329", + "topic_display_name": "Science and Climate Studies", + "match_score": 0.9, + } + ], + } + } + }, + ) + monkeypatch.setattr( + "inse.patents.keywords.reverse_lookup._load_topic_cache", + lambda: { + "Science and Climate Studies": { + "topic_id": "https://openalex.org/T14329", + } + }, + ) + clear_reverse_lookup_caches() + + items = [ + KeywordPatentSearchItem( + keyword="Science and Climate Studies", + topic_display_name="Science and Climate Studies", + relevance_score=1.0, + ) + ] + matches = _json_lookup(items) + assert len(matches) == 1 + assert matches[0].ipc_symbol == "G01N" diff --git a/service/src/main/inse/patents/logic.py b/service/src/main/inse/patents/logic.py index 6d2522c4..26e73984 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 +from inse.patents.all.logic import get_all_patents, get_patent_by_id 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 ( @@ -7,316 +7,11 @@ from inse.patents.institutions.logic import ( get_patents_by_institution_id, ) -import logging -import asyncio - - -from ..persons import logic as person_logic -from ..models.openalex.author import Author -from . import model -from inse.exceptions import MissingApiKeyError, ElasticsearchException -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 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 - elements = parse(data) - - if not elements: - return None - return elements[0] - - -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 = await _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=[], - ) - - epo_data, uspto_data = await _search_both_indices( - search_client, last_name, first_name - ) - - 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): - 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 ElasticsearchException 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, - ) - - -async def _get_author(author_id: str) -> Author | None: - short_id = author_id.replace("https://openalex.org/", "") - result = await 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() - - 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) - ) - - - await _enrich_patents_classifications(patents, ipc_search_client) - - return model.AllPatentsResponse( - total=total, - page=page, - size=size, - patents=patents, - ) +__all__ = [ + "_deduplicate_patents", + "_filter_patents_by_institution", + "get_all_patents", + "get_patent_by_id", + "get_patents_by_author_id", + "get_patents_by_institution_id", +] diff --git a/service/src/main/inse/patents/name_matching.py b/service/src/main/inse/patents/name_matching.py index a1e45065..c40ce50c 100644 --- a/service/src/main/inse/patents/name_matching.py +++ b/service/src/main/inse/patents/name_matching.py @@ -1,7 +1,10 @@ """Backward-compatible re-exports.""" from inse.patents.authors.name_matching import ( # noqa: F401 first_name_match_kind, + first_name_match_kind_for_person, + inventor_search_phrases, name_matches, + name_matches_person, search_name_variants, tokens_equal, ) diff --git a/service/src/main/inse/patents/org/elastic_search_client.py b/service/src/main/inse/patents/org/elastic_search_client.py index c8ef2d8a..157fefe1 100644 --- a/service/src/main/inse/patents/org/elastic_search_client.py +++ b/service/src/main/inse/patents/org/elastic_search_client.py @@ -1,10 +1,13 @@ """HTTP client for the org_patents Elasticsearch index.""" import json import logging +from datetime import datetime from typing import Any import httpx +from inse.integrations import elasticsearch +from inse.models.openalex.author import Author 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 @@ -13,6 +16,91 @@ from inse import config logger = logging.getLogger(__name__) DEFAULT_PAGE_SIZE = 20 +OPENALEX_AUTHORS_INDEX = "openalex-authors" +AUTHOR_PAGE_SIZE = 500 + + +async def fetch_authors_by_institution_name(institution_name: str) -> list[Author]: + """Fetches OpenAlex authors currently affiliated with institution_name. + + Mirrors the persons/search-list default filter: last_known_institutions + must match AND there must be an affiliations entry for the same + institution from the current year or the year before. + """ + target_year = datetime.now().year - 1 + query = { + "bool": { + "filter": [ + { + "nested": { + "path": "last_known_institutions", + "query": { + "match_phrase": { + "last_known_institutions.display_name": institution_name, + } + }, + } + }, + { + "nested": { + "path": "affiliations", + "query": { + "bool": { + "filter": [ + { + "match_phrase": { + "affiliations.institution.display_name": institution_name, + } + }, + { + "range": { + "affiliations.years": {"gte": target_year}, + } + }, + ] + } + }, + } + }, + ] + } + } + sort = [ + {"works_count": {"order": "desc"}}, + {"id": {"order": "asc"}}, + ] + + authors: list[Author] = [] + search_after: list | None = None + + while True: + body: dict = { + "size": AUTHOR_PAGE_SIZE, + "query": query, + "sort": sort, + } + if search_after: + body["search_after"] = search_after + + response = await elasticsearch.search(index=OPENALEX_AUTHORS_INDEX, 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 class OrgPatentsSearchClient: @@ -65,24 +153,66 @@ class OrgPatentsSearchClient: mapping_response.raise_for_status() async def delete_by_institution(self, institution_id: str) -> int: - payload = { - "query": {"term": {"institution_id": institution_id.upper()}}, - } + """Deletes all org_patents documents for institution_id. + + Uses a search + bulk-delete-by-id loop instead of _delete_by_query: + the patent-cluster API key has been observed to reject _delete_by_query + with 403 Forbidden, while individual document deletes via _bulk succeed. + """ + short_id = institution_id.upper() + query = {"term": {"institution_id": short_id}} + page_size = 1000 + deleted_total = 0 + 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) + while True: + search_response = await client.post( + f"/{ORG_PATENTS_INDEX}/_search", + headers=self._headers(), + json={ + "size": page_size, + "query": query, + "_source": False, + "sort": ["_doc"], + }, + ) + if search_response.status_code == 404: + return deleted_total + search_response.raise_for_status() + hits = search_response.json().get("hits", {}).get("hits", []) + if not hits: + break + + bulk_lines = [ + json.dumps({"delete": {"_index": ORG_PATENTS_INDEX, "_id": hit["_id"]}}) + for hit in hits + ] + bulk_response = await client.post( + "/_bulk", + content="\n".join(bulk_lines) + "\n", + headers=self._headers("application/x-ndjson"), + params={"refresh": "true"}, + ) + bulk_response.raise_for_status() + result = bulk_response.json() + if result.get("errors"): + failed = [ + item + for item in result.get("items", []) + if item.get("delete", {}).get("status", 200) >= 400 + ] + logger.error("Bulk delete errors: %s", failed[:3]) + raise RuntimeError("Bulk deleting existing org_patents documents failed.") + + deleted_total += len(hits) + if len(hits) < page_size: + break + + return deleted_total async def bulk_index(self, documents: list[tuple[str, dict[str, Any]]]) -> None: if not documents: @@ -170,6 +300,71 @@ class OrgPatentsSearchClient: patents = [_hit_to_org_patent(hit) for hit in data.get("hits", {}).get("hits", [])] return patents, total + async def top_authors_by_institution( + self, + institution_id: str, + size: int = 10, + ) -> list[dict[str, Any]]: + short_id = institution_id.replace("https://openalex.org/", "").upper() + payload = { + "size": 0, + "query": {"term": {"institution_id": short_id}}, + "aggs": { + "matched_authors_nested": { + "nested": {"path": "matched_authors"}, + "aggs": { + "authors": { + "terms": { + "field": "matched_authors.openalex_author_id", + "size": size, + "order": [{"_count": "desc"}, {"_key": "asc"}], + }, + "aggs": { + "names": { + "terms": { + "field": "matched_authors.author_name", + "size": 1, + } + }, + "patents": {"reverse_nested": {}}, + }, + } + }, + } + }, + } + + 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() + + buckets = ( + data.get("aggregations", {}) + .get("matched_authors_nested", {}) + .get("authors", {}) + .get("buckets", []) + ) + return [ + { + "id": bucket.get("key"), + "name": _top_author_name(bucket), + "count": int(bucket.get("patents", {}).get("doc_count", 0)), + } + for bucket in buckets + if bucket.get("key") + ] + def _hit_to_org_patent(hit: dict[str, Any]) -> OrgPatentEntry: source = hit.get("_source", {}) @@ -197,3 +392,10 @@ def _hit_to_org_patent(hit: dict[str, Any]) -> OrgPatentEntry: country=source.get("country"), matched_authors=source.get("matched_authors") or [], ) + + +def _top_author_name(bucket: dict[str, Any]) -> str: + name_buckets = bucket.get("names", {}).get("buckets", []) + if name_buckets: + return str(name_buckets[0].get("key") or bucket.get("key")) + return str(bucket.get("key")) diff --git a/service/src/main/inse/patents/org/logic.py b/service/src/main/inse/patents/org/logic.py index 4e8f8308..c6cc79e4 100644 --- a/service/src/main/inse/patents/org/logic.py +++ b/service/src/main/inse/patents/org/logic.py @@ -10,21 +10,31 @@ 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.authors.identity import ( + author_institution_names, + is_ambiguous_name, + patent_institution_match, + patent_personal_assignee_match, +) +from inse.patents.authors.name_matching import filter_patents_by_author_name 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, + enrich_patents_openalex_topics, 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.patents_openalex_keywords.client import PatentsOpenAlexKeywordsClient +from inse.patents.org.elastic_search_client import ( + OrgPatentsSearchClient, + fetch_authors_by_institution_name, +) from inse.patents.org.model import ( MatchType, MatchTypeFilter, @@ -36,40 +46,10 @@ 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 @@ -103,6 +83,33 @@ def resolve_match_type(institution_match: bool, has_name_match: bool) -> MatchTy return "name" +def _canonical_authors_by_name( + author_patents: list[tuple[Author, list[PatentEntry]]], +) -> dict[str, Author]: + """Picks one Author per case-normalized display name to attribute matches to. + + OpenAlex sometimes merges multiple real people who share a name into a + single, noisy author record with a long, unrelated affiliation history + (e.g. an economist and a biochemist both named "Michael Ehrmann" ending up + under one ID with both "European Central Bank" and "University of X"). + Such merged records tend to have an inflated works_count and therefore + sort first in the author list, which would otherwise make them "win" the + dedup below. Preferring the author with the fewest total institutions + favors the cleaner, more specific identity for the drill-down link. + """ + canonical: dict[str, Author] = {} + for author, _ in author_patents: + name_key = (author.display_name or "").casefold().strip() + if not name_key: + continue + current_best = canonical.get(name_key) + if current_best is None or ( + len(author_institution_names(author)) < len(author_institution_names(current_best)) + ): + canonical[name_key] = author + return canonical + + def merge_org_patents( institution_id: str, institution_name: str | None, @@ -119,15 +126,25 @@ def merge_org_patents( else: entry.institution_match = True + canonical_authors = _canonical_authors_by_name(author_patents) + 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 + # Use case-normalized name as dedup key to collapse OpenAlex duplicate records + # (e.g. "Kenji TANAKA" and "Kenji Tanaka" are the same person) + author_dedup_key = author_name.casefold().strip() or author_id + + # Attribute the match to the canonical (cleanest-profile) author for + # this name, not necessarily the one whose patents we're iterating — + # see _canonical_authors_by_name(). + canonical = canonical_authors.get(author_dedup_key, author) matched_author = MatchedAuthor( - openalex_author_id=author_id, - author_name=author_name, + openalex_author_id=normalize_author_id(canonical.id) or author_id, + author_name=canonical.display_name or author_name, ) for patent in patents: key = patent_dedup_key(patent) @@ -135,10 +152,10 @@ def merge_org_patents( if entry is None: accumulated[key] = _AccumulatedPatent( patent=patent, - matched_authors={author_id: matched_author}, + matched_authors={author_dedup_key: matched_author}, ) else: - entry.matched_authors[author_id] = matched_author + entry.matched_authors.setdefault(author_dedup_key, matched_author) org_patents: list[OrgPatentEntry] = [] short_institution_id = normalize_institution_id(institution_id) @@ -201,76 +218,28 @@ def org_patent_to_es_document(patent: OrgPatentEntry) -> dict: } -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, + institution_name: str | None, search_client: PatentSearchClient, + ipc_client: IpcSearchClient, ) -> 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: + if not author_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 + author_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 + author_name, + size=ORG_PATENT_SEARCH_SIZE, ) ), ) @@ -278,9 +247,41 @@ async def _search_patents_by_author( 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) + patents = deduplicate_patents(patents) + patent_hit_count = len(patents) + name_matched = filter_patents_by_author_name(patents, author_name) + if not name_matched: + return [] + + from inse.persons import logic as person_logic + from inse.patents.authors.name_variants import parse_person_name + + full_name_count = await person_logic.count_authors_by_display_name(author_name) + parsed_for_last = parse_person_name(author_name) + last_name_count: int | None = None + if parsed_for_last and not parsed_for_last.is_single_token: + last_name_count = await person_logic.count_authors_by_last_name( + parsed_for_last.last_name + ) + is_ambiguous = is_ambiguous_name( + author_name, + patent_hit_count=patent_hit_count, + openalex_full_name_count=full_name_count, + openalex_last_name_count=last_name_count, + ) + + if is_ambiguous: + # Common names (Zhang, Li, Wang): only keep if the assignee matches the + # institution we're building this index for (not any institution from + # the author's whole affiliation history) or the person themselves. + inst_names = [institution_name] if institution_name else [] + return [ + p for p in name_matched + if patent_institution_match(p, inst_names) + or patent_personal_assignee_match(p, author_name) + ] + else: + return name_matched async def build_org_patents_for_institution( @@ -294,7 +295,7 @@ async def build_org_patents_for_institution( institution_client = institutions_client or InstitutionsSearchClient() short_id = normalize_institution_id(institution_id) - institution = institution_client.get_institution_by_id(short_id) + institution = await institution_client.get_institution_by_id(short_id) institution_name = institution.display_name institution_response = await get_patents_by_institution_id( @@ -305,7 +306,7 @@ async def build_org_patents_for_institution( ) institution_patents = institution_response.patents - authors = fetch_authors_for_institution(short_id) + authors = await fetch_authors_by_institution_name(institution_name) logger.info( "Building org_patents for %s (%s): %d authors, %d institution patents", institution_name, @@ -318,7 +319,9 @@ async def build_org_patents_for_institution( async def _fetch_for_author(author: Author) -> tuple[Author, list[PatentEntry]]: async with semaphore: - patents = await _search_patents_by_author(author, patent_client) + patents = await _search_patents_by_author( + author, institution_name, patent_client, ipc_search_client + ) return author, patents author_results = await asyncio.gather( @@ -394,7 +397,7 @@ async def get_org_patents_by_institution_id( institution_client = institutions_client or InstitutionsSearchClient() try: - institution = institution_client.get_institution_by_id(short_id) + institution = await institution_client.get_institution_by_id(short_id) institution_name = institution.display_name except Exception: institution_name = None @@ -419,6 +422,15 @@ async def get_org_patents_by_institution_id( detail="org_patents search request failed.", ) from exc + try: + await enrich_patents_openalex_topics( + patents, PatentsOpenAlexKeywordsClient() + ) + except Exception: + logger.warning( + "Failed to enrich org_patents with OpenAlex topics", exc_info=True + ) + return OrgPatentsResponse( institution_id=short_id, institution_name=institution_name, diff --git a/service/src/main/inse/patents/org/service.py b/service/src/main/inse/patents/org/service.py index df04d86b..2db362c2 100644 --- a/service/src/main/inse/patents/org/service.py +++ b/service/src/main/inse/patents/org/service.py @@ -1,7 +1,9 @@ from functools import lru_cache from typing import Annotated -from fastapi import APIRouter, Depends, Query +from fastapi import APIRouter, BackgroundTasks, Depends, HTTPException, Query +from pydantic import BaseModel +from starlette.status import HTTP_202_ACCEPTED from inse.institutions.institutions_search_client import InstitutionsSearchClient from inse.patents.org import logic @@ -9,6 +11,8 @@ from inse.patents.org.model import MatchTypeFilter, OrgPatentsResponse router = APIRouter(prefix="/api/inse-service/institutions", tags=["Patents"]) +_rebuild_running: set[str] = set() + @lru_cache def get_institutions_search_client() -> InstitutionsSearchClient: @@ -42,3 +46,44 @@ async def get_org_patents_by_institution( source=source, institutions_client=client, ) + + +class RebuildResponse(BaseModel): + status: str + institution_id: str + message: str + + +@router.post( + "/{id}/org-patents/rebuild", + operation_id="rebuildOrgPatents", + response_model=RebuildResponse, + status_code=HTTP_202_ACCEPTED, + summary="Trigger a background rebuild of the org_patents index for an institution.", +) +async def rebuild_org_patents( + id: str, + background_tasks: BackgroundTasks, +) -> RebuildResponse: + short_id = logic.normalize_institution_id(id) + + if short_id in _rebuild_running: + raise HTTPException( + status_code=409, + detail=f"A rebuild for institution {short_id} is already in progress.", + ) + + async def _run() -> None: + _rebuild_running.add(short_id) + try: + await logic.index_org_patents_for_institution(short_id) + finally: + _rebuild_running.discard(short_id) + + background_tasks.add_task(_run) + + return RebuildResponse( + status="accepted", + institution_id=short_id, + message=f"Rebuild started for institution {short_id}. Check server logs for progress.", + ) diff --git a/service/src/main/inse/patents/org/test_elastic_search_client.py b/service/src/main/inse/patents/org/test_elastic_search_client.py new file mode 100644 index 00000000..6ac6ac7c --- /dev/null +++ b/service/src/main/inse/patents/org/test_elastic_search_client.py @@ -0,0 +1,55 @@ +import json + +import httpx +import pytest + +from inse.patents.org.elastic_search_client import OrgPatentsSearchClient + + +@pytest.mark.anyio +async def test_top_authors_by_institution_aggregates_matched_authors(): + requests: list[httpx.Request] = [] + + def handler(request: httpx.Request) -> httpx.Response: + requests.append(request) + return httpx.Response( + 200, + json={ + "aggregations": { + "matched_authors_nested": { + "authors": { + "buckets": [ + { + "key": "A1", + "patents": {"doc_count": 5}, + "names": { + "buckets": [ + {"key": "Ada Example", "doc_count": 5} + ] + }, + } + ] + } + } + } + }, + ) + + client = OrgPatentsSearchClient( + base_url="https://example.test", + api_key="key", + transport=httpx.MockTransport(handler), + ) + + result = await client.top_authors_by_institution( + "https://openalex.org/I123", + size=10, + ) + + assert result == [{"id": "A1", "name": "Ada Example", "count": 5}] + payload = json.loads(requests[0].content) + assert payload["query"] == {"term": {"institution_id": "I123"}} + assert ( + payload["aggs"]["matched_authors_nested"]["nested"]["path"] + == "matched_authors" + ) diff --git a/service/src/main/inse/patents/org/test_logic.py b/service/src/main/inse/patents/org/test_logic.py index ca01887e..bb0313ef 100644 --- a/service/src/main/inse/patents/org/test_logic.py +++ b/service/src/main/inse/patents/org/test_logic.py @@ -1,5 +1,9 @@ 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.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 diff --git a/service/src/main/inse/patents/patents_openalex_keywords/__init__.py b/service/src/main/inse/patents/patents_openalex_keywords/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/service/src/main/inse/patents/patents_openalex_keywords/client.py b/service/src/main/inse/patents/patents_openalex_keywords/client.py new file mode 100644 index 00000000..d60c9b42 --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/client.py @@ -0,0 +1,216 @@ +"""HTTP client for the patents_openalex_keywords Elasticsearch index.""" +from __future__ import annotations + +import json +import logging +from typing import Any + +import httpx + +from inse import config +from inse.patents.common.elastic_search_client import MissingApiKeyError +from inse.patents.patents_openalex_keywords.mapping import ( + PATENTS_OPENALEX_KEYWORDS_INDEX, + PATENTS_OPENALEX_KEYWORDS_MAPPING, +) + +logger = logging.getLogger(__name__) + +_LEVEL_LOOKUP_ORDER = ("subgroup", "group", "subclass", "class", "section") + + +def candidate_doc_ids(symbol: str) -> list[str]: + """Builds the ordered (most to least specific) doc ids to try for a symbol.""" + from inse.patents.patents_openalex_keywords.ipc_entries import infer_subclass + + normalized = symbol.strip().upper().replace(" ", "") + candidates: list[tuple[str, str]] = [(level, normalized) for level in _LEVEL_LOOKUP_ORDER] + subclass = infer_subclass(normalized) + if subclass: + candidates.append(("subclass", subclass)) + if len(normalized) >= 3: + candidates.append(("class", normalized[:3])) + if normalized: + candidates.append(("section", normalized[:1])) + + seen: set[tuple[str, str]] = set() + ordered_ids: list[str] = [] + for level, candidate in candidates: + key = (level, candidate) + if key in seen: + continue + seen.add(key) + ordered_ids.append(f"{level}:{candidate}") + return ordered_ids + + +class PatentsOpenAlexKeywordsClient: + def __init__( + self, + base_url: str | None = None, + api_key: str | None = None, + timeout: float = 10.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"/{PATENTS_OPENALEX_KEYWORDS_INDEX}", + headers=self._headers(), + ) + if response.status_code == 404: + create_response = await client.put( + f"/{PATENTS_OPENALEX_KEYWORDS_INDEX}", + headers=self._headers(), + json={"mappings": PATENTS_OPENALEX_KEYWORDS_MAPPING}, + ) + create_response.raise_for_status() + logger.info("Created index %s", PATENTS_OPENALEX_KEYWORDS_INDEX) + return + + response.raise_for_status() + mapping_response = await client.put( + f"/{PATENTS_OPENALEX_KEYWORDS_INDEX}/_mapping", + headers=self._headers(), + json=PATENTS_OPENALEX_KEYWORDS_MAPPING, + ) + mapping_response.raise_for_status() + + async def index_exists(self) -> bool: + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.head( + f"/{PATENTS_OPENALEX_KEYWORDS_INDEX}", + headers=self._headers(), + ) + if response.status_code == 404: + return False + response.raise_for_status() + return True + + 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": PATENTS_OPENALEX_KEYWORDS_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( + f"Bulk indexing into {PATENTS_OPENALEX_KEYWORDS_INDEX} failed." + ) + + async def lookup(self, level: str, symbol: str) -> dict[str, Any] | None: + normalized = symbol.strip().upper().replace(" ", "") + doc_id = f"{level}:{normalized}" + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + # Doc ids like "subgroup:C07K11/02" contain a "/", which breaks + # GET .../_doc/{id} through the gateway in front of this cluster + # (it mangles the path before ES sees it). A _search with an ids + # query sends the id in the request body instead, sidestepping + # the issue. + response = await client.post( + f"/{PATENTS_OPENALEX_KEYWORDS_INDEX}/_search", + headers=self._headers(), + json={"size": 1, "query": {"ids": {"values": [doc_id]}}}, + ) + if response.status_code == 404: + return None + response.raise_for_status() + hits = response.json().get("hits", {}).get("hits", []) + return hits[0].get("_source") if hits else None + + async def lookup_ids(self, doc_ids: list[str]) -> dict[str, dict[str, Any]]: + """Resolves multiple doc ids in a single _search request (id -> _source).""" + unique_ids = list(dict.fromkeys(doc_ids)) + if not unique_ids: + return {} + + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.post( + f"/{PATENTS_OPENALEX_KEYWORDS_INDEX}/_search", + headers=self._headers(), + json={"size": len(unique_ids), "query": {"ids": {"values": unique_ids}}}, + ) + if response.status_code == 404: + return {} + response.raise_for_status() + hits = response.json().get("hits", {}).get("hits", []) + return {hit["_id"]: hit.get("_source", {}) for hit in hits} + + async def lookup_symbol(self, symbol: str) -> dict[str, Any] | None: + ordered_ids = candidate_doc_ids(symbol) + if not ordered_ids: + return None + + # One _search covering every candidate level instead of up to 5 + # sequential requests per symbol — this matters a lot when enriching + # many patents at once (see get_all_patents), where a sequential + # per-symbol lookup chain added multiple seconds of latency. + docs_by_id = await self.lookup_ids(ordered_ids) + for doc_id in ordered_ids: + if doc_id in docs_by_id: + return docs_by_id[doc_id] + return None diff --git a/service/src/main/inse/patents/patents_openalex_keywords/ipc_entries.py b/service/src/main/inse/patents/patents_openalex_keywords/ipc_entries.py new file mode 100644 index 00000000..b89ad79e --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/ipc_entries.py @@ -0,0 +1,207 @@ +"""Fetch unique IPC/CPC hierarchy symbols and labels from the ipc Elasticsearch index.""" +from __future__ import annotations + +import re +from collections import defaultdict + +from inse.integrations import elasticsearch +from inse.model import ESCluster +from inse.patents.ipc_search_client import IPC_INDEX + +LEVEL_FIELDS: tuple[tuple[str, str, str], ...] = ( + ("section", "cpc_section_number", "cpc_section_name"), + ("class", "cpc_class_number", "cpc_class_name"), + ("group", "cpc_group_number", "cpc_group_name"), + ("subgroup", "cpc_subgroup_number", "cpc_subgroup_name"), +) +DEFAULT_BUILD_LEVELS = ("section", "class", "subclass", "group", "subgroup") + + +def normalize_symbol(symbol: str | None) -> str: + if not symbol: + return "" + return symbol.strip().upper().replace(" ", "") + + +def infer_subclass(symbol: str | None) -> str | None: + if not symbol: + return None + cleaned = normalize_symbol(symbol) + match = re.match(r"^([A-HY]\d{2}[A-Z])", cleaned) + return match.group(1) if match else None + + +def infer_class(symbol: str | None) -> str | None: + if not symbol: + return None + cleaned = normalize_symbol(symbol) + match = re.match(r"^([A-HY]\d{2})", cleaned) + return match.group(1) if match else None + + +def build_class_entries_from_subclasses( + subclass_entries: dict[str, str], + max_labels_per_class: int = 8, +) -> dict[str, str]: + labels_by_class: dict[str, list[str]] = defaultdict(list) + seen_labels_by_class: dict[str, set[str]] = defaultdict(set) + + for subclass_symbol, subclass_label in sorted(subclass_entries.items()): + class_symbol = infer_class(subclass_symbol) + if not class_symbol: + continue + + label = " ".join(subclass_label.split()) + label_key = label.casefold() + if label_key in seen_labels_by_class[class_symbol]: + continue + + seen_labels_by_class[class_symbol].add(label_key) + labels_by_class[class_symbol].append(f"{subclass_symbol}: {label}") + + class_entries: dict[str, str] = {} + for class_symbol, labels in labels_by_class.items(): + selected_labels = labels[:max_labels_per_class] + class_entries[class_symbol] = ( + f"IPC/CPC class {class_symbol}. Related subclasses: " + "; ".join(selected_labels) + ) + return class_entries + + +async def fetch_unique_ipc_entries( + levels: tuple[str, ...] = DEFAULT_BUILD_LEVELS, +) -> dict[str, dict[str, str]]: + entries: dict[str, dict[str, str]] = defaultdict(dict) + + async def _composite_with_label( + level: str, + number_field: str, + name_field: str, + page_size: int, + ) -> bool: + for field_name in (number_field, f"{number_field}.keyword"): + after_key: dict[str, str] | None = None + found_any = False + while True: + payload: dict[str, object] = { + "size": 0, + "aggs": { + "items": { + "composite": { + "size": page_size, + "sources": [ + {"symbol": {"terms": {"field": field_name}}}, + ], + }, + "aggs": { + "sample": { + "top_hits": {"size": 1, "_source": [name_field]}, + } + }, + } + }, + } + if after_key: + payload["aggs"]["items"]["composite"]["after"] = after_key + try: + data = await elasticsearch.search( + index=IPC_INDEX, + body=payload, + cluster=ESCluster.INSE, + ) + except Exception: + found_any = False + break + items = data.get("aggregations", {}).get("items", {}) + buckets = items.get("buckets", []) + if not buckets: + break + found_any = True + for bucket in buckets: + key = bucket.get("key", {}) + symbol = key.get("symbol") + hits = bucket.get("sample", {}).get("hits", {}).get("hits", []) + if not symbol or not hits: + continue + name = hits[0].get("_source", {}).get(name_field) + if not name: + continue + normalized = normalize_symbol(str(symbol)) + if level == "subclass": + if len(normalized) <= 3: + continue + normalized = infer_subclass(str(symbol)) or normalized + entries[level][normalized] = str(name).strip() + after_key = items.get("after_key") + if not after_key: + break + if found_any: + return True + return False + + async def _terms_with_label( + level: str, + number_field: str, + name_field: str, + size: int, + ) -> None: + for field_name in (number_field, f"{number_field}.keyword"): + payload = { + "size": 0, + "aggs": { + "items": { + "terms": {"field": field_name, "size": size}, + "aggs": { + "sample": { + "top_hits": {"size": 1, "_source": [name_field]}, + } + }, + } + }, + } + try: + data = await elasticsearch.search( + index=IPC_INDEX, + body=payload, + cluster=ESCluster.INSE, + ) + except Exception: + continue + buckets = data.get("aggregations", {}).get("items", {}).get("buckets", []) + if buckets: + break + else: + return + for bucket in buckets: + symbol = bucket.get("key") + hits = bucket.get("sample", {}).get("hits", {}).get("hits", []) + if not symbol or not hits: + continue + name = hits[0].get("_source", {}).get(name_field) + if not name: + continue + normalized = normalize_symbol(str(symbol)) + if level == "class" and len(normalized) != 3: + continue + if level == "subclass": + if len(normalized) <= 3: + continue + normalized = infer_subclass(str(symbol)) or normalized + entries[level][normalized] = str(name).strip() + + if "section" in levels: + await _terms_with_label("section", "cpc_section_number", "cpc_section_name", 30) + if "subclass" in levels or "class" in levels: + await _terms_with_label("subclass", "cpc_class_number", "cpc_class_name", 10000) + if "group" in levels: + if not await _composite_with_label("group", "cpc_group_number", "cpc_group_name", 1000): + await _terms_with_label("group", "cpc_group_number", "cpc_group_name", 20000) + if "subgroup" in levels: + if not await _composite_with_label("subgroup", "cpc_subgroup_number", "cpc_subgroup_name", 1000): + await _terms_with_label("subgroup", "cpc_subgroup_number", "cpc_subgroup_name", 20000) + if "class" in levels: + subclass_entries = entries.get("subclass", {}) + entries["class"].update(build_class_entries_from_subclasses(subclass_entries)) + if "subclass" not in levels: + entries.pop("subclass", None) + return entries diff --git a/service/src/main/inse/patents/patents_openalex_keywords/mapping.py b/service/src/main/inse/patents/patents_openalex_keywords/mapping.py new file mode 100644 index 00000000..8464dd30 --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/mapping.py @@ -0,0 +1,34 @@ +PATENTS_OPENALEX_KEYWORDS_INDEX = "patents_openalex_keywords" + +PATENTS_OPENALEX_KEYWORDS_MAPPING = { + "properties": { + "ipc_level": {"type": "keyword"}, + "ipc_symbol": {"type": "keyword"}, + "ipc_label": {"type": "text", "fields": {"keyword": {"type": "keyword"}}}, + "topic_matches": { + "type": "nested", + "properties": { + "rank": {"type": "integer"}, + "topic_id": {"type": "keyword"}, + "topic_display_name": {"type": "keyword"}, + "subfield": {"type": "keyword"}, + "field": {"type": "keyword"}, + "domain": {"type": "keyword"}, + "match_score": {"type": "float"}, + }, + }, + "keyword_matches": { + "type": "nested", + "properties": { + "rank": {"type": "integer"}, + "keyword": {"type": "keyword"}, + "topic_id": {"type": "keyword"}, + "topic_display_name": {"type": "keyword"}, + "match_score": {"type": "float"}, + }, + }, + "match_method": {"type": "keyword"}, + "model_name": {"type": "keyword"}, + "built_at": {"type": "date"}, + } +} diff --git a/service/src/main/inse/patents/patents_openalex_keywords/matching.py b/service/src/main/inse/patents/patents_openalex_keywords/matching.py new file mode 100644 index 00000000..2467d4d6 --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/matching.py @@ -0,0 +1,409 @@ +"""SentenceTransformer-based IPC/CPC → OpenAlex topic/keyword matching.""" +from __future__ import annotations + +import json +import logging +from dataclasses import dataclass +from datetime import datetime, timezone +from pathlib import Path +from typing import Any + +import numpy as np +from sentence_transformers import SentenceTransformer + +from inse.config import settings +from inse.integrations import elasticsearch +from inse.model import ESCluster +from inse.util import get_model + +logger = logging.getLogger(__name__) + +TOPIC_CACHE_FILENAME = "topic_hierarchy_cache.json" +MATCH_METHOD = "sentence_transformer" +TOPIC_VECTORS_INDEX = "topicvectors" + + +@dataclass(frozen=True) +class TopicCandidate: + topic_id: str + display_name: str + subfield: str | None = None + field: str | None = None + domain: str | None = None + + +@dataclass(frozen=True) +class KeywordCandidate: + keyword: str + topic_id: str + topic_display_name: str | None = None + + +def _data_dir() -> Path: + return Path(__file__).resolve().parents[4] / "data" + + +def load_topic_cache(cache_path: Path | None = None) -> list[TopicCandidate]: + path = cache_path or (_data_dir() / TOPIC_CACHE_FILENAME) + with path.open(encoding="utf-8") as handle: + raw = json.load(handle) + topics: list[TopicCandidate] = [] + for display_name, info in raw.items(): + topic_id = info.get("topic_id") + if not topic_id: + continue + topics.append( + TopicCandidate( + topic_id=str(topic_id), + display_name=display_name, + subfield=info.get("subfield"), + field=info.get("field"), + domain=info.get("domain"), + ) + ) + return topics + + +def topic_embedding_text(topic: TopicCandidate) -> str: + parts = [topic.display_name] + for label in (topic.subfield, topic.field, topic.domain): + if label: + parts.append(label) + return ". ".join(parts) + + +async def fetch_keyword_candidates() -> list[KeywordCandidate]: + candidates: list[KeywordCandidate] = [] + seen: set[tuple[str, str]] = set() + async for hit in elasticsearch.scan( + index="openalex-topics", + query={"match_all": {}}, + source=["id", "display_name", "keywords"], + cluster=ESCluster.NES, + ): + source = hit.get("_source", {}) + topic_id = source.get("id") + topic_name = source.get("display_name") + if not topic_id: + continue + keywords = source.get("keywords") or [] + if not isinstance(keywords, list): + keywords = [keywords] if keywords else [] + for keyword in keywords: + if not keyword or not str(keyword).strip(): + continue + key = (str(topic_id), str(keyword).strip().casefold()) + if key in seen: + continue + seen.add(key) + candidates.append( + KeywordCandidate( + keyword=str(keyword).strip(), + topic_id=str(topic_id), + topic_display_name=topic_name, + ) + ) + return candidates + + +def _normalize_rows(vectors: np.ndarray) -> np.ndarray: + norms = np.linalg.norm(vectors, axis=1, keepdims=True) + norms = np.where(norms == 0, 1.0, norms) + return vectors / norms + + +def top_k_indices(query_vector: np.ndarray, corpus_matrix: np.ndarray, k: int) -> list[tuple[int, float]]: + if corpus_matrix.size == 0: + return [] + scores = corpus_matrix @ query_vector + limit = min(k, len(scores)) + if limit <= 0: + return [] + top_idx = np.argpartition(-scores, limit - 1)[:limit] + top_idx = top_idx[np.argsort(-scores[top_idx])] + return [(int(idx), float(scores[idx])) for idx in top_idx] + + +class EmbeddingMatcher: + def __init__( + self, + model: SentenceTransformer | None = None, + min_score: float = 0.5, + batch_size: int = 64, + ): + self.model = model or get_model() + self.min_score = min_score + self.batch_size = batch_size + self.model_name = settings.sentence_transformers_model_name + self._topic_candidates: list[TopicCandidate] = [] + self._keyword_candidates: list[KeywordCandidate] = [] + self._topic_matrix: np.ndarray | None = None + self._keyword_matrix: np.ndarray | None = None + + def prepare_topics(self, topics: list[TopicCandidate]) -> None: + self._topic_candidates = topics + texts = [topic_embedding_text(topic) for topic in topics] + vectors = self.model.encode( + texts, + batch_size=self.batch_size, + show_progress_bar=True, + convert_to_numpy=True, + ) + self._topic_matrix = _normalize_rows(np.asarray(vectors, dtype=np.float32)) + + def prepare_keywords(self, keywords: list[KeywordCandidate]) -> None: + self._keyword_candidates = keywords + if not keywords: + self._keyword_matrix = np.empty((0, 0), dtype=np.float32) + return + texts = [item.keyword for item in keywords] + vectors = self.model.encode( + texts, + batch_size=self.batch_size, + show_progress_bar=True, + convert_to_numpy=True, + ) + self._keyword_matrix = _normalize_rows(np.asarray(vectors, dtype=np.float32)) + + def match_ipc_label( + self, + ipc_label: str, + top_k: int, + ) -> tuple[list[dict], list[dict]]: + query_vector = self.model.encode( + ipc_label, + convert_to_numpy=True, + ) + query_vector = query_vector / max(float(np.linalg.norm(query_vector)), 1e-9) + + topic_matches: list[dict] = [] + if self._topic_matrix is not None and len(self._topic_candidates): + for rank, (idx, score) in enumerate( + top_k_indices(query_vector, self._topic_matrix, top_k), + start=1, + ): + if score < self.min_score: + continue + topic = self._topic_candidates[idx] + topic_matches.append( + { + "rank": rank, + "topic_id": topic.topic_id, + "topic_display_name": topic.display_name, + "subfield": topic.subfield, + "field": topic.field, + "domain": topic.domain, + "match_score": round(score, 4), + } + ) + + keyword_matches: list[dict] = [] + if self._keyword_matrix is not None and len(self._keyword_candidates): + for rank, (idx, score) in enumerate( + top_k_indices(query_vector, self._keyword_matrix, top_k), + start=1, + ): + if score < self.min_score: + continue + keyword = self._keyword_candidates[idx] + keyword_matches.append( + { + "rank": rank, + "keyword": keyword.keyword, + "topic_id": keyword.topic_id, + "topic_display_name": keyword.topic_display_name, + "match_score": round(score, 4), + } + ) + + return topic_matches, keyword_matches + + +def build_documents( + ipc_entries: dict[str, dict[str, str]], + matcher: EmbeddingMatcher, + levels: tuple[str, ...], + top_k: int, +) -> list[tuple[str, dict]]: + built_at = datetime.now(timezone.utc).isoformat() + documents: list[tuple[str, dict]] = [] + label_cache: dict[str, tuple[list[dict], list[dict]]] = {} + + for level in levels: + for symbol, label in ipc_entries.get(level, {}).items(): + cache_key = label.casefold() + if cache_key not in label_cache: + label_cache[cache_key] = matcher.match_ipc_label(label, top_k=top_k) + topic_matches, keyword_matches = label_cache[cache_key] + if not topic_matches and not keyword_matches: + continue + doc_id = f"{level}:{symbol}" + documents.append( + ( + doc_id, + { + "ipc_level": level, + "ipc_symbol": symbol, + "ipc_label": label, + "topic_matches": topic_matches, + "keyword_matches": keyword_matches, + "match_method": MATCH_METHOD, + "model_name": matcher.model_name, + "built_at": built_at, + }, + ) + ) + return documents + + +def documents_to_json_mapping(documents: list[tuple[str, dict]]) -> dict[str, dict[str, dict]]: + mapping: dict[str, dict[str, dict]] = { + "section": {}, + "class": {}, + "subclass": {}, + "group": {}, + "subgroup": {}, + } + for _doc_id, source in documents: + level = source["ipc_level"] + symbol = source["ipc_symbol"] + mapping.setdefault(level, {})[symbol] = source + return mapping + + +class TopicVectorsMatcher: + + def __init__( + self, + model: SentenceTransformer | None = None, + min_score: float = 0.5, + num_candidates: int = 200, + ): + self.model = model or get_model() + self.min_score = min_score + self.num_candidates = num_candidates + self.model_name = settings.sentence_transformers_model_name + + async def _search_topic_vectors( + self, + *, + vector: list[float], + top_k: int, + ) -> list[dict[str, Any]]: + payload = { + "size": max(top_k * 4, top_k), + "_source": ["id", "display_name", "subfield", "field", "domain", "keywords"], + "knn": { + "field": "display_name_vector", + "query_vector": vector, + "k": max(top_k * 4, top_k), + "num_candidates": max(self.num_candidates, top_k * 8), + }, + } + data = await elasticsearch.search( + index=TOPIC_VECTORS_INDEX, + body=payload, + cluster=ESCluster.NES, + ) + return data.get("hits", {}).get("hits", []) or [] + + async def match_ipc_label( + self, + ipc_label: str, + top_k: int, + ) -> tuple[list[dict], list[dict]]: + vector = self.model.encode(ipc_label, convert_to_numpy=True) + query_vector = _normalize_rows(np.asarray([vector], dtype=np.float32))[0].tolist() + hits = await self._search_topic_vectors(vector=query_vector, top_k=top_k) + + topic_matches: list[dict] = [] + keyword_matches: list[dict] = [] + seen_topics: set[str] = set() + seen_keywords: set[tuple[str, str]] = set() + + for hit in hits: + source = hit.get("_source", {}) + topic_id = str(source.get("id") or "") + topic_name = str(source.get("display_name") or "") + if not topic_id or not topic_name or topic_id in seen_topics: + continue + score = float(hit.get("_score") or 0.0) + if score < self.min_score: + continue + + seen_topics.add(topic_id) + topic_matches.append( + { + "rank": len(topic_matches) + 1, + "topic_id": topic_id, + "topic_display_name": topic_name, + "subfield": source.get("subfield"), + "field": source.get("field"), + "domain": source.get("domain"), + "match_score": round(score, 4), + } + ) + + keywords = source.get("keywords") or [] + if not isinstance(keywords, list): + keywords = [keywords] if keywords else [] + for keyword in keywords: + normalized_keyword = str(keyword).strip() + if not normalized_keyword: + continue + key = (topic_id, normalized_keyword.casefold()) + if key in seen_keywords: + continue + seen_keywords.add(key) + keyword_matches.append( + { + "rank": len(keyword_matches) + 1, + "keyword": normalized_keyword, + "topic_id": topic_id, + "topic_display_name": topic_name, + "match_score": round(score, 4), + } + ) + break + + if len(topic_matches) >= top_k and len(keyword_matches) >= top_k: + break + + return topic_matches[:top_k], keyword_matches[:top_k] + + +async def build_documents_from_topicvectors( + ipc_entries: dict[str, dict[str, str]], + matcher: TopicVectorsMatcher, + levels: tuple[str, ...], + top_k: int, +) -> list[tuple[str, dict]]: + built_at = datetime.now(timezone.utc).isoformat() + documents: list[tuple[str, dict]] = [] + label_cache: dict[str, tuple[list[dict], list[dict]]] = {} + + for level in levels: + for symbol, label in ipc_entries.get(level, {}).items(): + cache_key = label.casefold() + if cache_key not in label_cache: + label_cache[cache_key] = await matcher.match_ipc_label(label, top_k=top_k) + topic_matches, keyword_matches = label_cache[cache_key] + if not topic_matches and not keyword_matches: + continue + doc_id = f"{level}:{symbol}" + documents.append( + ( + doc_id, + { + "ipc_level": level, + "ipc_symbol": symbol, + "ipc_label": label, + "topic_matches": topic_matches, + "keyword_matches": keyword_matches, + "match_method": "topicvectors_knn", + "model_name": matcher.model_name, + "built_at": built_at, + }, + ) + ) + return documents diff --git a/service/src/main/inse/patents/patents_openalex_keywords/resolver.py b/service/src/main/inse/patents/patents_openalex_keywords/resolver.py new file mode 100644 index 00000000..bb33970b --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/resolver.py @@ -0,0 +1,284 @@ +"""Runtime resolver for IPC/CPC → OpenAlex matches from patents_openalex_keywords.""" +from __future__ import annotations + +import json +import logging +import os +from functools import lru_cache + +from inse.patents.authors.ipc_openalex_mapping import ( + MappedOpenAlexTopic, + _enrich_mapped_topic, + load_ipc_openalex_mapping, + normalize_openalex_id, + resolve_mapped_topics_for_code, +) +from inse.patents.common import model +from inse.patents.ipc_lookup import extract_ipc_symbol, parse_ipc_symbol +from inse.patents.patents_openalex_keywords.client import PatentsOpenAlexKeywordsClient +from inse.patents.patents_openalex_keywords.ipc_entries import infer_subclass, normalize_symbol + +logger = logging.getLogger(__name__) + +KEYWORDS_MAPPING_FILENAME = "patents_openalex_keywords_mapping.json" +_LEVEL_ORDER = {"subgroup": 5, "group": 4, "subclass": 3, "class": 2, "section": 1} + + +def _data_dir() -> str: + for base in ( + "/data", + os.path.normpath( + os.path.join( + os.path.dirname(__file__), + "..", + "..", + "..", + "..", + "data", + ) + ), + ): + if os.path.isdir(base): + return base + return os.path.normpath( + os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "data") + ) + + +@lru_cache(maxsize=1) +def load_patents_openalex_keywords_json() -> dict[str, dict[str, dict]]: + path = os.path.join(_data_dir(), KEYWORDS_MAPPING_FILENAME) + try: + with open(path, encoding="utf-8") as handle: + raw = json.load(handle) + except (OSError, json.JSONDecodeError): + return {} + if not isinstance(raw, dict): + return {} + return { + level: { + normalize_symbol(symbol): entry + for symbol, entry in (entries or {}).items() + if isinstance(entry, dict) + } + for level, entries in raw.items() + if isinstance(entries, dict) + } + + +def clear_resolver_caches() -> None: + load_patents_openalex_keywords_json.cache_clear() + + +def mapped_topics_from_index_doc(doc: dict) -> list[MappedOpenAlexTopic]: + seen: set[str] = set() + mapped: list[MappedOpenAlexTopic] = [] + ipc_level = doc.get("ipc_level") + ipc_symbol = doc.get("ipc_symbol") + + for match in doc.get("topic_matches") or []: + topic_id = match.get("topic_id") + if not topic_id: + continue + key = normalize_openalex_id(str(topic_id)) or str(topic_id) + if key in seen: + continue + seen.add(key) + mapped.append( + _enrich_mapped_topic( + MappedOpenAlexTopic( + topic_id=str(topic_id), + topic_display_name=match.get("topic_display_name"), + subfield_name=match.get("subfield"), + field_name=match.get("field"), + domain_name=match.get("domain"), + ipc_level=ipc_level, + ipc_symbol=ipc_symbol, + ) + ) + ) + + for match in doc.get("keyword_matches") or []: + topic_id = match.get("topic_id") + if not topic_id: + continue + key = normalize_openalex_id(str(topic_id)) or str(topic_id) + if key in seen: + continue + seen.add(key) + mapped.append( + _enrich_mapped_topic( + MappedOpenAlexTopic( + topic_id=str(topic_id), + topic_display_name=match.get("topic_display_name"), + ipc_level=ipc_level, + ipc_symbol=ipc_symbol, + ) + ) + ) + + return mapped + + +def _json_lookup_symbol( + symbol: str, + table: dict[str, dict[str, dict]], +) -> dict | None: + normalized = normalize_symbol(symbol) + best_doc: dict | None = None + best_rank = -1 + + subclass = infer_subclass(normalized) + candidates: list[tuple[str, str]] = [ + ("subgroup", normalized), + ("group", normalized), + ] + if subclass: + candidates.append(("subclass", subclass)) + if len(normalized) >= 3: + candidates.append(("class", normalized[:3])) + if normalized: + candidates.append(("section", normalized[:1])) + + for level, candidate in candidates: + doc = table.get(level, {}).get(candidate) + if not doc: + continue + rank = _LEVEL_ORDER.get(level, 0) + if rank > best_rank: + best_rank = rank + best_doc = doc + + if best_doc is not None: + return best_doc + + for entries in table.values(): + if normalized in entries: + return entries[normalized] + return None + + +def _lookup_candidates(raw_code: str) -> list[str]: + symbol = extract_ipc_symbol(raw_code) + if not symbol: + return [] + + candidates: list[str] = [] + normalized = normalize_symbol(symbol) + if normalized: + candidates.append(normalized) + + keys = parse_ipc_symbol(symbol) or parse_ipc_symbol(normalized) + if keys is not None: + for value in ( + keys.subgroup or keys.normalized, + keys.main_group, + keys.subclass, + keys.ipc_class, + keys.section, + ): + if value: + candidates.append(normalize_symbol(value)) + + subclass = infer_subclass(normalized) + if subclass: + candidates.append(subclass) + + seen: set[str] = set() + ordered: list[str] = [] + for candidate in candidates: + if candidate and candidate not in seen: + seen.add(candidate) + ordered.append(candidate) + return ordered + + +class PatentOpenAlexMappingResolver: + """Resolve patent IPC/CPC codes via patents_openalex_keywords (ES → JSON → legacy).""" + + def __init__( + self, + client: PatentsOpenAlexKeywordsClient | None = None, + *, + use_elasticsearch: bool = True, + ): + self.client = client or PatentsOpenAlexKeywordsClient() + self.use_elasticsearch = use_elasticsearch + self._doc_cache: dict[str, dict | None] = {} + self._legacy_mapping = load_ipc_openalex_mapping() + self._elasticsearch_checked = False + self._elasticsearch_enabled = False + + async def resolve_topics_for_patents( + self, + patents: list[model.PatentEntry], + ) -> dict[str, list[MappedOpenAlexTopic]]: + from inse.patents.common.parsing import patent_map_key + + result: dict[str, list[MappedOpenAlexTopic]] = {} + for patent in patents: + result[patent_map_key(patent)] = await self.resolve_mapped_topics_for_patent( + patent + ) + return result + + async def _elasticsearch_enabled_for_request(self) -> bool: + if not self.use_elasticsearch: + return False + if self._elasticsearch_checked: + return self._elasticsearch_enabled + self._elasticsearch_checked = True + try: + self._elasticsearch_enabled = await self.client.index_exists() + except Exception as exc: + logger.warning("patents_openalex_keywords index check failed: %s", exc) + self._elasticsearch_enabled = False + return self._elasticsearch_enabled + + async def resolve_mapped_topics_for_patent( + self, + patent: model.PatentEntry, + ) -> list[MappedOpenAlexTopic]: + seen: set[str] = set() + resolved: list[MappedOpenAlexTopic] = [] + for raw_code in (*patent.ipc, *patent.cpc): + for mapped in await self.resolve_mapped_topics_for_code(raw_code): + topic_key = normalize_openalex_id(mapped.topic_id) or mapped.topic_id + if topic_key in seen: + continue + seen.add(topic_key) + resolved.append(mapped) + return resolved + + async def resolve_mapped_topics_for_code(self, raw_code: str) -> list[MappedOpenAlexTopic]: + for candidate in _lookup_candidates(raw_code): + doc = await self._lookup_document(candidate) + if doc is not None: + mapped = mapped_topics_from_index_doc(doc) + if mapped: + return mapped + + return resolve_mapped_topics_for_code(raw_code, self._legacy_mapping) + + async def _lookup_document(self, symbol: str) -> dict | None: + normalized = normalize_symbol(symbol) + if normalized in self._doc_cache: + return self._doc_cache[normalized] + + doc: dict | None = None + if await self._elasticsearch_enabled_for_request(): + try: + doc = await self.client.lookup_symbol(normalized) + except Exception as exc: + logger.warning( + "patents_openalex_keywords ES lookup failed for %s: %s", + normalized, + exc, + ) + self._elasticsearch_enabled = False + + if doc is None: + doc = _json_lookup_symbol(normalized, load_patents_openalex_keywords_json()) + + self._doc_cache[normalized] = doc + return doc diff --git a/service/src/main/inse/patents/patents_openalex_keywords/test_client.py b/service/src/main/inse/patents/patents_openalex_keywords/test_client.py new file mode 100644 index 00000000..ec74f4c2 --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/test_client.py @@ -0,0 +1,118 @@ +import json + +import httpx +import pytest + +from inse.patents.patents_openalex_keywords.client import PatentsOpenAlexKeywordsClient +from inse.patents.patents_openalex_keywords.mapping import PATENTS_OPENALEX_KEYWORDS_INDEX + + +@pytest.fixture +def anyio_backend(): + return "asyncio" + + +@pytest.mark.anyio +async def test_lookup_uses_search_with_ids_query_not_doc_get(): + """Doc ids like "subgroup:C07K11/02" contain a "/", which breaks a GET to + .../_doc/{id} through the gateway in front of this cluster. lookup() must + use _search with an ids query (id goes in the body, not the URL) instead. + """ + captured: list[httpx.Request] = [] + + def handler(request: httpx.Request) -> httpx.Response: + captured.append(request) + return httpx.Response( + 200, + json={ + "hits": { + "hits": [ + {"_id": "subgroup:C07K11/02", "_source": {"ipc_label": "cyclic"}} + ] + } + }, + ) + + client = PatentsOpenAlexKeywordsClient( + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + doc = await client.lookup("subgroup", "C07K 11/02") + + assert len(captured) == 1 + request = captured[0] + assert request.method == "POST" + assert request.url.path.endswith(f"/{PATENTS_OPENALEX_KEYWORDS_INDEX}/_search") + body = json.loads(request.content) + assert body["query"] == {"ids": {"values": ["subgroup:C07K11/02"]}} + assert doc == {"ipc_label": "cyclic"} + + +@pytest.mark.anyio +async def test_lookup_returns_none_when_no_hits(): + def handler(request: httpx.Request) -> httpx.Response: + return httpx.Response(200, json={"hits": {"hits": []}}) + + client = PatentsOpenAlexKeywordsClient( + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + doc = await client.lookup("subgroup", "Z99Z99/99") + + assert doc is None + + +@pytest.mark.anyio +async def test_lookup_symbol_resolves_via_a_single_batched_request(): + """lookup_symbol must send exactly one _search covering every candidate + level (subgroup/group/subclass/class/section), not one request per level + — sequential per-level requests previously added multiple seconds of + latency when enriching many patents at once.""" + captured: list[httpx.Request] = [] + + def handler(request: httpx.Request) -> httpx.Response: + captured.append(request) + body = json.loads(request.content) + values = body["query"]["ids"]["values"] + if "group:C07K11/02" in values: + return httpx.Response( + 200, + json={ + "hits": { + "hits": [ + {"_id": "group:C07K11/02", "_source": {"ipc_label": "match"}} + ] + } + }, + ) + return httpx.Response(200, json={"hits": {"hits": []}}) + + client = PatentsOpenAlexKeywordsClient( + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + doc = await client.lookup_symbol("C07K 11/02") + + assert len(captured) == 1 + assert doc == {"ipc_label": "match"} + + +@pytest.mark.anyio +async def test_lookup_symbol_prefers_more_specific_level_when_multiple_match(): + def handler(request: httpx.Request) -> httpx.Response: + body = json.loads(request.content) + values = body["query"]["ids"]["values"] + hits = [] + if "subgroup:C07K11/02" in values: + hits.append({"_id": "subgroup:C07K11/02", "_source": {"ipc_label": "subgroup-match"}}) + if "class:C07" in values: + hits.append({"_id": "class:C07", "_source": {"ipc_label": "class-match"}}) + return httpx.Response(200, json={"hits": {"hits": hits}}) + + client = PatentsOpenAlexKeywordsClient( + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + doc = await client.lookup_symbol("C07K 11/02") + + assert doc == {"ipc_label": "subgroup-match"} diff --git a/service/src/main/inse/patents/patents_openalex_keywords/test_matching.py b/service/src/main/inse/patents/patents_openalex_keywords/test_matching.py new file mode 100644 index 00000000..66417433 --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/test_matching.py @@ -0,0 +1,88 @@ +"""Tests for patents_openalex_keywords embedding matcher.""" +from __future__ import annotations + +import numpy as np +import pytest + +from inse.patents.patents_openalex_keywords.matching import ( + EmbeddingMatcher, + TopicCandidate, + top_k_indices, + topic_embedding_text, +) + + +def test_topic_embedding_text_joins_hierarchy() -> None: + topic = TopicCandidate( + topic_id="T1", + display_name="Cancer Immunotherapy", + subfield="Oncology", + field="Medicine", + domain="Health", + ) + assert topic_embedding_text(topic) == "Cancer Immunotherapy. Oncology. Medicine. Health" + + +def test_top_k_indices_returns_highest_scores() -> None: + corpus = np.array( + [ + [1.0, 0.0, 0.0], + [0.0, 1.0, 0.0], + [0.9, 0.1, 0.0], + ], + dtype=np.float32, + ) + corpus = corpus / np.linalg.norm(corpus, axis=1, keepdims=True) + query = np.array([1.0, 0.0, 0.0], dtype=np.float32) + + matches = top_k_indices(query, corpus, k=2) + assert len(matches) == 2 + assert matches[0][0] in {0, 2} + assert matches[0][1] >= matches[1][1] + + +class _FakeModel: + def encode(self, sentences, **kwargs): + del kwargs + if isinstance(sentences, str): + sentences = [sentences] + vectors = [] + for text in sentences: + lowered = text.casefold() + if "surgery" in lowered: + vectors.append(np.array([1.0, 0.0], dtype=np.float32)) + elif "immunotherapy" in lowered: + vectors.append(np.array([0.95, 0.05], dtype=np.float32)) + else: + vectors.append(np.array([0.0, 1.0], dtype=np.float32)) + arr = np.vstack(vectors) + if len(sentences) == 1 and isinstance(sentences[0], str): + return arr[0] + return arr + + +def test_embedding_matcher_returns_topic_and_keyword_matches() -> None: + matcher = EmbeddingMatcher(model=_FakeModel(), min_score=0.5) + matcher.prepare_topics( + [ + TopicCandidate(topic_id="T1", display_name="Cancer Immunotherapy"), + TopicCandidate(topic_id="T2", display_name="Unrelated Topic"), + ] + ) + from inse.patents.patents_openalex_keywords.matching import KeywordCandidate + + matcher.prepare_keywords( + [ + KeywordCandidate(keyword="surgery", topic_id="T9", topic_display_name="Surgery"), + KeywordCandidate(keyword="finance", topic_id="T8", topic_display_name="Finance"), + ] + ) + + topic_matches, keyword_matches = matcher.match_ipc_label( + "medical immunotherapy devices", + top_k=2, + ) + assert topic_matches + assert topic_matches[0]["topic_id"] == "T1" + assert keyword_matches + assert keyword_matches[0]["keyword"] == "surgery" diff --git a/service/src/main/inse/patents/patents_openalex_keywords/test_resolver.py b/service/src/main/inse/patents/patents_openalex_keywords/test_resolver.py new file mode 100644 index 00000000..f46378de --- /dev/null +++ b/service/src/main/inse/patents/patents_openalex_keywords/test_resolver.py @@ -0,0 +1,102 @@ +"""Tests for patents_openalex_keywords runtime resolver.""" +from __future__ import annotations + +import asyncio + +from inse.patents.authors.ipc_openalex_mapping import MappedOpenAlexTopic +from inse.patents.authors.test_ipc_openalex_mapping import _author_with_topic +from inse.patents.authors.topic_filter import filter_patents_by_ipc_topic_mapping +from inse.patents.common import model +from inse.patents.patents_openalex_keywords.resolver import ( + PatentOpenAlexMappingResolver, + mapped_topics_from_index_doc, +) + + +def test_mapped_topics_from_index_doc_includes_topics_and_keywords() -> None: + doc = { + "ipc_level": "subclass", + "ipc_symbol": "H01L", + "topic_matches": [ + { + "rank": 1, + "topic_id": "https://openalex.org/T99999", + "topic_display_name": "Semiconductor materials and devices", + "subfield": "Electrical Engineering", + } + ], + "keyword_matches": [ + { + "rank": 1, + "keyword": "silicon", + "topic_id": "https://openalex.org/T88888", + "topic_display_name": "Silicon Processing", + } + ], + } + mapped = mapped_topics_from_index_doc(doc) + assert len(mapped) == 2 + assert {item.topic_id for item in mapped} == { + "https://openalex.org/T99999", + "https://openalex.org/T88888", + } + + +class _FakeKeywordsClient: + def __init__(self, docs: dict[str, dict]): + self.docs = docs + + async def index_exists(self) -> bool: + return True + + async def lookup_symbol(self, symbol: str): + return self.docs.get(symbol) + + +def test_resolver_uses_index_doc_before_legacy_fallback() -> None: + resolver = PatentOpenAlexMappingResolver( + client=_FakeKeywordsClient( + { + "H01L": { + "ipc_level": "subclass", + "ipc_symbol": "H01L", + "topic_matches": [ + { + "topic_id": "https://openalex.org/T99999", + "topic_display_name": "Semiconductor materials and devices", + } + ], + "keyword_matches": [], + } + } + ), + use_elasticsearch=True, + ) + mapped = asyncio.run(resolver.resolve_mapped_topics_for_code("H01L 21/02")) + assert mapped + assert mapped[0].topic_id.endswith("T99999") + + +def test_filter_uses_patent_topic_map_from_resolver() -> None: + author = _author_with_topic( + "https://openalex.org/T99999", + "Semiconductor materials and devices", + ) + patent = model.PatentEntry(patent_id="EP1", source="EPO", ipc=["H01L 21/02"]) + from inse.patents.common.parsing import patent_map_key + + topic_map = { + patent_map_key(patent): [ + MappedOpenAlexTopic( + topic_id="https://openalex.org/T99999", + topic_display_name="Semiconductor materials and devices", + ) + ] + } + filtered = filter_patents_by_ipc_topic_mapping( + [patent], + author, + is_ambiguous=True, + patent_topic_map=topic_map, + ) + assert len(filtered) == 1 diff --git a/service/src/main/inse/patents/service.py b/service/src/main/inse/patents/service.py index 39b30968..3cd2f6d8 100644 --- a/service/src/main/inse/patents/service.py +++ b/service/src/main/inse/patents/service.py @@ -1,70 +1,10 @@ """Aggregates patent API routers.""" from fastapi import APIRouter -from . import logic -from . import model -from typing import Annotated, Optional -from fastapi import Path -from fastapi import Query - -router = APIRouter(prefix="/api/inse-service/authors", tags=["Patents"]) - -patents_router = APIRouter(prefix="/api/inse-service", 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 - -@router.get( - "/{author_id}/patents", - operation_id="getPatentsByAuthor", - summary="Get patents matched to an author by name.", -) -async def get_patents_by_author(author_id: str) -> model.PatentsByAuthorResponse: - return await logic.get_patents_by_author_id(author_id) - - -@patents_router.get( - "/patents/{identifier}", - operation_id="getPatentByIdOrTitle", - summary="Returns one publication by OpenAlex ID or DOI.", -) -async def get_patent_by_identifier( - identifier: Annotated[str, Path(description="")], - prefix: Annotated[ - Optional[str], Query(description="Application Prefix (EP or US)") - ] = "", - title: Annotated[ - Optional[str], - Query( - 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,filling_date=filling_date) - - -@patents_router.get( - "/patents", - operation_id="getAllPatents", - 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", -) -> model.AllPatentsResponse: - return await logic.get_all_patents( - page=page, - size=size, - search=search, - source=source, - sort_by=sort_by, - sort_direction=sort_direction, - ) +router = author_patents_router +patents_router = all_patents_router +institution_patents_router = institution_patents_router 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 6aea4c7c..d9225534 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, @@ -12,17 +14,23 @@ def anyio_backend(): return "asyncio" +def test_patent_search_client_exposes_inventor_queries(): + client = PatentSearchClient(api_key="test-key") + assert hasattr(client, "epo_query_by_inventor") + assert hasattr(client, "uspto_query_by_inventor") + assert hasattr(client, "epo_query_by_application_number") + + 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") + payload = client.epo_query_by_inventor("Pedro José Marrón") 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"] + inventor_query = nested["query"] + assert "should" in inventor_query["bool"] def test_uspto_index_is_3_0(): @@ -30,17 +38,51 @@ def test_uspto_index_is_3_0(): assert ESIndex.EPO_INDEX == "epo_index_1.0" +def test_epo_query_by_application_number_uses_term_filter(): + client = PatentSearchClient(api_key="test-key") + payload = client.epo_query_by_application_number("12743403.3") + + assert payload["query"] == {"term": {"application_number": "12743403.3"}} + assert "application_number" in payload["_source"] + + +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(): 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("Christian Weber")) assert len(captured) == 1 - assert captured[0]["index"] == ESIndex.EPO_INDEX \ No newline at end of file + assert captured[0]["index"] == ESIndex.EPO_INDEX diff --git a/service/src/main/inse/patents/test_logic.py b/service/src/main/inse/patents/test_logic.py index 5e60288d..9e5f8744 100644 --- a/service/src/main/inse/patents/test_logic.py +++ b/service/src/main/inse/patents/test_logic.py @@ -1,5 +1,8 @@ from inse.patents import model -from inse.patents.common.parsing import deduplicate_patents +from inse.patents.common.parsing import ( + deduplicate_patents, + expand_matched_epo_application_families, +) from inse.patents.institutions.logic import filter_patents_by_institution @@ -93,6 +96,71 @@ def test_deduplicate_patents_keeps_same_patent_number_with_different_uspto_types assert [patent.application_type for patent in result] == ["utility", "reissue"] +def test_expand_matched_epo_application_families_adds_grant_stage() -> None: + application = _epo_patent( + publication_date="20150506", + kind="A1", + ) + application.application_number = "12743403.3" + application.inventors = ["MARRÓN, Pedro José"] + + grant = _epo_patent( + publication_date="20180411", + kind="B1", + ) + grant.application_number = "12743403.3" + grant.inventors = ["HANDTE, Marcus"] + + class _FakeSearchClient: + async def search_epo(self, payload): + return { + "hits": { + "hits": [ + { + "_id": "2867692", + "_source": { + "doc_number": "2867692", + "kind": "A1", + "date_publication": "20150506", + "date_publication_year": 2015, + "application_number": "12743403.3", + "title_en": "METHOD FOR GENERATING AND USING A MAP", + "inventors_name": ["MARRÓN, Pedro José"], + "applicants_name": ["Universität Duisburg-Essen"], + "ipc": ["G01S 5/02"], + }, + }, + { + "_id": "2867692", + "_source": { + "doc_number": "2867692", + "kind": "B1", + "date_publication": "20180411", + "date_publication_year": 2018, + "application_number": "12743403.3", + "title_en": "METHOD FOR GENERATING AND USING A MAP", + "inventors_name": ["HANDTE, Marcus"], + "applicants_name": ["Universität Duisburg-Essen"], + "ipc": ["G01S 5/02"], + }, + }, + ] + } + } + + def epo_query_by_application_number(self, application_number: str): + return {"query": {"term": {"application_number": application_number}}} + + import asyncio + + expanded = asyncio.run( + expand_matched_epo_application_families([application], _FakeSearchClient()) + ) + + assert len(expanded) == 2 + assert {patent.kind for patent in expanded} == {"A1", "B1"} + + def test_assignee_matches_institution_name_accepts_alternative_names() -> None: from inse.patents.name_matching import assignee_matches_institution_name diff --git a/service/src/main/inse/patents/test_name_matching.py b/service/src/main/inse/patents/test_name_matching.py index cc93465d..828a1082 100644 --- a/service/src/main/inse/patents/test_name_matching.py +++ b/service/src/main/inse/patents/test_name_matching.py @@ -2,7 +2,10 @@ import pytest from inse.patents.name_matching import ( first_name_match_kind, + first_name_match_kind_for_person, + inventor_search_phrases, name_matches, + name_matches_person, name_token_variants, normalize_name_part, search_name_variants, @@ -52,7 +55,7 @@ def test_hyphenated_first_name() -> None: [ ("Christian Weber", "Christian", "Weber", True), ("Weber, Christian", "Christian", "Weber", True), - ("Marc Christian Weber", "Christian", "Weber", False), + ("Marc Christian Weber", "Christian", "Weber", True), ("Müller, Hans", "Hans", "Müller", True), ("Mueller, Hans", "Hans", "Müller", True), ("Hans Mueller", "Hans", "Müller", True), @@ -114,7 +117,64 @@ def test_name_matches_initials(inventor: str, first: str, last: str, expected: b def test_first_name_match_kind() -> None: assert first_name_match_kind("Christian Weber", "Christian", "Weber") == "full" assert first_name_match_kind("C. Weber", "Christian", "Weber") == "initial" - assert first_name_match_kind("Marc Christian Weber", "Christian", "Weber") == "none" + assert first_name_match_kind("Marc Christian Weber", "Christian", "Weber") == "full" + + +@pytest.mark.parametrize( + ("inventor", "display_name", "expected"), + [ + ("Marrón, Pedro José", "Pedro José Marrón", True), + ("Marron, Pedro Jose, Dr.", "Pedro José Marrón", True), + ("P. J. Marrón", "Pedro José Marrón", True), + ("Schmidt, Anna Maria", "Anna Maria Schmidt", True), + ("Maria Schmidt", "Anna Maria Schmidt", True), + ("García López, Juan Carlos", "Juan Carlos García López", True), + ("López, Juan", "Juan Carlos García López", True), + ("Mohamed Ali Hassan", "Mohamed Ali Hassan", True), + ("Ali Hassan", "Mohamed Ali Hassan", True), + ("Karem C Weber", "Christian Weber", False), + ("Schmitz, Oliver", "Oliver J. Schmitz", False), + ("Schmitz, Oliver J.", "Oliver J. Schmitz", True), + ("Schmitz, O. J.", "Oliver J. Schmitz", True), + ], +) +def test_name_matches_person_multi_part( + inventor: str, + display_name: str, + expected: bool, +) -> None: + assert name_matches_person(inventor, display_name) is expected + + +def test_inventor_search_phrases_include_comma_and_initials() -> None: + phrases = inventor_search_phrases("Pedro José Marrón") + folded = {phrase.casefold() for phrase in phrases} + assert any("marron" in phrase and "pedro" in phrase for phrase in folded) + assert any("," in phrase for phrase in phrases) + + +def test_first_name_match_kind_multi_part() -> None: + assert ( + first_name_match_kind_for_person("Marrón, Pedro José", "Pedro José Marrón") + == "full" + ) + assert ( + first_name_match_kind_for_person("P. J. Marrón", "Pedro José Marrón") + == "initial" + ) + + +def test_middle_initial_requires_corroboration() -> None: + assert not name_matches_person("Schmitz, Oliver", "Oliver J. Schmitz") + assert name_matches_person("Schmitz, Oliver J.", "Oliver J. Schmitz") + assert ( + first_name_match_kind_for_person("Schmitz, Oliver", "Oliver J. Schmitz") + == "none" + ) + assert ( + first_name_match_kind_for_person("Schmitz, Oliver J.", "Oliver J. Schmitz") + == "full" + ) def test_search_name_variants_includes_initial() -> None: diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index 9102de3e..7bf9c9a7 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -4,40 +4,40 @@ Business logic for persons / authors. """ +import hashlib import json import logging import time from datetime import datetime -from typing import Optional, Callable, Any, List -import hashlib +from typing import List, Optional + from inse.exceptions import ( - NotFoundException, + BadRequestException, ElasticsearchException, ElasticsearchNotFoundException, - ElasticsearchConnectionException, - BadRequestException, + NotFoundException, ) - +from inse.integrations import elasticsearch from inse.model import ESIndex -from .. import config -from .. import util -from ..integrations import llm from inse.models.openalex.author import Author from inse.models.openalex.authors_list_response import AuthorsListResponse -from inse.integrations import elasticsearch from inse.models.openalex.meta import Meta -from inse.persons.query_builder import build_authors_search_rescored from inse.persons.model import ( + CareerMetrics, CustomAuthor, CustomAuthorsListResponse, - CareerMetrics, ) +from inse.persons.query_builder import build_authors_search_rescored from inse.works.logic import enrich_topic_descriptions +from .. import config, util +from ..integrations import llm + logger = logging.getLogger(__name__) INDEX_NAME = "openalex-authors" UDE_INSTITUTION_ID = "https://openalex.org/I62318514" # Universität Duisburg-Essen + async def find_ude_author_by_name(display_name: str) -> Optional[dict]: query = { "_source": ["display_name"], @@ -154,8 +154,41 @@ async def search_persons( return AuthorsListResponse(results=authors, meta=Meta(count=len(authors))) -async def _fetch_author_display_name(author_id: str) -> Optional[str]: +async def _count_authors(query: dict) -> int: + """Return the total number of authors matching a query (no documents fetched).""" + data = await elasticsearch.search( + index=ESIndex.OPENALEX_AUTHORS, + query=query, + size=0, + track_total_hits=True, + ) + total = data.get("hits", {}).get("total", {}) + if isinstance(total, dict): + return int(total.get("value", 0)) + return int(total or 0) + +async def count_authors_by_display_name(display_name: str) -> int: + """Count authors in the local OpenAlex index whose full name collides. + + Used purely as an internal ambiguity signal: a value >= 2 means at least one + other author shares the exact name. + """ + if not display_name or not display_name.strip(): + return 0 + query = {"match_phrase": {"display_name": display_name.strip()}} + return await _count_authors(query) + + +async def count_authors_by_last_name(last_name: str) -> int: + """Count authors in the local OpenAlex index sharing a family name.""" + if not last_name or not last_name.strip(): + return 0 + query = {"match": {"display_name": last_name.strip()}} + return await _count_authors(query) + + +async def _fetch_author_display_name(author_id: str) -> Optional[str]: query = { "query_string": { "default_field": "_id", @@ -178,7 +211,6 @@ async def _fetch_author_display_name(author_id: str) -> Optional[str]: async def _fetch_works_and_topics(author_id: str) -> tuple[list, list]: - WORK_SOURCE_FIELDS = [ "title", "display_name", @@ -364,7 +396,6 @@ async def get_career_metrics_for_author(author_id: str) -> CareerMetrics: def _build_papers(works: list) -> list: - papers = [] for work in works: name = work.get("title") or work.get("display_name") @@ -382,7 +413,6 @@ def _build_papers(works: list) -> list: async def get_data_for_bio(author_id: str) -> Optional[dict]: - display_name = await _fetch_author_display_name(author_id) if display_name is None: return None @@ -398,7 +428,9 @@ async def get_data_for_bio(author_id: str) -> Optional[dict]: return author_data -async def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str: +async def generate_person_bio( + author_id: str, include: Optional[set[str]] = None +) -> str: start_time = time.time() author_data = await get_data_for_bio(author_id) if author_data is None: @@ -584,26 +616,73 @@ async def search_persons_by_institution( page_offset: Optional[int] = 0, include: Optional[str] = None, ) -> AuthorsListResponse: - if not institution_name: raise BadRequestException("institution_name must be provided") - search_query = { + target_year = datetime.now().year - 1 + + recent_affiliation_query = { "nested": { - "path": "last_known_institutions", + "path": "affiliations", "query": { "bool": { - "must": [ + "filter": [ { "match_phrase": { - "last_known_institutions.display_name": institution_name + "affiliations.institution.display_name": institution_name } - } + }, + {"range": {"affiliations.years": {"gte": target_year}}}, ] } }, } } + matching_last_known_institution_query = { + "nested": { + "path": "last_known_institutions", + "query": { + "match_phrase": { + "last_known_institutions.display_name": institution_name + } + }, + } + } + missing_last_known_institutions_query = { + "bool": { + "must_not": [ + { + "nested": { + "path": "last_known_institutions", + "query": {"exists": {"field": "last_known_institutions.id"}}, + } + } + ] + } + } + search_query = { + "bool": { + "should": [ + { + "bool": { + "filter": [ + matching_last_known_institution_query, + recent_affiliation_query, + ] + } + }, + { + "bool": { + "filter": [ + missing_last_known_institutions_query, + recent_affiliation_query, + ] + } + }, + ], + "minimum_should_match": 1, + } + } try: response = await elasticsearch.search( index="openalex-authors", diff --git a/service/src/main/inse/persons/query_builder.py b/service/src/main/inse/persons/query_builder.py index 7431558d..d6b4119d 100644 --- a/service/src/main/inse/persons/query_builder.py +++ b/service/src/main/inse/persons/query_builder.py @@ -1,232 +1,4 @@ -# -*- coding: utf-8 -*- -from typing import List, Optional, Set, Any -import json -# def build_authors_search( -# using: Any = None, -# index: Optional[str] = None, -# query: Optional[str] = None, -# institution_name: Optional[str] = None, -# sort_by: Optional[str] = None, -# sort_order: Optional[str] = None, -# topics: Optional[List[str]] = None, -# page: int = 1, -# page_size: int = 10, -# include: Optional[Set[str]] = None, -# strict: Optional[bool] = False, -# track_total_hits: Optional[bool] = False, -# filter_mode: Optional[str] = "from", -# filter_year: Optional[int] = None, -# ) -> dict: -# """ -# Builds an Elasticsearch search request query body for authors as a dictionary. -# """ -# # 1. Build Query Clauses -# query_clause = None -# if query: -# query_clause = { -# "bool": { -# "should": [ -# { -# "match_phrase": { -# "display_name": { -# "query": query, -# "boost": 5 -# } -# } -# }, -# { -# "match_phrase_prefix": { -# "display_name": { -# "query": query, -# "boost": 3 -# } -# } -# }, -# { -# "match": { -# "display_name": { -# "query": query, -# "fuzziness": 1 -# } -# } -# } -# ], -# "minimum_should_match": 1 -# } -# } - -# # 2. Build Filters -# filter_clauses = [] - -# # Filter against false entries (nested ((Works > 2 AND Year > 2020) OR has last_known_institution)) -# filter_clauses.append({ -# "bool": { -# "should": [ -# { -# "bool": { -# "filter": [ -# { -# "range": { "works_count": { "gt": 2 } } -# }, -# { -# "nested": { -# "path": "counts_by_year", -# "query": { -# "range": { "counts_by_year.year": { "gt": 2020 } } # hardcoded for now -# } -# } -# } -# ] -# } -# }, -# { -# "nested": { -# "path": "last_known_institutions", -# "query": { -# "exists": { -# "field": "last_known_institutions.id" -# } -# } -# } -# } - -# ], -# "minimum_should_match": 1 -# } -# }) -# # Institution filter with optional year-based filtering -# if institution_name: -# if filter_year is not None: -# target_year = filter_year -# mode = filter_mode or "from" -# else: -# from datetime import datetime -# current_year = datetime.now().year -# target_year = current_year - 1 -# mode = "from" - -# range_query = {"gte": target_year} -# if mode == "in": -# range_query["lte"] = target_year - -# if strict: -# filter_clauses.append({ -# "nested": { -# "path": "affiliations", -# "query": { -# "bool": { -# "filter": [ -# { -# "match_phrase": { -# "affiliations.institution.display_name": institution_name -# } -# }, -# { -# "range": { -# "affiliations.years": range_query -# } -# } -# ] -# } -# } -# } -# }) -# else: -# filter_clauses.append({ -# "bool": { -# "filter": [ -# { -# "nested": { -# "path": "last_known_institutions", -# "query": { -# "match_phrase": { -# "last_known_institutions.display_name": institution_name -# } -# } -# } -# }, -# { -# "nested": { -# "path": "affiliations", -# "query": { -# "bool": { -# "filter": [ -# { -# "match_phrase": { -# "affiliations.institution.display_name": institution_name -# } -# }, -# { -# "range": { -# "affiliations.years": range_query -# } -# } -# ] -# } -# } -# } -# } -# ] -# } -# }) - -# if topics: -# for t in topics: -# if t: -# filter_clauses.append({ -# "nested": { -# "path": "topics", -# "query": { -# "match_phrase": { -# "topics.display_name": t -# } -# } -# } -# }) - -# # Combine query and filters -# body = {} -# if query_clause: -# if filter_clauses: -# body["query"] = { -# "bool": { -# "must": [query_clause], -# "filter": filter_clauses -# } -# } -# else: -# body["query"] = query_clause -# else: -# if filter_clauses: -# body["query"] = { -# "bool": { -# "filter": filter_clauses -# } -# } -# else: -# body["query"] = { -# "match_all": {} -# } - -# # 3. Source Filtering -# if include: -# body["_source"] = list(include) -# else: -# body["_source"] = True - -# # 4. Pagination -# es_size = page_size -# es_from = (page - 1) * page_size -# body["from"] = es_from -# body["size"] = es_size -# body["track_total_hits"] = track_total_hits - -# # 5. Sorting -# if sort_by and sort_order: -# body["sort"] = [ -# {sort_by: {"order": sort_order}}, -# ] -# return body +from typing import Any, List, Optional, Set def build_authors_search_rescored( @@ -244,11 +16,11 @@ def build_authors_search_rescored( track_total_hits: Optional[bool] = False, filter_mode: Optional[str] = "from", filter_year: Optional[int] = None, - name_quality_boost = True, - h_index_boost = True, - citations_boost =True, - works_boost = True, - _2yr_mean_citedness_boost = True, + name_quality_boost=True, + h_index_boost=True, + citations_boost=True, + works_boost=True, + _2yr_mean_citedness_boost=True, ) -> dict: """ Builds an Elasticsearch search request query body for authors as a dictionary. @@ -259,73 +31,56 @@ def build_authors_search_rescored( query_clause = { "bool": { "should": [ - { - "match_phrase": { - "display_name": { - "query": query, - "boost": 5 - } - } - }, + {"match_phrase": {"display_name": {"query": query, "boost": 5}}}, { "match_phrase_prefix": { - "display_name": { - "query": query, - "boost": 3 - } + "display_name": {"query": query, "boost": 3} } }, - { - "match": { - "display_name": { - "query": query - } - } - } + {"match": {"display_name": {"query": query}}}, ], - "minimum_should_match": 1 + "minimum_should_match": 1, } } # 2. Build Filters filter_clauses = [] - - # Filter against false entries (nested ((Works > 2 AND Year > 2020) OR has last_known_institution)) - filter_clauses.append({ - "bool": { - "should": [ - { - "bool": { - "filter": [ - { - "range": { "works_count": { "gt": 2 } } - }, - { - "nested": { - "path": "counts_by_year", - "query": { - "range": { "counts_by_year.year": { "gt": 2020 } } # hardcoded for now - } - } - } - ] - } - }, - { - "nested": { - "path": "last_known_institutions", - "query": { - "exists": { - "field": "last_known_institutions.id" - } - } - } - } - ], - "minimum_should_match": 1 + # Filter against false entries (nested ((Works > 2 AND Year > 2020) OR has last_known_institution)) + filter_clauses.append( + { + "bool": { + "should": [ + { + "bool": { + "filter": [ + {"range": {"works_count": {"gt": 2}}}, + { + "nested": { + "path": "counts_by_year", + "query": { + "range": { + "counts_by_year.year": {"gt": 2020} + } # hardcoded for now + }, + } + }, + ] + } + }, + { + "nested": { + "path": "last_known_institutions", + "query": { + "exists": {"field": "last_known_institutions.id"} + }, + } + }, + ], + "minimum_should_match": 1, + } } - }) + ) # Institution filter with optional year-based filtering if institution_name: if filter_year is not None: @@ -333,6 +88,7 @@ def build_authors_search_rescored( mode = filter_mode or "from" else: from datetime import datetime + current_year = datetime.now().year target_year = current_year - 1 mode = "from" @@ -342,7 +98,27 @@ def build_authors_search_rescored( range_query["lte"] = target_year if strict: - filter_clauses.append({ + filter_clauses.append( + { + "nested": { + "path": "affiliations", + "query": { + "bool": { + "filter": [ + { + "match_phrase": { + "affiliations.institution.display_name": institution_name + } + }, + {"range": {"affiliations.years": range_query}}, + ] + } + }, + } + } + ) + else: + recent_affiliation_query = { "nested": { "path": "affiliations", "query": { @@ -353,71 +129,75 @@ def build_authors_search_rescored( "affiliations.institution.display_name": institution_name } }, - { - "range": { - "affiliations.years": range_query - } - } + {"range": {"affiliations.years": range_query}}, ] } - } + }, } - }) - else: - filter_clauses.append({ - "bool": { - "filter": [ - { - "nested": { - "path": "last_known_institutions", - "query": { - "match_phrase": { - "last_known_institutions.display_name": institution_name - } - } + } + matching_last_known_institution_query = { + "nested": { + "path": "last_known_institutions", + "query": { + "match_phrase": { + "last_known_institutions.display_name": institution_name } }, - { - "nested": { - "path": "affiliations", - "query": { - "bool": { - "filter": [ - { - "match_phrase": { - "affiliations.institution.display_name": institution_name - } - }, - { - "range": { - "affiliations.years": range_query - } - } - ] - } + } + } + missing_last_known_institutions_query = { + "bool": { + "must_not": [ + { + "nested": { + "path": "last_known_institutions", + "query": { + "exists": {"field": "last_known_institutions.id"} + }, } } - } - ] + ] + } } - }) - + filter_clauses.append( + { + "bool": { + "should": [ + { + "bool": { + "filter": [ + matching_last_known_institution_query, + recent_affiliation_query, + ] + } + }, + { + "bool": { + "filter": [ + missing_last_known_institutions_query, + recent_affiliation_query, + ] + } + }, + ], + "minimum_should_match": 1, + } + } + ) + if topics: for t in topics: if t: - filter_clauses.append({ - "nested": { - "path": "topics", - "query": { - "match_phrase": { - "topics.display_name": t - } + filter_clauses.append( + { + "nested": { + "path": "topics", + "query": {"match_phrase": {"topics.display_name": t}}, } } - }) + ) functions = [] if not sort_by: - # if (name_quality_boost): # Name quality boost, boost names which are not "Value Value" # name_boost_query={ # "script_score": { @@ -428,68 +208,61 @@ def build_authors_search_rescored( # } # } # functions.append(name_boost_query) - if (h_index_boost): # h_index boost - h_index_boost_query={ - "script_score": { - "script": { - "lang": "painless", - "source": "if (!doc.containsKey('summary_stats.h_index') || doc['summary_stats.h_index'].empty) return 1.0;double h = doc['summary_stats.h_index'].value;return 1.0 + Math.log1p(h) / 5.0;" - } + if h_index_boost: # h_index boost + h_index_boost_query = { + "script_score": { + "script": { + "lang": "painless", + "source": "if (!doc.containsKey('summary_stats.h_index') || doc['summary_stats.h_index'].empty) return 1.0;double h = doc['summary_stats.h_index'].value;return 1.0 + Math.log1p(h) / 5.0;", } + } } functions.append(h_index_boost_query) - if (citations_boost): # cited_by_count boost + if citations_boost: # cited_by_count boost cited_by_count_boost_query = { "script_score": { "script": { "lang": "painless", - "source": "if (!doc.containsKey('cited_by_count') || doc['cited_by_count'].empty) return 1.0;double citations = doc['cited_by_count'].value;return 1.0 + Math.log1p(citations) / 10.0;" + "source": "if (!doc.containsKey('cited_by_count') || doc['cited_by_count'].empty) return 1.0;double citations = doc['cited_by_count'].value;return 1.0 + Math.log1p(citations) / 10.0;", } } } functions.append(cited_by_count_boost_query) - if (works_boost): # works_count boost + if works_boost: # works_count boost works_count_boost_query = { "script_score": { "script": { "lang": "painless", - "source": "if (!doc.containsKey('works_count') || doc['works_count'].empty) return 1.0;double works = doc['works_count'].value;return 1.0 + Math.log1p(works) / 8.0;" + "source": "if (!doc.containsKey('works_count') || doc['works_count'].empty) return 1.0;double works = doc['works_count'].value;return 1.0 + Math.log1p(works) / 8.0;", } } } functions.append(works_count_boost_query) # Combine query and filters body = {} - + if functions: inner_query = None if query_clause: if filter_clauses: inner_query = { - "bool": { - "must": [query_clause], - "filter": filter_clauses - } + "bool": {"must": [query_clause], "filter": filter_clauses} } else: inner_query = query_clause # if query not null then multiply with name matching - body["query"] = { + body["query"] = { "function_score": { "query": inner_query, "functions": functions, "score_mode": "multiply", - "boost_mode": "multiply" + "boost_mode": "multiply", } } else: if filter_clauses: - inner_query = { - "bool": { - "filter": filter_clauses - } - } + inner_query = {"bool": {"filter": filter_clauses}} else: inner_query = {"match_all": {}} # if the query is null, replace the scoring completely @@ -498,27 +271,20 @@ def build_authors_search_rescored( "query": inner_query, "functions": functions, "score_mode": "multiply", - "boost_mode": "replace" + "boost_mode": "replace", } } else: if query_clause: if filter_clauses: body["query"] = { - "bool": { - "must": [query_clause], - "filter": filter_clauses - } + "bool": {"must": [query_clause], "filter": filter_clauses} } else: body["query"] = query_clause else: if filter_clauses: - body["query"] = { - "bool": { - "filter": filter_clauses - } - } + body["query"] = {"bool": {"filter": filter_clauses}} else: body["query"] = {"match_all": {}} @@ -541,4 +307,3 @@ def build_authors_search_rescored( {sort_by: {"order": sort_order}}, ] return body - diff --git a/service/src/main/inse/tags.py b/service/src/main/inse/tags.py index 1b25c312..51a6eec6 100644 --- a/service/src/main/inse/tags.py +++ b/service/src/main/inse/tags.py @@ -13,3 +13,4 @@ class Tags(StrEnum): ACCOUNT = "Account" ORGANIZATION = "Organization" UNIVERSITY_RANKINGS = "University Rankings" + DASHBOARD = "Dashboard" diff --git a/service/src/main/inse/works/logic.py b/service/src/main/inse/works/logic.py index 96bf0ef2..ec4f16af 100644 --- a/service/src/main/inse/works/logic.py +++ b/service/src/main/inse/works/logic.py @@ -55,6 +55,7 @@ async def get_author_works( language: list[str] | None = None, institution_id: list[str] | None = None, topic_id: list[str] | None = None, + sort: str = "year", client: OpenAlexWorksSearchClient | None = None, ) -> WorkPage: search_client = client or OpenAlexWorksSearchClient() @@ -68,6 +69,7 @@ async def get_author_works( language=language, institution_id=institution_id, topic_id=topic_id, + sort=sort, ) elements, total = _parse_full_work_search_response(data) @@ -929,6 +931,7 @@ async def _search_author_works_data( language: list[str] | None = None, institution_id: list[str] | None = None, topic_id: list[str] | None = None, + sort: str = "year", ) -> dict: return await search_client.search_author_works( author_id, @@ -939,6 +942,7 @@ async def _search_author_works_data( language=language, institution_id=institution_id, topic_id=topic_id, + sort=sort, ) diff --git a/service/src/main/inse/works/model.py b/service/src/main/inse/works/model.py index e16d723a..c4e01fdb 100644 --- a/service/src/main/inse/works/model.py +++ b/service/src/main/inse/works/model.py @@ -4,6 +4,7 @@ Pydantic models for publication works. """ +from enum import StrEnum from typing import List from typing import Optional @@ -41,3 +42,35 @@ class WorkPage(BaseModel): class WorkList(BaseModel): elements: List[Work] = Field(default_factory=list, description="All works.") total: int = Field(default=0, description="The total number of works.") + + +class WorkPurpose(StrEnum): + """Represents the purpose of a work. Either a foundation work or an application work.""" + + FOUNDATION = "Foundation" + APPLICATION = "Application" + + +class SpecificWorkPurpose(BaseModel): + """Represents the purpose of a specific work, including its ID, purpose, and optional reasoning.""" + + raw_oa_work_id: str = Field(description="The raw OpenAlex work id.") + publication_year: Optional[int] = Field( + default=None, description="The publication year of the work." + ) + purpose: WorkPurpose = Field(description="The purpose of the work.") + reasoning: Optional[str] = Field( + default=None, description="The reasoning behind the purpose determination." + ) + + +class AuthorWorkPurposes(BaseModel): + """Represents the purposes of an author, including their ID and a list of specific work purposes.""" + + raw_oa_author_id: str = Field(description="The raw OpenAlex author id.") + total: int = Field( + default=0, description="The total number of works for the author." + ) + purposes: List[SpecificWorkPurpose] = Field( + default_factory=list, description="The list of specific work purposes." + ) diff --git a/service/src/main/inse/works/purpose_router.py b/service/src/main/inse/works/purpose_router.py new file mode 100644 index 00000000..b641e008 --- /dev/null +++ b/service/src/main/inse/works/purpose_router.py @@ -0,0 +1,34 @@ +from typing import Annotated + +from fastapi import APIRouter, Path + +from inse.tags import Tags +from inse.works.model import AuthorWorkPurposes, SpecificWorkPurpose + +from inse.works import purpose_service + +WORKS_PREFIX = "/api/purpose" + +router = APIRouter(prefix=WORKS_PREFIX, tags=[Tags.WORKS]) + + +@router.get( + "/{raw_oa_work_id}/purpose", + operation_id="getWorkPurpose", + summary="Returns the purpose of a work based on its ID.", +) +async def get_work_purpose( + raw_oa_work_id: Annotated[str, Path(description="The raw OpenAlex work id.")], +) -> SpecificWorkPurpose: + return await purpose_service.get_work_purpose(raw_oa_work_id) + + +@router.get( + "/{raw_oa_author_id}/purposes", + operation_id="getAuthorWorkPurposes", + summary="Returns the purposes of an author based on their ID.", +) +async def get_author_work_purposes( + raw_oa_author_id: Annotated[str, Path(description="The raw OpenAlex author id.")], +) -> AuthorWorkPurposes: + return await purpose_service.get_author_work_purposes(raw_oa_author_id) diff --git a/service/src/main/inse/works/purpose_service.py b/service/src/main/inse/works/purpose_service.py new file mode 100644 index 00000000..9003f4c4 --- /dev/null +++ b/service/src/main/inse/works/purpose_service.py @@ -0,0 +1,101 @@ +import logging +import random +from typing import List + +from fastapi import HTTPException, status + +from inse.exceptions import NotFoundException +from inse.integrations import elasticsearch +from inse.model import ESIndex +from inse.works.model import AuthorWorkPurposes, SpecificWorkPurpose, WorkPurpose + +logger = logging.getLogger(__name__) + + +async def get_work_purpose(raw_oa_work_id: str) -> SpecificWorkPurpose: + raw_oa_work_id = raw_oa_work_id.strip().upper() + + response = await elasticsearch.get( + index=ESIndex.OPENALEX_WORKS, + doc_id=raw_oa_work_id, + source=["title", "abstract"], + ) + + logger.debug(f"Elasticsearch response for work id {raw_oa_work_id}: {response}") + + source = response.get("_source", {}) + if not source: + raise NotFoundException(f"Work with id {raw_oa_work_id} not found.") + + logger.debug(f"Found work source for id {raw_oa_work_id}: {source}") + + return SpecificWorkPurpose( + raw_oa_work_id=raw_oa_work_id, + publication_year=source.get("publication_year"), + purpose=WorkPurpose.FOUNDATION, # TODO: Replace with actual purpose determination logic + reasoning="This is a placeholder reasoning for the purpose determination.", + ) + + +async def get_author_work_purposes(raw_oa_author_id: str) -> AuthorWorkPurposes: + raw_oa_author_id = raw_oa_author_id.strip().upper() + + response = await elasticsearch.search( + index=ESIndex.OPENALEX_WORKS, + source=["id", "publication_year"], + query={ + "nested": { + "path": "authorships", + "query": { + "bool": { + "filter": [ + { + "term": { + "authorships.author.id": f"https://openalex.org/{raw_oa_author_id}" + } + }, + ], + }, + }, + }, + }, + size=10000, + ) + + logger.debug(f"Elasticsearch response for author id {raw_oa_author_id}: {response}") + + purposes: List[SpecificWorkPurpose] = [] + + # TODO: implement actual retrieval of previously determined purposes for the author's works + + hits_block = response.get("hits", {}) + hits = hits_block.get("hits", []) + total_hits = hits_block.get("total", {}).get("value", 0) + for hit in hits: + source = hit.get("_source", {}) + work_id = source.get("id") + publication_year = source.get("publication_year") + if work_id: + # TODO: Remove random based purpose assignment + if random.choice([True, False]): + purpose = SpecificWorkPurpose( + raw_oa_work_id=work_id, + publication_year=publication_year, + purpose=WorkPurpose.FOUNDATION, + reasoning=f"Placeholder reasoning for work {work_id}.", + ) + else: + purpose = SpecificWorkPurpose( + raw_oa_work_id=work_id, + publication_year=publication_year, + purpose=WorkPurpose.APPLICATION, + reasoning=f"Placeholder reasoning for work {work_id}.", + ) + + purposes.append(purpose) + else: + logger.warning(f"Work hit without id for author {raw_oa_author_id}: {hit}") + + return AuthorWorkPurposes( + raw_oa_author_id=raw_oa_author_id, total=total_hits, purposes=purposes + ) diff --git a/service/src/main/inse/works/search_client.py b/service/src/main/inse/works/search_client.py index 42b2ee8b..2e52a9a6 100644 --- a/service/src/main/inse/works/search_client.py +++ b/service/src/main/inse/works/search_client.py @@ -35,6 +35,7 @@ class OpenAlexWorksSearchClient: language: list[str] | None = None, institution_id: list[str] | None = None, topic_id: list[str] | None = None, + sort: str = "year", ) -> dict[str, Any]: indexed_author_id = f"https://openalex.org/{author_id.strip()}" filters = self._work_filters( @@ -73,6 +74,16 @@ class OpenAlexWorksSearchClient: }, }, }) + if sort == "citations": + sort_clauses = [ + {"cited_by_count": {"order": "desc", "missing": "_last"}}, + {"publication_year": {"order": "desc", "missing": "_last"}}, + ] + else: + sort_clauses = [ + {"publication_year": {"order": "desc", "missing": "_last"}}, + {"cited_by_count": {"order": "desc", "missing": "_last"}}, + ] return { "from": (page - 1) * size, "size": size, @@ -83,10 +94,7 @@ class OpenAlexWorksSearchClient: "filter": filters, }, }, - "sort": [ - {"publication_year": {"order": "desc", "missing": "_last"}}, - {"cited_by_count": {"order": "desc", "missing": "_last"}}, - ], + "sort": sort_clauses, } def _work_filters( @@ -130,6 +138,7 @@ class OpenAlexWorksSearchClient: language: list[str] | None = None, institution_id: list[str] | None = None, topic_id: list[str] | None = None, + sort: str = "year", ) -> dict[str, Any]: if not self.api_key: raise MissingApiKeyError("OpenAlex works Elasticsearch API key is not configured.") @@ -143,6 +152,7 @@ class OpenAlexWorksSearchClient: language=language, institution_id=institution_id, topic_id=topic_id, + sort=sort, ) return await elasticsearch.search(index=self.index,body=body,cluster=ESCluster.NES,) diff --git a/service/src/main/inse/works/service.py b/service/src/main/inse/works/service.py index 382f3fd7..ead6daad 100644 --- a/service/src/main/inse/works/service.py +++ b/service/src/main/inse/works/service.py @@ -4,7 +4,7 @@ REST API for publication works. """ -from typing import Annotated, Optional +from typing import Annotated, Literal, Optional from fastapi import APIRouter from fastapi import Path @@ -54,6 +54,10 @@ async def get_author_works( list[str] | None, Query(description="Filter by OpenAlex topic id. Can be repeated."), ] = None, + sort: Annotated[ + Literal["year", "citations"], + Query(description="Sort order: by publication year or by citation count."), + ] = "year", ): return await logic.get_author_works( author_id, @@ -64,6 +68,7 @@ async def get_author_works( language=language, institution_id=institution_id, topic_id=topic_id, + sort=sort, ) diff --git a/service/src/main/inse/works/test_search_client.py b/service/src/main/inse/works/test_search_client.py index 2d9e2a41..1f3c905e 100644 --- a/service/src/main/inse/works/test_search_client.py +++ b/service/src/main/inse/works/test_search_client.py @@ -26,6 +26,28 @@ def test_author_works_query_searches_authorship_author_id(): assert query["query"]["bool"]["filter"] == [] +def test_author_works_query_sorts_by_year_by_default(): + client = OpenAlexWorksSearchClient(api_key="test-key") + + query = client.author_works_query("A5023888391", page=1, size=20) + + assert query["sort"] == [ + {"publication_year": {"order": "desc", "missing": "_last"}}, + {"cited_by_count": {"order": "desc", "missing": "_last"}}, + ] + + +def test_author_works_query_sorts_by_citations(): + client = OpenAlexWorksSearchClient(api_key="test-key") + + query = client.author_works_query("A5023888391", page=1, size=20, sort="citations") + + assert query["sort"] == [ + {"cited_by_count": {"order": "desc", "missing": "_last"}}, + {"publication_year": {"order": "desc", "missing": "_last"}}, + ] + + def test_author_works_query_adds_publication_filters(): client = OpenAlexWorksSearchClient(api_key="test-key") diff --git a/ude_person.http b/ude_person.http index 9354020f..94a219fb 100644 --- a/ude_person.http +++ b/ude_person.http @@ -1195,6 +1195,11 @@ Content-Type: application/json ### +GET https://project.nes.uni-due.de/elastic/openalex-works/_mapping +Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ== + +### + GET https://project.nes.uni-due.de/elastic/openalex-works/_search Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ== Content-Type: application/json diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 65898fe8..b319bc66 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -36,6 +36,7 @@ model/authorNetworkNode.ts model/authorParsedLongestName.ts model/authorPositionCount.ts model/authorSummaryStats.ts +model/authorWorkPurposes.ts model/authorsFilterProperties.ts model/authorsListResponse.ts model/authorship.ts @@ -132,6 +133,8 @@ model/institutionsListResponse.ts model/ipcClassification.ts model/keywordEntry.ts model/keywordEntryWithTopic.ts +model/keywordPatentMatch.ts +model/keywordPatentSearchItem.ts model/keywordTopicMatch.ts model/keywords.ts model/keywordsRequest.ts @@ -152,6 +155,7 @@ model/newsArticle.ts model/newsArticleDetail.ts model/newsPage.ts model/openAccess.ts +model/openAlexTopicTag.ts model/orgPatentEntry.ts model/orgPatentsResponse.ts model/organizationPage.ts @@ -159,6 +163,8 @@ model/otkResponse.ts model/patentEntry.ts model/patentsByAuthorResponse.ts model/patentsByInstitutionResponse.ts +model/patentsByKeywordsRequest.ts +model/patentsByKeywordsResponse.ts model/personBio.ts model/projectType.ts model/projectsFilteringProperties.ts @@ -167,8 +173,10 @@ model/publicationDetailByFunder.ts model/publicationIdsByAuthorPosition.ts model/publicationsByAuthorResponse.ts model/rankingResponse.ts +model/rebuildResponse.ts model/score.ts model/sortDirection.ts +model/specificWorkPurpose.ts model/tokenType.ts model/topInstitutionItem.ts model/topic.ts @@ -203,6 +211,7 @@ model/workKeyword.ts model/workMeshInner.ts model/workNetworkNode.ts model/workPage.ts +model/workPurpose.ts model/workSustainableDevelopmentGoalsInner.ts model/workTopic.ts model/workTopicDomain.ts 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.base.service.ts b/webapp/src/app/api/api.base.service.ts index d9ec8f2e..dcf56358 100644 --- a/webapp/src/app/api/api.base.service.ts +++ b/webapp/src/app/api/api.base.service.ts @@ -1,109 +1,83 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ -import { - HttpHeaders, - HttpParams, - HttpParameterCodec, -} from '@angular/common/http'; +import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from './encoder'; import { Configuration } from './configuration'; export class BaseService { - protected basePath = 'http://localhost:8000'; - public defaultHeaders = new HttpHeaders(); - public configuration: Configuration; - public encoder: HttpParameterCodec; + protected basePath = 'http://localhost:8000'; + public defaultHeaders = new HttpHeaders(); + public configuration: Configuration; + public encoder: HttpParameterCodec; - constructor(basePath?: string | string[], configuration?: Configuration) { - this.configuration = configuration || new Configuration(); - if (typeof this.configuration.basePath !== 'string') { - const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined; - if (firstBasePath != undefined) { - basePath = firstBasePath; - } + constructor(basePath?: string|string[], configuration?: Configuration) { + this.configuration = configuration || new Configuration(); + if (typeof this.configuration.basePath !== 'string') { + const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined; + if (firstBasePath != undefined) { + basePath = firstBasePath; + } - if (typeof basePath !== 'string') { - basePath = this.basePath; - } - this.configuration.basePath = basePath; - } - this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); - } - - protected canConsumeForm(consumes: string[]): boolean { - return consumes.indexOf('multipart/form-data') !== -1; - } - - protected addToHttpParams( - httpParams: HttpParams, - value: any, - key?: string, - isDeep: boolean = false, - ): HttpParams { - // If the value is an object (but not a Date), recursively add its keys. - if (typeof value === 'object' && !(value instanceof Date)) { - return this.addToHttpParamsRecursive( - httpParams, - value, - isDeep ? key : undefined, - isDeep, - ); - } - return this.addToHttpParamsRecursive(httpParams, value, key); - } - - protected addToHttpParamsRecursive( - httpParams: HttpParams, - value?: any, - key?: string, - isDeep: boolean = false, - ): HttpParams { - if (value === null || value === undefined) { - return httpParams; - } - if (typeof value === 'object') { - // If JSON format is preferred, key must be provided. - if (key != null) { - return isDeep - ? Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), - httpParams, - ) - : httpParams.append(key, JSON.stringify(value)); - } - // Otherwise, if it's an array, add each element. - if (Array.isArray(value)) { - value.forEach( - (elem) => - (httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)), - ); - } else if (value instanceof Date) { - if (key != null) { - httpParams = httpParams.append(key, value.toISOString()); - } else { - throw Error('key may not be null if value is Date'); + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } - } else { - Object.keys(value).forEach((k) => { - const paramKey = key ? `${key}.${k}` : k; - httpParams = this.addToHttpParamsRecursive( - httpParams, - value[k], - paramKey, - ); - }); - } - return httpParams; - } else if (key != null) { - return httpParams.append(key, value); + this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); + } + + protected canConsumeForm(consumes: string[]): boolean { + return consumes.indexOf('multipart/form-data') !== -1; + } + + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep: boolean = false): HttpParams { + // If the value is an object (but not a Date), recursively add its keys. + if (typeof value === 'object' && !(value instanceof Date)) { + return this.addToHttpParamsRecursive(httpParams, value, isDeep ? key : undefined, isDeep); + } + return this.addToHttpParamsRecursive(httpParams, value, key); + } + + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep: boolean = false): HttpParams { + if (value === null || value === undefined) { + return httpParams; + } + if (typeof value === 'object') { + // If JSON format is preferred, key must be provided. + if (key != null) { + return isDeep + ? Object.keys(value as Record).reduce( + (hp, k) => hp.append(`${key}[${k}]`, value[k]), + httpParams, + ) + : httpParams.append(key, JSON.stringify(value)); + } + // Otherwise, if it's an array, add each element. + if (Array.isArray(value)) { + value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, value.toISOString()); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach(k => { + const paramKey = key ? `${key}.${k}` : k; + httpParams = this.addToHttpParamsRecursive(httpParams, value[k], paramKey); + }); + } + return httpParams; + } else if (key != null) { + return httpParams.append(key, value); + } + throw Error("key may not be null if value is not object or array"); } - throw Error('key may not be null if value is not object or array'); - } } diff --git a/webapp/src/app/api/api.module.ts b/webapp/src/app/api/api.module.ts index e29250f2..58d341fb 100644 --- a/webapp/src/app/api/api.module.ts +++ b/webapp/src/app/api/api.module.ts @@ -1,42 +1,30 @@ -import { - NgModule, - ModuleWithProviders, - SkipSelf, - Optional, -} from '@angular/core'; +import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; import { Configuration } from './configuration'; import { HttpClient } from '@angular/common/http'; + @NgModule({ - imports: [], + imports: [], declarations: [], - exports: [], - providers: [], + exports: [], + providers: [] }) export class ApiModule { - public static forRoot( - configurationFactory: () => Configuration, - ): ModuleWithProviders { - return { - ngModule: ApiModule, - providers: [{ provide: Configuration, useFactory: configurationFactory }], - }; - } + public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders { + return { + ngModule: ApiModule, + providers: [ { provide: Configuration, useFactory: configurationFactory } ] + }; + } - constructor( - @Optional() @SkipSelf() parentModule: ApiModule, - @Optional() http: HttpClient, - ) { - if (parentModule) { - throw new Error( - 'ApiModule is already loaded. Import in your base AppModule only.', - ); + constructor( @Optional() @SkipSelf() parentModule: ApiModule, + @Optional() http: HttpClient) { + if (parentModule) { + throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); + } + if (!http) { + throw new Error('You need to import the HttpClientModule in your AppModule! \n' + + 'See also https://github.com/angular/angular/issues/20575'); + } } - if (!http) { - throw new Error( - 'You need to import the HttpClientModule in your AppModule! \n' + - 'See also https://github.com/angular/angular/issues/20575', - ); - } - } } diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index 673b93bb..64e95400 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -28,20 +28,4 @@ export * from './universityRankings.service'; import { UniversityRankingsService } from './universityRankings.service'; export * from './works.service'; import { WorksService } from './works.service'; -export const APIS = [ - AuthService, - CompanyConnectionsService, - FundingService, - INSEServiceService, - InstitutionsService, - KeywordsService, - NewsService, - OrganizationService, - PatentsService, - PersonNetworkService, - PersonsService, - ProjectsService, - TopicsService, - UniversityRankingsService, - WorksService, -]; +export const APIS = [AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, KeywordsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, UniversityRankingsService, WorksService]; diff --git a/webapp/src/app/api/api/auth.service.ts b/webapp/src/app/api/api/auth.service.ts index f3d264dc..a906d12f 100644 --- a/webapp/src/app/api/api/auth.service.ts +++ b/webapp/src/app/api/api/auth.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 { AccessResponse } from '../model/accessResponse'; @@ -56,1747 +50,964 @@ import { OtkResponse } from '../model/otkResponse'; import { UpdateAccountRequest } from '../model/updateAccountRequest'; // @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 AuthService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Change Password - * Change the user\'s password and invalidate existing tokens. - * @endpoint post /api/auth/v2/change-password - * @param bodyChangePassword - * @param secureFgpAcc - * @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 changePassword( - bodyChangePassword: BodyChangePassword, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public changePassword( - bodyChangePassword: BodyChangePassword, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public changePassword( - bodyChangePassword: BodyChangePassword, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public changePassword( - bodyChangePassword: BodyChangePassword, - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (bodyChangePassword === null || bodyChangePassword === undefined) { - throw new Error( - 'Required parameter bodyChangePassword was null or undefined when calling changePassword.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Change Password + * Change the user\'s password and invalidate existing tokens. + * @endpoint post /api/auth/v2/change-password + * @param bodyChangePassword + * @param secureFgpAcc + * @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 changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public changePassword(bodyChangePassword: BodyChangePassword, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyChangePassword === null || bodyChangePassword === undefined) { + throw new Error('Required parameter bodyChangePassword was null or undefined when calling changePassword.'); + } - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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 (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/auth/v2/change-password`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyChangePassword, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Create Account + * @endpoint post /api/accounts + * @param createAccountRequest + * @param secureFgpAcc + * @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 createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createAccount(createAccountRequest: CreateAccountRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (createAccountRequest === null || createAccountRequest === undefined) { + throw new Error('Required parameter createAccountRequest was null or undefined when calling createAccount.'); + } - 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 (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/accounts`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: createAccountRequest, + 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'; - } + /** + * Delete Account + * @endpoint delete /api/accounts/{account_id} + * @param accountId + * @param secureFgpAcc + * @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 deleteAccount(accountId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteAccount(accountId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteAccount(accountId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteAccount(accountId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (accountId === null || accountId === undefined) { + throw new Error('Required parameter accountId was null or undefined when calling deleteAccount.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/accounts/${this.configuration.encodeParam({name: "accountId", value: accountId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`; + 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 localVarPath = `/api/auth/v2/change-password`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: bodyChangePassword, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } + /** + * Get Access Token + * Retrieve an access token for the authenticated user. + * @endpoint post /api/auth/v2/access + * @param bodyGetAccessToken + * @param idToken + * @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 getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAccessToken(bodyGetAccessToken: BodyGetAccessToken, idToken?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyGetAccessToken === null || bodyGetAccessToken === undefined) { + throw new Error('Required parameter bodyGetAccessToken was null or undefined when calling getAccessToken.'); + } - /** - * Create Account - * @endpoint post /api/accounts - * @param createAccountRequest - * @param secureFgpAcc - * @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 createAccount( - createAccountRequest: CreateAccountRequest, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public createAccount( - createAccountRequest: CreateAccountRequest, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public createAccount( - createAccountRequest: CreateAccountRequest, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public createAccount( - createAccountRequest: CreateAccountRequest, - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (createAccountRequest === null || createAccountRequest === undefined) { - throw new Error( - 'Required parameter createAccountRequest was null or undefined when calling createAccount.', - ); + 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/auth/v2/access`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyGetAccessToken, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Get Current Account + * @endpoint get /api/accounts/me + * @param secureFgpAcc + * @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 getCurrentAccount(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getCurrentAccount(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCurrentAccount(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getCurrentAccount(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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 (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/accounts/me`; + 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(); + /** + * Health Check + * @endpoint get /api/auth/v2/health + * @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 healthCheckApiAuthV2HealthGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public healthCheckApiAuthV2HealthGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public healthCheckApiAuthV2HealthGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public healthCheckApiAuthV2HealthGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - 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; + + + 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/auth/v2/health`; + 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 responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if ( - this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected) - ) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } + /** + * List Organizations + * @endpoint get /api/accounts/organizations + * @param secureFgpAcc + * @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 listAccountOrganizations(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listAccountOrganizations(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listAccountOrganizations(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public listAccountOrganizations(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/accounts/organizations`; + 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/accounts`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: createAccountRequest, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * List Accounts + * @endpoint get /api/accounts + * @param page + * @param pageSize + * @param offset + * @param search + * @param organizationId + * @param secureFgpAcc + * @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 listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public listAccounts(page?: number, pageSize?: number, offset?: number, search?: string, organizationId?: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Delete Account - * @endpoint delete /api/accounts/{account_id} - * @param accountId - * @param secureFgpAcc - * @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 deleteAccount( - accountId: string, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public deleteAccount( - accountId: string, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteAccount( - accountId: string, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteAccount( - accountId: string, - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (accountId === null || accountId === undefined) { - throw new Error( - 'Required parameter accountId was null or undefined when calling deleteAccount.', - ); + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + offset, 'offset'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + search, 'search'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + organizationId, 'organization_id'); + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/accounts`; + 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; + /** + * Login with One-Time Key + * Login using a one-time key (OTK) sent to the user\'s email. + * @endpoint post /api/auth/v2/login + * @param bodyLogin + * @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 login(bodyLogin: BodyLogin, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public login(bodyLogin: BodyLogin, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public login(bodyLogin: BodyLogin, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public login(bodyLogin: BodyLogin, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyLogin === null || bodyLogin === undefined) { + throw new Error('Required parameter bodyLogin was null or undefined when calling login.'); + } - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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, - ); + 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/auth/v2/login`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyLogin, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Logout + * Logout the authenticated user. + * @endpoint post /api/auth/v2/logout + * @param secureFgpAcc + * @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 logout(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public logout(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public logout(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public logout(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - 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'; - } + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/auth/v2/logout`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/accounts/${this.configuration.encodeParam({ name: 'accountId', value: accountId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`; - 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, - }, - ); - } + /** + * Refresh Access Token + * Refresh the access token using a valid refresh token. + * @endpoint post /api/auth/v2/refresh + * @param refreshToken + * @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 refreshAccessToken(refreshToken?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public refreshAccessToken(refreshToken?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public refreshAccessToken(refreshToken?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public refreshAccessToken(refreshToken?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - /** - * Get Access Token - * Retrieve an access token for the authenticated user. - * @endpoint post /api/auth/v2/access - * @param bodyGetAccessToken - * @param idToken - * @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 getAccessToken( - bodyGetAccessToken: BodyGetAccessToken, - idToken?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAccessToken( - bodyGetAccessToken: BodyGetAccessToken, - idToken?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAccessToken( - bodyGetAccessToken: BodyGetAccessToken, - idToken?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAccessToken( - bodyGetAccessToken: BodyGetAccessToken, - idToken?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (bodyGetAccessToken === null || bodyGetAccessToken === undefined) { - throw new Error( - 'Required parameter bodyGetAccessToken was null or undefined when calling getAccessToken.', - ); + 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/auth/v2/refresh`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * Request One-Time Key + * Request a one-time key (OTK) for authentication using email and password. + * @endpoint post /api/auth/v2/request-otk + * @param bodyRequestOtk + * @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 requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public requestOtk(bodyRequestOtk: BodyRequestOtk, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public requestOtk(bodyRequestOtk: BodyRequestOtk, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyRequestOtk === null || bodyRequestOtk === undefined) { + throw new Error('Required parameter bodyRequestOtk was null or undefined when calling requestOtk.'); + } - 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/auth/v2/request-otk`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyRequestOtk, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Request Password Reset + * Request a one-time password reset link for the given email address. + * @endpoint post /api/auth/v2/request-password-reset + * @param bodyRequestPasswordReset + * @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 requestPasswordReset(bodyRequestPasswordReset: BodyRequestPasswordReset, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public requestPasswordReset(bodyRequestPasswordReset: BodyRequestPasswordReset, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public requestPasswordReset(bodyRequestPasswordReset: BodyRequestPasswordReset, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public requestPasswordReset(bodyRequestPasswordReset: BodyRequestPasswordReset, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyRequestPasswordReset === null || bodyRequestPasswordReset === undefined) { + throw new Error('Required parameter bodyRequestPasswordReset was null or undefined when calling requestPasswordReset.'); + } - 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/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/auth/v2/request-password-reset`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyRequestPasswordReset, + 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'; - } + /** + * Reset Password + * Reset the user\'s password using a one-time password reset token. + * @endpoint post /api/auth/v2/reset-password + * @param bodyResetPassword + * @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 resetPassword(bodyResetPassword: BodyResetPassword, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public resetPassword(bodyResetPassword: BodyResetPassword, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public resetPassword(bodyResetPassword: BodyResetPassword, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public resetPassword(bodyResetPassword: BodyResetPassword, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (bodyResetPassword === null || bodyResetPassword === undefined) { + throw new Error('Required parameter bodyResetPassword was null or undefined when calling resetPassword.'); + } + + 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/auth/v2/reset-password`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: bodyResetPassword, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarPath = `/api/auth/v2/access`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: bodyGetAccessToken, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Update Account + * @endpoint put /api/accounts/{account_id} + * @param accountId + * @param updateAccountRequest + * @param secureFgpAcc + * @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 updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateAccount(accountId: string, updateAccountRequest: UpdateAccountRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (accountId === null || accountId === undefined) { + throw new Error('Required parameter accountId was null or undefined when calling updateAccount.'); + } + if (updateAccountRequest === null || updateAccountRequest === undefined) { + throw new Error('Required parameter updateAccountRequest was null or undefined when calling updateAccount.'); + } - /** - * Get Current Account - * @endpoint get /api/accounts/me - * @param secureFgpAcc - * @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 getCurrentAccount( - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getCurrentAccount( - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCurrentAccount( - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getCurrentAccount( - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; + let localVarHeaders = this.defaultHeaders; - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - 'Authorization', - localVarHeaders, - 'Bearer ', - ); + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer '); - 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; + + + // 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/accounts/${this.configuration.encodeParam({name: "accountId", value: accountId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: updateAccountRequest, + 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/accounts/me`; - 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, - }, - ); - } - - /** - * Health Check - * @endpoint get /api/auth/v2/health - * @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 healthCheckApiAuthV2HealthGet( - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public healthCheckApiAuthV2HealthGet( - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public healthCheckApiAuthV2HealthGet( - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public healthCheckApiAuthV2HealthGet( - 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/auth/v2/health`; - 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, - }); - } - - /** - * List Organizations - * @endpoint get /api/accounts/organizations - * @param secureFgpAcc - * @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 listAccountOrganizations( - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listAccountOrganizations( - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable< - HttpResponse> - >; - public listAccountOrganizations( - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable< - HttpEvent> - >; - public listAccountOrganizations( - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; - - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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/accounts/organizations`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request< - Array - >('get', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * List Accounts - * @endpoint get /api/accounts - * @param page - * @param pageSize - * @param offset - * @param search - * @param organizationId - * @param secureFgpAcc - * @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 listAccounts( - page?: number, - pageSize?: number, - offset?: number, - search?: string, - organizationId?: string, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public listAccounts( - page?: number, - pageSize?: number, - offset?: number, - search?: string, - organizationId?: string, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listAccounts( - page?: number, - pageSize?: number, - offset?: number, - search?: string, - organizationId?: string, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public listAccounts( - page?: number, - pageSize?: number, - offset?: number, - search?: string, - organizationId?: string, - secureFgpAcc?: 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, - 'page_size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - offset, - 'offset', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - search, - 'search', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - organizationId, - 'organization_id', - ); - - let localVarHeaders = this.defaultHeaders; - - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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/accounts`; - 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, - }, - ); - } - - /** - * Login with One-Time Key - * Login using a one-time key (OTK) sent to the user\'s email. - * @endpoint post /api/auth/v2/login - * @param bodyLogin - * @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 login( - bodyLogin: BodyLogin, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public login( - bodyLogin: BodyLogin, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public login( - bodyLogin: BodyLogin, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public login( - bodyLogin: BodyLogin, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (bodyLogin === null || bodyLogin === undefined) { - throw new Error( - 'Required parameter bodyLogin was null or undefined when calling login.', - ); - } - - 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/auth/v2/login`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: bodyLogin, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Logout - * Logout the authenticated user. - * @endpoint post /api/auth/v2/logout - * @param secureFgpAcc - * @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 logout( - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public logout( - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public logout( - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public logout( - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarHeaders = this.defaultHeaders; - - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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/auth/v2/logout`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * Refresh Access Token - * Refresh the access token using a valid refresh token. - * @endpoint post /api/auth/v2/refresh - * @param refreshToken - * @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 refreshAccessToken( - refreshToken?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public refreshAccessToken( - refreshToken?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public refreshAccessToken( - refreshToken?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public refreshAccessToken( - refreshToken?: string, - 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/auth/v2/refresh`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Request One-Time Key - * Request a one-time key (OTK) for authentication using email and password. - * @endpoint post /api/auth/v2/request-otk - * @param bodyRequestOtk - * @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 requestOtk( - bodyRequestOtk: BodyRequestOtk, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public requestOtk( - bodyRequestOtk: BodyRequestOtk, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public requestOtk( - bodyRequestOtk: BodyRequestOtk, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public requestOtk( - bodyRequestOtk: BodyRequestOtk, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (bodyRequestOtk === null || bodyRequestOtk === undefined) { - throw new Error( - 'Required parameter bodyRequestOtk was null or undefined when calling requestOtk.', - ); - } - - 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/auth/v2/request-otk`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: bodyRequestOtk, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } - - /** - * Request Password Reset - * Request a one-time password reset link for the given email address. - * @endpoint post /api/auth/v2/request-password-reset - * @param bodyRequestPasswordReset - * @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 requestPasswordReset( - bodyRequestPasswordReset: BodyRequestPasswordReset, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public requestPasswordReset( - bodyRequestPasswordReset: BodyRequestPasswordReset, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public requestPasswordReset( - bodyRequestPasswordReset: BodyRequestPasswordReset, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public requestPasswordReset( - bodyRequestPasswordReset: BodyRequestPasswordReset, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if ( - bodyRequestPasswordReset === null || - bodyRequestPasswordReset === undefined - ) { - throw new Error( - 'Required parameter bodyRequestPasswordReset was null or undefined when calling requestPasswordReset.', - ); - } - - 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; - - 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/auth/v2/request-password-reset`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: bodyRequestPasswordReset, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * Reset Password - * Reset the user's password using a one-time password reset token. - * @endpoint post /api/auth/v2/reset-password - * @param bodyResetPassword - * @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 resetPassword( - bodyResetPassword: BodyResetPassword, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public resetPassword( - bodyResetPassword: BodyResetPassword, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public resetPassword( - bodyResetPassword: BodyResetPassword, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public resetPassword( - bodyResetPassword: BodyResetPassword, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (bodyResetPassword === null || bodyResetPassword === undefined) { - throw new Error( - 'Required parameter bodyResetPassword was null or undefined when calling resetPassword.', - ); - } - - 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; - - 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/auth/v2/reset-password`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, { - context: localVarHttpContext, - body: bodyResetPassword, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }); - } - - /** - * Update Account - * @endpoint put /api/accounts/{account_id} - * @param accountId - * @param updateAccountRequest - * @param secureFgpAcc - * @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 updateAccount( - accountId: string, - updateAccountRequest: UpdateAccountRequest, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public updateAccount( - accountId: string, - updateAccountRequest: UpdateAccountRequest, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public updateAccount( - accountId: string, - updateAccountRequest: UpdateAccountRequest, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public updateAccount( - accountId: string, - updateAccountRequest: UpdateAccountRequest, - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (accountId === null || accountId === undefined) { - throw new Error( - 'Required parameter accountId was null or undefined when calling updateAccount.', - ); - } - if (updateAccountRequest === null || updateAccountRequest === undefined) { - throw new Error( - 'Required parameter updateAccountRequest was null or undefined when calling updateAccount.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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/accounts/${this.configuration.encodeParam({ name: 'accountId', value: accountId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'put', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: updateAccountRequest, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } } 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/iNSEService.service.ts b/webapp/src/app/api/api/iNSEService.service.ts index da26fff7..1149c309 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,355 +9,205 @@ */ /* 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'; // @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); - } - /** - * Builds the topic hierarchy cache. - * @endpoint get /api/inse-service/topics/cache - * @param pageSize Page size for each search page. - * @param saveJson Persist cache JSON to data folder. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public buildTopicCache( - pageSize?: number, - saveJson?: boolean, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - pageSize, - 'page_size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - saveJson, - 'save_json', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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 localVarTransferCache: boolean = options?.transferCache ?? true; + 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; - 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 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 + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * 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 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}); + if (topic) { + topic.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topic'); + }) + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/topics/count`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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 { - 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/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 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 { - 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, - }, - ); - } } diff --git a/webapp/src/app/api/api/institutions.service.ts b/webapp/src/app/api/api/institutions.service.ts index b837e00e..641a3b13 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'; @@ -34,591 +28,295 @@ import { InstitutionPage } from '../model/institutionPage'; import { InstitutionsListResponse } from '../model/institutionsListResponse'; // @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 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 { - /** - * 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, + 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 + } + ); } - let localVarHeaders = this.defaultHeaders; + /** + * 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 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, + 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 + } + ); } - 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, - }, - ); - } - - /** - * 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/keywords.service.ts b/webapp/src/app/api/api/keywords.service.ts index 172d077c..fa73019b 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'; @@ -28,135 +22,155 @@ import { ExtractedKeywordsResponse } from '../model/extractedKeywordsResponse'; import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore import { KeywordsRequest } from '../model/keywordsRequest'; +// @ts-ignore +import { PatentsByKeywordsRequest } from '../model/patentsByKeywordsRequest'; +// @ts-ignore +import { PatentsByKeywordsResponse } from '../model/patentsByKeywordsResponse'; // @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(); + /** + * Find patents matching extracted OpenAlex keywords. + * @endpoint post /api/inse-service/keywords/patents + * @param patentsByKeywordsRequest + * @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 getPatentsByKeywords(patentsByKeywordsRequest: PatentsByKeywordsRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentsByKeywords(patentsByKeywordsRequest: PatentsByKeywordsRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByKeywords(patentsByKeywordsRequest: PatentsByKeywordsRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentsByKeywords(patentsByKeywordsRequest: PatentsByKeywordsRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (patentsByKeywordsRequest === null || patentsByKeywordsRequest === undefined) { + throw new Error('Required parameter patentsByKeywordsRequest was null or undefined when calling getPatentsByKeywords.'); + } - 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/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/patents`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: patentsByKeywordsRequest, + 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'; - } - } - - 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 eb6e0f11..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,1151 +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 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 { - 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, - }, - ); - } - - /** - * 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 { - 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, - }, - ); - } - - /** - * 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.', - ); - } - - 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, - }, - ); - } - - /** - * 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.', - ); - } - - 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, - }, - ); - } } diff --git a/webapp/src/app/api/api/organization.service.ts b/webapp/src/app/api/api/organization.service.ts index 4315e7c1..14fb942d 100644 --- a/webapp/src/app/api/api/organization.service.ts +++ b/webapp/src/app/api/api/organization.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 { CreateOrganizationRequest } from '../model/createOrganizationRequest'; @@ -34,545 +28,287 @@ import { OrganizationPage } from '../model/organizationPage'; import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest'; // @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 OrganizationService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Create Organization - * @endpoint post /api/organizations - * @param createOrganizationRequest - * @param secureFgpAcc - * @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 createOrganisation( - createOrganizationRequest: CreateOrganizationRequest, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public createOrganisation( - createOrganizationRequest: CreateOrganizationRequest, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable< - HttpResponse - >; - public createOrganisation( - createOrganizationRequest: CreateOrganizationRequest, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public createOrganisation( - createOrganizationRequest: CreateOrganizationRequest, - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if ( - createOrganizationRequest === null || - createOrganizationRequest === undefined - ) { - throw new Error( - 'Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.', - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - let localVarHeaders = this.defaultHeaders; + /** + * Create Organization + * @endpoint post /api/organizations + * @param createOrganizationRequest + * @param secureFgpAcc + * @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 createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (createOrganizationRequest === null || createOrganizationRequest === undefined) { + throw new Error('Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.'); + } - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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 (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/organizations`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: createOrganizationRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Delete Organization + * @endpoint delete /api/organizations/{organization_id} + * @param organizationId + * @param secureFgpAcc + * @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 deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (organizationId === null || organizationId === undefined) { + throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganisation.'); + } - 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 (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`; + 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'; - } + /** + * Get Organizations + * @endpoint get /api/organizations + * @param page + * @param pageSize + * @param offset + * @param secureFgpAcc + * @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 getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: 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, 'page_size'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + offset, 'offset'); + + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/organizations`; + 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/organizations`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'post', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: createOrganizationRequest, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined - ? { transferCache: localVarTransferCache } - : {}), - reportProgress: reportProgress, - }, - ); - } + /** + * Update Organization + * @endpoint put /api/organizations/{organization_id} + * @param organizationId + * @param updateOrganizationRequest + * @param secureFgpAcc + * @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 updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (organizationId === null || organizationId === undefined) { + throw new Error('Required parameter organizationId was null or undefined when calling updateOrganisation.'); + } + if (updateOrganizationRequest === null || updateOrganizationRequest === undefined) { + throw new Error('Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.'); + } - /** - * Delete Organization - * @endpoint delete /api/organizations/{organization_id} - * @param organizationId - * @param secureFgpAcc - * @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 deleteOrganisation( - organizationId: string, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public deleteOrganisation( - organizationId: string, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteOrganisation( - organizationId: string, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public deleteOrganisation( - organizationId: string, - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (organizationId === null || organizationId === undefined) { - throw new Error( - 'Required parameter organizationId was null or undefined when calling deleteOrganisation.', - ); + let localVarHeaders = this.defaultHeaders; + + // authentication (HTTPBearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', '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/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('put', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + body: updateOrganizationRequest, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - let localVarHeaders = this.defaultHeaders; - - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`; - 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, - }, - ); - } - - /** - * Get Organizations - * @endpoint get /api/organizations - * @param page - * @param pageSize - * @param offset - * @param secureFgpAcc - * @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 getOrganisations( - page?: number, - pageSize?: number, - offset?: number, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getOrganisations( - page?: number, - pageSize?: number, - offset?: number, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getOrganisations( - page?: number, - pageSize?: number, - offset?: number, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getOrganisations( - page?: number, - pageSize?: number, - offset?: number, - secureFgpAcc?: 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, - 'page_size', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - offset, - 'offset', - ); - - let localVarHeaders = this.defaultHeaders; - - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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/organizations`; - 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, - }, - ); - } - - /** - * Update Organization - * @endpoint put /api/organizations/{organization_id} - * @param organizationId - * @param updateOrganizationRequest - * @param secureFgpAcc - * @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 updateOrganisation( - organizationId: string, - updateOrganizationRequest: UpdateOrganizationRequest, - secureFgpAcc?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public updateOrganisation( - organizationId: string, - updateOrganizationRequest: UpdateOrganizationRequest, - secureFgpAcc?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable< - HttpResponse - >; - public updateOrganisation( - organizationId: string, - updateOrganizationRequest: UpdateOrganizationRequest, - secureFgpAcc?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public updateOrganisation( - organizationId: string, - updateOrganizationRequest: UpdateOrganizationRequest, - secureFgpAcc?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (organizationId === null || organizationId === undefined) { - throw new Error( - 'Required parameter organizationId was null or undefined when calling updateOrganisation.', - ); - } - if ( - updateOrganizationRequest === null || - updateOrganizationRequest === undefined - ) { - throw new Error( - 'Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.', - ); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (HTTPBearer) required - localVarHeaders = this.configuration.addCredentialToHeaders( - 'HTTPBearer', - '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/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - 'put', - `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: updateOrganizationRequest, - 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 904279c3..ec6e9280 100644 --- a/webapp/src/app/api/api/patents.service.ts +++ b/webapp/src/app/api/api/patents.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 { AllPatentsResponse } from '../model/allPatentsResponse'; @@ -34,659 +28,403 @@ import { PatentEntry } from '../model/patentEntry'; import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse'; // @ts-ignore import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse'; +// @ts-ignore +import { RebuildResponse } from '../model/rebuildResponse'; // @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 PatentsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Get all patents with pagination and search. - * @endpoint get /api/inse-service/patents - * @param page - * @param size - * @param search - * @param source - * @param sortBy - * @param sortDirection - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAllPatents( - page?: number, - size?: number, - search?: string, - source?: string, - sortBy?: string, - sortDirection?: string, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - 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', - ); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = - options?.httpHeaderAccept ?? - this.configuration.selectHeaderAccept(['application/json']); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set( - 'Accept', - localVarHttpHeaderAcceptSelected, - ); + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * 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 { - const localVarTransferCache: boolean = options?.transferCache ?? true; + 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 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/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 + } + ); } - 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.'); + } - /** - * 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 + } + ); } - 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', - ); + /** + * Get a single patent by identifier with optional title fallback. + * @endpoint get /api/inse-service/patents/{identifier} + * @param identifier + * @param prefix + * @param title + * @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 getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPatentByIdOrTitle(identifier: string, prefix?: string, title?: string, fillingDate?: 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 getPatentByIdOrTitle.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + prefix, 'prefix'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + title, 'title'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + fillingDate, 'filling_date'); - 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/patents/${this.configuration.encodeParam({name: "identifier", value: identifier, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('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(); + /** + * 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.'); + } - 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/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 + } + ); } - 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 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.'); + } - /** - * 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. - */ - public getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getPatentByIdOrTitle( - identifier: string, - prefix?: string, - title?: string, - fillingDate?: 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 getPatentByIdOrTitle.', - ); + 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 + } + ); } - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - prefix, - 'prefix', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - title, - 'title', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - fillingDate, - 'filling_date', - ); + /** + * Trigger a background rebuild of the org_patents index for an institution. + * @endpoint post /api/inse-service/institutions/{id}/org-patents/rebuild + * @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 rebuildOrgPatents(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public rebuildOrgPatents(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public rebuildOrgPatents(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public rebuildOrgPatents(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 rebuildOrgPatents.'); + } - 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/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/org-patents/rebuild`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('post', `${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/patents/${this.configuration.encodeParam({ name: 'identifier', value: identifier, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request( - '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/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/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 5a51e233..ef7b0c7f 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'; @@ -34,929 +28,484 @@ import { KeywordsTopicsResponse } from '../model/keywordsTopicsResponse'; 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(); + /** + * 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.'); + } - const localVarTransferCache: boolean = options?.transferCache ?? true; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + searchType, 'searchType'); - 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; + + + // 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 + } + ); } - 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/api/universityRankings.service.ts b/webapp/src/app/api/api/universityRankings.service.ts index 4ed6111d..2039f87b 100644 --- a/webapp/src/app/api/api/universityRankings.service.ts +++ b/webapp/src/app/api/api/universityRankings.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 { AutocompleteLocationItem } from '../model/autocompleteLocationItem'; @@ -34,545 +28,296 @@ import { TopInstitutionItem } from '../model/topInstitutionItem'; import { TrendResponse } from '../model/trendResponse'; // @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 UniversityRankingsService extends BaseService { - constructor( - protected httpClient: HttpClient, - @Optional() @Inject(BASE_PATH) basePath: string | string[], - @Optional() configuration?: Configuration, - ) { - super(basePath, configuration); - } - /** - * Returns country and continent options for autocomplete inputs. - * @endpoint get /api/inse-service/university-rankings/autocomplete-locations - * @param query Query text to search for countries/continents - * @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 getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( - query: string, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( - query: string, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( - query: string, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet( - query: 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 getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet.', - ); + 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', - ); + /** + * Returns country and continent options for autocomplete inputs. + * @endpoint get /api/inse-service/university-rankings/autocomplete-locations + * @param query Query text to search for countries/continents + * @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 getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(query: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(query: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(query: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet(query: 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 getAutocompleteLocationsApiInseServiceUniversityRankingsAutocompleteLocationsGet.'); + } - let localVarHeaders = this.defaultHeaders; + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + 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 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/inse-service/university-rankings/autocomplete-locations`; - 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 display name or OpenAlex ID (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: string, - metric?: 'publications' | 'citations', - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: string, - metric?: 'publications' | 'citations', - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: string, - metric?: 'publications' | 'citations', - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getRankingsApiInseServiceUniversityRankingsGet( - topic: string, - 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 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, - 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 top institutions filtered by country/region and sorted by topic-level publications count. - * @endpoint get /api/inse-service/university-rankings/top-institutions - * @param topic Research topic - * @param region Region identifier (e.g. EU) - * @param country Country code (e.g. DE) - * @param limit Max suggestions 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 getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( - topic: string, - region?: string, - country?: string, - limit?: number, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( - topic: string, - region?: string, - country?: string, - limit?: number, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( - topic: string, - region?: string, - country?: string, - limit?: number, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>>; - public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet( - topic: string, - region?: string, - country?: string, - limit?: number, - 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 getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - topic, - 'topic', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - region, - 'region', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - country, - 'country', - ); - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - limit, - 'limit', - ); - - 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/top-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, - }, - ); - } - - /** - * Returns timeseries publication data for compared institutions, countries and regions. - * @endpoint get /api/inse-service/university-rankings/trend - * @param topics List of topics to analyze - * @param institutions List of OpenAlex Institution IDs - * @param countries List of country codes - * @param regions List of region identifiers - * @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 getTrendApiInseServiceUniversityRankingsTrendGet( - topics: Array, - institutions?: Array, - countries?: Array, - regions?: Array, - observe?: 'body', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable; - public getTrendApiInseServiceUniversityRankingsTrendGet( - topics: Array, - institutions?: Array, - countries?: Array, - regions?: Array, - observe?: 'response', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTrendApiInseServiceUniversityRankingsTrendGet( - topics: Array, - institutions?: Array, - countries?: Array, - regions?: Array, - observe?: 'events', - reportProgress?: boolean, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable>; - public getTrendApiInseServiceUniversityRankingsTrendGet( - topics: Array, - institutions?: Array, - countries?: Array, - regions?: Array, - observe: any = 'body', - reportProgress: boolean = false, - options?: { - httpHeaderAccept?: 'application/json'; - context?: HttpContext; - transferCache?: boolean; - }, - ): Observable { - if (topics === null || topics === undefined) { - throw new Error( - 'Required parameter topics was null or undefined when calling getTrendApiInseServiceUniversityRankingsTrendGet.', - ); - } - - let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); - if (topics) { - topics.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topics', + let localVarPath = `/api/inse-service/university-rankings/autocomplete-locations`; + 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 (institutions) { - institutions.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'institutions', + + /** + * Returns data for the University Ranking Dashboard. + * @endpoint get /api/inse-service/university-rankings + * @param topic Research topic display name or OpenAlex ID (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: string, metric?: 'publications' | 'citations', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getRankingsApiInseServiceUniversityRankingsGet(topic: string, metric?: 'publications' | 'citations', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet(topic: string, metric?: 'publications' | 'citations', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getRankingsApiInseServiceUniversityRankingsGet(topic: string, 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 + } ); - }); } - if (countries) { - countries.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'countries', + + /** + * Returns top institutions filtered by country/region and sorted by topic-level publications count. + * @endpoint get /api/inse-service/university-rankings/top-institutions + * @param topic Research topic + * @param region Region identifier (e.g. EU) + * @param country Country code (e.g. DE) + * @param limit Max suggestions 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 getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(topic: string, region?: string, country?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(topic: string, region?: string, country?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(topic: string, region?: string, country?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(topic: string, region?: string, country?: string, limit?: number, 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 getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + topic, 'topic'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + region, 'region'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + country, 'country'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + limit, 'limit'); + + 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/top-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 + } ); - }); } - if (regions) { - regions.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'regions', + + /** + * Returns timeseries publication data for compared institutions, countries and regions. + * @endpoint get /api/inse-service/university-rankings/trend + * @param topics List of topics to analyze + * @param institutions List of OpenAlex Institution IDs + * @param countries List of country codes + * @param regions List of region identifiers + * @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 getTrendApiInseServiceUniversityRankingsTrendGet(topics: Array, institutions?: Array, countries?: Array, regions?: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTrendApiInseServiceUniversityRankingsTrendGet(topics: Array, institutions?: Array, countries?: Array, regions?: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTrendApiInseServiceUniversityRankingsTrendGet(topics: Array, institutions?: Array, countries?: Array, regions?: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTrendApiInseServiceUniversityRankingsTrendGet(topics: Array, institutions?: Array, countries?: Array, regions?: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (topics === null || topics === undefined) { + throw new Error('Required parameter topics was null or undefined when calling getTrendApiInseServiceUniversityRankingsTrendGet.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (topics) { + topics.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'topics'); + }) + } + if (institutions) { + institutions.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'institutions'); + }) + } + if (countries) { + countries.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'countries'); + }) + } + if (regions) { + regions.forEach((element) => { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + element, 'regions'); + }) + } + + 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/trend`; + 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/university-rankings/trend`; - 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 ca494a80..6db4cd1a 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,22 +9,20 @@ */ /* 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 { AuthorWorkPurposes } from '../model/authorWorkPurposes'; // @ts-ignore import { HTTPValidationError } from '../model/hTTPValidationError'; // @ts-ignore +import { SpecificWorkPurpose } from '../model/specificWorkPurpose'; +// @ts-ignore import { TopicCount } from '../model/topicCount'; // @ts-ignore import { TopicsByTime } from '../model/topicsByTime'; @@ -36,664 +34,469 @@ 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.'); + } - 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/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 the purposes of an author based on their ID. + * @endpoint get /api/purpose/{raw_oa_author_id}/purposes + * @param rawOaAuthorId The raw OpenAlex author id. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getAuthorWorkPurposes(rawOaAuthorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getAuthorWorkPurposes(rawOaAuthorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorkPurposes(rawOaAuthorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getAuthorWorkPurposes(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 getAuthorWorkPurposes.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/purpose/${this.configuration.encodeParam({name: "rawOaAuthorId", value: rawOaAuthorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/purposes`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + 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 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 sort Sort order: by publication year or by citation count. + * @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, sort?: 'year' | 'citations', 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, sort?: 'year' | 'citations', 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, sort?: 'year' | 'citations', 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, sort?: 'year' | 'citations', 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'); + }) + } + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + sort, 'sort'); + + 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/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 (institutionId) { - institutionId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'institution_id', + + /** + * 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; + + 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 (topicId) { - topicId.forEach((element) => { - localVarQueryParameters = this.addToHttpParams( - localVarQueryParameters, - element, - 'topic_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; + + 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 + } ); - }); } - let localVarHeaders = this.defaultHeaders; + /** + * 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.'); + } - 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, + title, 'title'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/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 + } + ); } - const localVarHttpContext: HttpContext = - options?.context ?? new HttpContext(); + /** + * Returns the purpose of a work based on its ID. + * @endpoint get /api/purpose/{raw_oa_work_id}/purpose + * @param rawOaWorkId The raw OpenAlex work id. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getWorkPurpose(rawOaWorkId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getWorkPurpose(rawOaWorkId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWorkPurpose(rawOaWorkId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getWorkPurpose(rawOaWorkId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (rawOaWorkId === null || rawOaWorkId === undefined) { + throw new Error('Required parameter rawOaWorkId was null or undefined when calling getWorkPurpose.'); + } - 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/purpose/${this.configuration.encodeParam({name: "rawOaWorkId", value: rawOaWorkId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/purpose`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); } - 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; - - 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; - - 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; - - 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 17a7070e..2b8c80f7 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 HTTPBearer credential - if (!this.credentials['HTTPBearer']) { - this.credentials['HTTPBearer'] = () => { - 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 HTTPBearer credential + if (!this.credentials['HTTPBearer']) { + this.credentials['HTTPBearer'] = () => { + 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/accessResponse.ts b/webapp/src/app/api/model/accessResponse.ts index 2a188f73..6a36e872 100644 --- a/webapp/src/app/api/model/accessResponse.ts +++ b/webapp/src/app/api/model/accessResponse.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 { AccessToken } from './accessToken'; -export interface AccessResponse { - /** - * The access token issued upon successful authentication. - */ - access_token: AccessToken; + +export interface AccessResponse { + /** + * The access token issued upon successful authentication. + */ + access_token: AccessToken; } + diff --git a/webapp/src/app/api/model/accessToken.ts b/webapp/src/app/api/model/accessToken.ts index 405d3521..2c470009 100644 --- a/webapp/src/app/api/model/accessToken.ts +++ b/webapp/src/app/api/model/accessToken.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,42 +10,46 @@ import { TokenType } from './tokenType'; import { UserRole } from './userRole'; -export interface AccessToken { - /** - * The unique identifier of the real account associated with this token. - */ - real_account_id: string; - /** - * The timestamp indicating when the token will expire. - */ - expires_at: string; - /** - * The epoch value for the token. Used for versioning of tokens. - */ - epoch?: number; - /** - * The type of the token, which is always ACCESS_TOKEN for this class. - */ - token_type?: TokenType; - /** - * A unique fingerprint of the user, used for additional security checks. - */ - user_fingerprint_hash: string; - /** - * The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation. - */ - effective_account_id: string; - /** - * The specific role this access token grants within its organization. - */ - effective_role?: UserRole; - /** - * The unique identifier of the organization associated with this access token. - */ - effective_organization_id: string; - /** - * The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes. - */ - raw_token: string; + +export interface AccessToken { + /** + * The unique identifier of the real account associated with this token. + */ + real_account_id: string; + /** + * The timestamp indicating when the token will expire. + */ + expires_at: string; + /** + * The epoch value for the token. Used for versioning of tokens. + */ + epoch?: number; + /** + * The type of the token, which is always ACCESS_TOKEN for this class. + */ + token_type?: TokenType; + /** + * A unique fingerprint of the user, used for additional security checks. + */ + user_fingerprint_hash: string; + /** + * The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation. + */ + effective_account_id: string; + /** + * The specific role this access token grants within its organization. + */ + effective_role?: UserRole; + /** + * The unique identifier of the organization associated with this access token. + */ + effective_organization_id: string; + /** + * The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes. + */ + raw_token: string; } -export namespace AccessToken {} +export namespace AccessToken { +} + + diff --git a/webapp/src/app/api/model/accountPage.ts b/webapp/src/app/api/model/accountPage.ts index 64c7f969..c92c4ba3 100644 --- a/webapp/src/app/api/model/accountPage.ts +++ b/webapp/src/app/api/model/accountPage.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 { AccountProfile } from './accountProfile'; -export interface AccountPage { - items: Array; - total: number; - page: number; - page_size: number; + +export interface AccountPage { + items: Array; + total: number; + page: number; + page_size: number; } + diff --git a/webapp/src/app/api/model/accountProfile.ts b/webapp/src/app/api/model/accountProfile.ts index b40876f2..58adefb8 100644 --- a/webapp/src/app/api/model/accountProfile.ts +++ b/webapp/src/app/api/model/accountProfile.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,21 @@ */ import { UserRole } from './userRole'; -export interface AccountProfile { - id: string; - email: string; - name: string; - role: UserRole; - organization_id: string; - organization_name: string; - deleted: boolean; - activated: boolean; - is_current?: boolean; - is_real_account?: boolean; - is_impersonating?: boolean; + +export interface AccountProfile { + id: string; + email: string; + name: string; + role: UserRole; + organization_id: string; + organization_name: string; + deleted: boolean; + activated: boolean; + is_current?: boolean; + is_real_account?: boolean; + is_impersonating?: boolean; } -export namespace AccountProfile {} +export namespace AccountProfile { +} + + diff --git a/webapp/src/app/api/model/allPatentsResponse.ts b/webapp/src/app/api/model/allPatentsResponse.ts index f9b5e8ad..dfe6fb24 100644 --- a/webapp/src/app/api/model/allPatentsResponse.ts +++ b/webapp/src/app/api/model/allPatentsResponse.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 AllPatentsResponse { - total: number; - page: number; - size: number; - patents: Array; + +export interface AllPatentsResponse { + total: number; + page: number; + size: number; + patents: 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/authorWorkPurposes.ts b/webapp/src/app/api/model/authorWorkPurposes.ts new file mode 100644 index 00000000..bbe4289a --- /dev/null +++ b/webapp/src/app/api/model/authorWorkPurposes.ts @@ -0,0 +1,30 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { SpecificWorkPurpose } from './specificWorkPurpose'; + + +/** + * Represents the purposes of an author, including their ID and a list of specific work purposes. + */ +export interface AuthorWorkPurposes { + /** + * The raw OpenAlex author id. + */ + raw_oa_author_id: string; + /** + * The total number of works for the author. + */ + total?: number; + /** + * The list of specific work purposes. + */ + purposes?: Array; +} + 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/autocompleteLocationItem.ts b/webapp/src/app/api/model/autocompleteLocationItem.ts index b07e699e..56a10e09 100644 --- a/webapp/src/app/api/model/autocompleteLocationItem.ts +++ b/webapp/src/app/api/model/autocompleteLocationItem.ts @@ -1,23 +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 AutocompleteLocationItem { - id: string; - display_name: string; - code: string; - type: AutocompleteLocationItem.TypeEnum; + +export interface AutocompleteLocationItem { + id: string; + display_name: string; + code: string; + type: AutocompleteLocationItem.TypeEnum; } export namespace AutocompleteLocationItem { - export const TypeEnum = { - Country: 'country', - Continent: 'continent', - } as const; - export type TypeEnum = (typeof TypeEnum)[keyof typeof TypeEnum]; + export const TypeEnum = { + Country: 'country', + Continent: 'continent' + } as const; + export type TypeEnum = typeof TypeEnum[keyof typeof TypeEnum]; } + + 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/bodyChangePassword.ts b/webapp/src/app/api/model/bodyChangePassword.ts index c76bafc4..b6454f0e 100644 --- a/webapp/src/app/api/model/bodyChangePassword.ts +++ b/webapp/src/app/api/model/bodyChangePassword.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 BodyChangePassword { - /** - * Current password - */ - current_password: string; - /** - * New password - */ - new_password: string; + +export interface BodyChangePassword { + /** + * Current password + */ + current_password: string; + /** + * New password + */ + new_password: string; } + diff --git a/webapp/src/app/api/model/bodyGetAccessToken.ts b/webapp/src/app/api/model/bodyGetAccessToken.ts index 3314146a..8e5df2ed 100644 --- a/webapp/src/app/api/model/bodyGetAccessToken.ts +++ b/webapp/src/app/api/model/bodyGetAccessToken.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 BodyGetAccessToken { - /** - * User\'s account ID - */ - real_account_id: string; - /** - * Effective account ID for the access token - */ - effective_account_id: string; + +export interface BodyGetAccessToken { + /** + * User\'s account ID + */ + real_account_id: string; + /** + * Effective account ID for the access token + */ + effective_account_id: string; } + diff --git a/webapp/src/app/api/model/bodyLogin.ts b/webapp/src/app/api/model/bodyLogin.ts index e4e8efd6..f4022b0b 100644 --- a/webapp/src/app/api/model/bodyLogin.ts +++ b/webapp/src/app/api/model/bodyLogin.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 BodyLogin { - /** - * User\'s account ID - */ - account_id: string; - /** - * One-time code sent to user\'s email - */ - email_code: string; + +export interface BodyLogin { + /** + * User\'s account ID + */ + account_id: string; + /** + * One-time code sent to user\'s email + */ + email_code: string; } + diff --git a/webapp/src/app/api/model/bodyRequestOtk.ts b/webapp/src/app/api/model/bodyRequestOtk.ts index 1600a002..ba1a396d 100644 --- a/webapp/src/app/api/model/bodyRequestOtk.ts +++ b/webapp/src/app/api/model/bodyRequestOtk.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 BodyRequestOtk { - /** - * User\'s email address - */ - email: string; - /** - * User\'s password - */ - password: string; + +export interface BodyRequestOtk { + /** + * User\'s email address + */ + email: string; + /** + * User\'s password + */ + password: string; } + diff --git a/webapp/src/app/api/model/bodyRequestPasswordReset.ts b/webapp/src/app/api/model/bodyRequestPasswordReset.ts index c3f6d5d4..2c9b4b13 100644 --- a/webapp/src/app/api/model/bodyRequestPasswordReset.ts +++ b/webapp/src/app/api/model/bodyRequestPasswordReset.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 BodyRequestPasswordReset { - /** - * User's email address - */ - email: string; + +export interface BodyRequestPasswordReset { + /** + * User\'s email address + */ + email: string; } + diff --git a/webapp/src/app/api/model/bodyResetPassword.ts b/webapp/src/app/api/model/bodyResetPassword.ts index 0e3b74aa..03e63c44 100644 --- a/webapp/src/app/api/model/bodyResetPassword.ts +++ b/webapp/src/app/api/model/bodyResetPassword.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 BodyResetPassword { - /** - * Password reset token from the reset link - */ - reset_token: string; - /** - * New password - */ - new_password: string; + +export interface BodyResetPassword { + /** + * Password reset token from the reset link + */ + reset_token: string; + /** + * New password + */ + new_password: string; } + 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/createAccountRequest.ts b/webapp/src/app/api/model/createAccountRequest.ts index 320029cf..3be9003b 100644 --- a/webapp/src/app/api/model/createAccountRequest.ts +++ b/webapp/src/app/api/model/createAccountRequest.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,12 +9,16 @@ */ import { UserRole } from './userRole'; -export interface CreateAccountRequest { - email: string; - name: string; - role?: UserRole; - organization_id: string; - password: string; - openalex_person_id?: string | null; + +export interface CreateAccountRequest { + email: string; + name: string; + role?: UserRole; + organization_id: string; + password: string; + openalex_person_id?: string | null; } -export namespace CreateAccountRequest {} +export namespace CreateAccountRequest { +} + + diff --git a/webapp/src/app/api/model/createOrganizationRequest.ts b/webapp/src/app/api/model/createOrganizationRequest.ts index 94aacb80..fffb5457 100644 --- a/webapp/src/app/api/model/createOrganizationRequest.ts +++ b/webapp/src/app/api/model/createOrganizationRequest.ts @@ -1,14 +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 CreateOrganizationRequest { - name: string; - other_inst_id?: string | null; + +export interface CreateOrganizationRequest { + name: string; + other_inst_id?: string | null; } + 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/euCordisProjectResponse.ts b/webapp/src/app/api/model/euCordisProjectResponse.ts index f0dc272a..63e9084d 100644 --- a/webapp/src/app/api/model/euCordisProjectResponse.ts +++ b/webapp/src/app/api/model/euCordisProjectResponse.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 { EuProjectData } from './euProjectData'; + /** * Response model for EU Cordis project endpoints. */ -export interface EuCordisProjectResponse { - /** - * Indicates if the request was successful - */ - success: boolean; - project_type?: string | null; - eu_project_data?: EuProjectData | null; - error?: string | null; +export interface EuCordisProjectResponse { + /** + * Indicates if the request was successful + */ + success: boolean; + project_type?: string | null; + eu_project_data?: EuProjectData | null; + error?: string | null; } + 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/euProjectData.ts b/webapp/src/app/api/model/euProjectData.ts index 34639d19..6acedaf5 100644 --- a/webapp/src/app/api/model/euProjectData.ts +++ b/webapp/src/app/api/model/euProjectData.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 @@ -23,47 +23,49 @@ import { Fp7ReportSummary } from './fp7ReportSummary'; import { HEUReportSummary } from './hEUReportSummary'; import { HEUProjectDetails } from './hEUProjectDetails'; + /** * The project data */ -export interface EuProjectData { - acronym?: string; - contentUpdateDate?: string; - ecMaxContribution?: number; - ecSignatureDate?: string; - endDate?: string; - frameworkProgramme?: string; - fundingScheme?: string; - grantDoi?: string; - humanValidated?: boolean; - id?: string; - keywords?: string; - legalBasis?: string; - masterCall?: string; - nature?: string; - objective?: string; - rcn?: string; - startDate?: string; - status?: string; - subCall?: string; - title?: string; - topics?: string; - totalCost?: number; - organizations?: Array; - publications?: Array; - iprs?: Array; - report_summaries?: Array; - topicsList?: Array; - web_links?: Array; - eurosciVoc?: Array; - legalBasisList?: Array; - organizationCount?: number; - publicationCount?: number; - iprCount?: number; - deliverables?: Array; - reportSummaries?: Array; - webLinks?: Array; - ercPrincipalInvestigators?: Array; - deliverableCount?: number; - ercPiCount?: number; +export interface EuProjectData { + acronym?: string; + contentUpdateDate?: string; + ecMaxContribution?: number; + ecSignatureDate?: string; + endDate?: string; + frameworkProgramme?: string; + fundingScheme?: string; + grantDoi?: string; + humanValidated?: boolean; + id?: string; + keywords?: string; + legalBasis?: string; + masterCall?: string; + nature?: string; + objective?: string; + rcn?: string; + startDate?: string; + status?: string; + subCall?: string; + title?: string; + topics?: string; + totalCost?: number; + organizations?: Array; + publications?: Array; + iprs?: Array; + report_summaries?: Array; + topicsList?: Array; + web_links?: Array; + eurosciVoc?: Array; + legalBasisList?: Array; + organizationCount?: number; + publicationCount?: number; + iprCount?: number; + deliverables?: Array; + reportSummaries?: Array; + webLinks?: Array; + ercPrincipalInvestigators?: Array; + deliverableCount?: number; + ercPiCount?: number; } + diff --git a/webapp/src/app/api/model/extractedKeywords.ts b/webapp/src/app/api/model/extractedKeywords.ts index 4038c211..8e74c6e0 100644 --- a/webapp/src/app/api/model/extractedKeywords.ts +++ b/webapp/src/app/api/model/extractedKeywords.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 { KeywordEntryWithTopic } from './keywordEntryWithTopic'; -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; + +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; } + diff --git a/webapp/src/app/api/model/extractedKeywordsLLM.ts b/webapp/src/app/api/model/extractedKeywordsLLM.ts index b49b98d7..b12957f6 100644 --- a/webapp/src/app/api/model/extractedKeywordsLLM.ts +++ b/webapp/src/app/api/model/extractedKeywordsLLM.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 { 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; + +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 8fe10a5f..43731b7c 100644 --- a/webapp/src/app/api/model/extractedKeywordsResponse.ts +++ b/webapp/src/app/api/model/extractedKeywordsResponse.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,17 +10,19 @@ import { ExtractedKeywordsLLM } from './extractedKeywordsLLM'; import { ExtractedKeywords } from './extractedKeywords'; -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; + +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/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/fp7EurosciVoc.ts b/webapp/src/app/api/model/fp7EurosciVoc.ts index 14ae95bc..fb7e8deb 100644 --- a/webapp/src/app/api/model/fp7EurosciVoc.ts +++ b/webapp/src/app/api/model/fp7EurosciVoc.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. */ + /** * Fp7EurosciVoc */ -export interface Fp7EurosciVoc { - code?: string | null; - description?: string | null; - id?: string | null; - path?: string | null; - projectID?: string | null; - title?: string | null; +export interface Fp7EurosciVoc { + code?: string | null; + description?: string | null; + id?: string | null; + path?: string | null; + projectID?: string | null; + title?: string | null; } + diff --git a/webapp/src/app/api/model/fp7LegalBasis.ts b/webapp/src/app/api/model/fp7LegalBasis.ts index bf5ef53e..89a05742 100644 --- a/webapp/src/app/api/model/fp7LegalBasis.ts +++ b/webapp/src/app/api/model/fp7LegalBasis.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. */ + /** * Fp7LegalBasis */ -export interface Fp7LegalBasis { - id?: string | null; - legalBasis?: string | null; - projectID?: string | null; - title?: string | null; - uniqueProgrammePart?: string | null; +export interface Fp7LegalBasis { + id?: string | null; + legalBasis?: string | null; + projectID?: string | null; + title?: string | null; + uniqueProgrammePart?: string | null; } + diff --git a/webapp/src/app/api/model/fp7Organization.ts b/webapp/src/app/api/model/fp7Organization.ts index a46d9d02..2989a873 100644 --- a/webapp/src/app/api/model/fp7Organization.ts +++ b/webapp/src/app/api/model/fp7Organization.ts @@ -1,41 +1,43 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Fp7Organization */ -export interface Fp7Organization { - SME?: boolean | null; - active?: boolean | null; - activityType?: string | null; - city?: string | null; - contactForm?: string | null; - contentUpdateDate?: string | null; - country?: string | null; - ecContribution?: number | null; - endOfParticipation?: boolean | null; - geolocation?: string | null; - id?: string | null; - name?: string | null; - netEcContribution?: number | null; - nutsCode?: string | null; - order?: number | null; - organisationID?: string | null; - organizationURL?: string | null; - postCode?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - role?: string | null; - shortName?: string | null; - street?: string | null; - totalCost?: number | null; - vatNumber?: string | null; +export interface Fp7Organization { + SME?: boolean | null; + active?: boolean | null; + activityType?: string | null; + city?: string | null; + contactForm?: string | null; + contentUpdateDate?: string | null; + country?: string | null; + ecContribution?: number | null; + endOfParticipation?: boolean | null; + geolocation?: string | null; + id?: string | null; + name?: string | null; + netEcContribution?: number | null; + nutsCode?: string | null; + order?: number | null; + organisationID?: string | null; + organizationURL?: string | null; + postCode?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + role?: string | null; + shortName?: string | null; + street?: string | null; + totalCost?: number | null; + vatNumber?: string | null; } + diff --git a/webapp/src/app/api/model/fp7ProjectDetails.ts b/webapp/src/app/api/model/fp7ProjectDetails.ts index 034a986d..a7dce634 100644 --- a/webapp/src/app/api/model/fp7ProjectDetails.ts +++ b/webapp/src/app/api/model/fp7ProjectDetails.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,41 +16,43 @@ import { Fp7ProjectIPR } from './fp7ProjectIPR'; import { Fp7Organization } from './fp7Organization'; import { Fp7LegalBasis } from './fp7LegalBasis'; + /** * Comprehensive FP7 Project model combining all related entities. This model extends the base Fp7Project with all associated data. */ -export interface Fp7ProjectDetails { - acronym?: string | null; - contentUpdateDate?: string | null; - ecMaxContribution?: number | null; - ecSignatureDate?: string | null; - endDate?: string | null; - frameworkProgramme?: string | null; - fundingScheme?: string | null; - grantDoi?: string | null; - humanValidated?: boolean | null; - id?: string | null; - keywords?: string | null; - legalBasis?: string | null; - masterCall?: string | null; - nature?: string | null; - objective?: string | null; - rcn?: string | null; - startDate?: string | null; - status?: string | null; - subCall?: string | null; - title?: string | null; - topics?: string | null; - totalCost?: number | null; - organizations?: Array | null; - publications?: Array | null; - iprs?: Array | null; - report_summaries?: Array | null; - topicsList?: Array | null; - web_links?: Array | null; - eurosciVoc?: Array | null; - legalBasisList?: Array | null; - organizationCount?: number | null; - publicationCount?: number | null; - iprCount?: number | null; +export interface Fp7ProjectDetails { + acronym?: string | null; + contentUpdateDate?: string | null; + ecMaxContribution?: number | null; + ecSignatureDate?: string | null; + endDate?: string | null; + frameworkProgramme?: string | null; + fundingScheme?: string | null; + grantDoi?: string | null; + humanValidated?: boolean | null; + id?: string | null; + keywords?: string | null; + legalBasis?: string | null; + masterCall?: string | null; + nature?: string | null; + objective?: string | null; + rcn?: string | null; + startDate?: string | null; + status?: string | null; + subCall?: string | null; + title?: string | null; + topics?: string | null; + totalCost?: number | null; + organizations?: Array | null; + publications?: Array | null; + iprs?: Array | null; + report_summaries?: Array | null; + topicsList?: Array | null; + web_links?: Array | null; + eurosciVoc?: Array | null; + legalBasisList?: Array | null; + organizationCount?: number | null; + publicationCount?: number | null; + iprCount?: number | null; } + diff --git a/webapp/src/app/api/model/fp7ProjectIPR.ts b/webapp/src/app/api/model/fp7ProjectIPR.ts index 37040026..f35487c4 100644 --- a/webapp/src/app/api/model/fp7ProjectIPR.ts +++ b/webapp/src/app/api/model/fp7ProjectIPR.ts @@ -1,34 +1,36 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Fp7ProjectIPR */ -export interface Fp7ProjectIPR { - applicantName?: string | null; - applicationDate?: string | null; - applicationIdentifier?: string | null; - applicationKind?: string | null; - applicationPrefix?: string | null; - awardDate?: string | null; - awardIdentifier?: string | null; - awardKind?: string | null; - awardPrefix?: string | null; - epoAppUrl?: string | null; - epoPubUrl?: string | null; - id?: string | null; - organisationID?: string | null; - patentFamilyIdentifier?: string | null; - patentType?: string | null; - priorityDate?: string | null; - projectID?: string | null; - title?: string | null; - type?: string | null; +export interface Fp7ProjectIPR { + applicantName?: string | null; + applicationDate?: string | null; + applicationIdentifier?: string | null; + applicationKind?: string | null; + applicationPrefix?: string | null; + awardDate?: string | null; + awardIdentifier?: string | null; + awardKind?: string | null; + awardPrefix?: string | null; + epoAppUrl?: string | null; + epoPubUrl?: string | null; + id?: string | null; + organisationID?: string | null; + patentFamilyIdentifier?: string | null; + patentType?: string | null; + priorityDate?: string | null; + projectID?: string | null; + title?: string | null; + type?: string | null; } + diff --git a/webapp/src/app/api/model/fp7Publication.ts b/webapp/src/app/api/model/fp7Publication.ts index 34fba260..fd0e2491 100644 --- a/webapp/src/app/api/model/fp7Publication.ts +++ b/webapp/src/app/api/model/fp7Publication.ts @@ -1,33 +1,35 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * Fp7Publication */ -export interface Fp7Publication { - authors?: string | null; - collection?: string | null; - contentUpdateDate?: string | null; - doi?: string | null; - id?: string | null; - isPublishedAs?: string | null; - journalNumber?: string | null; - journalTitle?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - publishedPages?: string | null; - publishedYear?: number | null; - publisher?: string | null; - qaProcessedDoi?: string | null; - rcn?: string | null; - repositoryUrl?: string | null; - title?: string | null; - volume?: string | null; +export interface Fp7Publication { + authors?: string | null; + collection?: string | null; + contentUpdateDate?: string | null; + doi?: string | null; + id?: string | null; + isPublishedAs?: string | null; + journalNumber?: string | null; + journalTitle?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + publishedPages?: string | null; + publishedYear?: number | null; + publisher?: string | null; + qaProcessedDoi?: string | null; + rcn?: string | null; + repositoryUrl?: string | null; + title?: string | null; + volume?: string | null; } + diff --git a/webapp/src/app/api/model/fp7ReportSummary.ts b/webapp/src/app/api/model/fp7ReportSummary.ts index 084d2ba8..f0413439 100644 --- a/webapp/src/app/api/model/fp7ReportSummary.ts +++ b/webapp/src/app/api/model/fp7ReportSummary.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. */ + /** * Fp7ReportSummary */ -export interface Fp7ReportSummary { - attachments?: string | null; - contentUpdateDate?: string | null; - id?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - title?: string | null; +export interface Fp7ReportSummary { + attachments?: string | null; + contentUpdateDate?: string | null; + id?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + title?: string | null; } + diff --git a/webapp/src/app/api/model/fp7Topic.ts b/webapp/src/app/api/model/fp7Topic.ts index 4202cdb0..f39a021e 100644 --- a/webapp/src/app/api/model/fp7Topic.ts +++ b/webapp/src/app/api/model/fp7Topic.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. */ + /** * Fp7Topic */ -export interface Fp7Topic { - id?: string | null; - projectID?: string | null; - title?: string | null; - topic?: string | null; +export interface Fp7Topic { + id?: string | null; + projectID?: string | null; + title?: string | null; + topic?: string | null; } + diff --git a/webapp/src/app/api/model/fp7WebLink.ts b/webapp/src/app/api/model/fp7WebLink.ts index 67071bb8..eeaff7ab 100644 --- a/webapp/src/app/api/model/fp7WebLink.ts +++ b/webapp/src/app/api/model/fp7WebLink.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. */ + /** * Fp7WebLink */ -export interface Fp7WebLink { - archivedDate?: string | null; - availableLanguages?: string | null; - id?: string | null; - linkId?: string | null; - projectID?: string | null; - represents?: string | null; - source?: string | null; - status?: string | null; - type?: string | null; - url?: string | null; +export interface Fp7WebLink { + archivedDate?: string | null; + availableLanguages?: string | null; + id?: string | null; + linkId?: string | null; + projectID?: string | null; + represents?: string | null; + source?: string | null; + status?: string | null; + type?: string | null; + url?: string | 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/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/h2020Deliverable.ts b/webapp/src/app/api/model/h2020Deliverable.ts index ccb837a1..390d2c7a 100644 --- a/webapp/src/app/api/model/h2020Deliverable.ts +++ b/webapp/src/app/api/model/h2020Deliverable.ts @@ -1,23 +1,25 @@ /** * 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. */ + /** * H2020Deliverable */ -export interface H2020Deliverable { - collection?: string | null; - contentUpdateDate?: string | null; - deliverableType?: string | null; - description?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - url?: string | null; +export interface H2020Deliverable { + collection?: string | null; + contentUpdateDate?: string | null; + deliverableType?: string | null; + description?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + url?: string | null; } + diff --git a/webapp/src/app/api/model/h2020ErcPI.ts b/webapp/src/app/api/model/h2020ErcPI.ts index d6e2324e..48ae3ff0 100644 --- a/webapp/src/app/api/model/h2020ErcPI.ts +++ b/webapp/src/app/api/model/h2020ErcPI.ts @@ -1,23 +1,25 @@ /** * 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. */ + /** * H2020ErcPI */ -export interface H2020ErcPI { - firstName?: string | null; - fundingScheme?: string | null; - id?: string | null; - lastName?: string | null; - organisationID?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - title?: string | null; +export interface H2020ErcPI { + firstName?: string | null; + fundingScheme?: string | null; + id?: string | null; + lastName?: string | null; + organisationID?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + title?: string | null; } + diff --git a/webapp/src/app/api/model/h2020EurosciVoc.ts b/webapp/src/app/api/model/h2020EurosciVoc.ts index b275e94e..7d1ea931 100644 --- a/webapp/src/app/api/model/h2020EurosciVoc.ts +++ b/webapp/src/app/api/model/h2020EurosciVoc.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. */ + /** * H2020EurosciVoc */ -export interface H2020EurosciVoc { - code?: string | null; - description?: string | null; - id?: string | null; - path?: string | null; - projectID?: string | null; - title?: string | null; +export interface H2020EurosciVoc { + code?: string | null; + description?: string | null; + id?: string | null; + path?: string | null; + projectID?: string | null; + title?: string | null; } + diff --git a/webapp/src/app/api/model/h2020LegalBasis.ts b/webapp/src/app/api/model/h2020LegalBasis.ts index e5846466..d247488d 100644 --- a/webapp/src/app/api/model/h2020LegalBasis.ts +++ b/webapp/src/app/api/model/h2020LegalBasis.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. */ + /** * H2020LegalBasis */ -export interface H2020LegalBasis { - id?: string | null; - legalBasis?: string | null; - projectID?: string | null; - title?: string | null; - uniqueProgrammePart?: string | null; +export interface H2020LegalBasis { + id?: string | null; + legalBasis?: string | null; + projectID?: string | null; + title?: string | null; + uniqueProgrammePart?: string | null; } + diff --git a/webapp/src/app/api/model/h2020Organization.ts b/webapp/src/app/api/model/h2020Organization.ts index 26a5acb9..003a00ed 100644 --- a/webapp/src/app/api/model/h2020Organization.ts +++ b/webapp/src/app/api/model/h2020Organization.ts @@ -1,41 +1,43 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * H2020Organization */ -export interface H2020Organization { - SME?: boolean | null; - active?: boolean | null; - activityType?: string | null; - city?: string | null; - contactForm?: string | null; - contentUpdateDate?: string | null; - country?: string | null; - ecContribution?: number | null; - endOfParticipation?: boolean | null; - geolocation?: string | null; - id?: string | null; - name?: string | null; - netEcContribution?: number | null; - nutsCode?: string | null; - order?: number | null; - organisationID?: string | null; - organizationURL?: string | null; - postCode?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - role?: string | null; - shortName?: string | null; - street?: string | null; - totalCost?: number | null; - vatNumber?: string | null; +export interface H2020Organization { + SME?: boolean | null; + active?: boolean | null; + activityType?: string | null; + city?: string | null; + contactForm?: string | null; + contentUpdateDate?: string | null; + country?: string | null; + ecContribution?: number | null; + endOfParticipation?: boolean | null; + geolocation?: string | null; + id?: string | null; + name?: string | null; + netEcContribution?: number | null; + nutsCode?: string | null; + order?: number | null; + organisationID?: string | null; + organizationURL?: string | null; + postCode?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + role?: string | null; + shortName?: string | null; + street?: string | null; + totalCost?: number | null; + vatNumber?: string | null; } + diff --git a/webapp/src/app/api/model/h2020ProjectDetails.ts b/webapp/src/app/api/model/h2020ProjectDetails.ts index f06b2fe5..7d08134e 100644 --- a/webapp/src/app/api/model/h2020ProjectDetails.ts +++ b/webapp/src/app/api/model/h2020ProjectDetails.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 @@ -17,43 +17,45 @@ import { H2020Topic } from './h2020Topic'; import { H2020EurosciVoc } from './h2020EurosciVoc'; import { H2020Organization } from './h2020Organization'; + /** * Comprehensive Horizon 2020 Project model combining all related entities. This model extends the base H2020Project with all associated data. */ -export interface H2020ProjectDetails { - acronym?: string | null; - contentUpdateDate?: string | null; - ecMaxContribution?: number | null; - ecSignatureDate?: string | null; - endDate?: string | null; - frameworkProgramme?: string | null; - fundingScheme?: string | null; - grantDoi?: string | null; - humanValidated?: boolean | null; - id?: string | null; - keywords?: string | null; - legalBasis?: string | null; - masterCall?: string | null; - nature?: string | null; - objective?: string | null; - rcn?: string | null; - startDate?: string | null; - status?: string | null; - subCall?: string | null; - title?: string | null; - topics?: string | null; - totalCost?: number | null; - organizations?: Array | null; - publications?: Array | null; - deliverables?: Array | null; - reportSummaries?: Array | null; - topicsList?: Array | null; - webLinks?: Array | null; - eurosciVoc?: Array | null; - legalBasisList?: Array | null; - ercPrincipalInvestigators?: Array | null; - organizationCount?: number | null; - publicationCount?: number | null; - deliverableCount?: number | null; - ercPiCount?: number | null; +export interface H2020ProjectDetails { + acronym?: string | null; + contentUpdateDate?: string | null; + ecMaxContribution?: number | null; + ecSignatureDate?: string | null; + endDate?: string | null; + frameworkProgramme?: string | null; + fundingScheme?: string | null; + grantDoi?: string | null; + humanValidated?: boolean | null; + id?: string | null; + keywords?: string | null; + legalBasis?: string | null; + masterCall?: string | null; + nature?: string | null; + objective?: string | null; + rcn?: string | null; + startDate?: string | null; + status?: string | null; + subCall?: string | null; + title?: string | null; + topics?: string | null; + totalCost?: number | null; + organizations?: Array | null; + publications?: Array | null; + deliverables?: Array | null; + reportSummaries?: Array | null; + topicsList?: Array | null; + webLinks?: Array | null; + eurosciVoc?: Array | null; + legalBasisList?: Array | null; + ercPrincipalInvestigators?: Array | null; + organizationCount?: number | null; + publicationCount?: number | null; + deliverableCount?: number | null; + ercPiCount?: number | null; } + diff --git a/webapp/src/app/api/model/h2020Publication.ts b/webapp/src/app/api/model/h2020Publication.ts index bb84dd6e..945e22d2 100644 --- a/webapp/src/app/api/model/h2020Publication.ts +++ b/webapp/src/app/api/model/h2020Publication.ts @@ -1,33 +1,35 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * H2020Publication */ -export interface H2020Publication { - authors?: string | null; - collection?: string | null; - contentUpdateDate?: string | null; - doi?: string | null; - id?: string | null; - isPublishedAs?: string | null; - journalNumber?: string | null; - journalTitle?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - publishedPages?: string | null; - publishedYear?: number | null; - publisher?: string | null; - qaProcessedDoi?: string | null; - rcn?: string | null; - repositoryUrl?: string | null; - title?: string | null; - volume?: string | null; +export interface H2020Publication { + authors?: string | null; + collection?: string | null; + contentUpdateDate?: string | null; + doi?: string | null; + id?: string | null; + isPublishedAs?: string | null; + journalNumber?: string | null; + journalTitle?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + publishedPages?: string | null; + publishedYear?: number | null; + publisher?: string | null; + qaProcessedDoi?: string | null; + rcn?: string | null; + repositoryUrl?: string | null; + title?: string | null; + volume?: string | null; } + diff --git a/webapp/src/app/api/model/h2020ReportSummary.ts b/webapp/src/app/api/model/h2020ReportSummary.ts index 2a9989c8..a5975ffb 100644 --- a/webapp/src/app/api/model/h2020ReportSummary.ts +++ b/webapp/src/app/api/model/h2020ReportSummary.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. */ + /** * H2020ReportSummary */ -export interface H2020ReportSummary { - attachments?: string | null; - contentUpdateDate?: string | null; - id?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - title?: string | null; +export interface H2020ReportSummary { + attachments?: string | null; + contentUpdateDate?: string | null; + id?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + title?: string | null; } + diff --git a/webapp/src/app/api/model/h2020Topic.ts b/webapp/src/app/api/model/h2020Topic.ts index 8573a661..8ddb1991 100644 --- a/webapp/src/app/api/model/h2020Topic.ts +++ b/webapp/src/app/api/model/h2020Topic.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. */ + /** * H2020Topic */ -export interface H2020Topic { - id?: string | null; - projectID?: string | null; - title?: string | null; - topic?: string | null; +export interface H2020Topic { + id?: string | null; + projectID?: string | null; + title?: string | null; + topic?: string | null; } + diff --git a/webapp/src/app/api/model/h2020WebLink.ts b/webapp/src/app/api/model/h2020WebLink.ts index ce8e8f93..26d54599 100644 --- a/webapp/src/app/api/model/h2020WebLink.ts +++ b/webapp/src/app/api/model/h2020WebLink.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. */ + /** * H2020WebLink */ -export interface H2020WebLink { - archivedDate?: string | null; - availableLanguages?: string | null; - id?: string | null; - linkId?: string | null; - projectID?: string | null; - represents?: string | null; - source?: string | null; - status?: string | null; - type?: string | null; - url?: string | null; +export interface H2020WebLink { + archivedDate?: string | null; + availableLanguages?: string | null; + id?: string | null; + linkId?: string | null; + projectID?: string | null; + represents?: string | null; + source?: string | null; + status?: string | null; + type?: string | null; + url?: string | null; } + diff --git a/webapp/src/app/api/model/hEUDeliverable.ts b/webapp/src/app/api/model/hEUDeliverable.ts index 4645913d..05d8c5ba 100644 --- a/webapp/src/app/api/model/hEUDeliverable.ts +++ b/webapp/src/app/api/model/hEUDeliverable.ts @@ -1,23 +1,25 @@ /** * 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. */ + /** * HEUDeliverable */ -export interface HEUDeliverable { - collection?: string | null; - contentUpdateDate?: string | null; - deliverableType?: string | null; - description?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - url?: string | null; +export interface HEUDeliverable { + collection?: string | null; + contentUpdateDate?: string | null; + deliverableType?: string | null; + description?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + url?: string | null; } + diff --git a/webapp/src/app/api/model/hEUEurosciVoc.ts b/webapp/src/app/api/model/hEUEurosciVoc.ts index 38fe125e..93921ab7 100644 --- a/webapp/src/app/api/model/hEUEurosciVoc.ts +++ b/webapp/src/app/api/model/hEUEurosciVoc.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. */ + /** * HEUEurosciVoc */ -export interface HEUEurosciVoc { - code?: string | null; - description?: string | null; - id?: string | null; - path?: string | null; - projectID?: string | null; - title?: string | null; +export interface HEUEurosciVoc { + code?: string | null; + description?: string | null; + id?: string | null; + path?: string | null; + projectID?: string | null; + title?: string | null; } + diff --git a/webapp/src/app/api/model/hEULegalBasis.ts b/webapp/src/app/api/model/hEULegalBasis.ts index a02eebd0..e3cb66ca 100644 --- a/webapp/src/app/api/model/hEULegalBasis.ts +++ b/webapp/src/app/api/model/hEULegalBasis.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. */ + /** * HEULegalBasis */ -export interface HEULegalBasis { - id?: string | null; - legalBasis?: string | null; - projectID?: string | null; - title?: string | null; - uniqueProgrammePart?: string | null; +export interface HEULegalBasis { + id?: string | null; + legalBasis?: string | null; + projectID?: string | null; + title?: string | null; + uniqueProgrammePart?: string | null; } + diff --git a/webapp/src/app/api/model/hEUOrganization.ts b/webapp/src/app/api/model/hEUOrganization.ts index 1dcd1615..6bb193ef 100644 --- a/webapp/src/app/api/model/hEUOrganization.ts +++ b/webapp/src/app/api/model/hEUOrganization.ts @@ -1,41 +1,43 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * HEUOrganization */ -export interface HEUOrganization { - SME?: boolean | null; - active?: boolean | null; - activityType?: string | null; - city?: string | null; - contactForm?: string | null; - contentUpdateDate?: string | null; - country?: string | null; - ecContribution?: number | null; - endOfParticipation?: boolean | null; - geolocation?: string | null; - id?: string | null; - name?: string | null; - netEcContribution?: number | null; - nutsCode?: string | null; - order?: number | null; - organisationID?: string | null; - organizationURL?: string | null; - postCode?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - role?: string | null; - shortName?: string | null; - street?: string | null; - totalCost?: number | null; - vatNumber?: string | null; +export interface HEUOrganization { + SME?: boolean | null; + active?: boolean | null; + activityType?: string | null; + city?: string | null; + contactForm?: string | null; + contentUpdateDate?: string | null; + country?: string | null; + ecContribution?: number | null; + endOfParticipation?: boolean | null; + geolocation?: string | null; + id?: string | null; + name?: string | null; + netEcContribution?: number | null; + nutsCode?: string | null; + order?: number | null; + organisationID?: string | null; + organizationURL?: string | null; + postCode?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + role?: string | null; + shortName?: string | null; + street?: string | null; + totalCost?: number | null; + vatNumber?: string | null; } + diff --git a/webapp/src/app/api/model/hEUProjectDetails.ts b/webapp/src/app/api/model/hEUProjectDetails.ts index f7a46271..8a897435 100644 --- a/webapp/src/app/api/model/hEUProjectDetails.ts +++ b/webapp/src/app/api/model/hEUProjectDetails.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,41 +16,43 @@ import { HEUReportSummary } from './hEUReportSummary'; import { HEUDeliverable } from './hEUDeliverable'; import { HEUEurosciVoc } from './hEUEurosciVoc'; + /** * Comprehensive Horizon Europe Project model combining all related entities. This model extends the base HEUProject with all associated data. */ -export interface HEUProjectDetails { - acronym?: string | null; - contentUpdateDate?: string | null; - ecMaxContribution?: number | null; - ecSignatureDate?: string | null; - endDate?: string | null; - frameworkProgramme?: string | null; - fundingScheme?: string | null; - grantDoi?: string | null; - humanValidated?: boolean | null; - id?: string | null; - keywords?: string | null; - legalBasis?: string | null; - masterCall?: string | null; - nature?: string | null; - objective?: string | null; - rcn?: string | null; - startDate?: string | null; - status?: string | null; - subCall?: string | null; - title?: string | null; - topics?: string | null; - totalCost?: number | null; - organizations?: Array | null; - publications?: Array | null; - deliverables?: Array | null; - reportSummaries?: Array | null; - topicsList?: Array | null; - webLinks?: Array | null; - eurosciVoc?: Array | null; - legalBasisList?: Array | null; - organizationCount?: number | null; - publicationCount?: number | null; - deliverableCount?: number | null; +export interface HEUProjectDetails { + acronym?: string | null; + contentUpdateDate?: string | null; + ecMaxContribution?: number | null; + ecSignatureDate?: string | null; + endDate?: string | null; + frameworkProgramme?: string | null; + fundingScheme?: string | null; + grantDoi?: string | null; + humanValidated?: boolean | null; + id?: string | null; + keywords?: string | null; + legalBasis?: string | null; + masterCall?: string | null; + nature?: string | null; + objective?: string | null; + rcn?: string | null; + startDate?: string | null; + status?: string | null; + subCall?: string | null; + title?: string | null; + topics?: string | null; + totalCost?: number | null; + organizations?: Array | null; + publications?: Array | null; + deliverables?: Array | null; + reportSummaries?: Array | null; + topicsList?: Array | null; + webLinks?: Array | null; + eurosciVoc?: Array | null; + legalBasisList?: Array | null; + organizationCount?: number | null; + publicationCount?: number | null; + deliverableCount?: number | null; } + diff --git a/webapp/src/app/api/model/hEUPublication.ts b/webapp/src/app/api/model/hEUPublication.ts index 86d59473..4d067177 100644 --- a/webapp/src/app/api/model/hEUPublication.ts +++ b/webapp/src/app/api/model/hEUPublication.ts @@ -1,33 +1,35 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ + /** * HEUPublication */ -export interface HEUPublication { - authors?: string | null; - collection?: string | null; - contentUpdateDate?: string | null; - doi?: string | null; - id?: string | null; - isPublishedAs?: string | null; - journalNumber?: string | null; - journalTitle?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - publishedPages?: string | null; - publishedYear?: number | null; - publisher?: string | null; - qaProcessedDoi?: string | null; - rcn?: string | null; - repositoryUrl?: string | null; - title?: string | null; - volume?: string | null; +export interface HEUPublication { + authors?: string | null; + collection?: string | null; + contentUpdateDate?: string | null; + doi?: string | null; + id?: string | null; + isPublishedAs?: string | null; + journalNumber?: string | null; + journalTitle?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + publishedPages?: string | null; + publishedYear?: number | null; + publisher?: string | null; + qaProcessedDoi?: string | null; + rcn?: string | null; + repositoryUrl?: string | null; + title?: string | null; + volume?: string | null; } + diff --git a/webapp/src/app/api/model/hEUReportSummary.ts b/webapp/src/app/api/model/hEUReportSummary.ts index 94f58b4c..b9e1a299 100644 --- a/webapp/src/app/api/model/hEUReportSummary.ts +++ b/webapp/src/app/api/model/hEUReportSummary.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. */ + /** * HEUReportSummary */ -export interface HEUReportSummary { - attachments?: string | null; - contentUpdateDate?: string | null; - id?: string | null; - projectAcronym?: string | null; - projectID?: string | null; - rcn?: string | null; - title?: string | null; +export interface HEUReportSummary { + attachments?: string | null; + contentUpdateDate?: string | null; + id?: string | null; + projectAcronym?: string | null; + projectID?: string | null; + rcn?: string | null; + title?: string | null; } + diff --git a/webapp/src/app/api/model/hEUTopic.ts b/webapp/src/app/api/model/hEUTopic.ts index ccd60c27..a0a5e764 100644 --- a/webapp/src/app/api/model/hEUTopic.ts +++ b/webapp/src/app/api/model/hEUTopic.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. */ + /** * HEUTopic */ -export interface HEUTopic { - id?: string | null; - projectID?: string | null; - title?: string | null; - topic?: string | null; +export interface HEUTopic { + id?: string | null; + projectID?: string | null; + title?: string | null; + topic?: string | null; } + diff --git a/webapp/src/app/api/model/hEUWebLink.ts b/webapp/src/app/api/model/hEUWebLink.ts index 1159d2a6..81c5d60f 100644 --- a/webapp/src/app/api/model/hEUWebLink.ts +++ b/webapp/src/app/api/model/hEUWebLink.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. */ + /** * HEUWebLink */ -export interface HEUWebLink { - archivedDate?: string | null; - availableLanguages?: string | null; - id?: string | null; - linkId?: string | null; - projectID?: string | null; - represents?: string | null; - source?: string | null; - status?: string | null; - type?: string | null; - url?: string | null; +export interface HEUWebLink { + archivedDate?: string | null; + availableLanguages?: string | null; + id?: string | null; + linkId?: string | null; + projectID?: string | null; + represents?: string | null; + source?: string | null; + status?: string | null; + type?: string | null; + url?: string | 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/idTokenMetadata.ts b/webapp/src/app/api/model/idTokenMetadata.ts index ab99fb1c..5398083d 100644 --- a/webapp/src/app/api/model/idTokenMetadata.ts +++ b/webapp/src/app/api/model/idTokenMetadata.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,22 +9,26 @@ */ import { TokenType } from './tokenType'; -export interface IdTokenMetadata { - /** - * The unique identifier of the real account associated with this token. - */ - real_account_id: string; - /** - * The timestamp indicating when the token will expire. - */ - expires_at: string; - /** - * The epoch value for the token. Used for versioning of tokens. - */ - epoch?: number; - /** - * The type of the token, which is always ID_TOKEN for this class. - */ - token_type?: TokenType; + +export interface IdTokenMetadata { + /** + * The unique identifier of the real account associated with this token. + */ + real_account_id: string; + /** + * The timestamp indicating when the token will expire. + */ + expires_at: string; + /** + * The epoch value for the token. Used for versioning of tokens. + */ + epoch?: number; + /** + * The type of the token, which is always ID_TOKEN for this class. + */ + token_type?: TokenType; } -export namespace IdTokenMetadata {} +export namespace IdTokenMetadata { +} + + diff --git a/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts b/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts index 47235351..c67acc71 100644 --- a/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.ts +++ b/webapp/src/app/api/model/inseAccountManagementModelOrganizationProfile.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 InseAccountManagementModelOrganizationProfile { - id: string; - name: string; - openalex_institution_id?: string | null; + +export interface InseAccountManagementModelOrganizationProfile { + id: string; + name: string; + openalex_institution_id?: string | null; } + diff --git a/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts b/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts index 8f9f0e6b..404df0f9 100644 --- a/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.ts +++ b/webapp/src/app/api/model/inseOrganizationManagementModelOrganizationProfile.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 InseOrganizationManagementModelOrganizationProfile { - id: string; - name: string; - other_inst_id?: string | null; - deleted: boolean; - member_count: number; + +export interface InseOrganizationManagementModelOrganizationProfile { + id: string; + name: string; + other_inst_id?: string | null; + deleted: boolean; + member_count: number; } + 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/ipcClassification.ts b/webapp/src/app/api/model/ipcClassification.ts index b7e65c0d..74805329 100644 --- a/webapp/src/app/api/model/ipcClassification.ts +++ b/webapp/src/app/api/model/ipcClassification.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. */ -export interface IpcClassification { - symbol: string; - section?: string | null; - class?: string | null; - subclass?: string | null; - main_group?: string | null; - subgroup?: string | null; + +export interface IpcClassification { + symbol: string; + section?: string | null; + 'class'?: string | null; + subclass?: string | null; + main_group?: string | null; + subgroup?: string | null; } + diff --git a/webapp/src/app/api/model/keywordEntry.ts b/webapp/src/app/api/model/keywordEntry.ts index 94dd6e18..e8e9cc5c 100644 --- a/webapp/src/app/api/model/keywordEntry.ts +++ b/webapp/src/app/api/model/keywordEntry.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 KeywordEntry { - /** - * The extracted keyword. - */ - keyword: string; - /** - * The relevance score of the keyword. - */ - relevance_score: number; + +export interface KeywordEntry { + /** + * The extracted keyword. + */ + keyword: string; + /** + * The relevance score of the keyword. + */ + relevance_score: number; } + diff --git a/webapp/src/app/api/model/keywordEntryWithTopic.ts b/webapp/src/app/api/model/keywordEntryWithTopic.ts index 4670f554..6680e773 100644 --- a/webapp/src/app/api/model/keywordEntryWithTopic.ts +++ b/webapp/src/app/api/model/keywordEntryWithTopic.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 { KeywordEntry } from './keywordEntry'; import { KeywordTopicMatch } from './keywordTopicMatch'; -export interface KeywordEntryWithTopic { - /** - * The keyword extracted by the LLM. - */ - llm_keyword: KeywordEntry; - topic_mapping?: KeywordTopicMatch | null; + +export interface KeywordEntryWithTopic { + /** + * The keyword extracted by the LLM. + */ + llm_keyword: KeywordEntry; + topic_mapping?: KeywordTopicMatch | null; } + diff --git a/webapp/src/app/api/model/keywordPatentMatch.ts b/webapp/src/app/api/model/keywordPatentMatch.ts new file mode 100644 index 00000000..004c84ad --- /dev/null +++ b/webapp/src/app/api/model/keywordPatentMatch.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { PatentEntry } from './patentEntry'; + + +export interface KeywordPatentMatch { + patent: PatentEntry; + /** + * Combined match quality score. + */ + match_score: number; + matched_keywords?: Array; + matched_ipc_symbols?: Array; +} + diff --git a/webapp/src/app/api/model/keywordPatentSearchItem.ts b/webapp/src/app/api/model/keywordPatentSearchItem.ts new file mode 100644 index 00000000..bae1a0a6 --- /dev/null +++ b/webapp/src/app/api/model/keywordPatentSearchItem.ts @@ -0,0 +1,37 @@ +/** + * 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 KeywordPatentSearchItem { + /** + * Extracted keyword text. + */ + keyword: string; + keyword_level?: KeywordPatentSearchItem.KeywordLevelEnum | null; + topic_id?: string | null; + topic_display_name?: string | null; + subfield_name?: string | null; + field_name?: string | null; + /** + * LLM relevance score for the keyword. + */ + relevance_score?: number; +} +export namespace KeywordPatentSearchItem { + export const KeywordLevelEnum = { + Broad: 'broad', + Coarse: 'coarse', + Fine: 'fine', + Custom: 'custom' + } as const; + export type KeywordLevelEnum = typeof KeywordLevelEnum[keyof typeof KeywordLevelEnum]; +} + + diff --git a/webapp/src/app/api/model/keywordTopicMatch.ts b/webapp/src/app/api/model/keywordTopicMatch.ts index ee4c8326..f9c2ab49 100644 --- a/webapp/src/app/api/model/keywordTopicMatch.ts +++ b/webapp/src/app/api/model/keywordTopicMatch.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,7 +9,9 @@ */ import { Topic } from './topic'; -export interface KeywordTopicMatch { - keyword: string; - topic?: Topic | null; + +export interface KeywordTopicMatch { + keyword: string; + topic?: Topic | null; } + 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/keywordsRequest.ts b/webapp/src/app/api/model/keywordsRequest.ts index 8acb7082..094ed97b 100644 --- a/webapp/src/app/api/model/keywordsRequest.ts +++ b/webapp/src/app/api/model/keywordsRequest.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,20 +9,18 @@ */ import { FileUpload } from './fileUpload'; - -export interface KeywordsRequest { - /** - * The input text from which to extract keywords. - */ - query: string; - files?: Array | null; - /** - * The mode of keyword extraction, e.g., \'url\', \'text\', or \'keywords\'. - */ - mode: string; - /** - * The maximum number of keywords to extract. - */ - limit?: number; +export interface KeywordsRequest { + /** + * The input text from which to extract keywords. + */ + query: string; + files?: Array | null; + /** + * The mode of keyword extraction, e.g., \'url\', \'text\', or \'keywords\'. + */ + mode: string; + /** + * The maximum number of keywords to extract. + */ + limit?: number; } - diff --git a/webapp/src/app/api/model/keywordsTopicsRequest.ts b/webapp/src/app/api/model/keywordsTopicsRequest.ts index 883ed079..8810bf5f 100644 --- a/webapp/src/app/api/model/keywordsTopicsRequest.ts +++ b/webapp/src/app/api/model/keywordsTopicsRequest.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 KeywordsTopicsRequest { - /** - * List of keywords/sentences to query by similarity. - */ - keywords: Array; + +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 index 78a2f9d2..4aee622f 100644 --- a/webapp/src/app/api/model/keywordsTopicsResponse.ts +++ b/webapp/src/app/api/model/keywordsTopicsResponse.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 { KeywordTopicMatch } from './keywordTopicMatch'; -export interface KeywordsTopicsResponse { - /** - * Top matching topics for each keyword in the requested list. - */ - results: Array; + +export interface KeywordsTopicsResponse { + /** + * Top matching topics for each keyword in the requested list. + */ + results: Array; } + 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/loginResponse.ts b/webapp/src/app/api/model/loginResponse.ts index b0ccb902..c91eb493 100644 --- a/webapp/src/app/api/model/loginResponse.ts +++ b/webapp/src/app/api/model/loginResponse.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 { IdTokenMetadata } from './idTokenMetadata'; -export interface LoginResponse { - /** - * The ID token issued upon successful login. - */ - id_token: IdTokenMetadata; + +export interface LoginResponse { + /** + * The ID token issued upon successful login. + */ + id_token: IdTokenMetadata; } + 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 311e2184..6194df94 100644 --- a/webapp/src/app/api/model/matchedAuthor.ts +++ b/webapp/src/app/api/model/matchedAuthor.ts @@ -1,14 +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 MatchedAuthor { - openalex_author_id: string; - author_name: string; + +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/matchedTopic.ts b/webapp/src/app/api/model/matchedTopic.ts new file mode 100644 index 00000000..64e54ab3 --- /dev/null +++ b/webapp/src/app/api/model/matchedTopic.ts @@ -0,0 +1,20 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface MatchedTopic { + id?: string | null; + display_name?: string | null; + subfield_name?: string | null; + field_name?: string | null; + domain_name?: string | null; + source_keyword?: string | null; +} + 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/models.ts b/webapp/src/app/api/model/models.ts index d932a058..91abe3c5 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -11,6 +11,7 @@ export * from './authorNetworkNode'; export * from './authorParsedLongestName'; export * from './authorPositionCount'; export * from './authorSummaryStats'; +export * from './authorWorkPurposes'; export * from './authorsFilterProperties'; export * from './authorsListResponse'; export * from './authorship'; @@ -106,6 +107,8 @@ export * from './institutionsListResponse'; export * from './ipcClassification'; export * from './keywordEntry'; export * from './keywordEntryWithTopic'; +export * from './keywordPatentMatch'; +export * from './keywordPatentSearchItem'; export * from './keywordTopicMatch'; export * from './keywords'; export * from './keywordsRequest'; @@ -117,6 +120,7 @@ export * from './loginResponse'; export * from './longitude'; export * from './matchedAuthor'; export * from './matchedOfficer'; +export * from './matchedTopic'; export * from './mentionedPerson'; export * from './meta'; export * from './model2YrMeanCitedness'; @@ -124,6 +128,7 @@ export * from './newsArticle'; export * from './newsArticleDetail'; export * from './newsPage'; export * from './openAccess'; +export * from './openAlexTopicTag'; export * from './orgPatentEntry'; export * from './orgPatentsResponse'; export * from './organizationPage'; @@ -131,6 +136,8 @@ export * from './otkResponse'; export * from './patentEntry'; export * from './patentsByAuthorResponse'; export * from './patentsByInstitutionResponse'; +export * from './patentsByKeywordsRequest'; +export * from './patentsByKeywordsResponse'; export * from './personBio'; export * from './projectType'; export * from './projectsFilteringProperties'; @@ -139,8 +146,10 @@ export * from './publicationDetailByFunder'; export * from './publicationIdsByAuthorPosition'; export * from './publicationsByAuthorResponse'; export * from './rankingResponse'; +export * from './rebuildResponse'; export * from './score'; export * from './sortDirection'; +export * from './specificWorkPurpose'; export * from './tokenType'; export * from './topInstitutionItem'; export * from './topic'; @@ -175,6 +184,7 @@ export * from './workKeyword'; export * from './workMeshInner'; export * from './workNetworkNode'; export * from './workPage'; +export * from './workPurpose'; export * from './workSustainableDevelopmentGoalsInner'; export * from './workTopic'; export * from './workTopicDomain'; diff --git a/webapp/src/app/api/model/newsArticle.ts b/webapp/src/app/api/model/newsArticle.ts index e04f0029..ab48810d 100644 --- a/webapp/src/app/api/model/newsArticle.ts +++ b/webapp/src/app/api/model/newsArticle.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 NewsArticle { - id: string; - date?: string | null; - maintitle?: string | null; - author?: string | null; - url?: string | null; - relevant?: boolean | null; - snippet?: string | null; - related?: boolean | 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 ac51097c..171a14ff 100644 --- a/webapp/src/app/api/model/newsArticleDetail.ts +++ b/webapp/src/app/api/model/newsArticleDetail.ts @@ -1,25 +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 { MatchedTopic } from './matchedTopic'; 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; - related?: boolean | null; - full_content?: string | null; - authors?: Array; - topics?: Array; - keywords?: 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; + keywords?: Array; + topics?: Array; } + 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/openAlexTopicTag.ts b/webapp/src/app/api/model/openAlexTopicTag.ts new file mode 100644 index 00000000..dece79c5 --- /dev/null +++ b/webapp/src/app/api/model/openAlexTopicTag.ts @@ -0,0 +1,18 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface OpenAlexTopicTag { + topic_id?: string | null; + topic_display_name: string; + field_name?: string | null; + domain_name?: string | null; +} + diff --git a/webapp/src/app/api/model/orgPatentEntry.ts b/webapp/src/app/api/model/orgPatentEntry.ts index 7c4d0ce0..762e1968 100644 --- a/webapp/src/app/api/model/orgPatentEntry.ts +++ b/webapp/src/app/api/model/orgPatentEntry.ts @@ -1,46 +1,50 @@ /** * 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 { OpenAlexTopicTag } from './openAlexTopicTag'; 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; + openalex_topics?: Array; + 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/organizationPage.ts b/webapp/src/app/api/model/organizationPage.ts index fccb1081..5b8294b1 100644 --- a/webapp/src/app/api/model/organizationPage.ts +++ b/webapp/src/app/api/model/organizationPage.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 { InseOrganizationManagementModelOrganizationProfile } from './inseOrganizationManagementModelOrganizationProfile'; -export interface OrganizationPage { - items: Array; - total: number; - page: number; - page_size: number; + +export interface OrganizationPage { + items: Array; + total: number; + page: number; + page_size: number; } + diff --git a/webapp/src/app/api/model/otkResponse.ts b/webapp/src/app/api/model/otkResponse.ts index 3b69c11d..7d956289 100644 --- a/webapp/src/app/api/model/otkResponse.ts +++ b/webapp/src/app/api/model/otkResponse.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 OtkResponse { - /** - * The status of the one-time code (OTC) request. - */ - status: string; - /** - * The unique identifier of the account for which the OTC was requested. - */ - account_id: string; + +export interface OtkResponse { + /** + * The status of the one-time code (OTC) request. + */ + status: string; + /** + * The unique identifier of the account for which the OTC was requested. + */ + account_id: string; } + diff --git a/webapp/src/app/api/model/patentEntry.ts b/webapp/src/app/api/model/patentEntry.ts index 7a0339b1..7f6d7809 100644 --- a/webapp/src/app/api/model/patentEntry.ts +++ b/webapp/src/app/api/model/patentEntry.ts @@ -1,32 +1,36 @@ /** * Innovation Search Engine API * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ +import { OpenAlexTopicTag } from './openAlexTopicTag'; 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?: Array; - assignees?: Array; - ipc?: Array; - ipc_descriptions?: Array; - cpc?: Array; - cpc_descriptions?: Array; - 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; + openalex_topics?: 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 d80972d0..b167c48b 100644 --- a/webapp/src/app/api/model/patentsByInstitutionResponse.ts +++ b/webapp/src/app/api/model/patentsByInstitutionResponse.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 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/patentsByKeywordsRequest.ts b/webapp/src/app/api/model/patentsByKeywordsRequest.ts new file mode 100644 index 00000000..1e9d3021 --- /dev/null +++ b/webapp/src/app/api/model/patentsByKeywordsRequest.ts @@ -0,0 +1,19 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { KeywordPatentSearchItem } from './keywordPatentSearchItem'; + + +export interface PatentsByKeywordsRequest { + /** + * Keywords to match against patents_openalex_keywords. + */ + keywords: Array; +} + diff --git a/webapp/src/app/api/model/patentsByKeywordsResponse.ts b/webapp/src/app/api/model/patentsByKeywordsResponse.ts new file mode 100644 index 00000000..1e31acb5 --- /dev/null +++ b/webapp/src/app/api/model/patentsByKeywordsResponse.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 { KeywordPatentMatch } from './keywordPatentMatch'; + + +export interface PatentsByKeywordsResponse { + 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/rebuildResponse.ts b/webapp/src/app/api/model/rebuildResponse.ts new file mode 100644 index 00000000..13e6c910 --- /dev/null +++ b/webapp/src/app/api/model/rebuildResponse.ts @@ -0,0 +1,17 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface RebuildResponse { + status: string; + institution_id: string; + message: string; +} + 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/specificWorkPurpose.ts b/webapp/src/app/api/model/specificWorkPurpose.ts new file mode 100644 index 00000000..0deaf6cb --- /dev/null +++ b/webapp/src/app/api/model/specificWorkPurpose.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 { WorkPurpose } from './workPurpose'; + + +/** + * Represents the purpose of a specific work, including its ID, purpose, and optional reasoning. + */ +export interface SpecificWorkPurpose { + /** + * The raw OpenAlex work id. + */ + raw_oa_work_id: string; + publication_year?: number | null; + /** + * The purpose of the work. + */ + purpose: WorkPurpose; + reasoning?: string | null; +} +export namespace SpecificWorkPurpose { +} + + diff --git a/webapp/src/app/api/model/tokenType.ts b/webapp/src/app/api/model/tokenType.ts index 88512eb6..a0efdc46 100644 --- a/webapp/src/app/api/model/tokenType.ts +++ b/webapp/src/app/api/model/tokenType.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 TokenType = { - IdToken: 'ID_TOKEN', - RefreshToken: 'REFRESH_TOKEN', - AccessToken: 'ACCESS_TOKEN', + IdToken: 'ID_TOKEN', + RefreshToken: 'REFRESH_TOKEN', + AccessToken: 'ACCESS_TOKEN' } as const; -export type TokenType = (typeof TokenType)[keyof typeof TokenType]; +export type TokenType = typeof TokenType[keyof typeof TokenType]; + diff --git a/webapp/src/app/api/model/topInstitutionItem.ts b/webapp/src/app/api/model/topInstitutionItem.ts index a98f52b8..a9367bae 100644 --- a/webapp/src/app/api/model/topInstitutionItem.ts +++ b/webapp/src/app/api/model/topInstitutionItem.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 TopInstitutionItem { - id?: string | null; - display_name?: string | null; - ror?: string | null; - country_code?: string | null; - type?: string | null; - lineage?: Array | null; - works_count?: number | null; - exact_topic_count?: number | null; + +export interface TopInstitutionItem { + id?: string | null; + display_name?: string | null; + ror?: string | null; + country_code?: string | null; + type?: string | null; + lineage?: Array | null; + works_count?: number | null; + exact_topic_count?: number | null; } + 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/topicYearlyData.ts b/webapp/src/app/api/model/topicYearlyData.ts index a1fdbdc2..7dc05940 100644 --- a/webapp/src/app/api/model/topicYearlyData.ts +++ b/webapp/src/app/api/model/topicYearlyData.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 TopicYearlyData { - year: number; - raw: number; - normalized: number; - cumulative: number; - institutions_count: number; + +export interface TopicYearlyData { + year: number; + raw: number; + normalized: number; + cumulative: number; + institutions_count: number; } + 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/trendResponse.ts b/webapp/src/app/api/model/trendResponse.ts index e6b291c9..c7819dd7 100644 --- a/webapp/src/app/api/model/trendResponse.ts +++ b/webapp/src/app/api/model/trendResponse.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 { TrendSeries } from './trendSeries'; -export interface TrendResponse { - series: Array; - years: Array; - location_mappings?: { [key: string]: Array } | null; + +export interface TrendResponse { + series: Array; + years: Array; + location_mappings?: { [key: string]: Array; } | null; } + diff --git a/webapp/src/app/api/model/trendSeries.ts b/webapp/src/app/api/model/trendSeries.ts index 1dc054be..d723e111 100644 --- a/webapp/src/app/api/model/trendSeries.ts +++ b/webapp/src/app/api/model/trendSeries.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,21 @@ */ import { TopicYearlyData } from './topicYearlyData'; -export interface TrendSeries { - entity_id: string; - entity_name: string; - entity_type: TrendSeries.EntityTypeEnum; - country_code?: string | null; - topic_data: { [key: string]: Array }; + +export interface TrendSeries { + entity_id: string; + entity_name: string; + entity_type: TrendSeries.EntityTypeEnum; + country_code?: string | null; + topic_data: { [key: string]: Array; }; } export namespace TrendSeries { - export const EntityTypeEnum = { - Institution: 'institution', - Country: 'country', - Region: 'region', - } as const; - export type EntityTypeEnum = - (typeof EntityTypeEnum)[keyof typeof EntityTypeEnum]; + export const EntityTypeEnum = { + Institution: 'institution', + Country: 'country', + Region: 'region' + } as const; + export type EntityTypeEnum = typeof EntityTypeEnum[keyof typeof EntityTypeEnum]; } + + 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 3bf43088..ea31291d 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 @@ -10,8 +10,10 @@ import { YearlyData } from './yearlyData'; import { Topic } from './topic'; -export interface UniversityTopicData { - university: string; - topic: Topic; - yearly_data: Array; + +export interface UniversityTopicData { + university: string; + topic: Topic; + yearly_data: Array; } + diff --git a/webapp/src/app/api/model/updateAccountRequest.ts b/webapp/src/app/api/model/updateAccountRequest.ts index f486df74..efc4cea6 100644 --- a/webapp/src/app/api/model/updateAccountRequest.ts +++ b/webapp/src/app/api/model/updateAccountRequest.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,18 @@ */ import { UserRole } from './userRole'; -export interface UpdateAccountRequest { - email?: string | null; - name?: string | null; - role?: UserRole | null; - organization_id?: string | null; - password?: string | null; - openalex_person_id?: string | null; - deleted?: boolean | null; - activated?: boolean | null; + +export interface UpdateAccountRequest { + email?: string | null; + name?: string | null; + role?: UserRole | null; + organization_id?: string | null; + password?: string | null; + openalex_person_id?: string | null; + deleted?: boolean | null; + activated?: boolean | null; } -export namespace UpdateAccountRequest {} +export namespace UpdateAccountRequest { +} + + diff --git a/webapp/src/app/api/model/updateOrganizationRequest.ts b/webapp/src/app/api/model/updateOrganizationRequest.ts index a56b51e7..e12063b6 100644 --- a/webapp/src/app/api/model/updateOrganizationRequest.ts +++ b/webapp/src/app/api/model/updateOrganizationRequest.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 UpdateOrganizationRequest { - name?: string | null; - other_inst_id?: string | null; - deleted?: boolean | null; + +export interface UpdateOrganizationRequest { + name?: string | null; + other_inst_id?: string | null; + deleted?: boolean | null; } + diff --git a/webapp/src/app/api/model/userRole.ts b/webapp/src/app/api/model/userRole.ts index f6d08b53..83b5c595 100644 --- a/webapp/src/app/api/model/userRole.ts +++ b/webapp/src/app/api/model/userRole.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 const UserRole = { - SuperAdmin: 'SUPER_ADMIN', - Admin: 'ADMIN', - Manager: 'MANAGER', - User: 'USER', + SuperAdmin: 'SUPER_ADMIN', + Admin: 'ADMIN', + Manager: 'MANAGER', + User: 'USER' } as const; -export type UserRole = (typeof UserRole)[keyof typeof UserRole]; +export type UserRole = typeof UserRole[keyof typeof UserRole]; + 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/workPurpose.ts b/webapp/src/app/api/model/workPurpose.ts new file mode 100644 index 00000000..617ce5e1 --- /dev/null +++ b/webapp/src/app/api/model/workPurpose.ts @@ -0,0 +1,20 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Represents the purpose of a work. Either a foundation work or an application work. + */ +export const WorkPurpose = { + Foundation: 'Foundation', + Application: 'Application' +} as const; +export type WorkPurpose = typeof WorkPurpose[keyof typeof WorkPurpose]; + 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 4b365f33..f938cb25 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,15 +12,17 @@ import { WorkTopicDomain } from './workTopicDomain'; import { WorkTopicSubfield } from './workTopicSubfield'; import { WorkTopicField } from './workTopicField'; + /** * WorkTopic */ -export interface WorkTopic { - id?: string | null; - display_name?: string | null; - description?: string | null; - score?: Score | null; - subfield?: WorkTopicSubfield | null; - field?: WorkTopicField | null; - domain?: WorkTopicDomain | null; +export interface WorkTopic { + id?: string | null; + display_name?: string | null; + description?: 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': '|' +} diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index e651d81e..7658cd96 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -5,6 +5,7 @@ import { guestOnlyGuard } from './shared/guards/guest-only.guard'; import { collaborationNetworkResolver } from './resolvers/collaboration-network.resolver'; import { personListResolver } from './resolvers/person-list.resolver'; import { personBioResolver } from './resolvers/person-bio.resolver'; +import { personPatentsResolver } from './resolvers/person-patents.resolver'; import { personResolver } from './resolvers/person.resolver'; import { personNewsResolver } from './resolvers/person-news.resolver'; import { institutionResolver } from './resolvers/institution.resolver'; @@ -29,6 +30,7 @@ import { KeywordsToProjectsResultsComponent } from './modules/keywords-search/se import { KeywordsToPatentsResultsComponent } from './modules/keywords-search/search-results/patents-results/patents-results.component'; import { KeywordsToNewsResultsComponent } from './modules/keywords-search/search-results/news-results/news-results.component'; import { KeywordsToWorksResultsComponent } from './modules/keywords-search/search-results/works-results/works-results.component'; +import { authorWorkPurposesResolver } from './resolvers/author-work-purposes.resolver'; export const routes: Routes = [ { path: '', @@ -66,6 +68,14 @@ export const routes: Routes = [ (mod) => mod.DashboardComponent, ), }, + { + path: 'bookmarks', + canActivate: [userGuard], + loadComponent: () => + import('./modules/bookmarks/bookmarks.component').then( + (mod) => mod.BookmarksComponent, + ), + }, { path: 'persons', canActivate: [userGuard], @@ -234,6 +244,7 @@ export const routes: Routes = [ resolve: { personData: personResolver, personBio: personBioResolver, + personPatents: personPatentsResolver, }, runGuardsAndResolvers: (from, to) => from.params['id'] !== to.params['id'], children: [ @@ -268,6 +279,9 @@ export const routes: Routes = [ import('./modules/person-publications/person-publications.component').then( (mod) => mod.PersonPublicationsComponent, ), + resolve: { + authorWorkPurposes: authorWorkPurposesResolver, + }, }, { path: 'network', diff --git a/webapp/src/app/modules/bookmarks/bookmarks.component.html b/webapp/src/app/modules/bookmarks/bookmarks.component.html new file mode 100644 index 00000000..76f61397 --- /dev/null +++ b/webapp/src/app/modules/bookmarks/bookmarks.component.html @@ -0,0 +1,39 @@ +
+ + + @if (loading()) { +
+ +

Bookmarks werden geladen …

+
+ } @else if (persons().length) { +
+ @for (person of persons(); track person.id) { + + + } +
+ } @else { +
+ bookmark_border +

Noch keine Bookmarks

+

+ Speichere Personen über das Bookmark-Symbol auf einer Personenkarte. +

+
+ } +
diff --git a/webapp/src/app/modules/bookmarks/bookmarks.component.scss b/webapp/src/app/modules/bookmarks/bookmarks.component.scss new file mode 100644 index 00000000..b6473b46 --- /dev/null +++ b/webapp/src/app/modules/bookmarks/bookmarks.component.scss @@ -0,0 +1,98 @@ +:host { + display: block; +} + +.bookmarks-page { + padding: 32px; +} + +.page-header { + display: flex; + align-items: flex-end; + justify-content: space-between; + gap: 24px; + margin-bottom: 30px; + + h1 { + margin: 2px 0 6px; + font-size: 2rem; + } + + p { + margin: 0; + color: #667085; + } + + .eyebrow { + color: #3f51b5; + font-size: 0.75rem; + font-weight: 700; + letter-spacing: 0.12em; + text-transform: uppercase; + } +} + +.bookmark-count { + display: grid; + grid-template-columns: auto auto; + align-items: center; + gap: 0 10px; + padding: 14px 18px; + border: 1px solid #e4e7ec; + border-radius: 14px; + background: white; + + mat-icon { + grid-row: 1 / 3; + color: #3f51b5; + } + + strong { + font-size: 1.25rem; + } + + span { + color: #667085; + font-size: 0.75rem; + } +} + +.person-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); + gap: 20px; +} + +.loading-state, +.empty-state { + display: flex; + min-height: 320px; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + color: #667085; +} + +.empty-state mat-icon { + width: 54px; + height: 54px; + font-size: 54px; + color: #98a2b3; +} + +.empty-state h2 { + margin: 16px 0 6px; + color: #1d2939; +} + +@media (max-width: 700px) { + .bookmarks-page { + padding: 20px; + } + + .page-header { + align-items: flex-start; + flex-direction: column; + } +} diff --git a/webapp/src/app/modules/bookmarks/bookmarks.component.ts b/webapp/src/app/modules/bookmarks/bookmarks.component.ts new file mode 100644 index 00000000..c9c9e46e --- /dev/null +++ b/webapp/src/app/modules/bookmarks/bookmarks.component.ts @@ -0,0 +1,99 @@ +import { CommonModule } from '@angular/common'; +import { Component, DestroyRef, inject, signal } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { MatIconModule } from '@angular/material/icon'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { catchError, forkJoin, map, of, switchMap } from 'rxjs'; + +import { CustomAuthor, PersonsService } from '../../api'; +import { BookmarkService } from '../../shared/services/bookmark.service'; +import { PersonCardComponent } from '../person-card/person-card.component'; + +const PERSON_INCLUDE_TAGS = + 'display_name,works_count,cited_by_count,summary_stats,ids,' + + 'last_known_institutions,affiliations,topics,orcid,topics_full,' + + 'topic_share,career_metrics'; + +@Component({ + selector: 'app-bookmarks', + standalone: true, + imports: [ + CommonModule, + MatIconModule, + MatProgressSpinnerModule, + PersonCardComponent, + ], + templateUrl: './bookmarks.component.html', + styleUrl: './bookmarks.component.scss', +}) +export class BookmarksComponent { + readonly bookmarkService = inject(BookmarkService); + private readonly personsService = inject(PersonsService); + private readonly destroyRef = inject(DestroyRef); + + readonly persons = signal([]); + readonly loading = signal(true); + + constructor() { + this.loadBookmarks(); + } + + toggleBookmark(person: CustomAuthor): void { + this.bookmarkService + .confirmToggle(person) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe({ + next: (bookmarked) => { + if (!bookmarked) { + const id = this.personId(person); + this.persons.update((persons) => + persons.filter((item) => this.personId(item) !== id), + ); + } + }, + }); + } + + private loadBookmarks(): void { + this.bookmarkService + .load(true) + .pipe( + switchMap((bookmarks) => { + if (!bookmarks.length) return of([] as CustomAuthor[]); + return forkJoin( + bookmarks.map((bookmark) => + this.personsService + .getPersonByID(bookmark.person_id, PERSON_INCLUDE_TAGS) + .pipe( + map( + (response) => + response.results?.[0] ?? { + id: bookmark.person_id, + display_name: bookmark.person_name, + }, + ), + catchError(() => + of({ + id: bookmark.person_id, + display_name: bookmark.person_name, + } as CustomAuthor), + ), + ), + ), + ); + }), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe({ + next: (persons) => { + this.persons.set(persons); + this.loading.set(false); + }, + error: () => this.loading.set(false), + }); + } + + private personId(person: CustomAuthor): string { + return person.id?.replace(/\/$/, '').split('/').pop() ?? ''; + } +} diff --git a/webapp/src/app/modules/dashboard/dashboard-statistics.service.ts b/webapp/src/app/modules/dashboard/dashboard-statistics.service.ts new file mode 100644 index 00000000..828fd7ee --- /dev/null +++ b/webapp/src/app/modules/dashboard/dashboard-statistics.service.ts @@ -0,0 +1,125 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable, inject } from '@angular/core'; +import { Observable } from 'rxjs'; + +import { Configuration } from '../../api'; + +export type TopAuthorsWorksPeriod = 'all_time' | 'last_5_years'; + +export interface DashboardStatistics { + institution_id: string; + organization_name: string; + publications: number; + persons: number; + projects: number; + dfg_projects: number; + eu_projects: number; + bmbf_projects: number; +} + +export interface DashboardStatisticValue { + institution_id: string; + organization_name: string; + value: number; +} + +export interface TopAuthor { + id?: string | null; + name: string; + count: number; +} + +export interface TopAuthorStatistics { + institution_id: string; + works: TopAuthor[]; + projects: TopAuthor[]; + patents: TopAuthor[]; + news: TopAuthor[]; +} + +export interface TopicHeatmapValue { + year: number; + count: number; + share: number; +} + +export interface TopicHeatmapField { + id: string; + name: string; + total: number; + values: TopicHeatmapValue[]; +} + +export interface TopicHeatmap { + institution_id: string; + organization_name: string; + years: number[]; + fields: TopicHeatmapField[]; +} + +@Injectable({ providedIn: 'root' }) +export class DashboardStatisticsService { + private readonly httpClient = inject(HttpClient); + private readonly apiConfiguration = inject(Configuration, { optional: true }); + + getStatistics(): Observable { + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics`, + ); + } + + getPublicationCount(): Observable { + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/publications`, + ); + } + + getPersonCount(): Observable { + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/persons`, + ); + } + + getEuProjectCount(): Observable { + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/eu`, + ); + } + + getBmbfProjectCount(): Observable { + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/bmbf`, + ); + } + + getDfgProjectCount(): Observable { + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/dfg`, + ); + } + + getTopAuthors( + worksPeriod: TopAuthorsWorksPeriod = 'all_time', + ): Observable { + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/top-authors`, + { + params: { works_period: worksPeriod }, + }, + ); + } + + getTopicHeatmap( + fromYear?: number, + toYear?: number, + ): Observable { + const params: Record = {}; + if (fromYear !== undefined) params['from_year'] = fromYear; + if (toYear !== undefined) params['to_year'] = toYear; + + return this.httpClient.get( + `${this.apiConfiguration?.basePath ?? ''}/api/dashboard/topic-heatmap`, + { params }, + ); + } +} diff --git a/webapp/src/app/modules/dashboard/dashboard.component.html b/webapp/src/app/modules/dashboard/dashboard.component.html index 1c451952..6ac15fe6 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.html +++ b/webapp/src/app/modules/dashboard/dashboard.component.html @@ -1,41 +1,253 @@
-
-

University Performance Dashboard

-
- +
+ +
+ menu_book +
+
+ Publikationen + + {{ + isStatisticLoading('publications') + ? '…' + : ((statistics?.publications | number) ?? '–') + }} + +
+
-
+ + @if (statisticsError) { +

Die Kennzahlen konnten nicht geladen werden.

+ } + + @if (topicHeatmapLoading || topicHeatmapError || hasTopicHeatmapData()) { +
+
+
+

Field Treemap

+

Publikationen Ihrer Organisation nach Field.

+
+
+
+ + + +
+ + +
+
+ + @if (topicHeatmapError) { +

+ Die Field-Treemap konnte nicht geladen werden. +

+ } @else { + + } +
+ } + + @if (topAuthorsLoading || topAuthorsError || hasTopAuthorData()) { +
+
+
+

Top 10 Personen aller Zeiten

+

Nach Anzahl der Works und Projekte Ihrer Organisation.

+
+
-
-
+ -
-
- -
+ @if (topAuthorsError) { +

+ Die Autorenstatistiken konnten nicht geladen werden. +

+ } @else { +
+ @for (dataset of visibleTopAuthorDatasets(); track dataset.title) { +
+

+ {{ dataset.icon }}{{ dataset.title }} +

+ @for ( + entry of dataset.entries; + track entry.id || entry.name; + let rank = $index + ) { +
+ {{ rank + 1 }} +
+
+ @if (entry.id) { + + {{ entry.name }} + + } @else { + {{ entry.name }} + } + {{ entry.count | number }} +
+
+ +
+
+
+ } @empty { +

+ {{ + topAuthorsLoading + ? 'Wird geladen …' + : 'Keine Daten vorhanden.' + }} +

+ } +
+ } +
+ } + + } - -
diff --git a/webapp/src/app/modules/dashboard/dashboard.component.scss b/webapp/src/app/modules/dashboard/dashboard.component.scss index f9b4f56b..b3c16773 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.scss +++ b/webapp/src/app/modules/dashboard/dashboard.component.scss @@ -4,92 +4,350 @@ font-family: 'Inter', sans-serif; color: #333; - .dashboard-header { - display: flex; - justify-content: space-between; - align-items: center; + .statistics-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); + gap: 1rem; margin-bottom: 2rem; - border-bottom: 1px solid #eee; - padding-bottom: 1rem; } - .content-grid { - display: grid; - grid-template-columns: 2fr 1fr; - gap: 2rem; + .statistics-card { + display: flex; + align-items: center; + gap: 1rem; + min-height: 120px; + padding: 1.25rem; + border: 1px solid #e2e8f0; + border-radius: 12px; + background: #fff; + box-shadow: 0 4px 14px rgb(15 23 42 / 6%); + color: inherit; + text-decoration: none; + transition: + border-color 160ms ease, + box-shadow 160ms ease, + transform 160ms ease; - @media (max-width: 1024px) { + &:hover { + border-color: #93c5fd; + box-shadow: 0 8px 24px rgb(15 23 42 / 12%); + transform: translateY(-2px); + } + + &:focus-visible { + outline: 3px solid #93c5fd; + outline-offset: 3px; + } + + &.disabled { + pointer-events: none; + } + + span, + small { + display: block; + color: #64748b; + } + + strong { + display: block; + margin: 0.2rem 0; + color: #0f172a; + font-size: clamp(1.7rem, 3vw, 2.3rem); + line-height: 1.1; + } + } + + .statistics-icon { + display: grid; + flex: 0 0 52px; + width: 52px; + height: 52px; + place-items: center; + border-radius: 12px; + background: #dbeafe; + color: #1d4ed8; + + &--persons { + background: #dcfce7; + color: #15803d; + } + + &--eu-projects { + background: #e0f2fe; + color: #0369a1; + } + + &--bund-projects { + background: #fef3c7; + color: #b45309; + } + + &--dfg-projects { + background: #f3e8ff; + color: #7e22ce; + } + } + + .statistics-error { + margin: -1rem 0 2rem; + color: #b91c1c; + } + + .top-authors-section { + margin-bottom: 2.5rem; + } + + .topic-heatmap-section { + margin-bottom: 2.5rem; + padding: 1.25rem; + border: 1px solid #e2e8f0; + border-radius: 12px; + background: #fff; + } + + .topic-heatmap-header { + display: flex; + align-items: flex-end; + justify-content: space-between; + gap: 1rem; + margin-bottom: 1rem; + + h2, + p { + margin: 0; + } + + p { + margin-top: 0.35rem; + color: #64748b; + } + + @media (max-width: 820px) { + align-items: flex-start; + flex-direction: column; + } + } + + .topic-treemap-period-controls { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: 0.65rem; + + label { + display: inline-flex; + align-items: center; + gap: 0.35rem; + color: #475569; + font-size: 0.9rem; + font-weight: 600; + } + + input { + width: 5.5rem; + padding: 0.45rem 0.55rem; + border: 1px solid #cbd5e1; + border-radius: 6px; + color: #0f172a; + font: inherit; + + &:focus { + border-color: #93c5fd; + outline: 3px solid #bfdbfe; + outline-offset: 0; + } + } + } + + .topic-treemap-period-toggle { + display: inline-flex; + overflow: hidden; + border: 1px solid #cbd5e1; + border-radius: 6px; + background: #fff; + + button { + padding: 0.5rem 0.7rem; + border: 0; + border-right: 1px solid #cbd5e1; + background: transparent; + color: #334155; + cursor: pointer; + font: inherit; + font-weight: 600; + + &:last-child { + border-right: 0; + } + + &.active { + background: #1d4ed8; + color: #fff; + } + + &:focus-visible { + outline: 3px solid #93c5fd; + outline-offset: -3px; + } + } + } + + .top-authors-header { + display: flex; + align-items: flex-end; + justify-content: space-between; + gap: 1rem; + margin-bottom: 1rem; + + h2, + p { + margin: 0; + } + + p { + margin-top: 0.35rem; + color: #64748b; + } + + @media (max-width: 720px) { + align-items: flex-start; + flex-direction: column; + } + + } + + .top-authors-period-toggle { + display: inline-flex; + overflow: hidden; + border: 1px solid #cbd5e1; + border-radius: 6px; + background: #fff; + + button { + padding: 0.55rem 0.8rem; + border: 0; + border-right: 1px solid #cbd5e1; + background: transparent; + color: #334155; + cursor: pointer; + font: inherit; + + &:last-child { + border-right: 0; + } + + &.active { + background: #1d4ed8; + color: #fff; + } + + &:focus-visible { + outline: 3px solid #93c5fd; + outline-offset: -3px; + } + } + } + + .top-authors-grid { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 1rem; + + &.loading { + opacity: 0.65; + } + + @media (max-width: 900px) { grid-template-columns: 1fr; } } - .controls { + .top-authors-chart { + padding: 1.25rem; + border: 1px solid #e2e8f0; + border-radius: 12px; + background: #fff; + + h3 { + display: flex; + align-items: center; + gap: 0.5rem; + margin: 0 0 1rem; + color: #0f172a; + } + } + + .author-bar-row { display: flex; - gap: 1rem; - - select { - padding: 0.5rem; - border-radius: 4px; - border: 1px solid #ccc; - } - - .toggle-group { - button { - padding: 0.5rem 1rem; - border: 1px solid #0056b3; - background: white; - color: #0056b3; - cursor: pointer; - &:first-child { - border-radius: 4px 0 0 4px; - } - &:last-child { - border-radius: 0 4px 4px 0; - } - &.active { - background: #0056b3; - color: white; - } - } - } - } -} - -// Table styling -.ranking-table { - width: 100%; - border-collapse: collapse; - font-size: 0.9rem; - - th, - td { - padding: 0.75rem; - text-align: left; - border-bottom: 1px solid #f0f0f0; + align-items: center; + gap: 0.65rem; + margin-top: 0.7rem; } - .top-tier { - background-color: #f8fbff; - font-weight: 600; - } - .positive { - color: #28a745; - } - .negative { - color: #dc3545; - } - .mover-badge { - margin-left: 4px; + .author-rank { + flex: 0 0 1.4rem; + color: #64748b; font-size: 0.8rem; + text-align: center; } - .trend-col { - font-weight: bold; - &[data-trend='up'] { - color: #28a745; - } - &[data-trend='down'] { - color: #dc3545; + .author-bar-content { + min-width: 0; + flex: 1; + } + + .author-bar-label { + display: flex; + justify-content: space-between; + gap: 0.75rem; + margin-bottom: 0.25rem; + font-size: 0.85rem; + + span { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } } + + .author-link { + overflow: hidden; + color: #1d4ed8; + font-weight: 600; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + + &:hover { + text-decoration: underline; + } + + &:focus-visible { + border-radius: 2px; + outline: 2px solid #93c5fd; + outline-offset: 2px; + } + } + + .author-bar-track { + overflow: hidden; + height: 7px; + border-radius: 999px; + background: #e2e8f0; + } + + .author-bar-fill { + display: block; + height: 100%; + border-radius: inherit; + background: linear-gradient(90deg, #2563eb, #60a5fa); + transition: width 220ms ease; + } + + .empty-chart { + margin: 2rem 0; + color: #64748b; + text-align: center; + } } diff --git a/webapp/src/app/modules/dashboard/dashboard.component.ts b/webapp/src/app/modules/dashboard/dashboard.component.ts index 53af9fad..9a5a9660 100644 --- a/webapp/src/app/modules/dashboard/dashboard.component.ts +++ b/webapp/src/app/modules/dashboard/dashboard.component.ts @@ -1,67 +1,280 @@ -import { Component, inject, OnInit } from '@angular/core'; -import { UniversityLineChartComponent } from '../university-ranking/uni-line-chart/uni-line-chart.component'; -import { UniversityRankingTableComponent } from '../university-ranking/uni-ranking-table/uni-ranking-table.component'; +import { Component, OnInit } from '@angular/core'; +import { DecimalPipe } from '@angular/common'; +import { MatIconModule } from '@angular/material/icon'; +import { Observable, finalize } from 'rxjs'; +import { RouterLink } from '@angular/router'; +import { TopicHeatmapComponent } from './topic-heatmap/topic-heatmap.component'; import { - UniversityTopicData, - UniversityRanking, - UniversityRankingsService, -} from '../../api'; - -export type ResearchTopic = string; -export type DashboardMetric = 'publications' | 'citations'; + DashboardStatisticValue, + DashboardStatistics, + DashboardStatisticsService, + TopAuthor, + TopAuthorStatistics, + TopAuthorsWorksPeriod, + TopicHeatmap, +} from './dashboard-statistics.service'; +type DashboardStatisticKey = + | 'publications' + | 'persons' + | 'eu_projects' + | 'bmbf_projects' + | 'dfg_projects'; +type TopicTreemapPeriod = + | 'last_5_years' + | 'last_10_years' + | 'all_time' + | 'custom'; @Component({ selector: 'dashboard', - imports: [UniversityLineChartComponent, UniversityRankingTableComponent], + imports: [DecimalPipe, MatIconModule, RouterLink, TopicHeatmapComponent], templateUrl: './dashboard.component.html', styleUrl: './dashboard.component.scss', }) export class DashboardComponent implements OnInit { - private readonly dataService = inject(UniversityRankingsService); + statistics?: Partial; + statisticsLoading = false; + statisticsError = false; + statisticLoading: Record = { + publications: false, + persons: false, + eu_projects: false, + bmbf_projects: false, + dfg_projects: false, + }; + statisticErrors: Record = { + publications: false, + persons: false, + eu_projects: false, + bmbf_projects: false, + dfg_projects: false, + }; + private pendingStatisticRequests = 0; + topAuthors?: TopAuthorStatistics; + topAuthorsLoading = false; + topAuthorsError = false; + topAuthorsWorksPeriod: TopAuthorsWorksPeriod = 'all_time'; + topicHeatmap?: TopicHeatmap; + topicHeatmapLoading = false; + topicHeatmapError = false; + topicTreemapPeriod: TopicTreemapPeriod = 'last_5_years'; + topicTreemapFromYear = new Date().getFullYear() - 4; + topicTreemapToYear = new Date().getFullYear(); - topics: ResearchTopic[] = [ - 'Quantum Computing', - 'Renewable Energy', - 'Artificial Intelligence and Decision Support Systems', - ]; - selectedTopic: ResearchTopic = 'Quantum Computing'; - metric: DashboardMetric = 'publications'; - - rawDataSource: UniversityTopicData[] = []; - computedRankings: UniversityRanking[] = []; - isLoading = false; + constructor(private statisticsService: DashboardStatisticsService) {} ngOnInit() { - this.loadData(); + this.loadStatistics(); + this.loadTopAuthors(); + this.loadTopicHeatmap(); } - onTopicChange(topic: ResearchTopic) { - this.selectedTopic = topic; - this.loadData(); // Re-fetch as rankings depend on the topic + private loadStatistics(): void { + this.statisticsError = false; + this.loadStatistic( + 'publications', + this.statisticsService.getPublicationCount(), + ); + this.loadStatistic('persons', this.statisticsService.getPersonCount()); + this.loadStatistic( + 'eu_projects', + this.statisticsService.getEuProjectCount(), + ); + this.loadStatistic( + 'bmbf_projects', + this.statisticsService.getBmbfProjectCount(), + ); + this.loadStatistic( + 'dfg_projects', + this.statisticsService.getDfgProjectCount(), + ); } - setMetric(metric: DashboardMetric) { - this.metric = metric; - this.loadData(); // Re-fetch as ranking order changes based on metric + isStatisticLoading(key: DashboardStatisticKey): boolean { + return this.statisticLoading[key]; } - private loadData() { - this.isLoading = true; - this.dataService - .getRankingsApiInseServiceUniversityRankingsGet( - this.selectedTopic, - this.metric, + topAuthorDatasets(): Array<{ + title: string; + icon: string; + entries: TopAuthor[]; + }> { + return [ + { + title: 'Publikationen', + icon: 'menu_book', + entries: this.topAuthors?.works ?? [], + }, + { + title: 'Projekte', + icon: 'work', + entries: this.topAuthors?.projects ?? [], + }, + { + title: 'Patente', + icon: 'description', + entries: this.topAuthors?.patents ?? [], + }, + { title: 'News', icon: 'article', entries: this.topAuthors?.news ?? [] }, + ]; + } + + visibleTopAuthorDatasets(): Array<{ + title: string; + icon: string; + entries: TopAuthor[]; + }> { + const datasets = this.topAuthorDatasets(); + return this.topAuthorsLoading + ? datasets + : datasets.filter((dataset) => dataset.entries.length > 0); + } + + hasTopAuthorData(): boolean { + return this.topAuthorDatasets().some( + (dataset) => dataset.entries.length > 0, + ); + } + + hasTopicHeatmapData(): boolean { + return (this.topicHeatmap?.fields ?? []).some( + (field) => + field.total > 0 || field.values.some((value) => value.count > 0), + ); + } + + setTopAuthorsWorksPeriod(period: TopAuthorsWorksPeriod): void { + if (period === this.topAuthorsWorksPeriod) return; + this.topAuthorsWorksPeriod = period; + this.loadTopAuthors(); + } + + authorBarWidth(entries: TopAuthor[], count: number): number { + const maximum = Math.max(...entries.map((entry) => entry.count), 1); + return (count / maximum) * 100; + } + + organizationName(): string { + return this.statistics?.organization_name ?? 'Ihre Organisation'; + } + + institutionRouteId(): string { + return ( + this.statistics?.institution_id?.replace('https://openalex.org/', '') ?? + this.topAuthors?.institution_id?.replace('https://openalex.org/', '') ?? + '' + ); + } + + setTopicTreemapPeriod(period: TopicTreemapPeriod): void { + if (period === this.topicTreemapPeriod && period !== 'custom') return; + + const currentYear = new Date().getFullYear(); + this.topicTreemapPeriod = period; + if (period === 'last_5_years') { + this.topicTreemapFromYear = currentYear - 4; + this.topicTreemapToYear = currentYear; + } else if (period === 'last_10_years') { + this.topicTreemapFromYear = currentYear - 9; + this.topicTreemapToYear = currentYear; + } else if (period === 'all_time') { + this.topicTreemapFromYear = 1900; + this.topicTreemapToYear = currentYear; + } + this.loadTopicHeatmap(); + } + + onTopicTreemapYearChange(field: 'from' | 'to', value: string): void { + const year = Number(value); + if (!Number.isInteger(year)) return; + + if (field === 'from') { + this.topicTreemapFromYear = year; + } else { + this.topicTreemapToYear = year; + } + this.topicTreemapPeriod = 'custom'; + this.loadTopicHeatmap(); + } + + private loadStatistic( + key: DashboardStatisticKey, + request: Observable, + ): void { + this.statisticLoading[key] = true; + this.statisticErrors[key] = false; + this.pendingStatisticRequests += 1; + this.statisticsLoading = true; + + request + .pipe( + finalize(() => { + this.statisticLoading[key] = false; + this.pendingStatisticRequests -= 1; + this.statisticsLoading = this.pendingStatisticRequests > 0; + }), ) .subscribe({ - next: (response) => { - this.rawDataSource = (response.timeseries as any) || []; - this.computedRankings = (response.rankings as any) || []; - this.isLoading = false; + next: (statistic) => { + this.applyStatisticValue(key, statistic); }, error: () => { - this.rawDataSource = []; - this.computedRankings = []; - this.isLoading = false; + this.statisticErrors[key] = true; + this.statisticsError = true; + }, + }); + } + + private applyStatisticValue( + key: DashboardStatisticKey, + statistic: DashboardStatisticValue, + ): void { + const nextStatistics = { + ...(this.statistics ?? {}), + institution_id: statistic.institution_id, + organization_name: statistic.organization_name, + [key]: statistic.value, + }; + nextStatistics.projects = + (nextStatistics.eu_projects ?? 0) + + (nextStatistics.bmbf_projects ?? 0) + + (nextStatistics.dfg_projects ?? 0); + this.statistics = nextStatistics; + } + + private loadTopAuthors(): void { + this.topAuthorsLoading = true; + this.topAuthorsError = false; + this.statisticsService + .getTopAuthors(this.topAuthorsWorksPeriod) + .pipe(finalize(() => (this.topAuthorsLoading = false))) + .subscribe({ + next: (statistics) => { + this.topAuthors = statistics; + }, + error: () => { + this.topAuthorsError = true; + }, + }); + } + + private loadTopicHeatmap(): void { + if (this.topicTreemapFromYear > this.topicTreemapToYear) { + this.topicHeatmapError = true; + return; + } + + this.topicHeatmapLoading = true; + this.topicHeatmapError = false; + this.statisticsService + .getTopicHeatmap(this.topicTreemapFromYear, this.topicTreemapToYear) + .pipe(finalize(() => (this.topicHeatmapLoading = false))) + .subscribe({ + next: (heatmap) => { + this.topicHeatmap = heatmap; + }, + error: () => { + this.topicHeatmapError = true; }, }); } diff --git a/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.html b/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.html new file mode 100644 index 00000000..d443e1a1 --- /dev/null +++ b/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.html @@ -0,0 +1,7 @@ +@if (heatmap?.fields?.length) { +
+} @else { +

+ {{ loading ? 'Wird geladen ...' : 'Keine Field-Daten vorhanden.' }} +

+} diff --git a/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.scss b/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.scss new file mode 100644 index 00000000..773d1c4e --- /dev/null +++ b/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.scss @@ -0,0 +1,12 @@ +.topic-treemap-chart { + width: 100%; + height: 560px; +} + +.topic-treemap-empty { + display: grid; + min-height: 260px; + margin: 0; + place-items: center; + color: #64748b; +} diff --git a/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.ts b/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.ts new file mode 100644 index 00000000..d124c1d4 --- /dev/null +++ b/webapp/src/app/modules/dashboard/topic-heatmap/topic-heatmap.component.ts @@ -0,0 +1,212 @@ +import { Component, Input, OnChanges } from '@angular/core'; +import { EChartsOption } from 'echarts'; +import { NgxEchartsDirective } from 'ngx-echarts'; + +import { TopicHeatmap } from '../dashboard-statistics.service'; + +@Component({ + selector: 'app-topic-heatmap', + imports: [NgxEchartsDirective], + templateUrl: './topic-heatmap.component.html', + styleUrl: './topic-heatmap.component.scss', +}) +export class TopicHeatmapComponent implements OnChanges { + @Input() heatmap?: TopicHeatmap; + @Input() loading = false; + + options: EChartsOption = {}; + private readonly colors = [ + '#2563eb', + '#059669', + '#d97706', + '#dc2626', + '#7c3aed', + '#0284c7', + '#ea580c', + '#4f46e5', + '#0f766e', + '#be123c', + ]; + + ngOnChanges(): void { + this.options = this.buildOptions(); + } + + private buildOptions(): EChartsOption { + const fields = this.heatmap?.fields ?? []; + const data = fields.map((field) => ({ + id: field.id, + name: field.name, + value: field.total || this.totalCount(field.values), + label: { + show: true, + formatter: (params: any) => + `${params.name}\n${this.formatCount(params.value)}`, + color: '#ffffff', + fontWeight: 700, + lineHeight: 18, + overflow: 'truncate' as const, + }, + children: field.values + .filter((value) => value.count > 0) + .map((value) => ({ + name: String(value.year), + value: value.count, + share: value.share, + })), + })); + + return { + tooltip: { + formatter: (params: any) => { + const count = Number(params.value ?? 0); + const share = + typeof params.data?.share === 'number' + ? `
Anteil im Jahr: ${(params.data.share * 100).toFixed(1)}%` + : ''; + return `${params.name}
${count} Publikationen${share}`; + }, + }, + series: [ + { + name: 'Fields', + type: 'treemap', + data, + roam: false, + nodeClick: 'zoomToNode', + sort: 'desc', + drillDownIcon: '', + breadcrumb: { + show: true, + bottom: 0, + height: 24, + left: 8, + right: 8, + emptyItemWidth: 80, + itemStyle: { + color: '#f8fafc', + borderColor: '#cbd5e1', + borderWidth: 1, + textStyle: { + color: '#334155', + fontWeight: 600, + }, + }, + emphasis: { + itemStyle: { + color: '#e0f2fe', + borderColor: '#93c5fd', + textStyle: { + color: '#0f172a', + fontWeight: 700, + }, + }, + }, + }, + color: this.colors, + colorMappingBy: 'id', + label: { + show: true, + formatter: (params: any) => + `${params.name}\n${this.formatCount(params.value)}`, + color: '#ffffff', + fontWeight: 600, + lineHeight: 18, + position: 'inside', + align: 'center', + verticalAlign: 'middle', + overflow: 'truncate', + }, + upperLabel: { + show: true, + formatter: (params: any) => + `${params.name} · ${this.formatCount(params.value)}`, + height: 30, + color: '#ffffff', + fontWeight: 700, + overflow: 'truncate', + }, + levels: [ + { + color: this.colors, + label: { + show: true, + position: 'inside', + align: 'center', + verticalAlign: 'middle', + }, + upperLabel: { show: false }, + itemStyle: { + borderColor: '#ffffff', + borderWidth: 3, + gapWidth: 3, + }, + }, + { + color: this.colors, + label: { + show: true, + position: 'inside', + align: 'center', + verticalAlign: 'middle', + }, + upperLabel: { show: false }, + itemStyle: { + borderColor: '#ffffff', + borderWidth: 3, + gapWidth: 3, + }, + }, + { + colorSaturation: [0.45, 0.78], + label: { + show: true, + formatter: (params: any) => + `${params.name}\n${this.formatCount(params.value)}`, + position: 'inside', + align: 'center', + verticalAlign: 'middle', + color: '#ffffff', + fontWeight: 700, + lineHeight: 18, + overflow: 'truncate', + }, + upperLabel: { show: false }, + itemStyle: { + borderColor: '#ffffff', + borderWidth: 2, + gapWidth: 2, + }, + }, + ], + leafDepth: 1, + top: 8, + right: 8, + bottom: 32, + left: 8, + animationDurationUpdate: 450, + emphasis: { + focus: 'self', + label: { + color: '#ffffff', + }, + }, + itemStyle: { + borderRadius: 4, + borderColor: '#ffffff', + borderWidth: 3, + gapWidth: 3, + }, + }, + ], + }; + } + + private totalCount(values: Array<{ count: number }>): number { + return values.reduce((sum, value) => sum + value.count, 0); + } + + private formatCount(value: unknown): string { + return Number(value ?? 0).toLocaleString('de-DE'); + } +} 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 3b90b1b5..099e3335 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.ts +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -132,7 +132,8 @@ export class InstitutionPatentsComponent implements OnInit { this.patentsApi .getOrgPatentsByInstitution( institutionId, - this.activeMatchType, + + this.activeMatchType !== 'all' ? this.activeMatchType : undefined, this.selectedPage - 1, this.pageSize, this.activeFilter !== 'all' ? this.activeFilter : undefined, @@ -197,7 +198,7 @@ export class InstitutionPatentsComponent implements OnInit { ); } - formatDate(date: string | null): string { + formatDate(date: string | null | undefined): string { return formatPatentDate(date); } diff --git a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html new file mode 100644 index 00000000..a2649375 --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html @@ -0,0 +1,132 @@ +@if (loading()) { +

Lade passende Patente...

+} @else if (error()) { +

Fehler beim Laden der Patente.

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

Keine passenden Patente gefunden.

+} @else { +
+

Passende Patente

+ +
+
+
+ +
+ + + + + + + + + + + + @for (item of pagedMatches(); track trackMatch($index, item)) { + + + + + + + } + +
PatentScoreQuelleJahr
+ {{ item.patent.title ?? item.patent.patent_id }} + {{ formatScore(item.match_score) }} + + {{ item.patent.source }} + + {{ item.patent.publication_year ?? '-' }}
+ + @if (hasPagination()) { + + } +
+ + @if (selectedMatch(); as match) { +
+

{{ match.patent.title ?? match.patent.patent_id }}

+
+
+ Match-Score + {{ formatScore(match.match_score) }} +
+
+ Gematchte Keywords + {{ + formatMatchList(match.matched_keywords) + }} +
+
+ Gematchte IPC/CPC + {{ + formatMatchList(match.matched_ipc_symbols) + }} +
+
+ Quelle + + + {{ match.patent.source }} + + +
+
+ Patent-Nr. + {{ match.patent.patent_id }} +
+
+ Datum + {{ + formatDate(match.patent.publication_date) + }} +
+ @if (getPublicationStageLabel(match.patent); as stageLabel) { +
+ Publikationsstufe + {{ stageLabel }} +
+ } +
+ + +
+ } +
+
+} diff --git a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.scss b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.scss new file mode 100644 index 00000000..d700ff61 --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.scss @@ -0,0 +1,156 @@ +.message { + padding: 16px; + color: #666; +} + +.section-title { + margin: 0 0 16px; + font-size: 1.25rem; +} + +.patents-container { + margin-top: 1.5rem; + padding: 16px; + border-radius: 12px; + background: #fff; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); +} + +.sort-control { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 10px 14px; + border-radius: 20px; + background: #f2f2f2; + font-size: 14px; + + select { + border: 0; + background: transparent; + font: inherit; + cursor: pointer; + } +} + +.patents-content { + display: flex; + gap: 24px; + align-items: flex-start; +} + +.patents-list { + flex: 1; + + table { + width: 100%; + border-collapse: collapse; + } + + th { + text-align: left; + padding: 10px 12px; + border-bottom: 2px solid #e0e0e0; + } + + tr { + cursor: pointer; + + &:hover { + background: #f5f5f5; + } + + &.selected { + background: #f0f0f0; + } + } + + td { + padding: 10px 12px; + border-bottom: 1px solid #eee; + } +} + +.patent-title { + font-weight: 500; +} + +.source-badge { + display: inline-block; + padding: 2px 8px; + border-radius: 999px; + font-size: 12px; + font-weight: 600; + + &--epo { + background: #dbeafe; + color: #1e40af; + } + + &--uspto { + background: #dcfce7; + color: #166534; + } +} + +.pagination { + display: flex; + align-items: center; + gap: 12px; + margin-top: 12px; +} + +.patent-detail { + flex: 0 0 320px; + padding: 16px; + border-radius: 12px; + background: #f8fafc; +} + +.detail-stats { + display: grid; + gap: 10px; + margin: 12px 0; +} + +.match-score { + font-variant-numeric: tabular-nums; + color: #374151; + white-space: nowrap; +} + +.stat-label { + display: block; + font-size: 12px; + color: #666; +} + +.stat-value { + display: block; + word-break: break-word; +} + +.patent-detail-action { + display: flex; + align-items: center; + justify-content: space-between; + width: 100%; + margin-top: 12px; + padding: 10px 12px; + border: 0; + border-radius: 8px; + background: #111827; + color: #fff; + cursor: pointer; +} + +@media (max-width: 900px) { + .patents-content { + flex-direction: column; + } + + .patent-detail { + flex: 1; + width: 100%; + } +} diff --git a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts new file mode 100644 index 00000000..82acd1fa --- /dev/null +++ b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts @@ -0,0 +1,131 @@ +import { Component, input, signal } from '@angular/core'; + +import { Router } from '@angular/router'; + +import { PatentEntry } from '../../../api/model/patentEntry'; + +import { + formatPatentDate, + getPublicationStageLabel, +} from '../../patent-detail/patent-detail.utils'; +import { KeywordPatentMatch } from '../../../api'; + +type SourceFilter = 'all' | 'EPO' | 'USPTO'; + +@Component({ + selector: 'app-keywords-patents', + + templateUrl: './keywords-patents.component.html', + + styleUrl: './keywords-patents.component.scss', +}) +export class KeywordsPatentsComponent { + readonly matches = input([]); + + readonly loading = input(false); + + readonly error = input(false); + + activeFilter = signal('all'); + + selectedMatch = signal(null); + + selectedPage = signal(1); + + readonly pageSize = 10; + + constructor(private readonly router: Router) {} + + filteredMatches(): KeywordPatentMatch[] { + const filter = this.activeFilter(); + + const items = this.matches(); + + if (filter === 'all') { + return items; + } + + return items.filter((item) => item.patent.source === filter); + } + + pagedMatches(): KeywordPatentMatch[] { + const start = (this.selectedPage() - 1) * this.pageSize; + + return this.filteredMatches().slice(start, start + this.pageSize); + } + + pageCount(): number { + return Math.max( + 1, + Math.ceil(this.filteredMatches().length / this.pageSize), + ); + } + + hasPagination(): boolean { + return this.pageCount() > 1; + } + + setFilter(filter: SourceFilter): void { + this.activeFilter.set(filter); + + this.selectedPage.set(1); + + this.selectedMatch.set(null); + } + + setPage(page: number): void { + this.selectedPage.set(Math.min(Math.max(page, 1), this.pageCount())); + } + + selectMatch(item: KeywordPatentMatch): void { + this.selectedMatch.set(item); + } + + openDetail(): void { + const match = this.selectedMatch(); + + if (!match) return; + + void this.router.navigate(['/patent', match.patent.patent_id]); + } + + formatDate(date: string | null | undefined): string { + return formatPatentDate(date); + } + + getPublicationStageLabel(patent: PatentEntry): string | null { + return getPublicationStageLabel(patent); + } + + formatScore(score: number | null | undefined): string { + if (score == null || Number.isNaN(score)) { + return '-'; + } + + return score.toFixed(2); + } + + formatMatchList(values: string[] | null | undefined): string { + if (!values || values.length === 0) { + return '-'; + } + + return values.join(', '); + } + + trackMatch(_index: number, item: KeywordPatentMatch): string { + const patent = item.patent; + + return [ + patent.source, + + patent.patent_id, + + patent.publication_date ?? '', + + patent.kind ?? patent.application_type ?? '', + + item.match_score, + ].join('|'); + } +} 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 3edd92ee..ac68827c 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.html @@ -427,27 +427,46 @@ @if (keywordsExist()) { -
- +
+
+ - + + + +
+ + @if (showPatents()) { + + + } } 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 b9692f90..895c6a8b 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.scss +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.scss @@ -445,6 +445,7 @@ mat-button-toggle-group { ============================================================ */ .search-container { display: flex; + flex-wrap: wrap; justify-content: center; align-items: center; gap: 1rem; @@ -460,13 +461,19 @@ mat-button-toggle-group { } .search-btn, -.visualize-btn { +.visualize-btn, +.patents-btn { min-width: 220px; min-height: $touch-target; align-self: center; white-space: nowrap; } +.patents-btn { + background: #0f766e !important; + color: #fff !important; +} + /* Tablet */ @media (max-width: $tablet) { .search-container { @@ -478,7 +485,8 @@ mat-button-toggle-group { } .search-btn, - .visualize-btn { + .visualize-btn, + .patents-btn { width: 100%; } } @@ -501,7 +509,8 @@ mat-button-toggle-group { } .search-btn, - .visualize-btn { + .visualize-btn, + .patents-btn { width: 100%; } } @@ -526,7 +535,7 @@ mat-button-toggle-group { width: 100%; justify-content: center; } - .search-btn { + .action-btn { width: 100%; } } 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 d009ad67..b67b9017 100644 --- a/webapp/src/app/modules/keywords-search/keywords-search.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-search.component.ts @@ -53,11 +53,19 @@ import { } from '../../resolvers/utils/topic-legend'; import { MatTooltipModule } from '@angular/material/tooltip'; import { A11yModule } from '@angular/cdk/a11y'; +import { PatentsService } from '../../api/api/patents.service'; +import { KeywordsPatentsComponent } from './keywords-patents/keywords-patents.component'; import { DomSanitizer } from '@angular/platform-browser'; import { SearchResultsPayload } from './search-results/search-results-state.service'; +import { + KeywordPatentMatch, + KeywordPatentSearchItem, + KeywordsService, +} from '../../api'; type InputMode = 'url' | 'text' | 'file'; type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual'; type KeywordView = 'llm' | 'topic'; +type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom'; @Component({ selector: 'app-keywords-search', imports: [ @@ -80,6 +88,7 @@ type KeywordView = 'llm' | 'topic'; MatTooltipModule, A11yModule, NgTemplateOutlet, + KeywordsPatentsComponent, LoadingComponent, MatSlideToggleModule, MatSliderModule, @@ -98,6 +107,8 @@ export class KeywordsSearchComponent { private readonly websocketService = inject(KeywordWebSocketService); private readonly topicsService = inject(TopicsService); private readonly breakpointObserver = inject(BreakpointObserver); + private readonly keywordsService = inject(KeywordsService); + readonly form = this.formBuilder.nonNullable.group({ selectedInputType: 'url' as InputMode, urlInput: '', @@ -131,6 +142,11 @@ export class KeywordsSearchComponent { readonly loadingNewKeyword = signal(false); readonly extractionSource = signal(null); readonly showVisualization = signal(false); + readonly showPatents = signal(false); + readonly patentMatches = signal([]); + readonly loadingPatents = signal(false); + readonly patentsError = signal(false); + readonly patentsLoaded = signal(false); readonly topicMappingSearch = signal(false); readonly uploadedFiles = signal([]); @@ -324,6 +340,10 @@ export class KeywordsSearchComponent { this.broadKeywordEntries.set([]); this.coarseKeywordEntries.set([]); this.fineKeywordEntries.set([]); + this.patentMatches.set([]); + this.patentsLoaded.set(false); + this.patentsError.set(false); + this.showPatents.set(false); this.websocketService.close(); this.isExtracting.set(false); this.loadingNewKeyword.set(false); @@ -574,6 +594,10 @@ export class KeywordsSearchComponent { this.manualKeywordEntries.set([]); this.sourceContent.set(''); this.sourceUrl.set(null); + this.patentMatches.set([]); + this.patentsLoaded.set(false); + this.patentsError.set(false); + this.showPatents.set(false); // Keep only selected keywords that are in the manual list const manualSet = new Set(this.getKeywordLabels(this.manualKeywords())); @@ -740,6 +764,7 @@ export class KeywordsSearchComponent { search(): void { this.showVisualization.set(false); + this.showPatents.set(false); const payload: SearchResultsPayload = { extractedKeywords: this.getSelectedExtractedKeywordEntries(), @@ -771,9 +796,16 @@ export class KeywordsSearchComponent { } visualize(): void { + this.showPatents.set(false); this.showVisualization.set(true); } + loadPatentsForSelection(): void { + this.showVisualization.set(false); + this.showPatents.set(true); + this.loadMatchingPatents(); + } + // --- Helpers -------------------------------------------------------------- private applyExtractedKeywords(keywords: ExtractedKeywords): void { @@ -1206,4 +1238,76 @@ export class KeywordsSearchComponent { return 50; // fallback for unknown steps } } + + private loadMatchingPatents(): void { + const keywords = this.buildPatentSearchItems( + this.getSelectedPatentKeywordEntries(), + ); + if (keywords.length === 0) { + this.patentMatches.set([]); + this.patentsLoaded.set(true); + return; + } + + this.loadingPatents.set(true); + this.patentsError.set(false); + + this.keywordsService.getPatentsByKeywords({ keywords }).subscribe({ + next: (response) => { + this.patentMatches.set(response.patents ?? []); + this.patentsLoaded.set(true); + this.loadingPatents.set(false); + }, + error: (error) => { + console.error('Patent search failed:', error); + this.patentMatches.set([]); + this.patentsLoaded.set(true); + this.patentsError.set(true); + this.loadingPatents.set(false); + }, + }); + } + + private getSelectedPatentKeywordEntries(): Array<{ + entry: KeywordEntryWithTopic; + level: KeywordPatentLevel; + }> { + const selected = new Set( + this.selectedKeywords().map((k) => this.normalizeKeyword(k)), + ); + const isSelected = (item: KeywordEntryWithTopic) => + selected.has(this.normalizeKeyword(this.getKeywordLabel(item))); + + return [ + ...this.broadKeywordEntries() + .filter(isSelected) + .map((entry) => ({ entry, level: 'broad' as const })), + ...this.coarseKeywordEntries() + .filter(isSelected) + .map((entry) => ({ entry, level: 'coarse' as const })), + ...this.fineKeywordEntries() + .filter(isSelected) + .map((entry) => ({ entry, level: 'fine' as const })), + ...this.manualKeywordEntries() + .filter(isSelected) + .map((entry) => ({ entry, level: 'custom' as const })), + ]; + } + + private buildPatentSearchItems( + items: Array<{ entry: KeywordEntryWithTopic; level: KeywordPatentLevel }>, + ): KeywordPatentSearchItem[] { + return items + .map(({ entry, level }) => ({ + keyword: entry.llm_keyword.keyword, + keyword_level: level, + topic_id: entry.topic_mapping?.topic?.id ?? null, + topic_display_name: entry.topic_mapping?.topic?.display_name ?? null, + subfield_name: + entry.topic_mapping?.topic?.subfield?.display_name ?? null, + field_name: entry.topic_mapping?.topic?.field?.display_name ?? null, + relevance_score: entry.llm_keyword.relevance_score ?? 1, + })) + .filter((item) => item.keyword.trim().length > 0); + } } 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 ba19750e..1f978085 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.component.html +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.html @@ -24,10 +24,7 @@
- + {{ patent.source }} @if (patent.publication_year) { @@ -39,8 +36,9 @@

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

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

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

Erfinder

- {{ patent.inventors && patent.inventors.length }} + {{ patent.inventors?.length ?? 0 }}
@for (inventor of patent.inventors; track inventor) { @@ -107,12 +103,12 @@
- @if (patent.assignees && patent.assignees.length > 0) { + @if (patent.assignees?.length) {
account_balance

Anmelder

- {{ patent.assignees.length }} + {{ patent.assignees?.length ?? 0 }}
@for (assignee of patent.assignees; track assignee) { @@ -124,9 +120,28 @@
} - @if (patent.ipc_descriptions && patent.ipc_descriptions.length > 0) { -
+ @if (patent.openalex_topics?.length) { +
+
+ topic +

OpenAlex Themen

+
+
+ @for (topic of patent.openalex_topics; track topic.topic_id ?? topic.topic_display_name) { + + + } +
+
+ } + + @if (patent.ipc_descriptions?.length) { +
label

Klassifikation (IPC)

@@ -140,16 +155,22 @@
@for (symbol of card.symbols; track symbol) { - {{ symbol }} + + {{ symbol }} + }
- + {{ card.system }} - + {{ card.levelLabel }}
@@ -189,7 +210,7 @@ }
- } @else if (patent.ipc && patent.ipc.length > 0) { + } @else if (patent.ipc?.length) {
label @@ -203,9 +224,8 @@
} - @if (patent.cpc_descriptions && patent.cpc_descriptions.length > 0) { -
+ @if (patent.cpc_descriptions?.length) { +
label

Klassifikation (CPC)

@@ -219,16 +239,22 @@
@for (symbol of card.symbols; track symbol) { - {{ symbol }} + + {{ symbol }} + }
- + {{ card.system }} - + {{ card.levelLabel }}
@@ -268,7 +294,7 @@ }
- } @else if (patent.cpc && patent.cpc.length > 0) { + } @else if (patent.cpc?.length) {
label @@ -295,10 +321,7 @@
{{ row.label }}
@if (row.variant === 'source') { - + {{ row.value }} } @else { 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 5052d8db..013f39a4 100644 --- a/webapp/src/app/modules/patent-detail/patent-detail.component.ts +++ b/webapp/src/app/modules/patent-detail/patent-detail.component.ts @@ -9,6 +9,9 @@ import { finalize } from 'rxjs'; import { PatentsService } from '../../api/api/patents.service'; import { PatentEntry } from '../../api/model/patentEntry'; +import { OpenAlexTopicTag } from '../../api/model/openAlexTopicTag'; +import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; +import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; import { ClassificationCard, ClassificationSystem, @@ -28,6 +31,7 @@ import { MatIconModule, MatProgressSpinnerModule, RouterLink, + TopicChipComponent, ], templateUrl: './patent-detail.component.html', styleUrl: './patent-detail.component.scss', @@ -93,6 +97,19 @@ export class PatentDetailComponent implements OnInit { return getClassificationCards(entries, system); } + topicColor(topic: OpenAlexTopicTag): string { + return topicHierarchyColor({ + id: topic.topic_id, + name: topic.topic_display_name, + field_name: topic.field_name, + domain_name: topic.domain_name, + }); + } + + sectionColor(card: ClassificationCard): string { + return topicHierarchyColor({ field_name: card.sectionName }); + } + toggleClassificationExpanded(key: string): void { if (this.expandedClassificationKeys.has(key)) { this.expandedClassificationKeys.delete(key); @@ -128,7 +145,7 @@ export class PatentDetailComponent implements OnInit { .getPatentByIdOrTitle(patentId, prefix, title, fillingDate) .pipe(finalize(() => (this.loading = false))) .subscribe({ - next: (patent) => { + next: (patent: PatentEntry) => { this.patent = patent; }, error: () => { 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 e45957d9..91e2f826 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,6 @@ import { PatentEntry } from '../../api/model/patentEntry'; import { IpcClassification } from '../../api/model/ipcClassification'; + export type ClassificationSystem = 'IPC' | 'CPC'; export interface ClassificationCard { @@ -9,6 +10,7 @@ export interface ClassificationCard { levelLabel: string; primaryDescription: string | null; hierarchy: { label: string; value: string }[]; + sectionName: string | null; } export interface PatentMetadataRow { @@ -38,9 +40,7 @@ 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 }, @@ -120,9 +120,7 @@ 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); @@ -156,6 +154,7 @@ function buildClassificationCard( levelLabel: level.label, primaryDescription, hierarchy: buildHierarchyRows(entry, primaryDescription), + sectionName: entry.section ?? null, }; } @@ -181,25 +180,21 @@ 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 }); }; - if (entry.section) addRow('Sektion', entry.section); - if (entry.class) addRow('Klasse', entry.class); - if (entry.subclass) addRow('Unterklasse', entry.subclass); + + addRow('Sektion', entry.section ?? null); + addRow('Klasse', entry.class ?? null); + addRow('Unterklasse', entry.subclass ?? null); 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(' - ') diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index 92d02cec..be3f655b 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -1,313 +1,388 @@ -
-

Patente

- - - -
- - Suche nach Titel oder Patent-Nr. - - search - - - -
- - Alle - EPO - USPTO - - - -
-
- - - - @if (loading) { -
- - Lade Patente... -
- } @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) > 0) { -
-

Anmelder

-
    - @for (a of selectedPatent.assignees; track a) { -
  • {{ a }}
  • - } -
-
- } - - @if ((selectedPatent.ipc_descriptions?.length ?? 0) > 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) > 0) { -
-

Klassifikation (IPC)

-
    - @for (ipc of selectedPatent.ipc; track ipc) { -
  • {{ ipc }}
  • - } -
-
- } - - @if ((selectedPatent.cpc_descriptions?.length ?? 0) > 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) > 0) { -
-

Klassifikation (CPC)

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

Keine Patente gefunden.

-
- } @else { -
- @for ( - patent of patents; - track patent.patent_id + (patent.publication_date ?? '') - ) { - - - {{ - patent.title ?? patent.patent_id - }} - - {{ patent.source }} - - - - - - - - - - - - - - } -
- } - - - - @if (!showDetail) { - - } -
+
+

Patente

+ + + +
+ + Suche nach Titel oder Patent-Nr. + + search + + + +
+ + Alle + EPO + USPTO + + +
+
+ Zeitraum + +
+ +
+ {{ selectedStartYear }} + bis + {{ selectedEndYear }} +
+ +
+
+ + +
+ +
+ {{ minYear }} + {{ maxYear }} +
+
+
+
+ + + + @if (loading) { +
+ + Lade Patente... +
+ } @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) > 0) { +
+

Anmelder

+
    + @for (a of selectedPatent.assignees; track a) { +
  • {{ a }}
  • + } +
+
+ } + + @if ((selectedPatent.openalex_topics?.length ?? 0) > 0) { +
+

OpenAlex Themen

+
+ @for (topic of selectedPatent.openalex_topics; track topic.topic_id ?? topic.topic_display_name) { + + + } +
+
+ } + + @if ((selectedPatent.ipc_descriptions?.length ?? 0) > 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) > 0) { +
+

Klassifikation (IPC)

+
    + @for (ipc of selectedPatent.ipc; track ipc) { +
  • {{ ipc }}
  • + } +
+
+ } + + @if ((selectedPatent.cpc_descriptions?.length ?? 0) > 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) > 0) { +
+

Klassifikation (CPC)

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

Keine Patente gefunden.

+
+ } @else { +
+ @for ( + patent of patents; + track patent.patent_id + (patent.publication_date ?? '') + ) { + + + {{ + patent.title ?? patent.patent_id + }} + + {{ patent.source }} + + + + + + + + + + + + + + } +
+ } + + + + +
diff --git a/webapp/src/app/modules/patents/patents.component.ts b/webapp/src/app/modules/patents/patents.component.ts index e6af3264..1bedb3e4 100644 --- a/webapp/src/app/modules/patents/patents.component.ts +++ b/webapp/src/app/modules/patents/patents.component.ts @@ -1,366 +1,399 @@ -import { Component, OnInit, inject } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { ActivatedRoute, Router, RouterModule } from '@angular/router'; -import { MatIconModule } from '@angular/material/icon'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatPaginatorModule, PageEvent } from '@angular/material/paginator'; -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import { MatChipsModule } from '@angular/material/chips'; -import { MatDividerModule } from '@angular/material/divider'; -import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { debounceTime, distinctUntilChanged, Subject } from 'rxjs'; -import { PatentsService } from '../../api/api/patents.service'; -import { PatentEntry } from '../../api/model/patentEntry'; -import { IpcClassification } from '../../api'; -import { - QueryParamSelectorComponent, - SelectorOption, -} from '../../shared/ui/query-param-selector/query-param-selector.component'; - -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; - -@Component({ - selector: 'app-patents', - imports: [ - CommonModule, - RouterModule, - MatIconModule, - MatButtonModule, - MatCardModule, - MatFormFieldModule, - MatInputModule, - MatPaginatorModule, - MatProgressSpinnerModule, - MatChipsModule, - MatDividerModule, - QueryParamSelectorComponent, - ], - templateUrl: './patents.component.html', - styleUrl: './patents.component.scss', -}) -export class PatentsComponent implements OnInit { - private router = inject(Router); - private route = inject(ActivatedRoute); - private patentsApi = inject(PatentsService); - - patents: PatentEntry[] = []; - total = 0; - page = 0; - pageSize = 10; - - loading = true; - error = false; - - searchTerm = ''; - activeFilter: SourceFilter = 'all'; - sortDirection: string = 'desc'; - - selectedPatent: PatentEntry | null = null; - showDetail = false; - private expandedClassificationKeys = new Set(); - - private searchSubject = new Subject(); - - sortingDirectionOptions: SelectorOption[] = [ - { value: '', display_name: '' }, - { value: 'asc', display_name: 'Aufsteigend' }, - { value: 'desc', display_name: 'Absteigend' }, - ]; - - constructor() { - this.searchSubject - .pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed()) - .subscribe((term) => { - this.searchTerm = term; - this.page = 0; - this.selectedPatent = null; - this.showDetail = false; - this.loadPatents(); - this.updateQueryParams(); - }); - } - - ngOnInit(): void { - const qp = this.route.snapshot.queryParamMap; - this.searchTerm = qp.get('search') ?? ''; - this.page = parseInt(qp.get('page') ?? '0', 10); - this.pageSize = parseInt(qp.get('size') ?? '10', 10); - const f = qp.get('source'); - if (f === 'EPO' || f === 'USPTO') this.activeFilter = f; - const d = qp.get('sort_direction'); - if (d === 'asc' || d === 'desc') this.sortDirection = d; - - this.loadPatents(); - } - - 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, - ) - .subscribe({ - next: (res) => { - this.patents = res.patents; - this.total = res.total; - this.loading = false; - }, - error: () => { - this.error = true; - this.loading = false; - }, - }); - } - - onSearchInput(event: Event): void { - this.searchSubject.next((event.target as HTMLInputElement).value); - } - - clearSearch(): void { - this.searchTerm = ''; - this.page = 0; - this.selectedPatent = null; - this.showDetail = false; - this.loadPatents(); - this.updateQueryParams(); - } - - setFilterFromChip(event: any): void { - 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(); - } - - setSortDirection(direction: string): void { - this.sortDirection = direction; - this.loadPatents(); - this.updateQueryParams(); - } - - 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(); - } - - private updateQueryParams(): void { - this.router.navigate([], { - relativeTo: this.route, - queryParams: { - search: this.searchTerm || null, - page: this.page, - size: this.pageSize, - source: this.activeFilter === 'all' ? null : this.activeFilter, - sort_direction: this.sortDirection, - }, - queryParamsHandling: 'merge', - replaceUrl: true, - }); - } - - formatDate(date: string | null): string { - if (!date) return '-'; - const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); - const parsed = new Date(d); - 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 ?? null); - addRow('Klasse', entry.class ?? null); - addRow('Unterklasse', entry.subclass ?? null); - 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; - } -} +import { Component, OnInit, inject } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ActivatedRoute, Router, RouterModule } from '@angular/router'; +import { MatIconModule } from '@angular/material/icon'; +import { MatButtonModule } from '@angular/material/button'; +import { MatCardModule } from '@angular/material/card'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; +import { MatPaginatorModule, PageEvent } from '@angular/material/paginator'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatChipsModule } from '@angular/material/chips'; +import { MatDividerModule } from '@angular/material/divider'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { debounceTime, distinctUntilChanged, Subject } from 'rxjs'; +import { PatentsService } from '../../api/api/patents.service'; +import { PatentEntry } from '../../api/model/patentEntry'; +import { IpcClassification } from '../../api'; +import { OpenAlexTopicTag } from '../../api/model/openAlexTopicTag'; +import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; +import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; + +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 }[]; + sectionName: string | null; +} + +const DESCRIPTION_PREVIEW_LENGTH = 140; +const MIN_YEAR = 1978; + +@Component({ + selector: 'app-patents', + imports: [ + CommonModule, + RouterModule, + MatIconModule, + MatButtonModule, + MatCardModule, + MatFormFieldModule, + MatInputModule, + MatPaginatorModule, + MatProgressSpinnerModule, + MatChipsModule, + MatDividerModule, + TopicChipComponent, + ], + templateUrl: './patents.component.html', + styleUrl: './patents.component.scss', +}) +export class PatentsComponent implements OnInit { + private router = inject(Router); + private route = inject(ActivatedRoute); + private patentsApi = inject(PatentsService); + + patents: PatentEntry[] = []; + total = 0; + page = 0; + pageSize = 10; + + loading = true; + error = false; + + searchTerm = ''; + activeFilter: SourceFilter = 'all'; + sortDirection: string = 'asc'; + + // Jahr-Slider + readonly minYear = MIN_YEAR; + readonly maxYear = new Date().getFullYear(); + selectedStartYear = MIN_YEAR; + selectedEndYear = new Date().getFullYear(); + + private searchSubject = new Subject(); + + showDetail = false; + selectedPatent: PatentEntry | null = null; + readonly expandedClassificationKeys = new Set(); + + constructor() { + this.searchSubject + .pipe(debounceTime(300), distinctUntilChanged(), takeUntilDestroyed()) + .subscribe((term) => { + this.searchTerm = term; + this.page = 0; + this.loadPatents(); + this.updateQueryParams(); + }); + } + + ngOnInit(): void { + const qp = this.route.snapshot.queryParamMap; + this.searchTerm = qp.get('search') ?? ''; + this.page = parseInt(qp.get('page') ?? '0', 10); + this.pageSize = parseInt(qp.get('size') ?? '10', 10); + const f = qp.get('source'); + 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; + } + + // Fired continuously while dragging: only updates the displayed value/handle + // position, no HTTP request yet. + onStartYearDrag(event: Event): void { + const input = event.target as HTMLInputElement; + this.selectedStartYear = Math.min(parseInt(input.value, 10), this.selectedEndYear); + } + + onEndYearDrag(event: Event): void { + const input = event.target as HTMLInputElement; + this.selectedEndYear = Math.max(parseInt(input.value, 10), this.selectedStartYear); + } + + // Fired once on release: commits the value and triggers the search request. + onStartYearInput(event: Event): void { + const input = event.target as HTMLInputElement; + this.selectedStartYear = Math.min(parseInt(input.value, 10), this.selectedEndYear); + input.value = String(this.selectedStartYear); + this.page = 0; + this.loadPatents(); + this.updateQueryParams(); + } + + onEndYearInput(event: Event): void { + const input = event.target as HTMLInputElement; + this.selectedEndYear = Math.max(parseInt(input.value, 10), this.selectedStartYear); + input.value = String(this.selectedEndYear); + 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, + this.selectedStartYear, + this.selectedEndYear, + ) + .subscribe({ + next: (res) => { + this.patents = res.patents; + this.total = res.total; + this.loading = false; + }, + error: () => { + this.error = true; + this.loading = false; + }, + }); + } + + onSearchInput(event: Event): void { + this.searchSubject.next((event.target as HTMLInputElement).value); + } + + clearSearch(): void { + this.searchTerm = ''; + this.page = 0; + this.loadPatents(); + this.updateQueryParams(); + } + + setFilterFromChip(event: any): void { + const val = event.value; + this.activeFilter = val === 'EPO' || val === 'USPTO' ? val : 'all'; + this.page = 0; + this.loadPatents(); + this.updateQueryParams(); + } + + setSortDirection(direction: string): void { + this.sortDirection = direction; + this.loadPatents(); + this.updateQueryParams(); + } + + handlePageChange(event: PageEvent): void { + this.page = event.pageIndex; + this.pageSize = event.pageSize; + this.loadPatents(); + this.updateQueryParams(); + } + + openPatent(patent: PatentEntry): void { + this.router.navigate(['/patent', patent.patent_id]); + } + + selectPatent(patent: PatentEntry): void { + this.selectedPatent = patent; + this.showDetail = true; + this.expandedClassificationKeys.clear(); + } + + closeDetail(): void { + this.showDetail = false; + this.selectedPatent = null; + this.expandedClassificationKeys.clear(); + } + + private updateQueryParams(): void { + this.router.navigate([], { + relativeTo: this.route, + queryParams: { + search: this.searchTerm || null, + page: this.page, + 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, + }); + } + + formatDate(date: string | null): string { + if (!date) return '-'; + const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); + const parsed = new Date(d); + 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), + sectionName: entry.section ?? null, + }; + } + + topicColor(topic: OpenAlexTopicTag): string { + return topicHierarchyColor({ + id: topic.topic_id, + name: topic.topic_display_name, + field_name: topic.field_name, + domain_name: topic.domain_name, + }); + } + + sectionColor(card: ClassificationCard): string { + return topicHierarchyColor({ field_name: card.sectionName }); + } + + 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 ?? null); + addRow('Klasse', entry.class ?? null); + addRow('Unterklasse', entry.subclass ?? null); + 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-card/person-card.component.html b/webapp/src/app/modules/person-card/person-card.component.html index 946430ae..9f7bf142 100644 --- a/webapp/src/app/modules/person-card/person-card.component.html +++ b/webapp/src/app/modules/person-card/person-card.component.html @@ -5,25 +5,31 @@ {{ initials() }}
-
+
+

+ {{ person().display_name ?? '' }} +

-

- {{ person().display_name ?? '' }} -

{{ distinguishingId() }}

@@ -95,6 +101,14 @@ >{{ inst.country_code.toUpperCase() }} } + @if (institutionPageId() && !loading()) { + open_in_new + }
} diff --git a/webapp/src/app/modules/person-card/person-card.component.scss b/webapp/src/app/modules/person-card/person-card.component.scss index 75f0ed69..fdbb1e9b 100644 --- a/webapp/src/app/modules/person-card/person-card.component.scss +++ b/webapp/src/app/modules/person-card/person-card.component.scss @@ -25,6 +25,7 @@ .card-header { padding: 16px; display: flex; + align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--sg-surface-soft); text-decoration: none; @@ -52,6 +53,14 @@ } } +.name-row { + display: flex; + min-width: 0; + min-height: 40px; + align-items: center; + gap: 8px; +} + .rating-and-bookmark { display: flex; justify-content: space-between; @@ -82,18 +91,30 @@ } .bookmark-btn { + display: grid; + place-items: center; + flex: 0 0 32px; + width: 32px; + height: 32px; border: none; + border-radius: 50%; background: transparent; cursor: pointer; - padding: 2px; + padding: 0; color: var(--sg-text-soft); + transition: + color 0.15s ease, + background-color 0.15s ease; - &:hover { + &:hover, + &:focus-visible { + background: var(--sg-primary-soft); color: var(--sg-primary); + outline: none; } &.bookmarked { - color: #e53935; + color: var(--sg-success); } mat-icon { @@ -104,11 +125,12 @@ } .person-name { - margin: 6px 0 2px; + flex: 1 1 auto; + min-width: 0; + margin: 0; font-size: 16px; font-weight: 600; color: var(--sg-text); - min-height: 24px; line-height: 24px; white-space: nowrap; overflow: hidden; @@ -162,6 +184,31 @@ white-space: nowrap; } + .institution-open-icon { + flex-shrink: 0; + width: 12px; + height: 12px; + margin-left: 5px; + font-size: 12px; + line-height: 1; + vertical-align: middle; + cursor: pointer; + opacity: 0; + transition: opacity 0.15s ease; + + &:hover { + opacity: 1; + } + } + + &:hover .institution-open-icon { + opacity: 0.7; + + &:hover { + opacity: 1; + } + } + &:hover, &:focus-visible { background: var(--sg-primary); diff --git a/webapp/src/app/modules/person-card/person-card.component.ts b/webapp/src/app/modules/person-card/person-card.component.ts index e8a50711..aef4cd8f 100644 --- a/webapp/src/app/modules/person-card/person-card.component.ts +++ b/webapp/src/app/modules/person-card/person-card.component.ts @@ -1,6 +1,6 @@ -import { Component, input, computed, output } from '@angular/core'; +import { Component, inject, input, computed, output } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { RouterLink } from '@angular/router'; +import { Router, RouterLink } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api'; @@ -23,6 +23,8 @@ import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; styleUrl: './person-card.component.scss', }) export class PersonCardComponent { + private readonly router = inject(Router); + person = input.required(); isBookmarked = input(false); loading = input(false); @@ -66,6 +68,20 @@ export class PersonCardComponent { return newestInstitution; }); + institutionPageId = computed( + () => this.institution()?.id?.split('/').pop() ?? null, + ); + + openInstitutionPage(event: Event): void { + event.stopPropagation(); + event.preventDefault(); + + const id = this.institutionPageId(); + if (!id) return; + + void this.router.navigate(['/institution', id]); + } + isInstitutionActive = computed(() => { const active = this.activeInstitutionName().trim().toLowerCase(); if (!active) return false; diff --git a/webapp/src/app/modules/person-list/person-list.component.html b/webapp/src/app/modules/person-list/person-list.component.html index 0dc9fe14..9647b24a 100644 --- a/webapp/src/app/modules/person-list/person-list.component.html +++ b/webapp/src/app/modules/person-list/person-list.component.html @@ -82,6 +82,14 @@ filter.countryCode.toUpperCase() }} } + @if (findInstitutionPageIdByName(filter.value)) { + open_in_new + } - Seite {{ selectedPage }} von {{ getPageCount() }} - -
- } - - - @if (selectedPatent) { -
-

{{ 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

-

- Alle Patente dieser Person im Überblick. -

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

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

-
- } - - -} +@if (loading) { +

Lade Patente...

+} @else if (error) { +

Fehler beim Laden der Patente.

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

{{ getEmptyMessage() }}

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

{{ 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

+

Patente mit passendem Erfindername.

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

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

+
+ } +
+
+} diff --git a/webapp/src/app/modules/person-patents/person-patents.component.scss b/webapp/src/app/modules/person-patents/person-patents.component.scss index 654363da..68ec5480 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.scss +++ b/webapp/src/app/modules/person-patents/person-patents.component.scss @@ -1,567 +1,596 @@ -.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; - } -} +.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; + } + } +} + +.match-badges { + display: flex; + flex-wrap: wrap; + gap: 4px; + margin-top: 4px; +} + +.match-badge { + display: inline-flex; + align-items: center; + padding: 2px 8px; + border-radius: 999px; + background: #f3f4f6; + border: 1px solid #e5e7eb; + color: #374151; + font-size: 0.68rem; + font-weight: 600; + + &--signal { + padding: 4px 10px; + font-size: 0.75rem; + background: #ecfdf5; + border-color: #a7f3d0; + color: #047857; + } +} + +.match-badges--detail { + margin-top: 14px; + gap: 6px; +} + +.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/person-patents/person-patents.component.ts b/webapp/src/app/modules/person-patents/person-patents.component.ts index b29d1dda..b92b2cf2 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.ts +++ b/webapp/src/app/modules/person-patents/person-patents.component.ts @@ -1,30 +1,17 @@ -import { Component, OnInit, inject } from '@angular/core'; +import { Component, DestroyRef, inject } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CommonModule } from '@angular/common'; import { ActivatedRoute, Router } from '@angular/router'; -import { PatentsService } from '../../api/api/patents.service'; +import { finalize, of, switchMap } from 'rxjs'; import { PatentEntry } from '../../api/model/patentEntry'; -import { IpcClassification } from '../../api'; +import { PersonPatentsResolved } from '../../resolvers/person-patents.resolver'; +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', @@ -32,16 +19,15 @@ const DESCRIPTION_PREVIEW_LENGTH = 140; templateUrl: './person-patents.component.html', styleUrl: './person-patents.component.scss', }) -export class PersonPatentsComponent implements OnInit { +export class PersonPatentsComponent { private route = inject(ActivatedRoute); private router = inject(Router); - private patentsApi = inject(PatentsService); + private destroyRef = inject(DestroyRef); patents: PatentEntry[] = []; filteredPatents: PatentEntry[] = []; authorName: string | null = null; selectedPatent: PatentEntry | null = null; - showDetail = false; loading = true; error = false; @@ -51,44 +37,54 @@ export class PersonPatentsComponent implements OnInit { selectedPage = 1; readonly pageSize = 10; - private expandedClassificationKeys = new Set(); - ngOnInit(): void { - this.route.parent?.paramMap.subscribe((params) => { - const authorId = params.get('id') ?? ''; + constructor() { + const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); + const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy'); - 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 (this.isValidFilter(filterFromUrl)) { - this.activeFilter = filterFromUrl; - } - if (this.isValidSortMode(sortFromUrl)) { - this.sortMode = sortFromUrl; - } + this.route.parent?.data + .pipe( + switchMap((data) => { + const resolved = data['personPatents'] as + | PersonPatentsResolved + | undefined; + if (!resolved?.patents$) { + return of(null); + } - if (authorId) { - this.patentsApi.getPatentsByAuthor(authorId, 'body').subscribe({ - next: (result) => { - this.patents = result.patents ?? []; - this.authorName = result.author_name ?? null; - this.applyFilter(); - this.loading = false; - }, - error: () => { - this.error = true; - this.loading = false; - }, - }); - } - }); + this.loading = true; + this.error = false; + return resolved.patents$.pipe( + finalize(() => { + this.loading = false; + }), + ); + }), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe((result) => { + if (!result) { + this.error = true; + return; + } + + this.patents = result.patents ?? []; + this.authorName = result.author_name ?? null; + this.applyFilter(); + }); } setFilter(filter: SourceFilter): void { this.activeFilter = filter; this.selectedPage = 1; this.selectedPatent = null; - this.showDetail = false; this.applyFilter(); this.updateQueryParams(); } @@ -101,19 +97,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 { @@ -178,9 +167,7 @@ export class PersonPatentsComponent implements OnInit { } formatDate(date: string | null | undefined): string { - if (!date) return '-'; - const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'); - return new Intl.DateTimeFormat('de-DE').format(new Date(d)); + return formatPatentDate(date); } getEpoCount(): number { @@ -212,223 +199,10 @@ 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; + return getPublicationStageLabel(patent); } - 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 }); - }; - if (entry.section) { - addRow('Sektion', entry.section); - } - if (entry.class) { - addRow('Klasse', entry.class); - } - if (entry.subclass) { - addRow('Unterklasse', entry.subclass); - } - - return rows; - } - - private extractDescriptionText( - value: string | null | undefined, - ): string | null { - if (!value?.trim()) { - return null; - } - - const text = value.includes(' - ') - ? value.split(' - ').slice(1).join(' - ').trim() - : value.trim(); - if (!text) { - return null; - } - - const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text; - return this.normalizeDescriptionCase(firstSentence); - } - - private normalizeDescriptionCase(text: string): string { - if (text !== text.toUpperCase()) { - return text; - } - return text.charAt(0) + text.slice(1).toLowerCase(); + getEmptyMessage(): string { + return 'Keine Patente gefunden.'; } } diff --git a/webapp/src/app/modules/person-publications/person-publications.component.html b/webapp/src/app/modules/person-publications/person-publications.component.html index bf069698..5fa58797 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.html +++ b/webapp/src/app/modules/person-publications/person-publications.component.html @@ -3,497 +3,516 @@
Publikationen

Übersicht der wissenschaftlichen Veröffentlichungen.

-
-
- - calendar_today - - {{ yearSelectionSummary() }} - - @for (year of filteredYearOptions(); track year) { - {{ year }} - } @empty { -
Keine Treffer
- } -
-
- - - category - - {{ typeSelectionSummary() }} - - @for (type of filteredTypeOptions(); track type.value) { - {{ type.label }} - } @empty { -
Keine Treffer
- } -
-
- - - translate - - {{ - languageSelectionSummary() - }} - - @for (language of filteredLanguageOptions(); track language.value) { - {{ - language.label - }} - } @empty { -
Keine Treffer
- } -
-
- - - apartment - - - @for (institution of institutionOptions; track institution.id) { - - {{ institution.display_name }} - @if (institution.hint) { - {{ institution.hint }} + + + + Forschungszwecke + {{ foundationAmount() }} Grundlagenforschung, + {{ applicationAmount() }} anwendungsbasierte + Forschung + +
+
+ + + Publikationsliste + {{ total }} Publikationen + +
+ + + calendar_today + + {{ + yearSelectionSummary() + }} + + @for (year of filteredYearOptions(); track year) { + {{ year }} + } @empty { +
Keine Treffer
} - - } - @if ( - !institutionLookupLoading && - institutionOptions.length === 0 && - institutionSearchControl.value - ) { - Keine Institution gefunden - } - -
+ + - - label - - - @for (topic of topicOptions; track topic.id) { - - {{ topic.display_name }} - @if (topic.hint) { - {{ topic.hint }} + + category + + {{ + typeSelectionSummary() + }} + + @for (type of filteredTypeOptions(); track type.value) { + {{ type.label }} + } @empty { +
Keine Treffer
} -
- } - @if ( - !topicLookupLoading && - topicOptions.length === 0 && - topicSearchControl.value - ) { - Kein Thema gefunden - } -
-
+ + - - + + translate + + {{ + languageSelectionSummary() + }} + + @for ( + language of filteredLanguageOptions(); + track language.value + ) { + {{ + language.label + }} + } @empty { +
Keine Treffer
+ } +
+
- @let selectedYears = filterForm.controls.publicationYears.value; - @let selectedTypes = filterForm.controls.types.value; - @let selectedLanguages = filterForm.controls.languages.value; - @if ( - selectedInstitutions.length || - selectedTopics.length || - selectedYears.length || - selectedTypes.length || - selectedLanguages.length - ) { -
- Aktive Filter: -
- @for (year of selectedYears; track year) { - - - calendar_today - {{ year }} - - - - } - @for (type of selectedTypes; track type) { - - - category - {{ type }} - - - - } - @for (language of selectedLanguages; track language) { - - - translate - {{ - languageLabel(language) - }} - - - - } - @for (topic of selectedTopics; track topic.id) { - - - label - {{ - topic.display_name - }} - - - - } - @for (institution of selectedInstitutions; track institution.id) { - @let instCountry = selectedInstitutionCountry(institution); - - - apartment - {{ - institution.display_name - }} - @if (instCountry) { - - {{ - instCountry.toUpperCase() - }} - } - - - - } -
-
- } -
+ + apartment + + + @for (institution of institutionOptions; track institution.id) { + + {{ institution.display_name }} + @if (institution.hint) { + {{ institution.hint }} + } + + } + @if ( + !institutionLookupLoading && + institutionOptions.length === 0 && + institutionSearchControl.value + ) { + Keine Institution gefunden + } + + -
- @if (loading) { -
- - Publikationen werden geladen … -
- } @else if (publications.length === 0) { -
Keine Publikationen gefunden.
- } + + label + + + @for (topic of topicOptions; track topic.id) { + + {{ topic.display_name }} + @if (topic.hint) { + {{ topic.hint }} + } + + } + @if ( + !topicLookupLoading && + topicOptions.length === 0 && + topicSearchControl.value + ) { + Kein Thema gefunden + } + + - - - - - + + sort + + @for (option of sortOptions; track option.value) { + {{ + option.label + }} + } + + - - - - + + - - - - - - - - - - - - - - + } + - - - - - - - - - - - - -
Titel - - {{ publication.title || 'Ohne Titel' }} - - Jahr - @if (publication.publication_year) { - - } @else { - - - } - Typ - @if (publication.type) { - - } @else { - - - } - Sprache / Quelle - @if (publication.language) { - - } @else { - - - } - Institutionen - @let publicationInstitutions = institutions(publication); - @let institutionsExpanded = isInstitutionsExpanded(publication); - @let visibleInstitutions = - institutionsExpanded - ? publicationInstitutions - : publicationInstitutions.slice(0, 3); -
- @for (institution of visibleInstitutions; track institution.id) { - - } @empty { - - - } - @if (publicationInstitutions.length > 3) { - - } + @let selectedYears = filterForm.controls.publicationYears.value; + @let selectedTypes = filterForm.controls.types.value; + @let selectedLanguages = filterForm.controls.languages.value; + @if ( + selectedInstitutions.length || + selectedTopics.length || + selectedYears.length || + selectedTypes.length || + selectedLanguages.length + ) { +
+ Aktive Filter: +
+ @for (year of selectedYears; track year) { + + + calendar_today + {{ year }} + + + + } + @for (type of selectedTypes; track type) { + + + category + {{ type }} + + + + } + @for (language of selectedLanguages; track language) { + + + translate + {{ + languageLabel(language) + }} + + + + } + @for (topic of selectedTopics; track topic.id) { + + + label + {{ + topic.display_name + }} + + + + } + @for (institution of selectedInstitutions; track institution.id) { + @let instCountry = selectedInstitutionCountry(institution); + + + apartment + {{ + institution.display_name + }} + @if (instCountry) { + + {{ + instCountry.toUpperCase() + }} + } + open_in_new + + + + } +
-
Zitationen - {{ publication.cited_by_count ?? 0 }} - Themen - @let publicationTopics = publication.topics ?? []; - @let topicsExpanded = isTopicsExpanded(publication); - @let visibleTopics = - topicsExpanded ? publicationTopics : publicationTopics.slice(0, 3); -
- @for (topic of visibleTopics; track topic.id) { - - - } @empty { - - - } - @if (publicationTopics.length > 3) { - - } -
-
-
- - + + +
+
+ + + {{ work.title }} + + + + @if (work.type) { + + } @else { + - + } + + + + @if (work.publication_year) { + + } @else { + - + } + + + + @if (work.language) { + + } @else { + - + } + + + + @let publicationInstitutions = getInstitutions(work); + @let institutionsExpanded = true; + @let visibleInstitutions = + institutionsExpanded + ? publicationInstitutions + : publicationInstitutions.slice(0, 3); +
+ @for (institution of visibleInstitutions; track institution.id) { + + } @empty { + - + } + @if (publicationInstitutions.length > 3) { + + } +
+
+ + + @let publicationTopics = work.topics ?? []; + @let topicsExpanded = isTopicsExpanded(work); + @let visibleTopics = + topicsExpanded ? publicationTopics : publicationTopics.slice(0, 3); +
+ @for (topic of visibleTopics; track topic.id) { + + + } @empty { + - + } + @if (publicationTopics.length > 3) { + + } +
+
+ + + {{ work.cited_by_count ?? 0 }} + + + + + open_in_new + + diff --git a/webapp/src/app/modules/person-publications/person-publications.component.scss b/webapp/src/app/modules/person-publications/person-publications.component.scss index 45f2e235..8756a879 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.scss +++ b/webapp/src/app/modules/person-publications/person-publications.component.scss @@ -4,27 +4,6 @@ margin: 0 auto; } -.section-heading { - display: flex; - align-items: center; - justify-content: space-between; - gap: 18px; - margin-bottom: 18px; -} - -h2 { - margin: 0 0 6px; - font-size: 22px; - line-height: 1.2; - font-weight: 700; -} - -.section-heading p { - margin: 0; - color: var(--sg-text-muted); - font-size: 14px; -} - .publication-filter-stack { display: flex; align-items: flex-start; @@ -54,6 +33,10 @@ h2 { max-width: 320px; } +.publication-filters .sort-field { + width: 235px; +} + .publication-filters .reset-filter-btn { min-width: 132px; height: 42px; @@ -161,27 +144,18 @@ h2 { gap: 6px; } -.filter-chip, .filter-meta-chip { display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--sg-border-strong); + border-radius: 4px; background: var(--sg-surface-soft); color: var(--sg-text); font-size: 11px; font-weight: 600; } -.filter-chip { - gap: 4px; - border-radius: 12px; -} - -.filter-meta-chip { - border-radius: 4px; -} - .filter-topic-chip { display: inline-flex; align-items: center; @@ -301,6 +275,29 @@ h2 { font-size: 9px; } +.filter-institution-chip .institution-open-icon, +.publication-institution-tag .institution-open-icon { + flex-shrink: 0; + width: 12px; + height: 12px; + margin-left: 5px; + font-size: 12px; + line-height: 1; + cursor: pointer; + opacity: 0; + transition: opacity 0.15s ease; +} + +.filter-institution-chip:hover .institution-open-icon, +.publication-institution-tag:hover .institution-open-icon { + opacity: 0.7; +} + +.filter-institution-chip .institution-open-icon:hover, +.publication-institution-tag .institution-open-icon:hover { + opacity: 1; +} + .filter-meta-chip__label, .filter-topic-chip__label { overflow: hidden; @@ -309,7 +306,6 @@ h2 { min-width: 0; } -.filter-chip button, .active-institution-filter button, .active-meta-filter button { display: flex; @@ -324,7 +320,6 @@ h2 { } } -.filter-chip button mat-icon, .active-institution-filter button mat-icon, .active-meta-filter button mat-icon { width: 12px; @@ -361,12 +356,6 @@ a.title:hover { text-decoration: underline; } -.authors { - margin-top: 7px; - color: var(--sg-text-muted); - font-size: 12px; -} - table.is-hidden { display: none; } @@ -508,13 +497,8 @@ table.is-hidden { .mat-column-type, .mat-column-year, .mat-column-language, - .mat-column-citations { - text-align: center; - } - - .mat-mdc-header-cell.mat-column-title, - .mat-mdc-header-cell.mat-column-institutions, - .mat-mdc-header-cell.mat-column-topics { + .mat-column-citations, + .mat-mdc-header-cell { text-align: center; } @@ -549,7 +533,6 @@ mat-paginator { padding: 16px; } - .section-heading, .table-footer { align-items: stretch; flex-direction: column; @@ -578,3 +561,25 @@ mat-paginator { align-self: stretch; } } + +mat-expansion-panel { + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + background: var(--sg-none); + box-shadow: none; +} + +mat-expansion-panel-header { + padding: 0 16px; + min-height: 48px; +} + +mat-panel-title { + font-size: 16px; + font-weight: 700; +} + +mat-panel-description { + font-size: 14px; + color: var(--sg-text-muted); +} diff --git a/webapp/src/app/modules/person-publications/person-publications.component.ts b/webapp/src/app/modules/person-publications/person-publications.component.ts index 739602b2..d000f46d 100644 --- a/webapp/src/app/modules/person-publications/person-publications.component.ts +++ b/webapp/src/app/modules/person-publications/person-publications.component.ts @@ -2,8 +2,13 @@ import { Component, DestroyRef, OnInit, + TemplateRef, ViewChild, + computed, + effect, inject, + input, + viewChild, } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; @@ -38,13 +43,47 @@ import { switchMap, } from 'rxjs'; -import { InstitutionsService, Work, WorksService, WorkTopic } from '../../api'; +import { + AuthorWorkPurposes, + Institution, + InstitutionsService, + SpecificWorkPurpose, + Work, + WorkPurpose, + WorksService, + WorkTopic, +} from '../../api'; import { PaginationService } from '../../shared/services/pagination.service'; import { createLoadError } from '../../resolvers/utils/errorHandler'; import { ChipComponent } from '../../shared/ui/chip/chip.component'; import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; import { buildTopicHierarchyTooltip } from '../../resolvers/utils/topic-tooltip'; +import { NgxEchartsDirective } from 'ngx-echarts'; +import * as echarts from 'echarts/core'; +import { + GridComponent, + LegendComponent, + TitleComponent, +} from 'echarts/components'; +import { CanvasRenderer } from 'echarts/renderers'; +import { GraphChart } from 'echarts/charts'; +import { MatCardModule } from '@angular/material/card'; +import { MatExpansionModule } from '@angular/material/expansion'; +import { + GenericColumn, + DataTableComponent, +} from '../../shared/ui/data-table/data-table.component'; +import { WorkTypePipe } from '../../shared/pipes/work-type.pipe'; +import { LanguageCodePipe } from '../../shared/pipes/language-code.pipe'; +import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component'; +echarts.use([ + GridComponent, + CanvasRenderer, + GraphChart, + TitleComponent, + LegendComponent, +]); interface InstitutionAutocompleteOption { id?: string | null; @@ -74,6 +113,8 @@ interface TopicAutocompleteResponse { results?: TopicAutocompleteOption[] | null; } +type PublicationSort = 'year' | 'citations'; + interface PublicationFilterQueryState { pageIndex: number; pageSize: number; @@ -82,8 +123,19 @@ interface PublicationFilterQueryState { languages: string[]; institutions: InstitutionAutocompleteOption[]; topics: TopicAutocompleteOption[]; + sort: PublicationSort; } +interface YearlyPurposeCounts { + year: number; + FOUNDATION: number; + APPLICATION: number; +} + +const PURPOSE_LABELS: Record<'FOUNDATION' | 'APPLICATION', string> = { + FOUNDATION: 'Grundlagenforschung', + APPLICATION: 'anwendungsbasierte Forschung', +}; @Component({ selector: 'app-person-publications', imports: [ @@ -102,6 +154,13 @@ interface PublicationFilterQueryState { ReactiveFormsModule, RouterLink, TopicChipComponent, + NgxEchartsDirective, + MatCardModule, + MatExpansionModule, + DataTableComponent, + WorkTypePipe, + LanguageCodePipe, + QueryParamPaginatorComponent, ], templateUrl: './person-publications.component.html', styleUrl: './person-publications.component.scss', @@ -110,6 +169,44 @@ export class PersonPublicationsComponent implements OnInit { @ViewChild(MatPaginator) paginator?: MatPaginator; private readonly destroyRef = inject(DestroyRef); + authorWorkPurposes = input.required(); + specificWorkPurposesByYear = computed(() => { + const authorWorkPurposes = this.authorWorkPurposes(); + return this.getAuthorSpecificWorkPurposesByYear(authorWorkPurposes); + }); + foundationAmount = computed(() => { + const authorWorkPurposes = this.authorWorkPurposes(); + let count = 0; + for (const purpose of authorWorkPurposes.purposes ?? []) { + if (purpose.purpose === WorkPurpose.Foundation) { + count++; + } + } + return count; + }); + applicationAmount = computed(() => { + const authorWorkPurposes = this.authorWorkPurposes(); + let count = 0; + for (const purpose of authorWorkPurposes.purposes ?? []) { + if (purpose.purpose === WorkPurpose.Application) { + count++; + } + } + return count; + }); + + chartOption!: echarts.EChartsCoreOption; + + workColumns: GenericColumn[] = []; + titleTmp = viewChild.required>('titleTmp'); + typeTmp = viewChild.required>('typeTmp'); + yearTmp = viewChild.required>('yearTmp'); + languageTmp = viewChild.required>('languageTmp'); + institutionsTmp = viewChild.required>('institutionsTmp'); + topicsTmp = viewChild.required>('topicsTmp'); + citationsTmp = viewChild.required>('citationsTmp'); + actionsTmp = viewChild.required>('actionsTmp'); + displayedColumns: string[] = [ 'title', 'type', @@ -143,6 +240,14 @@ export class PersonPublicationsComponent implements OnInit { readonly yearSearchControl = new FormControl('', { nonNullable: true }); readonly typeSearchControl = new FormControl('', { nonNullable: true }); readonly languageSearchControl = new FormControl('', { nonNullable: true }); + readonly sortControl = new FormControl('year', { + nonNullable: true, + }); + + readonly sortOptions: { value: PublicationSort; label: string }[] = [ + { value: 'year', label: 'Neueste zuerst' }, + { value: 'citations', label: 'Meistzitiert zuerst' }, + ]; readonly filterForm = new FormGroup({ publicationYears: new FormControl([], { nonNullable: true }), @@ -164,6 +269,7 @@ export class PersonPublicationsComponent implements OnInit { topicNames: 'publicationTopicName', topicFields: 'publicationTopicField', topicDomains: 'publicationTopicDomain', + sort: 'publicationSort', } as const; readonly typeOptions = [ @@ -201,12 +307,148 @@ export class PersonPublicationsComponent implements OnInit { public readonly paginationService: PaginationService, private readonly snackBar: MatSnackBar, private readonly institutionsService: InstitutionsService, - ) {} + ) { + effect(() => { + const yearlyCounts = this.buildYearlyCounts( + this.specificWorkPurposesByYear(), + ); + this.chartOption = this.buildChartOption(yearlyCounts); + }); + } + + getAuthorSpecificWorkPurposesByYear( + authorWorkPurposes: AuthorWorkPurposes, + ): Record> { + const purposesByYear: Record> = {}; + for (const purpose of authorWorkPurposes.purposes ?? []) { + const year = purpose.publication_year; + if (!year) continue; + + if (!purposesByYear[year]) { + purposesByYear[year] = []; + } + + purposesByYear[year].push(purpose); + } + return purposesByYear; + } + + buildYearlyCounts( + purposesByYear: Record>, + ): YearlyPurposeCounts[] { + return Object.entries(purposesByYear) + .map(([year, purposes]) => { + const counts: YearlyPurposeCounts = { + year: Number(year), + FOUNDATION: 0, + APPLICATION: 0, + }; + for (const purpose of purposes) { + if (purpose.purpose === WorkPurpose.Foundation) { + counts.FOUNDATION++; + } else if (purpose.purpose === WorkPurpose.Application) { + counts.APPLICATION++; + } + } + return counts; + }) + .sort((a, b) => a.year - b.year); + } + + buildChartOption(data: YearlyPurposeCounts[]): echarts.EChartsCoreOption { + return { + tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, + legend: { + data: [PURPOSE_LABELS.FOUNDATION, PURPOSE_LABELS.APPLICATION], + top: 0, + itemGap: 40, + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + top: '10%', + containLabel: true, + }, + xAxis: { + type: 'category', + data: data.map((d) => d.year.toString()), + }, + yAxis: { type: 'value' }, + series: [ + { + name: PURPOSE_LABELS.FOUNDATION, + type: 'bar', + stack: 'total', + emphasis: { focus: 'series' }, + data: data.map((d) => d.FOUNDATION), + }, + { + name: PURPOSE_LABELS.APPLICATION, + type: 'bar', + stack: 'total', + emphasis: { focus: 'series' }, + data: data.map((d) => d.APPLICATION), + }, + ], + }; + } ngOnInit(): void { this.setupInstitutionAutocomplete(); this.setupTopicAutocomplete(); + this.workColumns = [ + { + id: 'title', + header: 'Titel', + type: 'display', + cellTemplate: this.titleTmp(), + }, + { + id: 'type', + header: 'Typ', + type: 'display', + cellTemplate: this.typeTmp(), + }, + { + id: 'publication_year', + header: 'Jahr', + type: 'display', + cellTemplate: this.yearTmp(), + }, + { + id: 'language', + header: 'Sprache', + type: 'display', + cellTemplate: this.languageTmp(), + }, + { + id: 'institutions', + header: 'Institutionen', + type: 'display', + cellTemplate: this.institutionsTmp(), + }, + { + id: 'topics', + header: 'Themen', + type: 'display', + cellTemplate: this.topicsTmp(), + }, + { + id: 'cited_by_count', + header: 'Zitiert von', + type: 'display', + cellTemplate: this.citationsTmp(), + }, + { + id: 'actions', + header: 'Aktionen', + type: 'display', + cellTemplate: this.actionsTmp(), + }, + ]; + const parentParamMap = this.route.parent?.paramMap; if (!parentParamMap) return; @@ -236,6 +478,7 @@ export class PersonPublicationsComponent implements OnInit { this.filters().languages, this.selectedInstitutionIds(), this.selectedTopicIds(), + this.sortControl.value, ) .subscribe({ next: (page) => { @@ -272,6 +515,10 @@ export class PersonPublicationsComponent implements OnInit { }); } + onSortChange(): void { + this.applyFilters(); + } + clearFilters(): void { this.filterForm.reset({ publicationYears: [], @@ -486,6 +733,19 @@ export class PersonPublicationsComponent implements OnInit { }); } + openInstitutionPage( + institutionId: string | null | undefined, + event: Event, + ): void { + event.stopPropagation(); + event.preventDefault(); + + const id = institutionId?.split('/').pop(); + if (!id) return; + + void this.router.navigate(['/institution', id]); + } + getSelectedTopicTooltip(topic: TopicAutocompleteOption): string { const workTopic = this.findPublicationTopic(topic.id); @@ -552,6 +812,19 @@ export class PersonPublicationsComponent implements OnInit { return 'info'; } + getInstitutions(work: Work): Array { + const institutions: Array = []; + for (const authorship of work.authorships ?? []) { + for (const institution of authorship.institutions ?? []) { + if (!institution.id || !institution.display_name) continue; + if (!institutions.some((inst) => inst.id === institution.id)) { + institutions.push(institution); + } + } + } + return institutions; + } + institutions( publication: Work, ): Array<{ id: string; name: string; country: string | null }> { @@ -785,6 +1058,8 @@ export class PersonPublicationsComponent implements OnInit { ) ? topicDomains : null, + [this.queryParamKeys.sort]: + this.sortControl.value !== 'year' ? this.sortControl.value : null, ...overrides, }, queryParamsHandling: 'merge', @@ -834,6 +1109,10 @@ export class PersonPublicationsComponent implements OnInit { field_name: topicFields[index] || undefined, domain_name: topicDomains[index] || undefined, })), + sort: + queryParams.get(this.queryParamKeys.sort) === 'citations' + ? 'citations' + : 'year', }; } @@ -844,6 +1123,7 @@ export class PersonPublicationsComponent implements OnInit { this.paginationService.selection = queryState.pageSize; this.selectedInstitutions = queryState.institutions; this.selectedTopics = queryState.topics; + this.sortControl.setValue(queryState.sort, { emitEvent: false }); this.filterForm.setValue( { publicationYears: queryState.publicationYears, diff --git a/webapp/src/app/modules/person/person.component.html b/webapp/src/app/modules/person/person.component.html index ac1984d6..316c07be 100644 --- a/webapp/src/app/modules/person/person.component.html +++ b/webapp/src/app/modules/person/person.component.html @@ -6,6 +6,27 @@
Person

{{ displayName() }}

+
apartment @@ -31,12 +52,14 @@ }
- @if (worksCount() !== null || citedByCount() !== null) { + @if ( + worksCount() !== null || citedByCount() !== null || h_index() !== null + ) { @if (worksCount() !== null) { menu_book - {{ worksCount() }} Publikationen + {{ worksCount() | number }} Publikationen } @if (worksCount() !== null && citedByCount() !== null) { @@ -45,50 +68,66 @@ @if (citedByCount() !== null) { format_quote - {{ citedByCount() }} Zitationen + {{ citedByCount() | number }} Zitationen + + } + @if ( + (worksCount() !== null || citedByCount() !== null) && + h_index() !== null + ) { + · + } + @if (h_index() !== null) { + + trending_up + h-Index {{ h_index() }} } - - @if (h_index() !== null) { - h_index: {{ h_index() }} + } + @if (displayCareerStage() || orcid()) { +
+ @if (displayCareerStage()) { +
+ Career Stage: + + {{ displayCareerStage() }} + +
+ } + @if (orcid(); as orcidId) { + + verified + {{ orcidId }} + } - - } - @if (displayCareerStage()) { -
- Career Stage: - - {{ displayCareerStage() }} -
}
-
-
- mail - uni-email@uni-due.de -
- @if (orcid()) { -
- verified - {{ - orcid() - }} -
- } - -
diff --git a/webapp/src/app/modules/publication-detail/publication-detail.component.scss b/webapp/src/app/modules/publication-detail/publication-detail.component.scss index 2e8c72d4..6c9b3334 100644 --- a/webapp/src/app/modules/publication-detail/publication-detail.component.scss +++ b/webapp/src/app/modules/publication-detail/publication-detail.component.scss @@ -188,6 +188,79 @@ aside { box-shadow: var(--sg-shadow-sm); } +.accordion-card { + padding: 0; + overflow: hidden; +} + +.accordion-header { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + padding: 18px 22px; + background: none; + border: none; + cursor: pointer; + text-align: left; + font-family: inherit; + font-size: 16px; + font-weight: 700; + color: var(--sg-text); + transition: background 0.12s; + + &:hover { + background: #f6f9ff; + } + + mat-icon { + flex-shrink: 0; + width: 20px; + height: 20px; + font-size: 20px; + color: var(--sg-text-muted); + } +} + +.accordion-title { + flex: 1; +} + +.count-badge { + padding: 2px 7px; + border-radius: 999px; + background: #e8effe; + color: #3b5bd6; + font-size: 11px; + font-weight: 700; +} + +.info-icon { + flex-shrink: 0; + width: 16px !important; + height: 16px !important; + font-size: 16px !important; + color: var(--sg-text-muted); + opacity: 0.7; + cursor: default; + + &:hover { + opacity: 1; + } +} + +.chevron { + transition: transform 0.2s ease; + + &.rotated { + transform: rotate(-90deg); + } +} + +.accordion-body { + padding: 4px 22px 22px; +} + .section-title { display: flex; align-items: center; @@ -371,6 +444,50 @@ dd { font-size: 11px; } +.list-pagination { + display: flex; + align-items: center; + justify-content: center; + gap: 8px; + margin-top: 12px; +} + +.page-btn { + display: grid; + place-items: center; + width: 28px; + height: 28px; + border: 1px solid var(--sg-border); + border-radius: 8px; + background: none; + cursor: pointer; + color: var(--sg-text-muted); + transition: background 0.12s; + + &:hover:not(:disabled) { + background: var(--sg-surface-muted); + color: var(--sg-text); + } + + &:disabled { + opacity: 0.35; + cursor: default; + } + + mat-icon { + font-size: 18px; + width: 18px; + height: 18px; + } +} + +.page-indicator { + font-size: 12px; + color: var(--sg-text-muted); + min-width: 36px; + text-align: center; +} + .institution-country { display: inline-flex; align-items: center; @@ -445,6 +562,18 @@ dd { padding: 22px 20px; } + .accordion-card { + padding: 0; + } + + .accordion-header { + padding: 16px 20px; + } + + .accordion-body { + padding: 4px 20px 20px; + } + .metrics, .author-list { grid-template-columns: 1fr; diff --git a/webapp/src/app/modules/publication-detail/publication-detail.component.ts b/webapp/src/app/modules/publication-detail/publication-detail.component.ts index b377543b..dcef9877 100644 --- a/webapp/src/app/modules/publication-detail/publication-detail.component.ts +++ b/webapp/src/app/modules/publication-detail/publication-detail.component.ts @@ -1,13 +1,13 @@ -import { DatePipe, DecimalPipe, UpperCasePipe } from '@angular/common'; -import { Location } from '@angular/common'; +import { DatePipe, DecimalPipe, Location } from '@angular/common'; + import { Component, DestroyRef, OnInit, inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { HttpClient } from '@angular/common/http'; 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 { MatTooltipModule } from '@angular/material/tooltip'; +import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Authorship, Location as ApiLocation, @@ -17,6 +17,8 @@ import { } from '../../api'; import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component'; import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; +import { WorkTypePipe } from '../../shared/pipes/work-type.pipe'; +import { LanguageCodePipe } from '../../shared/pipes/language-code.pipe'; interface DetailLink { label: string; @@ -38,9 +40,11 @@ interface InstitutionDetail { MatButtonModule, MatIconModule, MatProgressSpinnerModule, + MatTooltipModule, RouterLink, TopicChipComponent, - UpperCasePipe, + WorkTypePipe, + LanguageCodePipe, ], templateUrl: './publication-detail.component.html', styleUrl: './publication-detail.component.scss', @@ -50,18 +54,33 @@ export class PublicationDetailComponent implements OnInit { private readonly route = inject(ActivatedRoute); private readonly httpClient = inject(HttpClient); private readonly location = inject(Location); + private readonly router = inject(Router); private readonly worksService = inject(WorksService); publication: Work | null = null; loading = true; notFound = false; + authorsExpanded = true; + institutionsExpanded = false; + sourcesExpanded = false; + fundingExpanded = false; + linksExpanded = false; + + authorsPage = 0; + readonly authorsPageSize = 10; + + institutionsPage = 0; + readonly institutionsPageSize = 5; + ngOnInit(): void { this.loading = true; this.route.data.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({ next: ({ publication }) => { this.publication = publication; + this.authorsPage = 0; + this.institutionsPage = 0; this.loading = false; }, error: () => { @@ -75,6 +94,17 @@ export class PublicationDetailComponent implements OnInit { this.location.back(); } + findAuthorsForTopic(topic: WorkTopic): void { + const topicName = topic.display_name?.trim(); + if (!topicName) return; + + // Deep link into the person search with this topic preset as filter, + // so matching authors show up directly. + void this.router.navigate(['/persons'], { + queryParams: { topic: topicName }, + }); + } + getTopicColor(topic: WorkTopic): string { return topicHierarchyColor({ id: topic.id, @@ -110,6 +140,28 @@ export class PublicationDetailComponent implements OnInit { return this.publication?.authorships ?? []; } + pagedAuthors(): Authorship[] { + return this.authors().slice( + this.authorsPage * this.authorsPageSize, + (this.authorsPage + 1) * this.authorsPageSize, + ); + } + + authorsPageCount(): number { + return Math.ceil(this.authors().length / this.authorsPageSize); + } + + pagedInstitutions(): InstitutionDetail[] { + return this.institutions().slice( + this.institutionsPage * this.institutionsPageSize, + (this.institutionsPage + 1) * this.institutionsPageSize, + ); + } + + institutionsPageCount(): number { + return Math.ceil(this.institutions().length / this.institutionsPageSize); + } + institutions(): InstitutionDetail[] { const institutions = new Map(); for (const authorship of this.authors()) { @@ -155,6 +207,13 @@ export class PublicationDetailComponent implements OnInit { ); } + fundingCount(): number { + return ( + (this.publication?.funders?.length ?? 0) + + (this.publication?.awards?.length ?? 0) + ); + } + pages(): string | null { const first = this.publication?.biblio?.first_page; const last = this.publication?.biblio?.last_page; diff --git a/webapp/src/app/resolvers/author-work-purposes.resolver.ts b/webapp/src/app/resolvers/author-work-purposes.resolver.ts new file mode 100644 index 00000000..15285adb --- /dev/null +++ b/webapp/src/app/resolvers/author-work-purposes.resolver.ts @@ -0,0 +1,15 @@ +import { ResolveFn } from '@angular/router'; +import { AuthorWorkPurposes, WorksService } from '../api'; +import { inject } from '@angular/core'; + +export const authorWorkPurposesResolver: ResolveFn = ( + route, + state, +) => { + const id = route.parent?.paramMap.get('id') || route.paramMap.get('id'); + if (!id) { + throw new Error('Author ID is required to resolve author work purposes.'); + } + + return inject(WorksService).getAuthorWorkPurposes(id); +}; diff --git a/webapp/src/app/resolvers/person-patents.resolver.ts b/webapp/src/app/resolvers/person-patents.resolver.ts new file mode 100644 index 00000000..5008d36d --- /dev/null +++ b/webapp/src/app/resolvers/person-patents.resolver.ts @@ -0,0 +1,27 @@ +import { ResolveFn } from '@angular/router'; +import { inject } from '@angular/core'; +import { Observable, of, catchError, shareReplay } from 'rxjs'; +import { PatentsByAuthorResponse, PatentsService } from '../api'; + +export interface PersonPatentsResolved { + patents$: Observable; +} + +export const personPatentsResolver: ResolveFn = (route) => { + const authorId = route.paramMap.get('id'); + const patentsApi = inject(PatentsService); + + if (!authorId) { + return { patents$: of(null) }; + } + + const patents$ = patentsApi.getPatentsByAuthor(authorId, 'body').pipe( + catchError((err) => { + console.error('Failed to load patents:', err); + return of(null); + }), + shareReplay(1), + ); + + return { patents$ }; +}; diff --git a/webapp/src/app/resolvers/work-page.resolver.ts b/webapp/src/app/resolvers/work-page.resolver.ts new file mode 100644 index 00000000..5c69230a --- /dev/null +++ b/webapp/src/app/resolvers/work-page.resolver.ts @@ -0,0 +1,27 @@ +import { ResolveFn } from '@angular/router'; +import { WorkPage, WorksService } from '../api'; +import { inject } from '@angular/core'; + +export const workPageResolver: ResolveFn = (route, state) => { + const authorId = route.paramMap.get('authorId'); + const page = Number(route.queryParamMap.get('page') || 0); + const pageSize = Number(route.queryParamMap.get('pageSize') || 10); + const publicationYears = route.queryParamMap + .getAll('publicationYears') + .map(Number); + const type = route.queryParamMap.getAll('types'); + const languages = route.queryParamMap.getAll('languages'); + const institutionIds = route.queryParamMap.getAll('institutionIds'); + const topicsIds = route.queryParamMap.getAll('topicsIds'); + + return inject(WorksService).getAuthorWorks( + authorId!, + page, + pageSize, + publicationYears, + type, + languages, + institutionIds, + topicsIds, + ); +}; diff --git a/webapp/src/app/shared/pipes/language-code.pipe.ts b/webapp/src/app/shared/pipes/language-code.pipe.ts new file mode 100644 index 00000000..ea985af7 --- /dev/null +++ b/webapp/src/app/shared/pipes/language-code.pipe.ts @@ -0,0 +1,66 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'languageCode', +}) +export class LanguageCodePipe implements PipeTransform { + transform( + languageCode: string | null | undefined, + ...args: unknown[] + ): string { + switch (languageCode) { + case 'en': + return 'Englisch'; + case 'de': + return 'Deutsch'; + case 'fr': + return 'Französisch'; + case 'es': + return 'Spanisch'; + case 'it': + return 'Italienisch'; + case 'pt': + return 'Portugiesisch'; + case 'ru': + return 'Russisch'; + case 'zh': + return 'Chinesisch'; + case 'ja': + return 'Japanisch'; + case 'ar': + return 'Arabisch'; + case 'ko': + return 'Koreanisch'; + case 'nl': + return 'Niederländisch'; + case 'sv': + return 'Schwedisch'; + case 'no': + return 'Norwegisch'; + case 'da': + return 'Dänisch'; + case 'fi': + return 'Finnisch'; + case 'pl': + return 'Polnisch'; + case 'cs': + return 'Tschechisch'; + case 'hu': + return 'Ungarisch'; + case 'tr': + return 'Türkisch'; + case 'el': + return 'Griechisch'; + case 'he': + return 'Hebräisch'; + case 'hi': + return 'Hindi'; + case 'th': + return 'Thailändisch'; + case 'vi': + return 'Vietnamesisch'; + default: + return languageCode ?? 'Unbekannte Sprache'; + } + } +} diff --git a/webapp/src/app/shared/pipes/work-type.pipe.ts b/webapp/src/app/shared/pipes/work-type.pipe.ts new file mode 100644 index 00000000..eebedae6 --- /dev/null +++ b/webapp/src/app/shared/pipes/work-type.pipe.ts @@ -0,0 +1,27 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'workType', +}) +export class WorkTypePipe implements PipeTransform { + transform(value: string | null | undefined, ...args: unknown[]): string { + switch (value) { + case 'article': + return 'Artikel'; + case 'book': + return 'Buch'; + case 'book-chapter': + return 'Buchkapitel'; + case 'dataset': + return 'Datensatz'; + case 'dissertation': + return 'Dissertation'; + case 'report': + return 'Bericht'; + case 'preprint': + return 'Preprint'; + default: + return value ?? 'Unbekannter Typ'; + } + } +} diff --git a/webapp/src/app/shared/services/bookmark.service.ts b/webapp/src/app/shared/services/bookmark.service.ts new file mode 100644 index 00000000..0b3c34db --- /dev/null +++ b/webapp/src/app/shared/services/bookmark.service.ts @@ -0,0 +1,105 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable, inject, signal } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; +import { EMPTY, Observable, finalize, map, of, switchMap, tap } from 'rxjs'; + +import { Configuration, CustomAuthor } from '../../api'; +import { ConfirmationDialogComponent } from '../ui/confirmation-dialog/confirmation-dialog.component'; + +export interface PersonBookmark { + person_id: string; + person_name: string | null; + created_at: string; +} + +@Injectable({ providedIn: 'root' }) +export class BookmarkService { + private readonly http = inject(HttpClient); + private readonly configuration = inject(Configuration, { optional: true }); + private readonly dialog = inject(MatDialog); + private readonly bookmarkState = signal([]); + private loading = false; + private loaded = false; + + readonly bookmarks = this.bookmarkState.asReadonly(); + + load(force = false): Observable { + if (this.loaded && !force) return of(this.bookmarkState()); + if (this.loading) return of(this.bookmarkState()); + + this.loading = true; + return this.http + .get(`${this.basePath}/api/bookmarks/persons`) + .pipe( + tap((bookmarks) => { + this.bookmarkState.set(bookmarks); + this.loaded = true; + }), + finalize(() => (this.loading = false)), + ); + } + + isBookmarked(personId: string | null | undefined): boolean { + const id = this.normalizeId(personId); + return !!id && this.bookmarkState().some((item) => item.person_id === id); + } + + toggle(person: CustomAuthor): Observable { + const personId = this.normalizeId(person.id); + if (!personId) return of(false); + + if (this.isBookmarked(personId)) { + return this.http + .delete(`${this.basePath}/api/bookmarks/persons/${personId}`) + .pipe( + tap(() => + this.bookmarkState.update((items) => + items.filter((item) => item.person_id !== personId), + ), + ), + map(() => false), + ); + } + + return this.http + .put(`${this.basePath}/api/bookmarks/persons/${personId}`, { + person_name: person.display_name ?? null, + }) + .pipe( + tap((bookmark) => + this.bookmarkState.update((items) => [ + bookmark, + ...items.filter((item) => item.person_id !== bookmark.person_id), + ]), + ), + map(() => true), + ); + } + + confirmToggle(person: CustomAuthor): Observable { + const removing = this.isBookmarked(person.id); + const personName = person.display_name?.trim() || 'diese Person'; + const dialogRef = this.dialog.open(ConfirmationDialogComponent, { + data: { + title: removing ? 'Bookmark entfernen' : 'Person speichern', + message: removing + ? `Möchtest Du „${personName}“ wirklich aus Deinen Bookmarks entfernen?` + : `Möchtest Du „${personName}“ in Deinen Bookmarks speichern?`, + confirmText: removing ? 'Entfernen' : 'Speichern', + cancelText: 'Abbrechen', + }, + }); + + return dialogRef.afterClosed().pipe( + switchMap((confirmed) => (confirmed ? this.toggle(person) : EMPTY)), + ); + } + + private normalizeId(personId: string | null | undefined): string { + return personId?.trim().replace(/\/$/, '').split('/').pop() ?? ''; + } + + private get basePath(): string { + return this.configuration?.basePath ?? ''; + } +} diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts index f39ff565..644c59a3 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.ts +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.ts @@ -74,6 +74,12 @@ export class AppMenuComponent { }, disabled: false, }, + { + label: 'Bookmarks', + icon: 'bookmarks', + route: '/bookmarks', + disabled: false, + }, { label: 'News', icon: 'newspaper', diff --git a/webapp/src/app/shared/ui/confirmation-dialog/confirmation-dialog.component.ts b/webapp/src/app/shared/ui/confirmation-dialog/confirmation-dialog.component.ts index bfeb4734..bc2b33aa 100644 --- a/webapp/src/app/shared/ui/confirmation-dialog/confirmation-dialog.component.ts +++ b/webapp/src/app/shared/ui/confirmation-dialog/confirmation-dialog.component.ts @@ -51,11 +51,11 @@ export class ConfirmationDialogComponent { } onCancelClick(): void { - this.dialogRef.close(); + this.dialogRef.close(false); } onConfirmClick(): void { this.confirmDelete.emit(); - this.dialogRef.close(); + this.dialogRef.close(true); } }