diff --git a/service/Dockerfile b/service/Dockerfile index 403e56c1..2335ec87 100644 --- a/service/Dockerfile +++ b/service/Dockerfile @@ -15,7 +15,8 @@ RUN mkdir /test && \ "pytest~=8.1.0" \ "httpx~=0.27.0" \ "python-multipart~=0.0.19"\ - "elasticsearch~=9.4.0" + "elasticsearch~=9.4.0" \ + "openai~=2.41.0" COPY [ "src/main", "/home" ] COPY [ "src/data", "/data" ] diff --git a/service/pyproject.toml b/service/pyproject.toml index d0d54039..689f20cf 100644 --- a/service/pyproject.toml +++ b/service/pyproject.toml @@ -10,6 +10,7 @@ dependencies = [ "elasticsearch~=9.4.0", "fastapi~=0.115.0", "httpx~=0.27.0", + "openai~=2.41.0", "pydantic~=2.7.1", "pydantic-settings~=2.2.1", "pyjwt~=2.8.0", diff --git a/service/src/main/inse/.env b/service/src/main/inse/.env index 72266db6..f2fc4762 100644 --- a/service/src/main/inse/.env +++ b/service/src/main/inse/.env @@ -1,6 +1,6 @@ ELASTICSEARCH_URL=https://project.nes.uni-due.de/elastic/ ELASTICSEARCH_API_KEY=am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ -LLM_API_URL=https://project.nes.uni-due.de/llm2/api/generate +LLM_API_URL=https://project.nes.uni-due.de/llm2/v1/ LLM_API_KEY=c2d5e7ccf7a4760dd3d19bed2caed9d85ff7437400e0ea82a6d6f912ebc2f212 -LLM_MODEL=gemma4:e4b \ No newline at end of file +LLM_MODEL=gemma4-e4b \ No newline at end of file diff --git a/service/src/main/inse/funders/__init__.py b/service/src/main/inse/funders/__init__.py new file mode 100644 index 00000000..a12699fd --- /dev/null +++ b/service/src/main/inse/funders/__init__.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + Funders domain package. +""" diff --git a/service/src/main/inse/funders/elastic_search_client.py b/service/src/main/inse/funders/elastic_search_client.py new file mode 100644 index 00000000..f19cc511 --- /dev/null +++ b/service/src/main/inse/funders/elastic_search_client.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + HTTP client for funded-publication searches in the OpenAlex works index. +""" +from typing import Any + +import httpx + +from .. import config + + +class MissingApiKeyError(Exception): + pass + + +class FundedPublicationsSearchClient: + def __init__( + self, + base_url: str | None = None, + index: str | None = None, + api_key: str | None = None, + timeout: float | None = None, + transport: httpx.AsyncBaseTransport | None = None, + ): + self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/") + self.index = index or config.settings.openalex_works_search_index + self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key + self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds + self.transport = transport + + @staticmethod + def indexed_author_id(author_id: str) -> str: + short_id = author_id.strip().removeprefix("https://openalex.org/") + return f"https://openalex.org/{short_id}" + + def publications_by_author_query( + self, + author_id: str, + page: int, + size: int, + *, + funded_only: bool = False, + ) -> dict[str, Any]: + indexed_author_id = self.indexed_author_id(author_id) + must: list[dict[str, Any]] = [ + { + "nested": { + "path": "authorships", + "query": { + "term": { + "authorships.author.id": indexed_author_id, + }, + }, + }, + }, + ] + + if funded_only: + must.append(self._has_funding_clause()) + + return { + "from": (page - 1) * size, + "size": size, + "track_total_hits": True, + "_source": self._publication_source_fields(), + "query": { + "bool": { + "must": must, + }, + }, + } + + @staticmethod + def _publication_source_fields() -> list[str]: + return [ + "id", + "doi", + "title", + "display_name", + "publication_year", + "primary_location.landing_page_url", + "primary_location.pdf_url", + "best_oa_location.landing_page_url", + "best_oa_location.pdf_url", + "open_access.oa_url", + "authorships.author.id", + "authorships.author.display_name", + "authorships.author_position", + "funders.id", + "funders.display_name", + "funders.ror", + "awards.id", + "awards.funder_id", + "awards.funder_display_name", + "awards.funder_award_id", + ] + + @staticmethod + def _has_funding_clause() -> dict[str, Any]: + return { + "bool": { + "should": [ + { + "nested": { + "path": "funders", + "query": { + "bool": { + "should": [ + {"exists": {"field": "funders.id"}}, + {"exists": {"field": "funders.display_name"}}, + ], + "minimum_should_match": 1, + }, + }, + }, + }, + { + "nested": { + "path": "awards", + "query": { + "bool": { + "should": [ + {"exists": {"field": "awards.funder_id"}}, + {"exists": {"field": "awards.funder_display_name"}}, + ], + "minimum_should_match": 1, + }, + }, + }, + }, + ], + "minimum_should_match": 1, + }, + } + + def funded_publications_by_author_query( + self, + author_id: str, + page: int, + size: int, + ) -> dict[str, Any]: + return self.publications_by_author_query(author_id, page, size, funded_only=True) + + async def search(self, payload: dict[str, Any]) -> dict[str, Any]: + if not self.api_key: + raise MissingApiKeyError("OpenAlex works Elasticsearch API key is not configured.") + + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.post( + f"/{self.index}/_search", + headers={"Authorization": f"ApiKey {self.api_key}"}, + json=payload, + ) + response.raise_for_status() + return response.json() diff --git a/service/src/main/inse/funders/logic.py b/service/src/main/inse/funders/logic.py new file mode 100644 index 00000000..a04eb6fd --- /dev/null +++ b/service/src/main/inse/funders/logic.py @@ -0,0 +1,300 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + Business logic for author funding based on publication works. +""" +import logging +from typing import Any + +import httpx +from fastapi import HTTPException +from pydantic import ValidationError +from starlette.status import HTTP_502_BAD_GATEWAY +from starlette.status import HTTP_503_SERVICE_UNAVAILABLE + +from ..persons import logic as person_logic +from . import model +from .elastic_search_client import FundedPublicationsSearchClient +from .elastic_search_client import MissingApiKeyError + +logger = logging.getLogger(__name__) + +_VALID_AUTHOR_POSITIONS = frozenset({"first", "middle", "last"}) +_ES_PAGE_SIZE = 500 +_MAX_ES_PAGES = 100 + + +async def get_publications_by_author_id( + author_id: str, + page: int = 1, + page_size: int = 20, + client: FundedPublicationsSearchClient | None = None, +) -> model.PublicationsByAuthorResponse: + search_client = client or FundedPublicationsSearchClient() + total_works, all_hits = await _fetch_all_author_work_hits( + search_client, + author_id, + funded_only=True, + ) + funded_hits = [ + hit for hit in all_hits + if _publication_has_funder_data(hit.get("_source", {})) + ] + start = (page - 1) * page_size + end = start + page_size + + return model.PublicationsByAuthorResponse( + author_id=FundedPublicationsSearchClient.indexed_author_id(author_id), + page=page, + page_size=page_size, + total_works=total_works, + total=len(funded_hits), + results_count=len(funded_hits[start:end]), + results=funded_hits[start:end], + ) + + +async def get_funders_by_author_id( + author_id: str, + client: FundedPublicationsSearchClient | None = None, +) -> model.FundersByAuthorResponse: + search_client = client or FundedPublicationsSearchClient() + funder_counts: dict[str, dict[str, Any]] = {} + + normalized_author_id = FundedPublicationsSearchClient.indexed_author_id(author_id) + author_name = _get_author_name(author_id) + + try: + _, all_hits = await _fetch_all_author_work_hits( + search_client, + author_id, + funded_only=True, + ) + _collect_funders_from_publications(all_hits, author_id, funder_counts) + + if not funder_counts: + logger.info( + "No funders aggregated for author %s from Elasticsearch.", + normalized_author_id, + ) + + funders = sorted( + funder_counts.values(), + key=lambda entry: entry["publication_count"], + reverse=True, + ) + + return model.FundersByAuthorResponse( + author_id=normalized_author_id, + author_name=author_name, + funder_count=len(funders), + funders=[model.FunderByAuthor.model_validate(entry) for entry in funders], + ) + except ValidationError as exc: + logger.exception("Funders response could not be validated for author %s.", author_id) + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="Funders response could not be parsed.", + ) from exc + + +async def _fetch_all_author_work_hits( + search_client: FundedPublicationsSearchClient, + author_id: str, + *, + funded_only: bool = False, + page_size: int = _ES_PAGE_SIZE, +) -> tuple[int, list[dict]]: + page = 1 + total_works = 0 + all_hits: list[dict] = [] + + while page <= _MAX_ES_PAGES: + data = await _search_funded_publications( + search_client, + author_id, + page, + page_size, + funded_only=funded_only, + ) + total_works, hits = _parse_publication_search_response(data) + all_hits.extend(hits) + + if not hits or page * page_size >= total_works: + break + + page += 1 + + if page > _MAX_ES_PAGES and page * page_size < total_works: + logger.warning( + "Stopped pagination for author %s at %s pages (total works: %s).", + author_id, + _MAX_ES_PAGES, + total_works, + ) + + return total_works, all_hits + + +async def _search_funded_publications( + search_client: FundedPublicationsSearchClient, + author_id: str, + page: int, + page_size: int, + *, + funded_only: bool = False, +) -> dict: + try: + payload = search_client.publications_by_author_query( + author_id, + page, + page_size, + funded_only=funded_only, + ) + return await search_client.search(payload) + except MissingApiKeyError as exc: + logger.error("OpenAlex works Elasticsearch API key is not configured.") + raise HTTPException( + status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="OpenAlex works search is not configured.", + ) from exc + except httpx.HTTPError as exc: + logger.exception("OpenAlex works search request failed.") + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="OpenAlex works search request failed.", + ) from exc + + +def _parse_publication_search_response(data: dict) -> tuple[int, list[dict]]: + hits = data.get("hits", {}) + total = hits.get("total", 0) + + if isinstance(total, dict): + total = total.get("value", 0) + + results = hits.get("hits", []) + for hit in results: + _add_publication_url(hit.get("_source", {})) + + return total, results + + +def _get_author_name(author_id: str) -> str | None: + short_author_id = author_id.replace("https://openalex.org/", "") + search_result = person_logic.search_persons(author_id=short_author_id) + + if not search_result.results: + return None + + return search_result.results[0].display_name + + +def _get_author_position_in_publication(publication: dict, author_id: str) -> str: + normalized_author_id = FundedPublicationsSearchClient.indexed_author_id(author_id) + + for authorship in publication.get("authorships", []): + author = authorship.get("author", {}) + if author.get("id") == normalized_author_id: + position = authorship.get("author_position", "unknown") + if position in _VALID_AUTHOR_POSITIONS: + return position + return "unknown" + + return "unknown" + + +def _publication_has_funder_data(publication: dict) -> bool: + for funder in publication.get("funders", []): + if funder.get("id") or funder.get("display_name"): + return True + + for award in publication.get("awards", []): + if award.get("funder_id") or award.get("funder_display_name"): + return True + + return False + + +def _add_publication_url(publication: dict) -> None: + publication["publication_url"] = _resolve_publication_url(publication) + + +def _resolve_publication_url(publication: dict) -> str | None: + primary_location = publication.get("primary_location") or {} + best_oa_location = publication.get("best_oa_location") or {} + open_access = publication.get("open_access") or {} + + for url in ( + primary_location.get("pdf_url"), + best_oa_location.get("pdf_url"), + primary_location.get("landing_page_url"), + best_oa_location.get("landing_page_url"), + open_access.get("oa_url"), + ): + if url: + return url + + doi = publication.get("doi") + if doi: + return doi if doi.startswith("http") else f"https://doi.org/{doi}" + + return publication.get("id") + + +def _collect_funders_from_publications( + results: list[dict], + author_id: str, + funder_counts: dict[str, dict[str, Any]], +) -> None: + for hit in results: + publication = hit.get("_source", {}) + if not _publication_has_funder_data(publication): + continue + + publication_id = publication.get("id") + publication_url = publication.get("publication_url") or _resolve_publication_url(publication) + author_position = _get_author_position_in_publication(publication, author_id) + publication_funders: set[tuple[str, str | None, str | None]] = set() + + for funder in publication.get("funders", []): + funder_id = funder.get("id") + funder_name = funder.get("display_name") + if funder_id or funder_name: + key = funder_id or funder_name + publication_funders.add((key, funder_id, funder_name)) + + for award in publication.get("awards", []): + funder_id = award.get("funder_id") + funder_name = award.get("funder_display_name") + if funder_id or funder_name: + key = funder_id or funder_name + publication_funders.add((key, funder_id, funder_name)) + + for key, funder_id, funder_name in publication_funders: + if key not in funder_counts: + funder_counts[key] = { + "funder_id": funder_id, + "funder_name": funder_name, + "publication_count": 0, + "author_position_count": { + "first": 0, + "middle": 0, + "last": 0, + "unknown": 0, + }, + "publication_ids": { + "first": [], + "middle": [], + "last": [], + "unknown": [], + }, + "publication_urls": {}, + } + + entry = funder_counts[key] + entry["publication_count"] += 1 + entry["author_position_count"][author_position] += 1 + entry["publication_ids"][author_position].append(publication_id) + if publication_id and publication_url: + entry["publication_urls"][publication_id] = publication_url diff --git a/service/src/main/inse/funders/model.py b/service/src/main/inse/funders/model.py new file mode 100644 index 00000000..d2207541 --- /dev/null +++ b/service/src/main/inse/funders/model.py @@ -0,0 +1,43 @@ +from typing import Any + +from pydantic import BaseModel + + +class PublicationsByAuthorResponse(BaseModel): + author_id: str + page: int + page_size: int + total_works: int + total: int + results_count: int + results: list[dict[str, Any]] + + +class PublicationIdsByAuthorPosition(BaseModel): + first: list[str] = [] + middle: list[str] = [] + last: list[str] = [] + unknown: list[str] = [] + + +class AuthorPositionCount(BaseModel): + first: int = 0 + middle: int = 0 + last: int = 0 + unknown: int = 0 + + +class FunderByAuthor(BaseModel): + funder_id: str | None = None + funder_name: str | None = None + publication_count: int + author_position_count: AuthorPositionCount + publication_ids: PublicationIdsByAuthorPosition + publication_urls: dict[str, str] = {} + + +class FundersByAuthorResponse(BaseModel): + author_id: str + author_name: str | None = None + funder_count: int + funders: list[FunderByAuthor] diff --git a/service/src/main/inse/funders/service.py b/service/src/main/inse/funders/service.py new file mode 100644 index 00000000..b6c8c05f --- /dev/null +++ b/service/src/main/inse/funders/service.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + REST API for author publications and funding. +""" +from typing import Annotated + +from fastapi import APIRouter +from fastapi import Query + +from . import logic +from . import model + + +router = APIRouter(prefix="/api/inse-service/authors", tags=["Funding"]) + + +@router.get( + "/{author_id}/publications", + operation_id="getPublicationsByAuthor", + response_model=model.PublicationsByAuthorResponse, + summary="Get funded publications by author.", +) +async def get_publications_by_author( + author_id: str, + page: Annotated[int, Query(ge=1)] = 1, + page_size: Annotated[int, Query(ge=1, le=1000)] = 200, +): + return await logic.get_publications_by_author_id(author_id, page, page_size) + + +@router.get( + "/{author_id}/funders", + operation_id="getFundersByAuthor", + response_model=model.FundersByAuthorResponse, + summary="Get funding organizations by author.", +) +async def get_funders_by_author(author_id: str): + return await logic.get_funders_by_author_id(author_id) diff --git a/service/src/main/inse/funders/test_logic.py b/service/src/main/inse/funders/test_logic.py new file mode 100644 index 00000000..1c519224 --- /dev/null +++ b/service/src/main/inse/funders/test_logic.py @@ -0,0 +1,263 @@ +import json + +import httpx +import pytest +from fastapi import HTTPException + +from inse.funders import logic +from inse.funders.elastic_search_client import FundedPublicationsSearchClient + + +@pytest.fixture +def anyio_backend(): + return "asyncio" + + +def _funded_publication_hit( + work_id: str, + *, + funder_id: str | None = "https://openalex.org/F123", + funder_name: str | None = "Example Funder", + author_position: str = "first", + award_funder_id: str | None = None, + award_funder_name: str | None = None, + pdf_url: str | None = None, +) -> dict: + source: dict = { + "id": work_id, + "primary_location": { + "pdf_url": pdf_url, + }, + "authorships": [ + { + "author": { + "id": "https://openalex.org/A5023888391", + "display_name": "Example Author", + }, + "author_position": author_position, + } + ], + "funders": [], + "awards": [], + } + if funder_id or funder_name: + source["funders"].append( + { + "id": funder_id, + "display_name": funder_name, + } + ) + if award_funder_id or award_funder_name: + source["awards"].append( + { + "funder_id": award_funder_id, + "funder_display_name": award_funder_name, + } + ) + return {"_source": source} + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_aggregates_funders_and_awards(monkeypatch): + def handler(request: httpx.Request) -> httpx.Response: + payload = json.loads(request.content.decode("utf-8")) + assert payload["from"] == 0 + return httpx.Response( + 200, + json={ + "hits": { + "total": {"value": 2}, + "hits": [ + _funded_publication_hit( + "https://openalex.org/W1", + funder_id="https://openalex.org/F123", + funder_name="Funder A", + author_position="first", + pdf_url="https://example.org/w1.pdf", + ), + _funded_publication_hit( + "https://openalex.org/W2", + funder_id=None, + funder_name=None, + award_funder_id="https://openalex.org/F123", + award_funder_name="Funder A", + author_position="last", + ), + ], + }, + }, + ) + + monkeypatch.setattr( + logic.person_logic, + "search_persons", + lambda author_id: type( + "Result", + (), + {"results": [type("Author", (), {"display_name": "Example Author"})()]}, + )(), + ) + + client = FundedPublicationsSearchClient( + base_url="https://project.nes.uni-due.de/elastic", + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + + response = await logic.get_funders_by_author_id("A5023888391", client=client) + + assert response.author_id == "https://openalex.org/A5023888391" + assert response.author_name == "Example Author" + assert response.funder_count == 1 + assert response.funders[0].funder_id == "https://openalex.org/F123" + assert response.funders[0].funder_name == "Funder A" + assert response.funders[0].publication_count == 2 + assert response.funders[0].author_position_count.first == 1 + assert response.funders[0].author_position_count.last == 1 + assert response.funders[0].publication_ids.first == ["https://openalex.org/W1"] + assert response.funders[0].publication_ids.last == ["https://openalex.org/W2"] + assert response.funders[0].publication_urls["https://openalex.org/W1"] == "https://example.org/w1.pdf" + assert response.funders[0].publication_urls["https://openalex.org/W2"] == "https://openalex.org/W2" + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_paginates_until_all_results_are_loaded(monkeypatch): + requested_pages: list[int] = [] + + def handler(request: httpx.Request) -> httpx.Response: + payload = json.loads(request.content.decode("utf-8")) + size = payload["size"] + offset = payload["from"] + page = offset // size + 1 + requested_pages.append(page) + total = size + 1 + if page == 1: + hits = [ + _funded_publication_hit( + f"https://openalex.org/W{i}", + funder_id=f"https://openalex.org/F{i}", + funder_name=f"Funder {i}", + ) + for i in range(1, size + 1) + ] + else: + hits = [ + _funded_publication_hit( + f"https://openalex.org/W{total}", + funder_id=f"https://openalex.org/F{total}", + funder_name=f"Funder {total}", + ) + ] + + return httpx.Response( + 200, + json={ + "hits": { + "total": {"value": total}, + "hits": hits, + }, + }, + ) + + monkeypatch.setattr( + logic.person_logic, + "search_persons", + lambda author_id: type("Result", (), {"results": []})(), + ) + + client = FundedPublicationsSearchClient( + base_url="https://project.nes.uni-due.de/elastic", + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + + response = await logic.get_funders_by_author_id("A5023888391", client=client) + + assert requested_pages == [1, 2] + assert response.funder_count > 1 + funder_names = {funder.funder_name for funder in response.funders} + assert "Funder 1" in funder_names + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_ignores_publications_without_funders(monkeypatch): + def handler(request: httpx.Request) -> httpx.Response: + return httpx.Response( + 200, + json={ + "hits": { + "total": {"value": 2}, + "hits": [ + _funded_publication_hit( + "https://openalex.org/W1", + funder_id="https://openalex.org/F123", + funder_name="Bundesministerium", + ), + _funded_publication_hit( + "https://openalex.org/W2", + funder_id=None, + funder_name=None, + ), + ], + }, + }, + ) + + monkeypatch.setattr( + logic.person_logic, + "search_persons", + lambda author_id: type("Result", (), {"results": []})(), + ) + + client = FundedPublicationsSearchClient( + base_url="https://project.nes.uni-due.de/elastic", + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + + response = await logic.get_funders_by_author_id("A5093075883", client=client) + + assert response.funder_count == 1 + assert response.funders[0].funder_name == "Bundesministerium" + assert response.funders[0].publication_count == 1 + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_returns_empty_when_elasticsearch_has_no_funders(monkeypatch): + def handler(request: httpx.Request) -> httpx.Response: + return httpx.Response( + 200, + json={"hits": {"total": {"value": 0}, "hits": []}}, + ) + + monkeypatch.setattr( + logic.person_logic, + "search_persons", + lambda author_id: type("Result", (), {"results": []})(), + ) + + client = FundedPublicationsSearchClient( + base_url="https://project.nes.uni-due.de/elastic", + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + + response = await logic.get_funders_by_author_id("A5093075883", client=client) + + assert response.funder_count == 0 + assert response.funders == [] + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_maps_missing_api_key_to_service_unavailable(monkeypatch): + monkeypatch.setattr( + logic.person_logic, + "search_persons", + lambda author_id: type("Result", (), {"results": []})(), + ) + client = FundedPublicationsSearchClient(api_key="") + + with pytest.raises(HTTPException) as exc: + await logic.get_funders_by_author_id("A5023888391", client=client) + + assert exc.value.status_code == 503 diff --git a/service/src/main/inse/integrations/llm.py b/service/src/main/inse/integrations/llm.py index 8ec7a76d..6cf4ed22 100644 --- a/service/src/main/inse/integrations/llm.py +++ b/service/src/main/inse/integrations/llm.py @@ -1,5 +1,4 @@ -from typing import Any -import httpx +from openai import OpenAI, APIConnectionError from .. import config @@ -7,26 +6,35 @@ def call( system_prompt: str, user_prompt: str, model: str = None, - stream: bool = False, - timeout: int = 30 + timeout: int = 30, + temperature: float = 1.0, + top_p: float = 0.95, ) -> str: - headers = { - "Authorization": f"Bearer {config.settings.llm_api_token}", - "Content-Type": "application/json" - } - if model is None: model = config.settings.llm_model - payload = { - "model": model, - "prompt": f"{system_prompt}\n{user_prompt}", - "stream": stream - } + client = OpenAI( + base_url=config.settings.llm_api_url, + api_key=config.settings.llm_api_key, + timeout=timeout, + ) - with httpx.Client(timeout=timeout) as client: - response = client.post(config.settings.llm_api_url, json=payload, headers=headers) - response.raise_for_status() - data = response.json() - return data.get("response", "") + try: + response = client.chat.completions.create( + model=model, + messages=[ + {"role": "system", "content": system_prompt}, + {"role": "user", "content": user_prompt}, + ], + + temperature=temperature, + top_p=top_p, + extra_body={"top_k": 64}, + ) + except APIConnectionError: + return "Etwas ist schiefgelaufen. Bitte versuche es später erneut." + + return response.choices[0].message.content or ( + "Etwas ist schiefgelaufen. Bitte versuche es erneut." + ) diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index d32ad400..353626d6 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -18,8 +18,6 @@ import json from . import schema from . import model from . import config -from .integrations import llm -from elasticsearch import Elasticsearch from inse.models.topic import Topic @@ -31,20 +29,6 @@ from inse.models.topic_domain import TopicDomain logger = logging.getLogger(__name__) -def _init_es_client() -> Optional[Elasticsearch]: - es_url = config.settings.elasticsearch_url - if not es_url: - logger.warning("Elasticsearch URL not configured; skipping client init.") - return None - client = Elasticsearch( - hosts=[str(es_url)], - api_key=config.settings.elasticsearch_api_key, - ) - logger.info("Elasticsearch client initialized with URL: %s", es_url) - return client - - -es_client = _init_es_client() topic_cache_filename: str = "topic_hierarchy_cache.json" @@ -106,8 +90,12 @@ def insert_element(db: Session, value: S) -> S: def _load_topic_cache() -> dict: """Loads the topic hierarchy cache from a JSON file.""" + import os try: cache_path = "/data/" + topic_cache_filename + if not os.path.exists(cache_path): + current_dir = os.path.dirname(__file__) + cache_path = os.path.join(current_dir, "..", "data", topic_cache_filename) with open(cache_path, "r", encoding="utf-8") as f: return json.load(f) except Exception as exc: @@ -241,4 +229,58 @@ def count_topic_hierarchy(topic_names: List[str]) -> dict: if domain: counts["domains"][domain] = counts["domains"].get(domain, 0) + 1 - return counts \ No newline at end of file + return counts + +def get_topic_hierarchy() -> dict: + """ + Builds and returns a hierarchical tree structure of topics: + Domains -> Fields -> Subfields -> Topics + """ + flat_cache = _load_topic_cache() + tree = {} + + for topic_name, info in flat_cache.items(): + domain = info.get("domain") or "Unbekannter Bereich" + field = info.get("field") or "Unbekanntes Feld" + subfield = info.get("subfield") or "Unbekanntes Teilfeld" + topic_id = info.get("topic_id", "") + + # Clean topic ID to just be the trailing ID or keep full URL + # For querying, display name is used in persons search, but ID is useful + + if domain not in tree: + tree[domain] = {} + if field not in tree[domain]: + tree[domain][field] = {} + if subfield not in tree[domain][field]: + tree[domain][field][subfield] = [] + + tree[domain][field][subfield].append({ + "id": topic_id, + "name": topic_name + }) + + formatted_domains = [] + for d_name, d_fields in tree.items(): + formatted_fields = [] + for f_name, f_subfields in d_fields.items(): + formatted_subfields = [] + for sf_name, sf_topics in f_subfields.items(): + sf_topics.sort(key=lambda x: x["name"]) + formatted_subfields.append({ + "name": sf_name, + "topics": sf_topics + }) + formatted_subfields.sort(key=lambda x: x["name"]) + formatted_fields.append({ + "name": f_name, + "subfields": formatted_subfields + }) + formatted_fields.sort(key=lambda x: x["name"]) + formatted_domains.append({ + "name": d_name, + "fields": formatted_fields + }) + formatted_domains.sort(key=lambda x: x["name"]) + + return {"domains": formatted_domains} diff --git a/service/src/main/inse/main.py b/service/src/main/inse/main.py index 2b018c5d..4e0e62d2 100644 --- a/service/src/main/inse/main.py +++ b/service/src/main/inse/main.py @@ -13,6 +13,7 @@ from fastapi.middleware.cors import CORSMiddleware from inse.collaboration_network.router import router as collaboration_network_router from inse.works.service import router as works_service_router from inse.persons.service import router as persons_service_router +from inse.funders.service import router as funders_service_router from . import config from .service import router as service_router @@ -34,6 +35,7 @@ app = FastAPI( app.include_router(collaboration_network_router) app.include_router(works_service_router) app.include_router(persons_service_router) +app.include_router(funders_service_router) app.include_router(service_router) app.include_router(account_router) diff --git a/service/src/main/inse/models/topic_count.py b/service/src/main/inse/models/topic_count.py new file mode 100644 index 00000000..fa4a2fcf --- /dev/null +++ b/service/src/main/inse/models/topic_count.py @@ -0,0 +1,9 @@ +from typing import Optional + +from pydantic import BaseModel, Field + + +class TopicCount(BaseModel): + id: Optional[str] = Field(default=None, description="The topic id.") + name: str = Field(description="The topic display name.") + count: int = Field(default=0, description="The number of occurrences.") diff --git a/service/src/main/inse/models/topics_by_time.py b/service/src/main/inse/models/topics_by_time.py new file mode 100644 index 00000000..4b495e5a --- /dev/null +++ b/service/src/main/inse/models/topics_by_time.py @@ -0,0 +1,10 @@ +from typing import List + +from pydantic import BaseModel, Field + +from inse.models.topics_by_year import TopicsByYear + + +class TopicsByTime(BaseModel): + elements: List[TopicsByYear] = Field(default_factory=list, description="Topics grouped by year.") + total: int = Field(default=0, description="The number of years.") diff --git a/service/src/main/inse/models/topics_by_year.py b/service/src/main/inse/models/topics_by_year.py new file mode 100644 index 00000000..91efe7c6 --- /dev/null +++ b/service/src/main/inse/models/topics_by_year.py @@ -0,0 +1,12 @@ +from typing import List + +from pydantic import BaseModel, Field + +from inse.models.topic_count import TopicCount + + +class TopicsByYear(BaseModel): + year: int = Field(description="The publication year.") + publication_count: int = Field(default=0, description="The number of works in this year.") + topics: List[TopicCount] = Field(default_factory=list, description="The topics in this year.") + primary_topics: List[TopicCount] = Field(default_factory=list, description="The primary topics in this year.") diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index db1f699e..a4dc5c0f 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -7,23 +7,22 @@ Business logic for persons / authors. import json import logging import time -from typing import Optional - +from typing import Optional, Callable, Any, List +import hashlib import httpx from fastapi import HTTPException - from .. import config from .. import util -from ..integrations import elasticsearch - +from ..integrations import llm from inse.models.author import Author from inse.models.authors_list_response import AuthorsListResponse +from inse import util +from inse.integrations import elasticsearch from inse.models.meta import Meta -from typing import Callable, Any -from . import model - +from inse.persons.query_builder import build_authors_search +from inse.persons.model import CustomAuthor, CustomAuthorsListResponse, PersonSearchRequest logger = logging.getLogger(__name__) - +INDEX_NAME="openalex-authors" def search_persons( author_id: Optional[str] = None, @@ -52,11 +51,10 @@ def search_persons( # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) ids = source_copy.get("ids") if isinstance(ids, dict): - ids_copy = dict(ids) - for str_field in ["openalex", "orcid", "scopus"]: - val = ids_copy.get(str_field) - if val is not None and not isinstance(val, str): - ids_copy[str_field] = str(val) + ids_copy = {} + orcid_val = ids.get("orcid") + if orcid_val: + ids_copy["orcid"] = str(orcid_val) source_copy["ids"] = ids_copy author = Author.from_dict(source_copy) @@ -66,6 +64,7 @@ def search_persons( return AuthorsListResponse(results=authors, meta=Meta(count=len(authors))) + def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str: start_time = time.time() search_result = search_persons(author_id=author_id) @@ -91,23 +90,7 @@ def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> s user_prompt = f"Daten zur Person:\n{person_json}" - headers = { - "Authorization": f"Bearer {config.settings.llm_api_key}", - "Content-Type": "application/json", - } - payload = { - "model": config.settings.llm_model, - "prompt": f"{system_prompt}\n{user_prompt}", - "stream": False, - } - - with httpx.Client(timeout=30.0) as client: - response = client.post( - config.settings.llm_api_url, json=payload, headers=headers - ) - response.raise_for_status() - data = response.json() - bio = data.get("response", "") + bio = llm.call(system_prompt, user_prompt) elapsed_time = time.time() - start_time logger.info( @@ -116,6 +99,29 @@ def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> s return bio +def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse: + body = { + "_source":include.split(",") if include else True, + } + + try: + hit = elasticsearch.get( + index="openalex-authors", + body=body, + doc_id=author_id + ) + except NotFoundError: + raise HTTPException( + status_code=404, detail=f"Person with id {author_id} not found" + ) + + except ApiError as e: + raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}") + persons = [util.get_persons_data(hit)] + + return AuthorsListResponse(results=persons) + + def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse: body = { @@ -250,11 +256,10 @@ def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, incl # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) ids = source_copy.get("ids") if isinstance(ids, dict): - ids_copy = dict(ids) - for str_field in ["openalex", "orcid", "scopus"]: - val = ids_copy.get(str_field) - if val is not None and not isinstance(val, str): - ids_copy[str_field] = str(val) + ids_copy = {} + orcid_val = ids.get("orcid") + if orcid_val: + ids_copy["orcid"] = str(orcid_val) source_copy["ids"] = ids_copy for key,value in fields.items(): @@ -307,66 +312,124 @@ def search_persons_by_institution( persons = [util.get_persons_data(hit) for hit in hits] return AuthorsListResponse(results=persons,meta=Meta(count=total_count,page=page_offset)) -FILTER_BUILDERS: dict[str, Callable[[Any], dict]] = { - "institution": lambda v: { - "nested": { - "path": "last_known_institutions", - "query": { - "bool": { - "must": [ - { - "match_phrase": { - "last_known_institutions.display_name": v - } - } - ] - } - } - } - }, - # "cited_by_count": lambda v: {"range": {"cited_by_count": {"gte": v}}}, -} +def _enrich_author_data(author_data) -> Optional[CustomAuthor]: + if not author_data: + return None + if not isinstance(author_data, dict): + if hasattr(author_data, 'model_dump'): + author_data = author_data.model_dump() + elif hasattr(author_data, 'to_dict'): + author_data = author_data.to_dict() + else: + return None + author_id = author_data.get("id", "") or "" + # Not implemented yet + h = int(hashlib.md5(author_id.encode('utf-8')).hexdigest(), 16) + -def search_persons_with_filters(req: model.PersonSearchRequest) -> AuthorsListResponse: - should_clauses = [] - must_clauses = [] - - if req.name: - should_clauses = [ - {"match_phrase": {"display_name": {"query": req.name, "boost": 5}}}, - {"match_phrase_prefix": {"display_name": {"query": req.name, "boost": 3}}}, - ] - - for field, value in req.filters.model_dump(exclude_none=True).items(): - builder = FILTER_BUILDERS.get(field) - if builder: - must_clauses.append(builder(value)) - - if should_clauses or must_clauses: - query = { - "bool": { - **({"should": should_clauses, "minimum_should_match": 1} if should_clauses else {}), - **({"must": must_clauses} if must_clauses else {}), - } - } + # Experimental suitability rating + suitability_score = h % 100 + if suitability_score < 15: + relevance_rating = "Sehr geeignet" + elif suitability_score < 50: + relevance_rating = "Geeignet" else: - query = {"match_all": {}} + relevance_rating = "Möglich" + + # Resilient sanitization of IDs to protect against model type conflicts (Generated) TODO: multiple code occurrences (e.g. in util.py) => refactor into seperate utility function (if required, after all merges) + ids = author_data.get("ids") + if isinstance(ids, dict): + ids_copy = {} + orcid_val = ids.get("orcid") + if orcid_val: + ids_copy["orcid"] = str(orcid_val) + author_data["ids"] = ids_copy + + base_author = Author.from_dict(author_data) + if not base_author: + return None + + author = CustomAuthor( + **base_author.model_dump(), + relevance_rating=relevance_rating, + ) + return author + +def advanced_search_persons( + query: Optional[str] = None, + institution_name: Optional[str] = None, + topics: Optional[List[str]] = None, + page: int = 1, + page_size: int = 10, + include: Optional[set[str]] = None, + strict: Optional[bool] = False, + filter_mode: Optional[str] = "from", + filter_year: Optional[int] = None, +) -> CustomAuthorsListResponse: try: - response = elasticsearch.search( - index="openalex-authors", + query_body = build_authors_search( query=query, - offset=req.page_offset, - source=req.include.split(",") if req.include else True, - size=req.limit, - track_total_hits=True, + institution_name=institution_name, + topics=topics, + page=page, + page_size=page_size, + include=include, + strict=strict, + track_total_hits = True, + filter_mode=filter_mode, + filter_year=filter_year + ) + response_dict = elasticsearch.search( + index=INDEX_NAME, + body=query_body, + ) + except httpx.HTTPStatusError as e: + if e.response.status_code == 404: + logger.warning(f"Elasticsearch index '{INDEX_NAME}' not found.") + return CustomAuthorsListResponse( + results=[], + meta=Meta( + count=0, + page=page, + per_page=page_size + ) + ) + elif e.response.status_code == 400: + logger.error(f"Elasticsearch request error: {str(e)}") + raise HTTPException( + status_code=400, detail=f"Elasticsearch request error: {str(e)}" + ) + else: + logger.error(f"Elasticsearch API error: {str(e)}") + raise HTTPException( + status_code=500, detail=f"Elasticsearch API error: {str(e)}" + ) + except httpx.RequestError as e: + logger.error(f"Elasticsearch connection/request error: {str(e)}") + raise HTTPException( + status_code=500, detail=f"Elasticsearch connection/request error: {str(e)}" ) except Exception as e: - raise HTTPException(status_code=500, detail=f"Elasticsearch search failed: {str(e)}") + logger.error(f"Elasticsearch search failed: {str(e)}") + raise HTTPException( + status_code=500, detail=f"Elasticsearch search failed: {str(e)}" + ) + total_count = response_dict.get("hits",{}).get("total",{}).get("value",0) + hits = response_dict.get("hits", {}).get("hits", []) + total_count = response_dict.get("hits", {}).get("total", {}).get("value", 0) - total_count = response.get("hits", {}).get("total", {}).get("value", 0) - hits = response.get("hits", {}).get("hits", []) + results = [] + for hit in hits: + raw_data = util.get_persons_data(hit) + custom_author = _enrich_author_data(raw_data) + if custom_author: + results.append(custom_author) - return AuthorsListResponse( - results=[util.get_persons_data(hit) for hit in hits], - meta=Meta(count=total_count, page=req.page_offset), - ) \ No newline at end of file + return CustomAuthorsListResponse( + results=results, + meta=Meta( + count=total_count, + page=page, + per_page=page_size + ) + ) diff --git a/service/src/main/inse/persons/model.py b/service/src/main/inse/persons/model.py index c7b9f20e..49fc03bc 100644 --- a/service/src/main/inse/persons/model.py +++ b/service/src/main/inse/persons/model.py @@ -5,8 +5,22 @@ Data models for persons / authors. """ from pydantic import BaseModel -from typing import Optional from pydantic import Field +from typing import List, Optional +from inse.models.author import Author +from inse.models.meta import Meta +from inse.models.authors_list_response import AuthorsListResponse + +from inse.models.group_by_result import GroupByResult + +class CustomAuthor(Author): + relevance_rating: Optional[str] = Field(default=None, description="The relevance suitability rating.") + +class CustomAuthorsListResponse(AuthorsListResponse): + pass + #meta: Optional[Meta] = None + #results: Optional[List[CustomAuthor]] = None + #group_by: Optional[List[GroupByResult]] = None class PersonBio(BaseModel): diff --git a/service/src/main/inse/persons/query_builder.py b/service/src/main/inse/persons/query_builder.py new file mode 100644 index 00000000..279bfb98 --- /dev/null +++ b/service/src/main/inse/persons/query_builder.py @@ -0,0 +1,230 @@ +# -*- coding: utf-8 -*- +from typing import List, Optional, Set, Any + +def build_authors_search( + using: Any = None, + index: Optional[str] = None, + query: Optional[str] = None, + institution_name: Optional[str] = None, + topics: Optional[List[str]] = None, + page: int = 1, + page_size: int = 10, + include: Optional[Set[str]] = None, + strict: Optional[bool] = False, + 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 not query: + body["sort"] = [ + {"cited_by_count": {"order": "desc"}}, + {"works_count": {"order": "desc"}} + ] + + return body + diff --git a/service/src/main/inse/persons/service.py b/service/src/main/inse/persons/service.py index 81cb96a0..c442b578 100644 --- a/service/src/main/inse/persons/service.py +++ b/service/src/main/inse/persons/service.py @@ -9,6 +9,7 @@ from typing import Annotated, Optional from fastapi import APIRouter from fastapi import Path from fastapi import Query +from typing import List from . import logic from . import model from inse.models.authors_list_response import AuthorsListResponse @@ -174,12 +175,60 @@ def search_persons_by_institution( ): return logic.search_persons_by_institution(institution_name, include=include,page_offset=page_offset,limit=limit) -@router.post( - "/persons/searchWithFilters", - operation_id="searchPersonsWithFilters", - response_model=AuthorsListResponse, - summary="Search for persons with optional name and filters.", +@router.get( + "/persons/search-list", + operation_id="searchPersonsList", + response_model=model.CustomAuthorsListResponse, + summary="Searches for persons with advanced filters (Topic & Institution) and pagination.", + response_model_exclude_none=True, tags=["Persons"], ) -def search_persons_with_filters(body: model.PersonSearchRequest): - return logic.search_persons_with_filters(body) \ No newline at end of file +def search_persons_list( + query: Annotated[ + Optional[str], Query(description="Search query (e.g., Arman AND Arzani)") + ] = None, + institution_name: Annotated[ + Optional[str], Query(alias="institutionName", description="Filter by institution name") + ] = None, + topic: Annotated[ + Optional[List[str]], Query(description="Filter by topic display names") + ] = None, + page: Annotated[ + int, Query(description="Page number (1-indexed)", ge=1) + ] = 1, + page_size: Annotated[ + int, Query(alias="pageSize", description="Results per page", ge=1, le=100) + ] = 10, + include: Annotated[ + Optional[str], + Query( + description="Comma-separated include tags", + example="topics_full,topic_share", + ), + ] = None, + strict: Annotated[ + Optional[bool], Query(description="Strict institution search by target year") + ] = False, + filter_mode: Annotated[ + Optional[str], Query(alias="filterMode", description="Filter mode: 'in' or 'from'") + ] = "from", + filter_year: Annotated[ + Optional[int], Query(alias="filterYear", description="Filter year") + ] = None, +): + include_set = ( + {tag.strip().lower() for tag in include.split(",") if tag.strip()} + if include + else None + ) + return logic.advanced_search_persons( + query=query, + institution_name=institution_name, + topics=topic, + page=page, + page_size=page_size, + include=include_set, + strict=strict, + filter_mode=filter_mode, + filter_year=filter_year, + ) diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index f25b449b..6e3dadc5 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -27,7 +27,7 @@ from . import schema from . import database from . import security from . import util -from .works import service as works_service + logger = logging.getLogger(__name__) @@ -42,7 +42,6 @@ router = APIRouter( responses={404: {"description": "Not found"}}, ) - # @app.get("/", include_in_schema=False) # async def show_api(): # return RedirectResponse("api") @@ -208,4 +207,14 @@ def count_topic_hierarchy( ), ], ): - return logic.count_topic_hierarchy(topic_names) \ No newline at end of file + return logic.count_topic_hierarchy(topic_names) + +@router.get( + "/topics/hierarchy", + operation_id="getTopicHierarchy", + response_model=dict, + summary="Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).", + tags=["Topics"], +) +def get_topic_hierarchy(): + return logic.get_topic_hierarchy() diff --git a/service/src/main/inse/util.py b/service/src/main/inse/util.py index da4fc410..645e2235 100644 --- a/service/src/main/inse/util.py +++ b/service/src/main/inse/util.py @@ -28,11 +28,10 @@ def get_persons_data(hit:dict): # Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated) ids = source_copy.get("ids") if isinstance(ids, dict): - ids_copy = dict(ids) - for str_field in ["openalex", "orcid", "scopus"]: - val = ids_copy.get(str_field) - if val is not None and not isinstance(val, str): - ids_copy[str_field] = str(val) + ids_copy = {} + orcid_val = ids.get("orcid") + if orcid_val: + ids_copy["orcid"] = str(orcid_val) source_copy["ids"] = ids_copy author = Author.from_dict(source_copy) diff --git a/service/src/main/inse/works/logic.py b/service/src/main/inse/works/logic.py index 379e99e1..467410b7 100644 --- a/service/src/main/inse/works/logic.py +++ b/service/src/main/inse/works/logic.py @@ -17,6 +17,9 @@ from inse.models.work import Work from inse.models.work_page import WorkPage from inse.models.works_list_response import WorksListResponse from inse.models.meta import Meta +from inse.models.topic_count import TopicCount +from inse.models.topics_by_year import TopicsByYear +from inse.models.topics_by_time import TopicsByTime from .search_client import MissingApiKeyError from .search_client import OpenAlexWorksSearchClient @@ -87,6 +90,125 @@ async def get_all_author_works( ) +async def get_primary_topic_counts( + author_id: str, + client: OpenAlexWorksSearchClient | None = None, +) -> List[TopicCount]: + works = await get_all_author_works(author_id, client=client) + + counts = {} + + for work in works.results or []: + primary_topic = work.primary_topic + if not primary_topic or not primary_topic.display_name: + continue + + name = primary_topic.display_name + if name not in counts: + counts[name] = {"id": primary_topic.id, "name": name, "count": 0} + counts[name]["count"] += 1 + + items = sorted(counts.values(), key=lambda item: item["count"], reverse=True) + + return [ + TopicCount(id=item["id"], name=item["name"], count=item["count"]) + for item in items + ] + + +async def get_topics_by_time_by_author( + author_id: str, + max_topics_per_year: int = 3, + client: OpenAlexWorksSearchClient | None = None, +) -> TopicsByTime: + works = await get_all_author_works(author_id, client=client) + + years = {} + + for work in works.results or []: + if work.publication_year is None: + continue + + year = work.publication_year + + if year not in years: + years[year] = { + "publication_count": 0, + "topics": {}, + "primary_topics": {}, + } + + years[year]["publication_count"] += 1 + + for topic in work.topics or []: + if topic.display_name: + topic_name = topic.display_name + topic_id = topic.id + + if topic_name not in years[year]["topics"]: + years[year]["topics"][topic_name] = { + "id": topic_id, + "name": topic_name, + "count": 0, + } + + years[year]["topics"][topic_name]["count"] += 1 + + primary_topic = work.primary_topic + + if primary_topic and primary_topic.display_name: + primary_topic_name = primary_topic.display_name + primary_topic_id = primary_topic.id + + if primary_topic_name not in years[year]["primary_topics"]: + years[year]["primary_topics"][primary_topic_name] = { + "id": primary_topic_id, + "name": primary_topic_name, + "count": 0, + } + + years[year]["primary_topics"][primary_topic_name]["count"] += 1 + + elements = [] + + for year in sorted(years.keys()): + topic_items = list(years[year]["topics"].values()) + topic_items.sort(key=lambda item: item["count"], reverse=True) + + topics = [] + + for topic in topic_items[:max_topics_per_year]: + topics.append(TopicCount( + id=topic["id"], + name=topic["name"], + count=topic["count"], + )) + + primary_topic_items = list(years[year]["primary_topics"].values()) + primary_topic_items.sort(key=lambda item: item["count"], reverse=True) + + primary_topics = [] + + for topic in primary_topic_items[:max_topics_per_year]: + primary_topics.append(TopicCount( + id=topic["id"], + name=topic["name"], + count=topic["count"], + )) + + elements.append(TopicsByYear( + year=year, + publication_count=years[year]["publication_count"], + topics=topics, + primary_topics=primary_topics, + )) + + return TopicsByTime( + elements=elements, + total=len(elements), + ) + + async def _search_author_works_data( search_client: OpenAlexWorksSearchClient, author_id: str, diff --git a/service/src/main/inse/works/service.py b/service/src/main/inse/works/service.py index 3e27e61d..127b69a5 100644 --- a/service/src/main/inse/works/service.py +++ b/service/src/main/inse/works/service.py @@ -17,6 +17,8 @@ from .. import security from . import logic from inse.models.work_page import WorkPage from inse.models.works_list_response import WorksListResponse +from inse.models.topic_count import TopicCount +from inse.models.topics_by_time import TopicsByTime router = APIRouter(prefix="/api/works", tags=[Tags.WORKS]) @@ -68,3 +70,29 @@ async def get_all_author_works( principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), ): return await logic.get_all_author_works(author_id) + + +@router.get("/{author_id}/primary-topic-counts", + operation_id="getPrimaryTopicCountsByAuthor", + response_model=list[TopicCount], + summary="Returns work counts per primary topic for an author.") +async def get_primary_topic_counts( + author_id: Annotated[str, Path(description="The author id, for example A5023888391.")], + principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), +): + return await logic.get_primary_topic_counts(author_id) + + +@router.get("/{author_id}/topics-by-time", + operation_id="getTopicsByTimeByAuthor", + response_model=TopicsByTime, + summary="Returns topics grouped by publication year for an author.") +async def get_topics_by_time_by_author( + author_id: Annotated[str, Path(description="The author id, for example A5023888391.")], + max_topics_per_year: Annotated[int, Query(description="The maximum number of topics per year.", ge=1, le=20)] = 3, + principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), +): + return await logic.get_topics_by_time_by_author( + author_id, + max_topics_per_year=max_topics_per_year, + ) diff --git a/service/uv.lock b/service/uv.lock index b0828716..8564595c 100644 --- a/service/uv.lock +++ b/service/uv.lock @@ -145,6 +145,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a2/7b/b0d330852dd5953daee6b15f742f15d9f18e9c0154eb4cfcc8718f0436da/cryptography-42.0.8-cp39-abi3-win_amd64.whl", hash = "sha256:fa76fbb7596cc5839320000cdd5d0955313696d9511debab7ee7278fc8b5c84a", size = 2886038, upload-time = "2024-06-04T19:54:18.707Z" }, ] +[[package]] +name = "distro" +version = "1.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/fc/f8/98eea607f65de6527f8a2e8885fc8015d3e6f5775df186e443e0964a11c3/distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed", size = 60722, upload-time = "2023-12-24T09:54:32.31Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" }, +] + [[package]] name = "dotenv" version = "0.9.9" @@ -311,6 +320,97 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484, upload-time = "2025-10-18T21:55:41.639Z" }, ] +[[package]] +name = "jiter" +version = "0.15.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/66/b5/55f06bb281d92fb3cc86d14e1def2bd908bb77693183e7cb1f5a3c388b0c/jiter-0.15.0.tar.gz", hash = "sha256:4251acc80e2b7c9b7b8823456ea0fceeb0734dac2df7636d3c711b38476b5a76", size = 166640, upload-time = "2026-05-19T10:09:48.361Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/44/53/4f6bddbcde3c71e56d0aa1337ec95950f3d27dd4153e25aadf0feac71751/jiter-0.15.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:0e90a1c315a0226ec822d973817967f9223b7701546c8c2a7913e7ab0926294d", size = 308793, upload-time = "2026-05-19T10:07:35.25Z" }, + { url = "https://files.pythonhosted.org/packages/01/84/c01099b59a285a1ebba64ae93f62bfa036675340fd1b0045ae65890a0442/jiter-0.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8c9004af7c8d67cce7f1aae1026fb55607f4aa600710d08ede3a3ce4aeefe7e0", size = 309570, upload-time = "2026-05-19T10:07:36.919Z" }, + { url = "https://files.pythonhosted.org/packages/58/64/8fb7f9d45bb98190355454cd04dad8d8f27223d6bd52f83af07f637168a6/jiter-0.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c210f8b35dc6f30aafd4b4365ca89b9d1189f21ab49b8e68fa6322a847aef138", size = 336783, upload-time = "2026-05-19T10:07:38.694Z" }, + { url = "https://files.pythonhosted.org/packages/c3/b6/f5739011d009b3a30f6a53c5240979030ba29ae46a8c67e3a15759f7c37d/jiter-0.15.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5f30bae8bc1c2d613e28e5af3e8cceb09b742f1c8a8a5f839fb67afaffc03b61", size = 363555, upload-time = "2026-05-19T10:07:40.832Z" }, + { url = "https://files.pythonhosted.org/packages/e5/12/98a9d9f766665e8a3b6252454e17cb0c464606a28cf2fa09399b003345fa/jiter-0.15.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c60e71b6d10cfc284c9bf36bd885e8d44c46f688ce50aa91b5edd90181dea687", size = 452255, upload-time = "2026-05-19T10:07:42.62Z" }, + { url = "https://files.pythonhosted.org/packages/e8/d5/60f972840f79c5e7544fce567c56f1e4e50468f996baba3e78d823dd62a6/jiter-0.15.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0ab068bce62a45aa3e7367eceaffb5dde60b7eb853be8dece45132e3d0ff4879", size = 373559, upload-time = "2026-05-19T10:07:44.201Z" }, + { url = "https://files.pythonhosted.org/packages/ee/cf/d46ef1234ba335aabc2f013210db8e0821a22f5e644a2e9449df199ecc23/jiter-0.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa248c9eb220197d363f688818dac2fd4b2f0cd7d843ca7105d652034823427d", size = 346055, upload-time = "2026-05-19T10:07:46.005Z" }, + { url = "https://files.pythonhosted.org/packages/f0/63/4d2749d8d54d230bad9b3a6b0d00cc28c6ff6b2fdffc26a8ccf76cc5a974/jiter-0.15.0-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:2a77aadd57cac1682e4401a72724d2796d89a4ba129b1a5812aa94ee480826eb", size = 351406, upload-time = "2026-05-19T10:07:47.855Z" }, + { url = "https://files.pythonhosted.org/packages/d9/b9/9965b990035d8773328e0a8c8b457a87bf2b19f6c4126d9d99296be5d16a/jiter-0.15.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2ae901f3a55bfafdde31d289590fa25e3245735a2b1e8c7cc15871710a002871", size = 389357, upload-time = "2026-05-19T10:07:49.665Z" }, + { url = "https://files.pythonhosted.org/packages/2d/55/9ddf903deda1413e87fed792f416b7123daee5b8efbad6a202a7421c36a5/jiter-0.15.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:f0b271b462769543716f92d3a4f90527df6ef5ed05ee95ec4137f513e21e1b77", size = 517263, upload-time = "2026-05-19T10:07:51.537Z" }, + { url = "https://files.pythonhosted.org/packages/e8/76/a0c40ad064d3a20a4fde231e35d56e9a01ce82164278180e82d5daf85469/jiter-0.15.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:2fb6a5d26af81fc0f00f9360a891e05cf755e149bba391c4d563adc54812973d", size = 548646, upload-time = "2026-05-19T10:07:53.196Z" }, + { url = "https://files.pythonhosted.org/packages/23/4f/eca9b954942916ba2f453891b8593ab444cd872396fe66a3936616f236f3/jiter-0.15.0-cp312-cp312-win32.whl", hash = "sha256:c2f6bb8b5216ab9e7873bc08b5d7bef2b8abbb578a3069bf1cd14a45d71d771d", size = 206427, upload-time = "2026-05-19T10:07:55.307Z" }, + { url = "https://files.pythonhosted.org/packages/95/bf/8ead82a87495149542748e828d153fd232a512a22c83b02c4815c1a9c7d8/jiter-0.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:40b2c7e92c44a84d748d21706c68dc6ff8161d80b59c99d774721a0d2317d7c7", size = 197300, upload-time = "2026-05-19T10:07:56.651Z" }, + { url = "https://files.pythonhosted.org/packages/f4/e4/9b8a78fb2d894471bc344e37f1949bdd784bd914d031dba0ba3a40c71dd7/jiter-0.15.0-cp312-cp312-win_arm64.whl", hash = "sha256:cc0bc345cf2df9d1c00ac443f50d543c1ccfa8b0422cb85b1ab70d681c0b255b", size = 192702, upload-time = "2026-05-19T10:07:58.307Z" }, + { url = "https://files.pythonhosted.org/packages/e5/f4/f708c900ecee41b2025ef8413d5351e5649eb2125c506f6720cc69b06f5c/jiter-0.15.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:1c11465f97e2abf45a014b83b730222f8f1c5335e802c7055a67d50de6f1f4e3", size = 307829, upload-time = "2026-05-19T10:07:59.704Z" }, + { url = "https://files.pythonhosted.org/packages/86/59/db537c0949e83668c38481d426b9f2fd5ab758c4ee53a811dd0a510626a0/jiter-0.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:d1e7b1776f0797956c509e123d0952d10d293a9492dea9f288ab9570ec01d1a5", size = 308445, upload-time = "2026-05-19T10:08:01.184Z" }, + { url = "https://files.pythonhosted.org/packages/37/38/ea0e13b18c30ef951da0d47d39e7fa9edb82a93a62990ffbd7cea9b622d4/jiter-0.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:351a341c2105aa430b7047e30f1bf7975f6313b00165d3fc07be2edaf741f279", size = 336181, upload-time = "2026-05-19T10:08:02.688Z" }, + { url = "https://files.pythonhosted.org/packages/58/fc/2303901b16c4ba05865588990a420c0b4156270b44379c20931544a1d962/jiter-0.15.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4ab395feec8d249ec4044e228e98a7033f043426a265df439dc3698823f0a4e4", size = 362985, upload-time = "2026-05-19T10:08:04.394Z" }, + { url = "https://files.pythonhosted.org/packages/5b/6f/11bace093c52e7d4d26c8e606ccd7ae8c972189622469ec0d9e28161e28b/jiter-0.15.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a2a438005b6f22d0273413484d6094d7c2c5d10ec1b3a3bf128e0d1d3ba53258", size = 453292, upload-time = "2026-05-19T10:08:05.967Z" }, + { url = "https://files.pythonhosted.org/packages/22/db/987f2f086ca4d7a6582eb4ccd513f9b26b42d9e4243a087609a3137a8fc7/jiter-0.15.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f18f85e4218d1b40f000f42a92239a7a61a902cd42c65e6c360dbd17dcb20894", size = 373501, upload-time = "2026-05-19T10:08:07.857Z" }, + { url = "https://files.pythonhosted.org/packages/8f/7c/89fbcabb2739b7a5b8dc959a1b6c5761f6484f5fed3486854b3c789bb1de/jiter-0.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d1aa62e277fc1cbd80e6deacae6f4d983b41b3d7728e0645c5d741a6149bba45", size = 344683, upload-time = "2026-05-19T10:08:09.431Z" }, + { url = "https://files.pythonhosted.org/packages/30/6f/6cca7692e7dddfec6d8d76c54dc97f2af2a41df4ac0674b999df1f09a5f3/jiter-0.15.0-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:6550fa135c7deb8ead6af49ed7ff648532ea8334a1447fe34a36315ef79c5c29", size = 350892, upload-time = "2026-05-19T10:08:11.352Z" }, + { url = "https://files.pythonhosted.org/packages/39/14/0338d6190cb8e6d22e677ab1d4eabd4117f67cca70c54cd04b82ff64e068/jiter-0.15.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:066f8f33f18b2419cd8213b2436fa7fbc9c499f315971cfa3ce1f9820c001b1b", size = 388723, upload-time = "2026-05-19T10:08:12.912Z" }, + { url = "https://files.pythonhosted.org/packages/90/31/cc19f4a1bdb6afb09ce6a2f2615aa8d44d994eba0d8e6105ed1af920e736/jiter-0.15.0-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:75e8a04e91432dde9f1838373cf93d23726c79d3e908d319acf0e796f85592e7", size = 516648, upload-time = "2026-05-19T10:08:14.808Z" }, + { url = "https://files.pythonhosted.org/packages/49/9f/833c541512cd091b63c10c0381973dfe11bc7a503a818c16384417e0c81e/jiter-0.15.0-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:a97261f1fccb8e50ecd2890a96e46efdc3f57c80a197324c6777827231eca712", size = 547382, upload-time = "2026-05-19T10:08:16.927Z" }, + { url = "https://files.pythonhosted.org/packages/d2/11/e7b70e91f90bc4477e8eee9e8a5f7cf3cb41b4525d6394dc98a714eb8f7f/jiter-0.15.0-cp313-cp313-win32.whl", hash = "sha256:c77496cb10bd7549690fbbab3e5ec05857b83e49276f4a9423a766ddd2afcd4c", size = 205845, upload-time = "2026-05-19T10:08:18.401Z" }, + { url = "https://files.pythonhosted.org/packages/4b/23/5c20d9ad6f02c493e4023e5d2d09e1c1f15fe2753c9102c544aff068a88e/jiter-0.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b15741f501469009ae0ae90b7147958a664a7dede40aa7ff174a8a4645f546d0", size = 196842, upload-time = "2026-05-19T10:08:20.131Z" }, + { url = "https://files.pythonhosted.org/packages/6b/11/1eb400ef248e8c925fd883fbe325daf5e42cd1b0d308539dd332bd4f7ffc/jiter-0.15.0-cp313-cp313-win_arm64.whl", hash = "sha256:5d6a60072b44c3c2b797a7ddcbcbbf2b34ea3cfd4721580fbfd2a09d9d9b84ba", size = 192212, upload-time = "2026-05-19T10:08:21.807Z" }, + { url = "https://files.pythonhosted.org/packages/8a/60/2fd8d7c79da8acf9b7b277c7616847773779356b92acfc9bb158452174da/jiter-0.15.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:ef1fd24d9413f6209e00d3d5a453e67acfe004a25cc6c8e8484faed4311ab9e8", size = 315065, upload-time = "2026-05-19T10:08:23.218Z" }, + { url = "https://files.pythonhosted.org/packages/46/f4/008fb7d65e8ac2abf00811651a661e025c4ba80bbc6f378450384ddd3aed/jiter-0.15.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:144f8e72cb53dab146347b91cceac01f5481237f2b93b4a339a1ee8f8878b67c", size = 339444, upload-time = "2026-05-19T10:08:24.701Z" }, + { url = "https://files.pythonhosted.org/packages/00/55/90b0c7b9c6896c0f2a591dd36d36b71d22e09674bfef178fa03ba3f81499/jiter-0.15.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:553fcac2ef2cb990877f9fc0833b8b629a3e6a5670b6b5fd58219b41a653ddc4", size = 347779, upload-time = "2026-05-19T10:08:26.408Z" }, + { url = "https://files.pythonhosted.org/packages/51/6b/69666cec5000fd57734c118437394516c749ae8dbeea9fb66d6fef9c4775/jiter-0.15.0-cp313-cp313t-win_amd64.whl", hash = "sha256:774f93f65031856bf14ad9f59bdcab8b8cad501e5ceabd51ba3525f76937a25b", size = 200395, upload-time = "2026-05-19T10:08:28.055Z" }, + { url = "https://files.pythonhosted.org/packages/39/04/a6aa62cd27e8149b0d28df5561f10f6cceaf7935a9ccf3f1c5a05f9a0cd8/jiter-0.15.0-cp313-cp313t-win_arm64.whl", hash = "sha256:f1e1754960f38ec40613a07e5e372df67acb3b890fb383b6fb3de3e49ddbf3c7", size = 190516, upload-time = "2026-05-19T10:08:29.35Z" }, + { url = "https://files.pythonhosted.org/packages/eb/d2/079f350ebf7859d081de30aa890f9e3be68516f754f3ba32366ffff4dcee/jiter-0.15.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:ac0d9ddea4350974be7a221fc25895f251a8fee748c889bdced2141c0fec1a49", size = 308884, upload-time = "2026-05-19T10:08:31.667Z" }, + { url = "https://files.pythonhosted.org/packages/04/4e/a2c30a7f69b48c03b20935d647479106fe932f6e63f75faf53937197e05d/jiter-0.15.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:01a8222cf05ab1128e239421156c207949808acaaea2bdfd33130ae666786e86", size = 310028, upload-time = "2026-05-19T10:08:33.304Z" }, + { url = "https://files.pythonhosted.org/packages/40/90/2e7cdfd3cf8ca967be38c48f5cf474d79f089efaf559a40f15984a77ae69/jiter-0.15.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:182226cbc930c9fab81bc2e41a4da672f89539906dadb05e75670ac07b94f71f", size = 337485, upload-time = "2026-05-19T10:08:35.259Z" }, + { url = "https://files.pythonhosted.org/packages/9b/11/15a1aa28b120b8ee5b4f1fb894c125046225f09847738bd64233d3b84883/jiter-0.15.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:71683c38c825452999b5717fcae07ea708e8c93003e808be4319c1b02e3d176e", size = 364223, upload-time = "2026-05-19T10:08:36.694Z" }, + { url = "https://files.pythonhosted.org/packages/b7/25/f442e8af5f3d0dcf47b39e83a0efd9ee45ea946aa6d04625dc3181eae3b6/jiter-0.15.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:30f2218e6a9e5c18bc10fe6d41ac189c442c88eacf11bad9f28ef95a9bef00e6", size = 456387, upload-time = "2026-05-19T10:08:38.143Z" }, + { url = "https://files.pythonhosted.org/packages/da/f4/37f2d2c9f64f49af7da652ed7532bb5a2372e588e6927c3fdd76f911db65/jiter-0.15.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5157de9f76eb4bc5ea74a1219366a25f945ad305641d74e04f59c54087091aa9", size = 374461, upload-time = "2026-05-19T10:08:39.869Z" }, + { url = "https://files.pythonhosted.org/packages/60/28/edcfbbbf0cb15436f36664a8908a0df47ab9006298d4cd937dc08ea932d6/jiter-0.15.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:90c5db5527c221249a876160663ab891ace358c17f7b9c93ec1478b7f0550e5c", size = 345924, upload-time = "2026-05-19T10:08:41.668Z" }, + { url = "https://files.pythonhosted.org/packages/47/13/89fba6398dab7f202b7278c4b4aac122399d2c0183971c4a57a3b7088df5/jiter-0.15.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:3e4540b8e74e4268811ac05db226a6a128ff572e7e0ce3f1163b693cadb184cd", size = 352283, upload-time = "2026-05-19T10:08:43.091Z" }, + { url = "https://files.pythonhosted.org/packages/1b/da/0f6af8cef2c565a1ab44d970f268c43ccaa72707386ea6388e6fe2b6cd26/jiter-0.15.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:62ebd14e47e9aed9df4472afcb2663668ce4d74891cd54f86bf6e44029d6dc89", size = 389985, upload-time = "2026-05-19T10:08:44.915Z" }, + { url = "https://files.pythonhosted.org/packages/a1/ec/b9cb7d6d29e24ee14910266157d2a279d7a8f60ee0df7fa840882976ba64/jiter-0.15.0-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0be6f5ad41a809f303f416d17cec92a7a725902fb9b4f3de3d19362ac0ef8554", size = 517695, upload-time = "2026-05-19T10:08:46.486Z" }, + { url = "https://files.pythonhosted.org/packages/64/5e/6d1bda880723aae0ad86b4b763f044362448efe31e3e819635d41cb03451/jiter-0.15.0-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:813dfbb17d65328bf86e5f0905dd277ba2265d3ca20556e86c0c7035b7182e5a", size = 548868, upload-time = "2026-05-19T10:08:48.026Z" }, + { url = "https://files.pythonhosted.org/packages/0c/72/7de501cf38dcacaf35098796f3a50e0f2e338baba18a58946c618544b809/jiter-0.15.0-cp314-cp314-win32.whl", hash = "sha256:50e51156192722a9c58db112837d3f8ef96fb3c5ecc14e95f409134b08b158ec", size = 206380, upload-time = "2026-05-19T10:08:49.738Z" }, + { url = "https://files.pythonhosted.org/packages/1e/a9/e19addf4b0c1bdce52c6da12351e6bc42c340c45e7c09e2158e46d293ccc/jiter-0.15.0-cp314-cp314-win_amd64.whl", hash = "sha256:30ce1a5d16b5641dc935d50ef775af6a0871e3d14ab05d6fc54dff371b78e558", size = 197687, upload-time = "2026-05-19T10:08:51.088Z" }, + { url = "https://files.pythonhosted.org/packages/f2/c9/776b1db01db25fc6c1d58d1979a37b0a9fe787e5f5b1d062d2eaacb77923/jiter-0.15.0-cp314-cp314-win_arm64.whl", hash = "sha256:510c8b3c17a0ed9ac69850c0438dada3c9b82d9c4d589fcb62002a5a9cf3a866", size = 192571, upload-time = "2026-05-19T10:08:52.451Z" }, + { url = "https://files.pythonhosted.org/packages/a0/f6/45bb4670bacf300fd2c7abadbfb3af376e5f1b6ae75fd9bc069891d15870/jiter-0.15.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7553333dd0930c104a5a0db8df72bf7219fe663d731383b576bb6ed6351c984d", size = 317151, upload-time = "2026-05-19T10:08:53.867Z" }, + { url = "https://files.pythonhosted.org/packages/d7/68/ed635ad5acd7b73e454283083bbb7c8205ad10e88b0d9d7d793b09fe8226/jiter-0.15.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2143ab06181d2b029eedcb6af3cebe95f11bbac62441781860f98ee9330a6a6", size = 341243, upload-time = "2026-05-19T10:08:55.383Z" }, + { url = "https://files.pythonhosted.org/packages/5d/db/3ff4176b817b8ea33879e71e13d8bc2b0d481a7ed3fe9e080f333d415c16/jiter-0.15.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6eac374c5c975709b69c10f09afd199df74150172156ad10c8d4fd785b7da995", size = 363629, upload-time = "2026-05-19T10:08:56.928Z" }, + { url = "https://files.pythonhosted.org/packages/ab/24/5f8270e0ba9c883582f96f722f8a0b58015c7ce1f8c6d4571cf394e99b6b/jiter-0.15.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b3b3b775e33d3bfaec9899edc526ae97b0da0bf9d071a46124ba419149a414f8", size = 456198, upload-time = "2026-05-19T10:08:58.618Z" }, + { url = "https://files.pythonhosted.org/packages/45/5b/76fc02b0b5c54c3d18c60653156e2f76fde1816f9b4722db68d6ee2c897e/jiter-0.15.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eda3071db3346334beae1360b46da4606da57bf3528c167b3c38533afaf9f2c5", size = 373710, upload-time = "2026-05-19T10:09:00.151Z" }, + { url = "https://files.pythonhosted.org/packages/c4/52/4310821b0ea9277994d3e1f49fc6a4b34e4800caebacb2c0af81da59a454/jiter-0.15.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c6694a173ecabc12eb60efbc0b474464ead1951ff65cd8b1e72100715c64512b", size = 349901, upload-time = "2026-05-19T10:09:01.621Z" }, + { url = "https://files.pythonhosted.org/packages/93/fe/67648c35b3594fba8854ac64cc8a826d8bcd18324bbdb53d77697c60b6ef/jiter-0.15.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:a254e10b593624d230c365b6d616b22ca0ad65e63a16e6631c2b3466022e6ba8", size = 352438, upload-time = "2026-05-19T10:09:03.216Z" }, + { url = "https://files.pythonhosted.org/packages/cb/28/0a1879d07ad6b3e025a2750027363452ced93c2d16d1c9d4b153ffd51c91/jiter-0.15.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d8d2955167274e15d79a7a020afdd9b39c990eb80b2d89fca695d92dcfdd38ec", size = 388152, upload-time = "2026-05-19T10:09:04.741Z" }, + { url = "https://files.pythonhosted.org/packages/c1/78/46c6f6b56ba85c90021f4afd72ed42f691f8f84daacb5fe27277070e3858/jiter-0.15.0-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:acf4ee4d1fc55917239fe72972fb292dd773055d05eb040d36f4326e02cc2c0e", size = 517707, upload-time = "2026-05-19T10:09:06.231Z" }, + { url = "https://files.pythonhosted.org/packages/ca/cb/720662d4c88fcad606e826fef5424365527ba43ce4868a479aed8f8c507e/jiter-0.15.0-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:e7196e56f1cd69af1dbb07dff02dcfb260a50b45a82d409d92a06fedb32473b5", size = 548241, upload-time = "2026-05-19T10:09:08.093Z" }, + { url = "https://files.pythonhosted.org/packages/60/e3/935b8034fd143f21125c87d51404a9e0e1449186a494405721ff5d1d695e/jiter-0.15.0-cp314-cp314t-win32.whl", hash = "sha256:7f6163c0f10b055245f814dcc59f4818da60dfe72f3e72ab89fc24b6bd5e9c52", size = 207950, upload-time = "2026-05-19T10:09:09.616Z" }, + { url = "https://files.pythonhosted.org/packages/93/59/984fd9ece895953dad3e0880a650e766f5a2da2c5514f0eafdaaabbeb5f9/jiter-0.15.0-cp314-cp314t-win_amd64.whl", hash = "sha256:980c256edb05b78a111b99c4de3b1d32e31634b867fd1fc2cf726e7b7bba9854", size = 200055, upload-time = "2026-05-19T10:09:11.367Z" }, + { url = "https://files.pythonhosted.org/packages/0e/a4/cf8d779feb133a27a2e3bc833bccb9e13aa332cdf820497ebf72c10ce8c3/jiter-0.15.0-cp314-cp314t-win_arm64.whl", hash = "sha256:66b1880df2d01e206e8339769d1c7c1753bcb653efd6289e203f6f24ebada0c0", size = 191244, upload-time = "2026-05-19T10:09:12.74Z" }, + { url = "https://files.pythonhosted.org/packages/73/38/505941b2b092fd5bbbd60a52a880db1173f1690ae6751bed3af1c9ddcb4e/jiter-0.15.0-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:631f13a3d04e97d4e083993b10f4b99530e3a10d953e2eb5e196b7dc7f812ce0", size = 303769, upload-time = "2026-05-19T10:09:42.203Z" }, + { url = "https://files.pythonhosted.org/packages/e7/95/a06692b29e77473f286e1ec1f426d3ca44d7b5843be8ad21d7a5f3fcdcc0/jiter-0.15.0-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:b6c0ffae686c39bf3737be60793783267628783ea42545632c10b291105aee45", size = 305128, upload-time = "2026-05-19T10:09:43.657Z" }, + { url = "https://files.pythonhosted.org/packages/23/85/7270d7ad41d6061a25b950c6bf91d638bd9aacb113200a8c8d57a055fd67/jiter-0.15.0-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d54fb5b31dea401a41af3f8a7d2512e9b6a6a005491e6166c7e4ffab9639a9c", size = 340459, upload-time = "2026-05-19T10:09:45.452Z" }, + { url = "https://files.pythonhosted.org/packages/c8/8d/302cb2057b7513327b4d575cff6b1d066ee6431a5357fc3f8867cd684406/jiter-0.15.0-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:54d5d6090cdc1b7c9e780dfb04949a990adb1e301a2fc0bbcee7de4638d33f9a", size = 344469, upload-time = "2026-05-19T10:09:46.864Z" }, +] + +[[package]] +name = "openai" +version = "2.41.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "anyio" }, + { name = "distro" }, + { name = "httpx" }, + { name = "jiter" }, + { name = "pydantic" }, + { name = "sniffio" }, + { name = "tqdm" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/3c/a6/5815fe2e2aca74b36c650d1bd43b69827cee568073d0d2d9b6fc5aaac80c/openai-2.41.0.tar.gz", hash = "sha256:db5c362acd6604b84f076abbefa66826ea4b46ecba2954ed866e6a149a1352c0", size = 783525, upload-time = "2026-06-03T22:39:40.719Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/be/51/d82bb424e8aa372190c5233253a2ceb399a778747d18b42cff487411e663/openai-2.41.0-py3-none-any.whl", hash = "sha256:20cc7952e8501c7e5773dd2ef7be437bae9cb549044902e1041a83a54516e375", size = 1353378, upload-time = "2026-06-03T22:39:38.964Z" }, +] + [[package]] name = "packaging" version = "26.2" @@ -499,6 +599,7 @@ dependencies = [ { name = "elasticsearch" }, { name = "fastapi" }, { name = "httpx" }, + { name = "openai" }, { name = "pydantic" }, { name = "pydantic-settings" }, { name = "pyjwt" }, @@ -516,6 +617,7 @@ requires-dist = [ { name = "elasticsearch", specifier = "~=9.4.0" }, { name = "fastapi", specifier = "~=0.115.0" }, { name = "httpx", specifier = "~=0.27.0" }, + { name = "openai", specifier = ">=2.41.0" }, { name = "pydantic", specifier = "~=2.7.1" }, { name = "pydantic-settings", specifier = "~=2.2.1" }, { name = "pyjwt", specifier = "~=2.8.0" }, @@ -597,6 +699,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8b/0c/9d30a4ebeb6db2b25a841afbb80f6ef9a854fc3b41be131d249a977b4959/starlette-0.46.2-py3-none-any.whl", hash = "sha256:595633ce89f8ffa71a015caed34a5b2dc1c0cdb3f0f1fbd1e69339cf2abeec35", size = 72037, upload-time = "2025-04-13T13:56:16.21Z" }, ] +[[package]] +name = "tqdm" +version = "4.67.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/09/a9/6ba95a270c6f1fbcd8dac228323f2777d886cb206987444e4bce66338dd4/tqdm-4.67.3.tar.gz", hash = "sha256:7d825f03f89244ef73f1d4ce193cb1774a8179fd96f31d7e1dcde62092b960bb", size = 169598, upload-time = "2026-02-03T17:35:53.048Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/16/e1/3079a9ff9b8e11b846c6ac5c8b5bfb7ff225eee721825310c91b3b50304f/tqdm-4.67.3-py3-none-any.whl", hash = "sha256:ee1e4c0e59148062281c49d80b25b67771a127c85fc9676d3be5f243206826bf", size = 78374, upload-time = "2026-02-03T17:35:50.982Z" }, +] + [[package]] name = "typing-extensions" version = "4.15.0" diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index 90cfa5e3..13d8ad8b 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -3,6 +3,8 @@ README.md api.base.service.ts api.module.ts api/api.ts +api/funding.service.ts +api/funding.serviceInterface.ts api/inse-account-service.service.ts api/inse-account-service.serviceInterface.ts api/inse-service.service.ts @@ -28,6 +30,7 @@ model/author-affiliations-inner.ts model/author-counts-by-year-inner.ts model/author-ids.ts model/author-parsed-longest-name.ts +model/author-position-count.ts model/author-summary-stats.ts model/author.ts model/authors-list-response.ts @@ -38,12 +41,16 @@ model/collaboration-network-node-type.ts model/collaboration-network-node.ts model/collaboration-network.ts model/cost-usd.ts +model/custom-author.ts +model/custom-authors-list-response.ts model/dehydrated-author.ts model/dehydrated-funder.ts model/dehydrated-institution.ts model/dehydrated-source.ts model/filter-information.ts model/filter-properties.ts +model/funder-by-author.ts +model/funders-by-author-response.ts model/fwci.ts model/group-by-result.ts model/http-validation-error.ts @@ -58,7 +65,12 @@ model/model2-yr-mean-citedness.ts model/models.ts model/open-access.ts model/person-bio.ts +model/publication-ids-by-author-position.ts +model/publications-by-author-response.ts model/score.ts +model/topic-count.ts +model/topics-by-time.ts +model/topics-by-year.ts model/validation-error-loc-inner.ts model/validation-error.ts model/value.ts diff --git a/webapp/src/app/api/api/api.ts b/webapp/src/app/api/api/api.ts index e7502847..27d4e254 100644 --- a/webapp/src/app/api/api/api.ts +++ b/webapp/src/app/api/api/api.ts @@ -1,3 +1,6 @@ +export * from './funding.service'; +import { FundingService } from './funding.service'; +export * from './funding.serviceInterface'; export * from './inse-account-service.service'; import { INSEAccountServiceService } from './inse-account-service.service'; export * from './inse-account-service.serviceInterface'; @@ -19,4 +22,4 @@ export * from './topics.serviceInterface'; export * from './works.service'; import { WorksService } from './works.service'; export * from './works.serviceInterface'; -export const APIS = [INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, TopicsService, WorksService]; +export const APIS = [FundingService, INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, TopicsService, WorksService]; diff --git a/webapp/src/app/api/api/funding.service.ts b/webapp/src/app/api/api/funding.service.ts new file mode 100644 index 00000000..17619786 --- /dev/null +++ b/webapp/src/app/api/api/funding.service.ts @@ -0,0 +1,164 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { FundersByAuthorResponse } from '../model/funders-by-author-response'; +// @ts-ignore +import { HTTPValidationError } from '../model/http-validation-error'; +// @ts-ignore +import { PublicationsByAuthorResponse } from '../model/publications-by-author-response'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; +import { + FundingServiceInterface +} from './funding.serviceInterface'; + + + +@Injectable({ + providedIn: 'root' +}) +export class FundingService extends BaseService implements FundingServiceInterface { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Get funding organizations by author. + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getFundersByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/funders`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Get funded publications by author. + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPublicationsByAuthor.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/publications`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + +} diff --git a/webapp/src/app/api/api/funding.serviceInterface.ts b/webapp/src/app/api/api/funding.serviceInterface.ts new file mode 100644 index 00000000..86b8b171 --- /dev/null +++ b/webapp/src/app/api/api/funding.serviceInterface.ts @@ -0,0 +1,45 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { HttpHeaders } from '@angular/common/http'; + +import { Observable } from 'rxjs'; + +import { FundersByAuthorResponse } from '../model/models'; +import { HTTPValidationError } from '../model/models'; +import { PublicationsByAuthorResponse } from '../model/models'; + + +import { Configuration } from '../configuration'; + + + +export interface FundingServiceInterface { + defaultHeaders: HttpHeaders; + configuration: Configuration; + + /** + * Get funding organizations by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + */ + getFundersByAuthor(authorId: string, extraHttpRequestParams?: any): Observable; + + /** + * Get funded publications by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + */ + getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, extraHttpRequestParams?: any): Observable; + +} diff --git a/webapp/src/app/api/api/iNSEAccountService.service.ts b/webapp/src/app/api/api/iNSEAccountService.service.ts deleted file mode 100644 index 7b43eaa5..00000000 --- a/webapp/src/app/api/api/iNSEAccountService.service.ts +++ /dev/null @@ -1,213 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { AccessGrant } from '../model/accessGrant'; -// @ts-ignore -import { HTTPValidationError } from '../model/hTTPValidationError'; -// @ts-ignore -import { IdentityGrant } from '../model/identityGrant'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { BaseService } from '../api.base.service'; - - - -@Injectable({ - providedIn: 'root' -}) -export class INSEAccountServiceService extends BaseService { - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { - super(basePath, configuration); - } - - /** - * Get Access Grant - * @endpoint post /inse-account/auth/access - * @param secret - * @param account - * @param organization - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (secret === null || secret === undefined) { - throw new Error('Required parameter secret was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.'); - } - if (account === null || account === undefined) { - throw new Error('Required parameter account was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.'); - } - if (organization === null || organization === undefined) { - throw new Error('Required parameter organization was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.'); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/x-www-form-urlencoded' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any; }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({encoder: this.encoder}); - } - - if (secret !== undefined) { - localVarFormParams = localVarFormParams.append('secret', secret) as any || localVarFormParams; - } - if (account !== undefined) { - localVarFormParams = localVarFormParams.append('account', account) as any || localVarFormParams; - } - if (organization !== undefined) { - localVarFormParams = localVarFormParams.append('organization', organization) as any || localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/inse-account/auth/access`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * Get Identity Grant - * @endpoint post /inse-account/auth/id - * @param username - * @param password - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (username === null || username === undefined) { - throw new Error('Required parameter username was null or undefined when calling getIdentityGrantInseAccountAuthIdPost.'); - } - if (password === null || password === undefined) { - throw new Error('Required parameter password was null or undefined when calling getIdentityGrantInseAccountAuthIdPost.'); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/x-www-form-urlencoded' - ]; - - const canConsumeForm = this.canConsumeForm(consumes); - - let localVarFormParams: { append(param: string, value: any): any; }; - let localVarUseForm = false; - let localVarConvertFormParamsToString = false; - if (localVarUseForm) { - localVarFormParams = new FormData(); - } else { - localVarFormParams = new HttpParams({encoder: this.encoder}); - } - - if (username !== undefined) { - localVarFormParams = localVarFormParams.append('username', username) as any || localVarFormParams; - } - if (password !== undefined) { - localVarFormParams = localVarFormParams.append('password', password) as any || localVarFormParams; - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/inse-account/auth/id`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - -} diff --git a/webapp/src/app/api/api/iNSEService.service.ts b/webapp/src/app/api/api/iNSEService.service.ts deleted file mode 100644 index 0fa2f5f0..00000000 --- a/webapp/src/app/api/api/iNSEService.service.ts +++ /dev/null @@ -1,813 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { AuthorsListResponse } from '../model/authorsListResponse'; -// @ts-ignore -import { HTTPValidationError } from '../model/hTTPValidationError'; -// @ts-ignore -import { Item } from '../model/item'; -// @ts-ignore -import { ItemCreate } from '../model/itemCreate'; -// @ts-ignore -import { ItemPage } from '../model/itemPage'; -// @ts-ignore -import { PersonBio } from '../model/personBio'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { BaseService } from '../api.base.service'; - - - -@Injectable({ - providedIn: 'root' -}) -export class INSEServiceService extends BaseService { - - constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { - super(basePath, configuration); - } - - /** - * Adds a new item. - * @endpoint post /api/inse-service/items - * @param itemCreate - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public addItem(itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (itemCreate === null || itemCreate === undefined) { - throw new Error('Required parameter itemCreate was null or undefined when calling addItem.'); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: itemCreate, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * Builds the topic hierarchy cache. - * @endpoint get /api/inse-service/topics/cache - * @param pageSize Page size for each search page. - * @param saveJson Persist cache JSON to data folder. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - pageSize, 'page_size'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - saveJson, 'save_json'); - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/cache`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * Counts topic hierarchy occurrences from cache. - * @endpoint get /api/inse-service/topics/count - * @param topic Topic names (repeat parameter). - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public countTopicHierarchy(topic: Array, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public countTopicHierarchy(topic: Array, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public countTopicHierarchy(topic: Array, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public countTopicHierarchy(topic: Array, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (topic === null || topic === undefined) { - throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.'); - } - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - if (topic) { - topic.forEach((element) => { - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - element, 'topic'); - }) - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/topics/count`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * Deletes the item with the id. - * @endpoint delete /api/inse-service/items/{id} - * @param id The item id. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public deleteItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling deleteItem.'); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('delete', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * 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 - } - ); - } - - /** - * Returns the item with the id. - * @endpoint get /api/inse-service/items/{id} - * @param id The item id. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling getItem.'); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * Returns a page of items. - * @endpoint get /api/inse-service/items - * @param pageOffset The page offset. - * @param pageSize The page size. - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public getItems(pageOffset?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public getItems(pageOffset?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - - let localVarQueryParameters = new HttpParams({encoder: this.encoder}); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - pageOffset, 'pageOffset'); - localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, - pageSize, 'pageSize'); - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('get', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - params: localVarQueryParameters, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - - /** - * 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.'); - } - if (include === null || include === undefined) { - throw new Error('Required parameter include 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 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 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 observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByInstitution(institutionName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - 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'); - - 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 observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public searchPersonsByName(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsByName(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByName(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsByName(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - 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'); - - 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 - } - ); - } - - /** - * Updates the item with the id. - * @endpoint put /api/inse-service/items/{id} - * @param id The item id. - * @param itemCreate - * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. - * @param reportProgress flag to report request and response progress. - */ - public updateItem(id: number, itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (id === null || id === undefined) { - throw new Error('Required parameter id was null or undefined when calling updateItem.'); - } - if (itemCreate === null || itemCreate === undefined) { - throw new Error('Required parameter itemCreate was null or undefined when calling updateItem.'); - } - - let localVarHeaders = this.defaultHeaders; - - // authentication (bearer) required - localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('put', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: itemCreate, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - -} diff --git a/webapp/src/app/api/api/inse-service.service.ts b/webapp/src/app/api/api/inse-service.service.ts index 4e3d5637..dbca3805 100644 --- a/webapp/src/app/api/api/inse-service.service.ts +++ b/webapp/src/app/api/api/inse-service.service.ts @@ -16,6 +16,10 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; +// @ts-ignore +import { AuthorsListResponse } from '../model/authors-list-response'; +// @ts-ignore +import { FundersByAuthorResponse } from '../model/funders-by-author-response'; // @ts-ignore import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore @@ -24,6 +28,10 @@ import { Item } from '../model/item'; import { ItemCreate } from '../model/item-create'; // @ts-ignore import { ItemPage } from '../model/item-page'; +// @ts-ignore +import { PersonBio } from '../model/person-bio'; +// @ts-ignore +import { PublicationsByAuthorResponse } from '../model/publications-by-author-response'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -295,6 +303,127 @@ export class INSEServiceService extends BaseService implements INSEServiceServic } /** +<<<<<<< HEAD +======= + * 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 + } + ); + } + + /** + * Get funding organizations by author. + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getFundersByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/funders`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** +>>>>>>> 33f767dea36fe8a44c8249dbb74537d47c186c5d * Returns the item with the id. * @endpoint get /api/inse-service/items/{id} * @param id The item id. @@ -416,6 +545,332 @@ export class INSEServiceService extends BaseService implements INSEServiceServic } /** +<<<<<<< HEAD +======= + * 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.'); + } + if (include === null || include === undefined) { + throw new Error('Required parameter include 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 + } + ); + } + + /** + * Get funded publications by author. + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPublicationsByAuthor.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + page, 'page'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + pageSize, 'page_size'); + + let localVarHeaders = this.defaultHeaders; + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/publications`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Searches for persons by ID or name. + * @endpoint get /api/inse-service/persons/search + * @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 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 observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByInstitution(institutionName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + 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'); + + 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 observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public searchPersonsByName(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsByName(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsByName(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + 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'); + + 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 + } + ); + } + + /** +>>>>>>> 33f767dea36fe8a44c8249dbb74537d47c186c5d * Updates the item with the id. * @endpoint put /api/inse-service/items/{id} * @param id The item id. diff --git a/webapp/src/app/api/api/inse-service.serviceInterface.ts b/webapp/src/app/api/api/inse-service.serviceInterface.ts index 6739063e..979f6465 100644 --- a/webapp/src/app/api/api/inse-service.serviceInterface.ts +++ b/webapp/src/app/api/api/inse-service.serviceInterface.ts @@ -11,10 +11,14 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; +import { AuthorsListResponse } from '../model/models'; // +import { FundersByAuthorResponse } from '../model/models'; // import { HTTPValidationError } from '../model/models'; import { Item } from '../model/models'; import { ItemCreate } from '../model/models'; import { ItemPage } from '../model/models'; +import { PersonBio } from '../model/models'; // +import { PublicationsByAuthorResponse } from '../model/models'; // import { Configuration } from '../configuration'; @@ -59,6 +63,26 @@ export interface INSEServiceServiceInterface { deleteItem(id: number, extraHttpRequestParams?: any): Observable; /** +<<<<<<< HEAD +======= + * Generates a bio for a person by author ID. + * + * @endpoint get /api/inse-service/persons/bio + * @param authorId OpenAlex author ID (e.g., A5093075883) + * @param include Comma-separated list to include tags + */ + generatePersonBio(authorId: string, include?: string, extraHttpRequestParams?: any): Observable; + + /** + * Get funding organizations by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/funders + * @param authorId + */ + getFundersByAuthor(authorId: string, extraHttpRequestParams?: any): Observable; + + /** +>>>>>>> 33f767dea36fe8a44c8249dbb74537d47c186c5d * Returns the item with the id. * * @endpoint get /api/inse-service/items/{id} @@ -76,6 +100,56 @@ export interface INSEServiceServiceInterface { getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable; /** +<<<<<<< HEAD +======= + * Searches for person by ID. + * + * @endpoint get /api/inse-service/person/{id} + * @param id OpenAlex author ID + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + */ + getPersonByID(id: string, include: string, extraHttpRequestParams?: any): Observable; + + /** + * Get funded publications by author. + * + * @endpoint get /api/inse-service/authors/{author_id}/publications + * @param authorId + * @param page + * @param pageSize + */ + getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, extraHttpRequestParams?: any): Observable; + + /** + * Searches for persons by ID or name. + * + * @endpoint get /api/inse-service/persons/search + * @param authorId OpenAlex author ID (e.g., A5093075883) + * @param query Search query (e.g., Arman AND Arzani) + * @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost + */ + searchPersons(authorId?: string, query?: string, include?: string, extraHttpRequestParams?: any): Observable; + + /** + * Searches for persons by institution name. + * + * @endpoint get /api/inse-service/persons/searchByInstitution + * @param institutionName Institution name (e.g., MIT, Oxford University) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + */ + searchPersonsByInstitution(institutionName: string, include: string, extraHttpRequestParams?: any): Observable; + + /** + * Searches for person by name. + * + * @endpoint get /api/inse-service/persons/searchByName + * @param authorName Authors name (e.g., Arman Arzani) + * @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ... + */ + searchPersonsByName(authorName: string, include: string, extraHttpRequestParams?: any): Observable; + + /** +>>>>>>> 33f767dea36fe8a44c8249dbb74537d47c186c5d * Updates the item with the id. * * @endpoint put /api/inse-service/items/{id} diff --git a/webapp/src/app/api/api/personNetwork.service.ts b/webapp/src/app/api/api/personNetwork.service.ts deleted file mode 100644 index b1183ff6..00000000 --- a/webapp/src/app/api/api/personNetwork.service.ts +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -/* tslint:disable:no-unused-variable member-ordering */ - -import { Inject, Injectable, Optional } from '@angular/core'; -import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext - } from '@angular/common/http'; -import { CustomHttpParameterCodec } from '../encoder'; -import { Observable } from 'rxjs'; - -// @ts-ignore -import { CollaborationNetwork } from '../model/collaborationNetwork'; -// @ts-ignore -import { FilterProperties } from '../model/filterProperties'; -// @ts-ignore -import { HTTPValidationError } from '../model/hTTPValidationError'; - -// @ts-ignore -import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; -import { Configuration } from '../configuration'; -import { BaseService } from '../api.base.service'; - - - -@Injectable({ - 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.'); - } - - let localVarHeaders = this.defaultHeaders; - - const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ - 'application/json' - ]); - if (localVarHttpHeaderAcceptSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); - } - - const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); - - const localVarTransferCache: boolean = options?.transferCache ?? true; - - - // to determine the Content-Type header - const consumes: string[] = [ - 'application/json' - ]; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected); - } - - let responseType_: 'text' | 'json' | 'blob' = 'json'; - if (localVarHttpHeaderAcceptSelected) { - if (localVarHttpHeaderAcceptSelected.startsWith('text')) { - responseType_ = 'text'; - } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { - responseType_ = 'json'; - } else { - responseType_ = 'blob'; - } - } - - let localVarPath = `/api/person/network/${this.configuration.encodeParam({name: "rawUserId", value: rawUserId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`; - const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, - { - context: localVarHttpContext, - body: filterProperties, - responseType: responseType_, - ...(withCredentials ? { withCredentials } : {}), - headers: localVarHeaders, - observe: observe, - ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), - reportProgress: reportProgress - } - ); - } - -} diff --git a/webapp/src/app/api/api/persons-search.service.ts b/webapp/src/app/api/api/persons-search.service.ts new file mode 100644 index 00000000..a92a1b26 --- /dev/null +++ b/webapp/src/app/api/api/persons-search.service.ts @@ -0,0 +1,122 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +/* tslint:disable:no-unused-variable member-ordering */ + +import { Inject, Injectable, Optional } from '@angular/core'; +import { HttpClient, HttpHeaders, HttpParams, + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + } from '@angular/common/http'; +import { CustomHttpParameterCodec } from '../encoder'; +import { Observable } from 'rxjs'; + +// @ts-ignore +import { CustomAuthorsListResponse } from '../model/custom-authors-list-response'; +// @ts-ignore +import { HTTPValidationError } from '../model/http-validation-error'; + +// @ts-ignore +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; +import { BaseService } from '../api.base.service'; +import { + PersonsSearchServiceInterface +} from './persons-search.serviceInterface'; + + + +@Injectable({ + providedIn: 'root' +}) +export class PersonsSearchService extends BaseService implements PersonsSearchServiceInterface { + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) { + super(basePath, configuration); + } + + /** + * Searches for persons with advanced filters (Topic & Institution) and pagination. + * @endpoint get /api/inse-service/persons/search-list + * @param query Search query (e.g., Arman AND Arzani) + * @param institutionName Filter by institution name + * @param topic Filter by topic display names + * @param page Page number (1-indexed) + * @param pageSize Results per page + * @param include Comma-separated include tags + * @param strict Strict institution search by target year + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + query, 'query'); + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + institutionName, 'institutionName'); + 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'); + + 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 + } + ); + } + +} diff --git a/webapp/src/app/api/api/persons-search.serviceInterface.ts b/webapp/src/app/api/api/persons-search.serviceInterface.ts new file mode 100644 index 00000000..23155580 --- /dev/null +++ b/webapp/src/app/api/api/persons-search.serviceInterface.ts @@ -0,0 +1,40 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { HttpHeaders } from '@angular/common/http'; + +import { Observable } from 'rxjs'; + +import { CustomAuthorsListResponse } from '../model/custom-authors-list-response'; +import { HTTPValidationError } from '../model/models'; + + +import { Configuration } from '../configuration'; + + + +export interface PersonsSearchServiceInterface { + defaultHeaders: HttpHeaders; + configuration: Configuration; + + /** + * 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 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 + */ + searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, extraHttpRequestParams?: any): Observable; + +} diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index 7d50d272..c80c7c64 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -19,11 +19,11 @@ import { Observable } from 'rxjs'; // @ts-ignore import { AuthorsListResponse } from '../model/authors-list-response'; // @ts-ignore +import { CustomAuthorsListResponse } from '../model/custom-authors-list-response'; +// @ts-ignore import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore import { PersonBio } from '../model/person-bio'; -// @ts-ignore -import { PersonSearchRequest } from '../model/person-search-request'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; @@ -719,19 +719,46 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa } /** - * Search for persons with optional name and filters. - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest + * 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 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 observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (personSearchRequest === null || personSearchRequest === undefined) { - throw new Error('Required parameter personSearchRequest was null or undefined when calling searchPersonsWithFilters.'); + public searchPersonsList(query?: string, institutionName?: 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, 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, 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, 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'); + 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; @@ -747,15 +774,6 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa 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')) { @@ -767,12 +785,12 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa } } - let localVarPath = `/api/inse-service/persons/searchWithFilters`; + let localVarPath = `/api/inse-service/persons/search-list`; const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, - body: personSearchRequest, + params: localVarQueryParameters, responseType: responseType_, ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, @@ -784,19 +802,46 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa } /** - * Search for persons with optional name and filters. - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest + * 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 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 observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ - public searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; - public searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; - public searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { - if (personSearchRequest === null || personSearchRequest === undefined) { - throw new Error('Required parameter personSearchRequest was null or undefined when calling searchPersonsWithFilters_5.'); + public searchPersonsList_5(query?: string, institutionName?: 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, 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, 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, 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'); + 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; @@ -812,15 +857,6 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa 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')) { @@ -832,12 +868,12 @@ export class PersonsService extends BaseService implements PersonsServiceInterfa } } - let localVarPath = `/api/inse-service/persons/searchWithFilters`; + let localVarPath = `/api/inse-service/persons/search-list`; const { basePath, withCredentials } = this.configuration; - return this.httpClient.request('post', `${basePath}${localVarPath}`, + return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, - body: personSearchRequest, + params: localVarQueryParameters, responseType: responseType_, ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, diff --git a/webapp/src/app/api/api/persons.serviceInterface.ts b/webapp/src/app/api/api/persons.serviceInterface.ts index ced4dd2b..22232b9b 100644 --- a/webapp/src/app/api/api/persons.serviceInterface.ts +++ b/webapp/src/app/api/api/persons.serviceInterface.ts @@ -12,9 +12,9 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; import { AuthorsListResponse } from '../model/models'; +import { CustomAuthorsListResponse } from '../model/models'; import { HTTPValidationError } from '../model/models'; import { PersonBio } from '../model/models'; -import { PersonSearchRequest } from '../model/models'; import { Configuration } from '../configuration'; @@ -124,20 +124,20 @@ export interface PersonsServiceInterface { */ searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable; - /** - * Search for persons with optional name and filters. - * - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest - */ - searchPersonsWithFilters(personSearchRequest: PersonSearchRequest, extraHttpRequestParams?: any): Observable; + searchPersonsList(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable; /** - * Search for persons with optional name and filters. + * Searches for persons with advanced filters (Topic & Institution) and pagination. * - * @endpoint post /api/inse-service/persons/searchWithFilters - * @param personSearchRequest + * @endpoint get /api/inse-service/persons/search-list + * @param query Search query (e.g., Arman AND Arzani) + * @param institutionName Filter by institution name + * @param topic Filter by topic display names + * @param page Page number (1-indexed) + * @param pageSize Results per page + * @param include Comma-separated include tags + * @param strict Strict institution search by target year */ - searchPersonsWithFilters_5(personSearchRequest: PersonSearchRequest, extraHttpRequestParams?: any): Observable; + searchPersonsList_5(query?: string, institutionName?: string, topic?: Array, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable; } diff --git a/webapp/src/app/api/api/topics.service.ts b/webapp/src/app/api/api/topics.service.ts index 193a1b1f..8635bf04 100644 --- a/webapp/src/app/api/api/topics.service.ts +++ b/webapp/src/app/api/api/topics.service.ts @@ -162,4 +162,55 @@ export class TopicsService extends BaseService implements TopicsServiceInterface ); } + /** + * 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 localVarQueryParameters = new HttpParams({encoder: this.encoder}); + 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, + 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.serviceInterface.ts b/webapp/src/app/api/api/topics.serviceInterface.ts index 6a60f441..baebd5f6 100644 --- a/webapp/src/app/api/api/topics.serviceInterface.ts +++ b/webapp/src/app/api/api/topics.serviceInterface.ts @@ -39,4 +39,11 @@ export interface TopicsServiceInterface { */ countTopicHierarchy(topic: Array, extraHttpRequestParams?: any): Observable; + /** + * Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics). + * + * @endpoint get /api/inse-service/topics/hierarchy + */ + getTopicHierarchy(extraHttpRequestParams?: any): Observable; + } diff --git a/webapp/src/app/api/api/works.service.ts b/webapp/src/app/api/api/works.service.ts index 228548cb..cd80c9ac 100644 --- a/webapp/src/app/api/api/works.service.ts +++ b/webapp/src/app/api/api/works.service.ts @@ -19,6 +19,10 @@ import { Observable } from 'rxjs'; // @ts-ignore import { HTTPValidationError } from '../model/http-validation-error'; // @ts-ignore +import { TopicCount } from '../model/topic-count'; // +// @ts-ignore +import { TopicsByTime } from '../model/topics-by-time'; +// @ts-ignore import { WorkPage } from '../model/work-page'; // @ts-ignore import { WorksListResponse } from '../model/works-list-response'; @@ -188,4 +192,126 @@ export class WorksService extends BaseService implements WorksServiceInterface { ); } + /** + * Returns work counts per primary topic for an author. + * @endpoint get /api/works/{author_id}/primary-topic-counts + * @param authorId The author id, for example A5023888391. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>>; + public getPrimaryTopicCountsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getPrimaryTopicCountsByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/primary-topic-counts`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request>('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + + /** + * Returns topics grouped by publication year for an author. + * @endpoint get /api/works/{author_id}/topics-by-time + * @param authorId The author id, for example A5023888391. + * @param maxTopicsPerYear The maximum number of topics per year. + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + 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'); + + let localVarHeaders = this.defaultHeaders; + + // authentication (bearer) required + localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer '); + + const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([ + 'application/json' + ]); + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + const localVarTransferCache: boolean = options?.transferCache ?? true; + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/topics-by-time`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), + reportProgress: reportProgress + } + ); + } + } diff --git a/webapp/src/app/api/api/works.serviceInterface.ts b/webapp/src/app/api/api/works.serviceInterface.ts index 887bb9c3..792f42f7 100644 --- a/webapp/src/app/api/api/works.serviceInterface.ts +++ b/webapp/src/app/api/api/works.serviceInterface.ts @@ -12,6 +12,8 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; import { HTTPValidationError } from '../model/models'; +import { TopicCount } from '../model/models'; // +import { TopicsByTime } from '../model/models'; import { WorkPage } from '../model/models'; import { WorksListResponse } from '../model/models'; @@ -45,4 +47,13 @@ export interface WorksServiceInterface { */ getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array, type?: Array, language?: Array, extraHttpRequestParams?: any): Observable; + /** + * Returns topics grouped by publication year for an author. + * + * @endpoint get /api/works/{author_id}/topics-by-time + * @param authorId The author id, for example A5023888391. + * @param maxTopicsPerYear The maximum number of topics per year. + */ + getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, extraHttpRequestParams?: any): Observable; + } diff --git a/webapp/src/app/api/model/authAccount.ts b/webapp/src/app/api/model/author-position-count.ts similarity index 64% rename from webapp/src/app/api/model/authAccount.ts rename to webapp/src/app/api/model/author-position-count.ts index 0c76d8dc..a02e3749 100644 --- a/webapp/src/app/api/model/authAccount.ts +++ b/webapp/src/app/api/model/author-position-count.ts @@ -9,9 +9,10 @@ */ -export interface AuthAccount { - i: number; - l: string; - o: number; +export interface AuthorPositionCount { + first?: number; + middle?: number; + last?: number; + unknown?: number; } diff --git a/webapp/src/app/api/model/authorAffiliationsInner.ts b/webapp/src/app/api/model/authorAffiliationsInner.ts deleted file mode 100644 index 270443ff..00000000 --- a/webapp/src/app/api/model/authorAffiliationsInner.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { DehydratedInstitution } from './dehydratedInstitution'; - - -/** - * AuthorAffiliationsInner - */ -export interface AuthorAffiliationsInner { - institution?: DehydratedInstitution | null; - years?: Array | null; -} - diff --git a/webapp/src/app/api/model/authorIds.ts b/webapp/src/app/api/model/authorIds.ts deleted file mode 100644 index 9235a207..00000000 --- a/webapp/src/app/api/model/authorIds.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * External identifiers: - */ -export interface AuthorIds { - openalex?: string | null; - orcid?: string | null; - scopus?: string | null; -} - diff --git a/webapp/src/app/api/model/authorParsedLongestName.ts b/webapp/src/app/api/model/authorParsedLongestName.ts deleted file mode 100644 index f49e04be..00000000 --- a/webapp/src/app/api/model/authorParsedLongestName.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * The longest name parsed into its component parts. - */ -export interface AuthorParsedLongestName { - first?: string | null; - middle?: string | null; - last?: string | null; - suffix?: string | null; - nickname?: string | null; -} - diff --git a/webapp/src/app/api/model/authorSummaryStats.ts b/webapp/src/app/api/model/authorSummaryStats.ts deleted file mode 100644 index 1cfc0bdb..00000000 --- a/webapp/src/app/api/model/authorSummaryStats.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { Model2YrMeanCitedness } from './model2YrMeanCitedness'; - - -/** - * Citation metrics: - */ -export interface AuthorSummaryStats { - '2yr_mean_citedness'?: Model2YrMeanCitedness | null; - h_index?: number | null; - i10_index?: number | null; -} - diff --git a/webapp/src/app/api/model/authorsListResponse.ts b/webapp/src/app/api/model/authorsListResponse.ts deleted file mode 100644 index d309ae43..00000000 --- a/webapp/src/app/api/model/authorsListResponse.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { 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; -} - diff --git a/webapp/src/app/api/model/collaborationNetwork.ts b/webapp/src/app/api/model/collaborationNetwork.ts deleted file mode 100644 index 672858af..00000000 --- a/webapp/src/app/api/model/collaborationNetwork.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { FilterInformation } from './filterInformation'; -import { CollaborationNetworkEdge } from './collaborationNetworkEdge'; -import { CollaborationNetworkNode } from './collaborationNetworkNode'; - - -export interface CollaborationNetwork { - /** - * The raw person ID of the person whose collaboration network this is. - */ - raw_person_id: string; - /** - * The nodes in the collaboration network. - */ - nodes: Array; - /** - * The edges in the collaboration network. - */ - edges: Array; - /** - * The filter information for the collaboration network, including the minimum and maximum publication years of the works in the collaboration network. - */ - filter_information: FilterInformation; -} - diff --git a/webapp/src/app/api/model/collaborationNetworkNode.ts b/webapp/src/app/api/model/collaborationNetworkNode.ts deleted file mode 100644 index d37a6831..00000000 --- a/webapp/src/app/api/model/collaborationNetworkNode.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType'; - - -export interface CollaborationNetworkNode { - /** - * The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID. - */ - raw_id: string; - /** - * The display name of the node. - */ - display_name: string; - /** - * The category of the node, either \'author\', \'institution\', or \'work\'. - */ - category: CollaborationNetworkNodeType; -} -export namespace CollaborationNetworkNode { -} - - diff --git a/webapp/src/app/api/model/collaborationNetworkNodeType.ts b/webapp/src/app/api/model/collaborationNetworkNodeType.ts deleted file mode 100644 index 752e35b0..00000000 --- a/webapp/src/app/api/model/collaborationNetworkNodeType.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export const CollaborationNetworkNodeType = { - Author: 'author', - Institution: 'institution', - Work: 'work' -} as const; -export type CollaborationNetworkNodeType = typeof CollaborationNetworkNodeType[keyof typeof CollaborationNetworkNodeType]; - diff --git a/webapp/src/app/api/model/costUsd.ts b/webapp/src/app/api/model/costUsd.ts deleted file mode 100644 index c7bcbee8..00000000 --- a/webapp/src/app/api/model/costUsd.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * Cost of this request in USD - */ -export interface CostUsd { -} - diff --git a/webapp/src/app/api/model/custom-author.ts b/webapp/src/app/api/model/custom-author.ts new file mode 100644 index 00000000..07000ade --- /dev/null +++ b/webapp/src/app/api/model/custom-author.ts @@ -0,0 +1,39 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { AuthorAffiliationsInner } from './author-affiliations-inner'; +import { AuthorParsedLongestName } from './author-parsed-longest-name'; +import { DehydratedInstitution } from './dehydrated-institution'; +import { AuthorCountsByYearInner } from './author-counts-by-year-inner'; +import { AuthorIds } from './author-ids'; +import { AuthorSummaryStats } from './author-summary-stats'; +import { WorkTopic } from './work-topic'; + + +export interface CustomAuthor { + id?: string | null; + orcid?: string | null; + display_name?: string | null; + display_name_alternatives?: Array | 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; +} + diff --git a/webapp/src/app/api/model/worksListResponse.ts b/webapp/src/app/api/model/custom-authors-list-response.ts similarity index 62% rename from webapp/src/app/api/model/worksListResponse.ts rename to webapp/src/app/api/model/custom-authors-list-response.ts index a65d3849..45aeae54 100644 --- a/webapp/src/app/api/model/worksListResponse.ts +++ b/webapp/src/app/api/model/custom-authors-list-response.ts @@ -8,16 +8,13 @@ * Do not edit the class manually. */ import { Meta } from './meta'; -import { Work } from './work'; -import { GroupByResult } from './groupByResult'; +import { CustomAuthor } from './custom-author'; +import { GroupByResult } from './group-by-result'; -/** - * WorksListResponse - */ -export interface WorksListResponse { +export interface CustomAuthorsListResponse { meta?: Meta | null; - results?: Array | null; + results?: Array | null; group_by?: Array | null; } diff --git a/webapp/src/app/api/model/dehydratedAuthor.ts b/webapp/src/app/api/model/dehydratedAuthor.ts deleted file mode 100644 index 4d3817f1..00000000 --- a/webapp/src/app/api/model/dehydratedAuthor.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * [Dehydrated Author](/api-reference/authors#the-dehydratedauthor-object) — reduced-field version used in nested contexts - */ -export interface DehydratedAuthor { - id?: string | null; - display_name?: string | null; - orcid?: string | null; -} - diff --git a/webapp/src/app/api/model/dehydratedFunder.ts b/webapp/src/app/api/model/dehydratedFunder.ts deleted file mode 100644 index b134bbb1..00000000 --- a/webapp/src/app/api/model/dehydratedFunder.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * [Dehydrated Funder](/api-reference/funders) — reduced-field version used in nested contexts - */ -export interface DehydratedFunder { - id?: string | null; - display_name?: string | null; - ror?: string | null; -} - diff --git a/webapp/src/app/api/model/dehydratedInstitution.ts b/webapp/src/app/api/model/dehydratedInstitution.ts deleted file mode 100644 index 7b6c9824..00000000 --- a/webapp/src/app/api/model/dehydratedInstitution.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * [Dehydrated Institution](/api-reference/institutions#the-dehydratedinstitution-object) — reduced-field version used in nested contexts - */ -export interface DehydratedInstitution { - id?: string | null; - display_name?: string | null; - ror?: string | null; - country_code?: string | null; - type?: string | null; - lineage?: Array | null; -} - diff --git a/webapp/src/app/api/model/dehydratedSource.ts b/webapp/src/app/api/model/dehydratedSource.ts deleted file mode 100644 index ae714846..00000000 --- a/webapp/src/app/api/model/dehydratedSource.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * [Dehydrated Source](/api-reference/sources#the-dehydratedsource-object) — reduced-field version used in nested contexts - */ -export interface DehydratedSource { - id?: string | null; - display_name?: string | null; - issn_l?: string | null; - issn?: Array | null; - is_oa?: boolean | null; - is_in_doaj?: boolean | null; - is_core?: boolean | null; - host_organization?: string | null; - host_organization_name?: string | null; - host_organization_lineage?: Array | null; - type?: string | null; -} - diff --git a/webapp/src/app/api/model/filterInformation.ts b/webapp/src/app/api/model/filterInformation.ts deleted file mode 100644 index b2078376..00000000 --- a/webapp/src/app/api/model/filterInformation.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { 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; -} - diff --git a/webapp/src/app/api/model/filterProperties.ts b/webapp/src/app/api/model/filterProperties.ts deleted file mode 100644 index daeb08ee..00000000 --- a/webapp/src/app/api/model/filterProperties.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface FilterProperties { - start_year: number | null; - end_year: number | null; - allowed_institutions: Array | null; - allowed_topics: Array | null; - min_collaborators: number | null; - max_collaborators: number | null; - min_collaborations: number | null; - max_collaborations: number | null; -} - diff --git a/webapp/src/app/api/model/funder-by-author.ts b/webapp/src/app/api/model/funder-by-author.ts new file mode 100644 index 00000000..06fa85f0 --- /dev/null +++ b/webapp/src/app/api/model/funder-by-author.ts @@ -0,0 +1,22 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { PublicationIdsByAuthorPosition } from './publication-ids-by-author-position'; +import { AuthorPositionCount } from './author-position-count'; + + +export interface FunderByAuthor { + funder_id?: string | null; + funder_name?: string | null; + publication_count: number; + author_position_count: AuthorPositionCount; + publication_ids: PublicationIdsByAuthorPosition; + publication_urls?: { [key: string]: string; }; +} + diff --git a/webapp/src/app/api/model/accessGrant.ts b/webapp/src/app/api/model/funders-by-author-response.ts similarity index 50% rename from webapp/src/app/api/model/accessGrant.ts rename to webapp/src/app/api/model/funders-by-author-response.ts index ad1f537a..6949ed4b 100644 --- a/webapp/src/app/api/model/accessGrant.ts +++ b/webapp/src/app/api/model/funders-by-author-response.ts @@ -7,14 +7,13 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { AuthScope } from './authScope'; +import { FunderByAuthor } from './funder-by-author'; -export interface AccessGrant { - token_type: string; - access_token: string; - expires_in: number; - scope: AuthScope; - refresh_token: string; +export interface FundersByAuthorResponse { + author_id: string; + author_name?: string | null; + funder_count: number; + funders: Array; } diff --git a/webapp/src/app/api/model/groupByResult.ts b/webapp/src/app/api/model/groupByResult.ts deleted file mode 100644 index 68c51855..00000000 --- a/webapp/src/app/api/model/groupByResult.ts +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * GroupByResult - */ -export interface GroupByResult { - key?: string | null; - key_display_name?: string | null; - count?: number | null; -} - diff --git a/webapp/src/app/api/model/hTTPValidationError.ts b/webapp/src/app/api/model/hTTPValidationError.ts deleted file mode 100644 index f624be37..00000000 --- a/webapp/src/app/api/model/hTTPValidationError.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { ValidationError } from './validationError'; - - -export interface HTTPValidationError { - detail?: Array; -} - diff --git a/webapp/src/app/api/model/identityGrant.ts b/webapp/src/app/api/model/identityGrant.ts deleted file mode 100644 index 9ec3fe50..00000000 --- a/webapp/src/app/api/model/identityGrant.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { AuthScope } from './authScope'; - - -export interface IdentityGrant { - token_type: string; - access_token: string; - expires_in: number; - scope: AuthScope; -} - diff --git a/webapp/src/app/api/model/institutionInformation.ts b/webapp/src/app/api/model/institutionInformation.ts deleted file mode 100644 index e287b0fa..00000000 --- a/webapp/src/app/api/model/institutionInformation.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface 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/itemPage.ts b/webapp/src/app/api/model/itemPage.ts deleted file mode 100644 index 56595b8a..00000000 --- a/webapp/src/app/api/model/itemPage.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { Item } from './item'; - - -export interface ItemPage { - /** - * The elements of the page. - */ - elements?: Array; - /** - * The page offset in elements. - */ - offset?: number; - /** - * The total number of elements. - */ - total?: number; - /** - * The page size in elements. - */ - size?: number; -} - diff --git a/webapp/src/app/api/model/model2YrMeanCitedness.ts b/webapp/src/app/api/model/model2YrMeanCitedness.ts deleted file mode 100644 index 67ec623c..00000000 --- a/webapp/src/app/api/model/model2YrMeanCitedness.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface Model2YrMeanCitedness { -} - diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index 7c5c8f43..c9938757 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -6,6 +6,7 @@ export * from './author-affiliations-inner'; export * from './author-counts-by-year-inner'; export * from './author-ids'; export * from './author-parsed-longest-name'; +export * from './author-position-count'; export * from './author-summary-stats'; export * from './authors-list-response'; export * from './authorship'; @@ -15,12 +16,16 @@ export * from './collaboration-network-edge'; export * from './collaboration-network-node'; export * from './collaboration-network-node-type'; export * from './cost-usd'; +export * from './custom-author'; +export * from './custom-authors-list-response'; export * from './dehydrated-author'; export * from './dehydrated-funder'; export * from './dehydrated-institution'; export * from './dehydrated-source'; export * from './filter-information'; export * from './filter-properties'; +export * from './funder-by-author'; +export * from './funders-by-author-response'; export * from './fwci'; export * from './group-by-result'; export * from './http-validation-error'; @@ -34,9 +39,12 @@ export * from './meta'; export * from './model2-yr-mean-citedness'; export * from './open-access'; export * from './person-bio'; -export * from './person-filters'; -export * from './person-search-request'; +export * from './publication-ids-by-author-position'; +export * from './publications-by-author-response'; export * from './score'; +export * from './topic-count'; +export * from './topics-by-time'; +export * from './topics-by-year'; export * from './validation-error'; export * from './validation-error-loc-inner'; export * from './value'; diff --git a/webapp/src/app/api/model/openAccess.ts b/webapp/src/app/api/model/openAccess.ts deleted file mode 100644 index 32a4ddd9..00000000 --- a/webapp/src/app/api/model/openAccess.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * Open access information - */ -export interface OpenAccess { - is_oa?: boolean | null; - oa_status?: string | null; - oa_url?: string | null; - any_repository_has_fulltext?: boolean | null; -} - diff --git a/webapp/src/app/api/model/personBio.ts b/webapp/src/app/api/model/personBio.ts deleted file mode 100644 index f7291e6f..00000000 --- a/webapp/src/app/api/model/personBio.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface PersonBio { - /** - * The generated biography. - */ - bio: string; -} - diff --git a/webapp/src/app/api/model/authScope.ts b/webapp/src/app/api/model/publication-ids-by-author-position.ts similarity index 57% rename from webapp/src/app/api/model/authScope.ts rename to webapp/src/app/api/model/publication-ids-by-author-position.ts index 65ffa9b5..c35050ef 100644 --- a/webapp/src/app/api/model/authScope.ts +++ b/webapp/src/app/api/model/publication-ids-by-author-position.ts @@ -7,13 +7,12 @@ * https://openapi-generator.tech * Do not edit the class manually. */ -import { AuthAccount } from './authAccount'; -export interface AuthScope { - t: string; - a: AuthAccount; - d?: number | null; - r?: Array; +export interface PublicationIdsByAuthorPosition { + first?: Array; + middle?: Array; + last?: Array; + unknown?: Array; } diff --git a/webapp/src/app/api/model/authorCountsByYearInner.ts b/webapp/src/app/api/model/publications-by-author-response.ts similarity index 50% rename from webapp/src/app/api/model/authorCountsByYearInner.ts rename to webapp/src/app/api/model/publications-by-author-response.ts index d16c7c21..5176fe39 100644 --- a/webapp/src/app/api/model/authorCountsByYearInner.ts +++ b/webapp/src/app/api/model/publications-by-author-response.ts @@ -9,12 +9,13 @@ */ -/** - * AuthorCountsByYearInner - */ -export interface AuthorCountsByYearInner { - year?: number | null; - works_count?: number | null; - cited_by_count?: number | null; +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/itemCreate.ts b/webapp/src/app/api/model/topic-count.ts similarity index 65% rename from webapp/src/app/api/model/itemCreate.ts rename to webapp/src/app/api/model/topic-count.ts index 608d6910..c4e4ef18 100644 --- a/webapp/src/app/api/model/itemCreate.ts +++ b/webapp/src/app/api/model/topic-count.ts @@ -9,14 +9,15 @@ */ -export interface ItemCreate { +export interface TopicCount { + id?: string | null; /** - * The name of the item. + * The topic display name. */ name: string; /** - * The description of the item. + * The number of occurrences. */ - description: string; + count?: number; } diff --git a/webapp/src/app/api/model/collaborationNetworkEdge.ts b/webapp/src/app/api/model/topics-by-time.ts similarity index 55% rename from webapp/src/app/api/model/collaborationNetworkEdge.ts rename to webapp/src/app/api/model/topics-by-time.ts index 16fb5fc6..d2ecf101 100644 --- a/webapp/src/app/api/model/collaborationNetworkEdge.ts +++ b/webapp/src/app/api/model/topics-by-time.ts @@ -7,16 +7,17 @@ * https://openapi-generator.tech * Do not edit the class manually. */ +import { TopicsByYear } from './topics-by-year'; -export interface CollaborationNetworkEdge { +export interface TopicsByTime { /** - * The raw ID of the source node. + * Topics grouped by year. */ - raw_source_id: string; + elements?: Array; /** - * The raw ID of the target node. + * The number of years. */ - raw_target_id: string; + total?: number; } diff --git a/webapp/src/app/api/model/topics-by-year.ts b/webapp/src/app/api/model/topics-by-year.ts new file mode 100644 index 00000000..707cda16 --- /dev/null +++ b/webapp/src/app/api/model/topics-by-year.ts @@ -0,0 +1,31 @@ +/** + * Innovation Search Engine API + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { TopicCount } from './topic-count'; + + +export interface TopicsByYear { + /** + * The publication year. + */ + year: number; + /** + * The number of works in this year. + */ + publication_count?: number; + /** + * The topics in this year. + */ + topics?: Array; + /** + * The primary topics in this year. + */ + primary_topics?: Array; +} + diff --git a/webapp/src/app/api/model/validationError.ts b/webapp/src/app/api/model/validationError.ts deleted file mode 100644 index bdbd57ad..00000000 --- a/webapp/src/app/api/model/validationError.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { ValidationErrorLocInner } from './validationErrorLocInner'; - - -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 deleted file mode 100644 index d248a9b7..00000000 --- a/webapp/src/app/api/model/validationErrorLocInner.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface ValidationErrorLocInner { -} - diff --git a/webapp/src/app/api/model/workBiblio.ts b/webapp/src/app/api/model/workBiblio.ts deleted file mode 100644 index f6d7079b..00000000 --- a/webapp/src/app/api/model/workBiblio.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * Bibliographic info: `volume`, `issue`, `first_page`, `last_page`. - */ -export interface WorkBiblio { - volume?: string | null; - issue?: string | null; - first_page?: string | null; - last_page?: string | null; -} - diff --git a/webapp/src/app/api/model/workCitationNormalizedPercentile.ts b/webapp/src/app/api/model/workCitationNormalizedPercentile.ts deleted file mode 100644 index a587ddf6..00000000 --- a/webapp/src/app/api/model/workCitationNormalizedPercentile.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { Value } from './value'; - - -/** - * Percentile of citation count normalized by work type, year, and subfield. Includes `value`, `is_in_top_1_percent`, `is_in_top_10_percent`. - */ -export interface WorkCitationNormalizedPercentile { - value?: Value | null; - is_in_top_1_percent?: boolean | null; - is_in_top_10_percent?: boolean | null; -} - diff --git a/webapp/src/app/api/model/workCitedByPercentileYear.ts b/webapp/src/app/api/model/workCitedByPercentileYear.ts deleted file mode 100644 index 5257eb3b..00000000 --- a/webapp/src/app/api/model/workCitedByPercentileYear.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * Percentile rank compared to other works published in the same year. Contains `min` and `max`. - */ -export interface WorkCitedByPercentileYear { - min?: number | null; - max?: number | null; -} - diff --git a/webapp/src/app/api/model/workCountsByYearInner.ts b/webapp/src/app/api/model/workCountsByYearInner.ts deleted file mode 100644 index 76d97d77..00000000 --- a/webapp/src/app/api/model/workCountsByYearInner.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * WorkCountsByYearInner - */ -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 deleted file mode 100644 index 44fbe446..00000000 --- a/webapp/src/app/api/model/workHasContent.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * Information about downloadable full-text content: - */ -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 deleted file mode 100644 index e8315250..00000000 --- a/webapp/src/app/api/model/workIds.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * External identifiers: `openalex`, `doi`, `mag`, `pmid`, `pmcid`. - */ -export interface WorkIds { - openalex?: string | null; - doi?: string | null; - mag?: number | null; - pmid?: string | null; - pmcid?: string | null; -} - diff --git a/webapp/src/app/api/model/workKeyword.ts b/webapp/src/app/api/model/workKeyword.ts deleted file mode 100644 index c9c99afb..00000000 --- a/webapp/src/app/api/model/workKeyword.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { Score } from './score'; - - -/** - * WorkKeyword - */ -export interface WorkKeyword { - id?: string | null; - display_name?: string | null; - score?: Score | null; -} - diff --git a/webapp/src/app/api/model/workMeshInner.ts b/webapp/src/app/api/model/workMeshInner.ts deleted file mode 100644 index 40633524..00000000 --- a/webapp/src/app/api/model/workMeshInner.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * WorkMeshInner - */ -export interface WorkMeshInner { - descriptor_ui?: string | null; - descriptor_name?: string | null; - qualifier_ui?: string | null; - qualifier_name?: string | null; - is_major_topic?: boolean | null; -} - diff --git a/webapp/src/app/api/model/workPage.ts b/webapp/src/app/api/model/workPage.ts deleted file mode 100644 index 8490c3ab..00000000 --- a/webapp/src/app/api/model/workPage.ts +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { Work } from './work'; - - -export interface WorkPage { - /** - * Total number of works matching the query - */ - total: number; - /** - * List of works on the current page - */ - elements: Array; - /** - * Offset of the current page - */ - offset: number; - /** - * Size of the current page - */ - size: number; - /** - * Indicates if the current page is the last page - */ - last_page: boolean; -} - diff --git a/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts b/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts deleted file mode 100644 index c9ecd00f..00000000 --- a/webapp/src/app/api/model/workSustainableDevelopmentGoalsInner.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { Score } from './score'; - - -/** - * WorkSustainableDevelopmentGoalsInner - */ -export interface WorkSustainableDevelopmentGoalsInner { - id?: string | null; - display_name?: string | null; - score?: Score | null; -} - diff --git a/webapp/src/app/api/model/workTopic.ts b/webapp/src/app/api/model/workTopic.ts deleted file mode 100644 index 925ead4f..00000000 --- a/webapp/src/app/api/model/workTopic.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ -import { Score } from './score'; -import { WorkTopicDomain } from './workTopicDomain'; -import { WorkTopicSubfield } from './workTopicSubfield'; -import { WorkTopicField } from './workTopicField'; - - -/** - * WorkTopic - */ -export interface WorkTopic { - id?: string | null; - display_name?: string | null; - score?: Score | null; - subfield?: WorkTopicSubfield | null; - field?: WorkTopicField | null; - domain?: WorkTopicDomain | null; -} - diff --git a/webapp/src/app/api/model/workTopicDomain.ts b/webapp/src/app/api/model/workTopicDomain.ts deleted file mode 100644 index 1a9879d4..00000000 --- a/webapp/src/app/api/model/workTopicDomain.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * The parent [domain](/api-reference/domains) - */ -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 deleted file mode 100644 index 1807cfc1..00000000 --- a/webapp/src/app/api/model/workTopicField.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * The parent [field](/api-reference/fields) - */ -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 deleted file mode 100644 index ca3b9454..00000000 --- a/webapp/src/app/api/model/workTopicInformation.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -export interface 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 deleted file mode 100644 index b6e7278a..00000000 --- a/webapp/src/app/api/model/workTopicSubfield.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Innovation Search Engine API - * - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -/** - * The parent [subfield](/api-reference/subfields) - */ -export interface WorkTopicSubfield { - id?: string | null; - display_name?: string | null; -} - diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 62ca6832..c8fe99fe 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -80,6 +80,13 @@ export const routes: Routes = [ (mod) => mod.PersonPublicationsComponent, ), }, + { + path: 'funding', + loadComponent: () => + import('./modules/person-funding/person-funding.component').then( + (mod) => mod.PersonFundingComponent, + ), + }, ], }, { diff --git a/webapp/src/app/modules/person-funding/person-funding.component.html b/webapp/src/app/modules/person-funding/person-funding.component.html new file mode 100644 index 00000000..ff01f61e --- /dev/null +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -0,0 +1,119 @@ +@if (loading) { +

Lade Förderungen...

+} @else if (error) { +

Fehler beim Laden der Förderungen.

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

Keine Förderungen gefunden.

+} @else { +
+
+

+ {{ getUniquePublicationCount() }} + Einzigartige Publikationen +

+

+ {{ filteredFunders.length }} + Förderer +

+
+ + +
+ Filter nach Position: + + + + +
+ +
+ + +
+ + + + + + + + + @for (funder of getPagedFunders(); track funder.funder_id) { + + + + + } + +
FördererPublikationen
{{ funder.funder_name }}{{ getPublicationCount(funder) }}
+ @if (hasFunderListPagination()) { +
+ + Seite {{ selectedFunderListPage }} von {{ getFunderListPageCount() }} + +
+ } +
+ + + @if (selectedFunder) { +
+

{{ selectedFunder.funder_name }}

+ +
+ @if (shouldShowPosition('first')) { +
+ Erstautor + {{ selectedFunder.author_position_count.first }} +
+ } + @if (shouldShowPosition('middle')) { +
+ Mitautor + {{ selectedFunder.author_position_count.middle }} +
+ } + @if (shouldShowPosition('last')) { +
+ Letztautor + {{ selectedFunder.author_position_count.last }} +
+ } +
+ +

Publikationen

+
    + @for (id of getSelectedPublicationIdsPage(); track id) { +
  • + {{ id }} +
  • + } +
+ @if (hasPublicationPagination()) { +
+ + Seite {{ selectedPublicationPage }} von {{ getSelectedPublicationPageCount() }} + +
+ } +
+ } @else { +
+

Klicke auf einen Förderer für Details.

+
+ } + +
+
+} diff --git a/webapp/src/app/modules/person-funding/person-funding.component.scss b/webapp/src/app/modules/person-funding/person-funding.component.scss new file mode 100644 index 00000000..b9f511c9 --- /dev/null +++ b/webapp/src/app/modules/person-funding/person-funding.component.scss @@ -0,0 +1,221 @@ +.message { + padding: 16px; + color: #666; +} + +.funding-container { + padding: 16px; + display: flex; + flex-direction: column; + gap: 16px; +} + +.filter-bar { + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; + + span { + font-weight: 500; + color: #555; + } + + button { + padding: 6px 14px; + border: 1px solid #ccc; + border-radius: 20px; + background: white; + cursor: pointer; + font-size: 14px; + transition: all 0.2s; + + &:hover { + background: #f0f0f0; + } + + &.active { + background: + radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.78), transparent 34%), + linear-gradient(145deg, #c8d9ff, #f7faff 48%, #88a9ee); + color: var(--sg-primary); + border-color: var(--sg-border); + font-weight: 600; + box-shadow: var(--sg-shadow-sm); + } + } +} + +.funding-content { + display: flex; + gap: 24px; + align-items: flex-start; +} + +.funding-list { + flex: 1; + + 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; + transition: background 0.15s; + + &:hover { + background: #f5f5f5; + } + + &.selected { + background: #f0f0f0; + } + } + + td { + padding: 10px 12px; + border-bottom: 1px solid #f0f0f0; + } + + .funder-name { + color: #333; + font-weight: 500; + } + } +} + +.funding-detail { + width: 340px; + 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; + } + + h3 { + margin: 0 0 16px 0; + font-size: 16px; + color: #333; + } + + h4 { + margin: 16px 0 8px 0; + font-size: 14px; + color: #555; + } +} + +.position-stats { + display: flex; + gap: 12px; + margin-bottom: 16px; + + .stat { + flex: 1; + text-align: center; + background: white; + border: 1px solid #e0e0e0; + border-radius: 8px; + padding: 10px; + + .stat-label { + display: block; + font-size: 12px; + color: #666; + margin-bottom: 4px; + } + + .stat-value { + display: block; + font-size: 22px; + font-weight: bold; + color: #333; + } + } +} + +.publication-list { + list-style: none; + padding: 0; + margin: 0; + max-height: 300px; + overflow-y: auto; + + li { + padding: 6px 0; + border-bottom: 1px solid #f0f0f0; + font-size: 13px; + + a { + color: #2563eb; + text-decoration: none; + word-break: break-all; + + &:hover { + color: #1d4ed8; + text-decoration: underline; + } + } + } +} + +.publication-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; + } +} + +.funding-summary { + margin-bottom: 16px; + + .summary-line { + margin: 0 0 4px 0; + font-size: 14px; + color: #333; + } + + .summary-label { + color: #333; + } + + .summary-value { + font-weight: 600; + color: #333; + } +} diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts new file mode 100644 index 00000000..4e0a074d --- /dev/null +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -0,0 +1,260 @@ +import { Component, OnInit, inject } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ActivatedRoute } from '@angular/router'; +import { Router } from '@angular/router'; +import { PersonsService } from '../../api'; +import { FundingService } from '../../api'; +@Component({ + selector: 'app-person-funding', + imports: [CommonModule], + templateUrl: './person-funding.component.html', + styleUrl: './person-funding.component.scss', +}) +export class PersonFundingComponent implements OnInit { + private route = inject(ActivatedRoute); + private router = inject(Router); + private fundingApi = inject(FundingService); + private initialSelectedFunderKey: string | null = null; + private initialPublicationPage = 1; + private initialFunderListPage = 1; + + funders: any[] = []; + filteredFunders: any[] = []; + selectedFunder: any = null; + selectedFunderListPage = 1; + selectedPublicationPage = 1; + readonly funderListPageSize = 10; + readonly publicationPageSize = 10; + activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all'; + loading = true; + error = false; + + ngOnInit(): void { + this.route.parent?.paramMap.subscribe(params => { + const authorId = params.get('id') ?? ''; + const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); + this.initialSelectedFunderKey = this.route.snapshot.queryParamMap.get('funder'); + this.initialPublicationPage = this.parsePageParam( + this.route.snapshot.queryParamMap.get('publicationPage') ?? this.route.snapshot.queryParamMap.get('page') + ); + this.initialFunderListPage = this.parsePageParam(this.route.snapshot.queryParamMap.get('funderPage')); + if (this.isValidFilter(filterFromUrl)) { + this.activeFilter = filterFromUrl; + } + + if (authorId) { + this.fundingApi.getFundersByAuthor(authorId).subscribe({ + next: (result: any) => { + this.funders = result.funders ?? []; + this.applyFilter(); + this.selectedFunderListPage = this.clampPage(this.initialFunderListPage, this.getFunderListPageCount()); + this.restoreSelectedFunderFromUrl(); + this.loading = false; + }, + error: () => { + this.error = true; + this.loading = false; + } + }); + } + }); +} + + selectFunder(funder: any): void { + this.selectedFunder = funder; + this.selectedPublicationPage = 1; + this.updateQueryParams(); + } + + setFilter(filter: 'all' | 'first' | 'middle' | 'last'): void { + this.activeFilter = filter; + this.applyFilter(); + this.updateQueryParams(); + } + + private applyFilter(): void { + this.selectedFunder = null; + this.selectedFunderListPage = 1; + this.selectedPublicationPage = 1; + if (this.activeFilter === 'all') { + this.filteredFunders = this.funders; + } else { + this.filteredFunders = this.funders.filter( + f => f.author_position_count[this.activeFilter] > 0 + ); + } + } + + private restoreSelectedFunderFromUrl(): void { + if (!this.initialSelectedFunderKey) { + return; + } + + const matchedFunder = this.filteredFunders.find( + (funder: any) => this.getFunderKey(funder) === this.initialSelectedFunderKey + ); + + if (matchedFunder) { + this.selectedFunder = matchedFunder; + const matchedIndex = this.filteredFunders.findIndex( + (funder: any) => this.getFunderKey(funder) === this.getFunderKey(matchedFunder) + ); + if (matchedIndex >= 0) { + this.selectedFunderListPage = Math.floor(matchedIndex / this.funderListPageSize) + 1; + } + this.selectedPublicationPage = this.clampPublicationPage( + this.initialPublicationPage, + this.getPublicationPageCountForFunder(matchedFunder), + ); + this.updateQueryParams(); + } else { + this.updateQueryParams(); + } + } + + private updateQueryParams(): void { + this.router.navigate([], { + relativeTo: this.route, + queryParams: { + filter: this.activeFilter, + funder: this.selectedFunder ? this.getFunderKey(this.selectedFunder) : null, + publicationPage: this.selectedFunder ? this.selectedPublicationPage : null, + funderPage: this.selectedFunderListPage + }, + queryParamsHandling: 'merge', + replaceUrl: true + }); + } + + private getFunderKey(funder: any): string { + return funder.funder_id ?? funder.funder_name ?? ''; + } + + private isValidFilter(value: string | null): value is 'all' | 'first' | 'middle' | 'last' { + return value === 'all' || value === 'first' || value === 'middle' || value === 'last'; + } + + getPublicationCount(funder: any): number { + if (this.activeFilter === 'all') { + return funder.publication_count ?? 0; + } + return funder.author_position_count?.[this.activeFilter] ?? 0; + } + + getPublicationIds(funder: any): string[] { + if (this.activeFilter === 'all') { + return [ + ...funder.publication_ids.first, + ...funder.publication_ids.middle, + ...funder.publication_ids.last, + ...funder.publication_ids.unknown + ]; + } + return funder.publication_ids[this.activeFilter] ?? []; + } + + getPagedFunders(): any[] { + const startIndex = (this.selectedFunderListPage - 1) * this.funderListPageSize; + return this.filteredFunders.slice(startIndex, startIndex + this.funderListPageSize); + } + + hasFunderListPagination(): boolean { + return this.getFunderListPageCount() > 1; + } + + getFunderListPageCount(): number { + return Math.max(1, Math.ceil(this.filteredFunders.length / this.funderListPageSize)); + } + + setFunderListPage(page: number): void { + this.selectedFunderListPage = this.clampPage(page, this.getFunderListPageCount()); + this.updateQueryParams(); + } + + getSelectedPublicationIdsPage(): string[] { + if (!this.selectedFunder) { + return []; + } + const allPublicationIds = this.getPublicationIds(this.selectedFunder); + const startIndex = (this.selectedPublicationPage - 1) * this.publicationPageSize; + return allPublicationIds.slice(startIndex, startIndex + this.publicationPageSize); + } + + hasPublicationPagination(): boolean { + return this.getSelectedPublicationPageCount() > 1; + } + + getSelectedPublicationPageCount(): number { + if (!this.selectedFunder) { + return 1; + } + return this.getPublicationPageCountForFunder(this.selectedFunder); + } + + setPublicationPage(page: number): void { + const totalPages = this.getSelectedPublicationPageCount(); + this.selectedPublicationPage = this.clampPublicationPage(page, totalPages); + this.updateQueryParams(); + } + + openPublication(event: MouseEvent, publicationId: string): void { + event.preventDefault(); + const url = this.getPublicationUrl(publicationId); + window.open(url, '_blank', 'noopener'); + } + + getPositionLabel(position: string): string { + const labels: Record = { + first: 'Erstautor', + middle: 'Mitautor', + last: 'Letztautor', + unknown: 'Unbekannt' + }; + return labels[position] ?? position; + } + + shouldShowPosition(position: 'first' | 'middle' | 'last'): boolean { + return this.activeFilter === 'all' || this.activeFilter === position; + } + + getUniquePublicationCount(): number { + const allIds = new Set(); + for (const funder of this.funders) { + if (this.activeFilter === 'all') { + for (const ids of Object.values(funder.publication_ids) as string[][]) { + ids.forEach((id: string) => allIds.add(id)); + } + } else { + (funder.publication_ids[this.activeFilter] ?? []).forEach((id: string) => + allIds.add(id), + ); + } + } + return allIds.size; + } + + getPublicationUrl(publicationId: string): string { + return this.selectedFunder?.publication_urls?.[publicationId] ?? publicationId; + } + + private getPublicationPageCountForFunder(funder: any): number { + const publicationCount = this.getPublicationIds(funder).length; + return Math.max(1, Math.ceil(publicationCount / this.publicationPageSize)); + } + + private clampPublicationPage(page: number, totalPages: number): number { + return this.clampPage(page, totalPages); + } + + private clampPage(page: number, totalPages: number): number { + return Math.min(Math.max(page, 1), totalPages); + } + + private parsePageParam(value: string | null): number { + const parsed = Number(value); + if (!Number.isInteger(parsed) || parsed < 1) { + return 1; + } + return parsed; + } +} diff --git a/webapp/src/app/modules/person-interesting/person-interesting.component.html b/webapp/src/app/modules/person-interesting/person-interesting.component.html index 7f79895c..14767892 100644 --- a/webapp/src/app/modules/person-interesting/person-interesting.component.html +++ b/webapp/src/app/modules/person-interesting/person-interesting.component.html @@ -1,9 +1,14 @@ - +