Compare commits
177
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65ab9d59b9 | ||
|
|
bd958d1621 | ||
|
|
3c08bc1866 | ||
|
|
88f9474443 | ||
|
|
78990d9b73 | ||
|
|
701931d641 | ||
|
|
fc03a69ad3 | ||
|
|
4a909ab166 | ||
|
|
90d3a8aa21 | ||
|
|
e9b4cbc0c7 | ||
|
|
0ae41ef95e | ||
|
|
a5f7204b59 | ||
|
|
81c7bee3d8 | ||
|
|
e758fb5f96 | ||
|
|
585ac19c12 | ||
|
|
8dc9f0bccd | ||
|
|
b62dd33a33 | ||
|
|
b41b19a40f | ||
|
|
b7c8a6cfdc | ||
|
|
a00e8a88e4 | ||
|
|
17607d856b | ||
|
|
250b5c2de9 | ||
|
|
9cfd4e9b87 | ||
|
|
282d761c02 | ||
|
|
5a83c7eb52 | ||
|
|
05fabbb231 | ||
|
|
ad900a69d7 | ||
|
|
cad97057cf | ||
|
|
efd9d62477 | ||
|
|
60fa0e0a45 | ||
|
|
4ff574e9f1 | ||
|
|
c9601b06a2 | ||
|
|
a82e76bdef | ||
|
|
cf43330206 | ||
|
|
351f43aca6 | ||
|
|
0f838e3429 | ||
|
|
9a6166b4ee | ||
|
|
4701f294d0 | ||
|
|
755488fef7 | ||
|
|
a7a579ef57 | ||
|
|
038fdb8899 | ||
|
|
8d412fef4a | ||
|
|
52efe1a45a | ||
|
|
801f7419c5 | ||
|
|
c75203c755 | ||
|
|
770f2b31e1 | ||
|
|
3325590735 | ||
|
|
8e1ac13ca7 | ||
|
|
d79d0b842e | ||
|
|
6e64b3a633 | ||
|
|
8ce107f9e0 | ||
|
|
41f34a2e1b | ||
|
|
c482a917b2 | ||
|
|
472ff1208e | ||
|
|
f903e417ad | ||
|
|
e95e7bcaf0 | ||
|
|
e44040444f | ||
|
|
0f7283f475 | ||
|
|
33949bef75 | ||
|
|
f01f17dbaf | ||
|
|
ac69aa3915 | ||
|
|
68c354ad82 | ||
|
|
0025bac51a | ||
|
|
9f3066dbc4 | ||
|
|
bc3f6b6a95 | ||
|
|
8774a425d8 | ||
|
|
653c1745eb | ||
|
|
135705adc9 | ||
|
|
ca6ab84465 | ||
|
|
0529db02d1 | ||
|
|
d951e60ecb | ||
|
|
a5868a3107 | ||
|
|
c3865a8660 | ||
|
|
59a718aeaf | ||
|
|
fdb0cb3daa | ||
|
|
ba296ef499 | ||
|
|
33f767dea3 | ||
|
|
81e6d4436d | ||
|
|
2722c846f7 | ||
|
|
3930e94b30 | ||
|
|
39969fbaab | ||
|
|
2a20e7bc33 | ||
|
|
765c5c9509 | ||
|
|
5cfda2e5d6 | ||
|
|
eab0077347 | ||
|
|
247d81381f | ||
|
|
bf0cac3299 | ||
|
|
743353f511 | ||
|
|
1a1bd0226c | ||
|
|
44bd8c6ce5 | ||
|
|
c77149dcc3 | ||
|
|
5137601bc9 | ||
|
|
f76d63a76c | ||
|
|
e524d3d96c | ||
|
|
26940fd92d | ||
|
|
a769fcf380 | ||
|
|
941652209c | ||
|
|
b69608050e | ||
|
|
fffb362197 | ||
|
|
4aad221543 | ||
|
|
e107657318 | ||
|
|
fe6f64cc8c | ||
|
|
4c33a3e416 | ||
|
|
b168378b11 | ||
|
|
3e6f2b80f2 | ||
|
|
c08745c4b0 | ||
|
|
ff639ec74e | ||
|
|
fce1ad74b3 | ||
|
|
ee991adf3a | ||
|
|
736277d6ff | ||
|
|
57c7dd6d5f | ||
|
|
c37356a45a | ||
|
|
a939755b8d | ||
|
|
625cbdc6d7 | ||
|
|
372199573c | ||
|
|
943b989ccb | ||
|
|
4fa84d1342 | ||
|
|
968b7a0723 | ||
|
|
c8ad000f7e | ||
|
|
1e000319d5 | ||
|
|
fc834eab6a | ||
|
|
4d9a3f24fa | ||
|
|
5ef7204a07 | ||
|
|
b7082640bb | ||
|
|
ce265ebbf9 | ||
|
|
14b9ee0e50 | ||
|
|
08b3a0a585 | ||
|
|
87fa0e4a2d | ||
|
|
de4b7a9ff1 | ||
|
|
c30925e2ac | ||
|
|
8201913738 | ||
|
|
a4a9c58119 | ||
|
|
97db19f042 | ||
|
|
d37140866b | ||
|
|
9a5c833b3a | ||
|
|
9dd47f4373 | ||
|
|
d4b40f5962 | ||
|
|
537199742b | ||
|
|
ec2899fad9 | ||
|
|
2dfaace34b | ||
|
|
75514b7f57 | ||
|
|
9f5835a5d3 | ||
|
|
a9822ca5ff | ||
|
|
e7c17d1fa7 | ||
|
|
e0015c3ea9 | ||
|
|
547a82336e | ||
|
|
c409c1860d | ||
|
|
acee290e7f | ||
|
|
645ecebaad | ||
|
|
3b08118abe | ||
|
|
c24686258c | ||
|
|
8df18efd8f | ||
|
|
d0d5a1b793 | ||
|
|
e898f15583 | ||
|
|
fd09c5e08c | ||
|
|
b2996b07c6 | ||
|
|
300a618cfd | ||
|
|
9c49191629 | ||
|
|
b27e960e0a | ||
|
|
6fe70c8738 | ||
|
|
5294d26552 | ||
|
|
24ee9df743 | ||
|
|
9a06211a0a | ||
|
|
0a32a2c191 | ||
|
|
fac08044a8 | ||
|
|
0a86a3f5bc | ||
|
|
de571d47bd | ||
|
|
644b111280 | ||
|
|
aaead76390 | ||
|
|
96b3355f46 | ||
|
|
404386e153 | ||
|
|
355361558e | ||
|
|
ce4ccbf154 | ||
|
|
22dd33c0a9 | ||
|
|
32cb67df72 | ||
|
|
f2bca2f646 | ||
|
|
3caa759e4f |
+2
-1
@@ -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" ]
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
LLM_MODEL=gemma4-e4b
|
||||
@@ -1,5 +1,5 @@
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import List, Optional, Set
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
@@ -84,38 +84,65 @@ class FilterInformation(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class FilterProperties(BaseModel):
|
||||
start_year: Optional[int] = Field(
|
||||
class WorksFilterProperties(BaseModel):
|
||||
start_year: int = Field(
|
||||
default=0,
|
||||
title="Start Year",
|
||||
description="The start publication year for the works to include in the collaboration network.",
|
||||
)
|
||||
end_year: Optional[int] = Field(
|
||||
end_year: int = Field(
|
||||
default=9999,
|
||||
title="End Year",
|
||||
description="The end publication year for the works to include in the collaboration network.",
|
||||
)
|
||||
allowed_institutions: Optional[List[str]] = Field(
|
||||
title="Allowed Institutions",
|
||||
description="The list of raw institution IDs to include in the collaboration network. If not provided, all institutions will be included.",
|
||||
)
|
||||
allowed_topics: Optional[List[str]] = Field(
|
||||
allowed_topics: List[str] = Field(
|
||||
default_factory=list,
|
||||
title="Allowed Topics",
|
||||
description="The list of raw topic IDs to include in the collaboration network. If not provided, all topics will be included.",
|
||||
description="The list of raw topic IDs to include in the collaboration network. If empty, all topics will be included.",
|
||||
)
|
||||
min_collaborators: Optional[int] = Field(
|
||||
title="Minimum Collaborators",
|
||||
description="The minimum number of collaborators required for a work to be included in the collaboration network. If not provided, all works will be included regardless of the number of collaborators.",
|
||||
min_contributors: int = Field(
|
||||
default=1,
|
||||
title="Minimum Contributors",
|
||||
description="The minimum number of contributors required for a work to be included in the collaboration network.",
|
||||
)
|
||||
max_collaborators: Optional[int] = Field(
|
||||
title="Maximum Collaborators",
|
||||
description="The maximum number of collaborators allowed for a work to be included in the collaboration network. If not provided, all works will be included regardless of the number of collaborators.",
|
||||
max_contributors: int = Field(
|
||||
default=100,
|
||||
title="Maximum Contributors",
|
||||
description="The maximum number of contributors allowed for a work to be included in the collaboration network.",
|
||||
)
|
||||
min_collaborations: Optional[int] = Field(
|
||||
|
||||
|
||||
class AuthorsFilterProperties(BaseModel):
|
||||
allowed_institutions: List[str] = Field(
|
||||
default_factory=list,
|
||||
title="Allowed Institutions",
|
||||
description="The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included.",
|
||||
)
|
||||
min_collaborations: int = Field(
|
||||
default=1,
|
||||
title="Minimum Collaborations",
|
||||
description="The minimum number of collaborations required for a collaboration edge to be included in the collaboration network. If not provided, all collaboration edges will be included regardless of the number of collaborations.",
|
||||
description="The minimum number of collaborations required for an author to be included in the collaboration network.",
|
||||
)
|
||||
max_collaborations: Optional[int] = Field(
|
||||
max_collaborations: int = Field(
|
||||
default=1000,
|
||||
title="Maximum Collaborations",
|
||||
description="The maximum number of collaborations allowed for a collaboration edge to be included in the collaboration network. If not provided, all collaboration edges will be included regardless of the number of collaborations.",
|
||||
description="The maximum number of collaborations allowed for an author to be included in the collaboration network.",
|
||||
)
|
||||
|
||||
|
||||
class FilterProperties(BaseModel):
|
||||
filter_by: str = Field(
|
||||
default="works",
|
||||
title="Filter By",
|
||||
description="The type of filter to apply when generating the collaboration network. Can be either 'works' or 'authors'. If 'works', the filter properties in the 'works_filter_properties' field will be used. If 'authors', the filter properties in the 'authors_filter_properties' field will be used.",
|
||||
)
|
||||
works_filter_properties: Optional[WorksFilterProperties] = Field(
|
||||
title="Works Filter Properties",
|
||||
description="The filter properties to apply when filtering works for the collaboration network. This field is only applicable if the 'filter_by' field is set to 'works'.",
|
||||
)
|
||||
authors_filter_properties: Optional[AuthorsFilterProperties] = Field(
|
||||
title="Authors Filter Properties",
|
||||
description="The filter properties to apply when filtering authors for the collaboration network. This field is only applicable if the 'filter_by' field is set to 'authors'.",
|
||||
)
|
||||
|
||||
|
||||
@@ -141,6 +168,45 @@ class CollaborationNetworkNode(BaseModel):
|
||||
return hash(self.raw_id)
|
||||
|
||||
|
||||
class WorkNetworkNode(CollaborationNetworkNode):
|
||||
publication_year: Optional[int] = Field(
|
||||
title="Publication Year",
|
||||
description="The publication year of the work represented by this node. This field is only applicable if the category of the node is 'work'.",
|
||||
)
|
||||
work_topics_information: Optional[Set[WorkTopicInformation]] = Field(
|
||||
title="Work Topics Information",
|
||||
description="The list of topic information associated with the work represented by this node. This field is only applicable if the category of the node is 'work'.",
|
||||
)
|
||||
|
||||
def __eq__(self, value: object) -> bool:
|
||||
if isinstance(value, WorkNetworkNode):
|
||||
return self.raw_id == value.raw_id
|
||||
return False
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(self.raw_id)
|
||||
|
||||
|
||||
class AuthorNetworkNode(CollaborationNetworkNode):
|
||||
def __eq__(self, value: object) -> bool:
|
||||
if isinstance(value, AuthorNetworkNode):
|
||||
return self.raw_id == value.raw_id
|
||||
return False
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(self.raw_id)
|
||||
|
||||
|
||||
class InstitutionNetworkNode(CollaborationNetworkNode):
|
||||
def __eq__(self, value: object) -> bool:
|
||||
if isinstance(value, InstitutionNetworkNode):
|
||||
return self.raw_id == value.raw_id
|
||||
return False
|
||||
|
||||
def __hash__(self) -> int:
|
||||
return hash(self.raw_id)
|
||||
|
||||
|
||||
class CollaborationNetworkEdge(BaseModel):
|
||||
raw_source_id: str = Field(
|
||||
title="Source Raw ID",
|
||||
@@ -185,13 +251,21 @@ class CollaborationNetwork(BaseModel):
|
||||
title="Raw Person ID",
|
||||
description="The raw person ID of the person whose collaboration network this is.",
|
||||
)
|
||||
nodes: List[CollaborationNetworkNode] = Field(
|
||||
title="Collaboration Network Nodes",
|
||||
description="The nodes in the collaboration network.",
|
||||
work_nodes: List[WorkNetworkNode] = Field(
|
||||
title="Collaboration Network Work Nodes",
|
||||
description="The work nodes in the collaboration network.",
|
||||
)
|
||||
edges: List[CollaborationNetworkEdge] = Field(
|
||||
author_nodes: List[AuthorNetworkNode] = Field(
|
||||
title="Collaboration Network Author Nodes",
|
||||
description="The author nodes in the collaboration network.",
|
||||
)
|
||||
institution_nodes: List[InstitutionNetworkNode] = Field(
|
||||
title="Collaboration Network Institution Nodes",
|
||||
description="The institution nodes in the collaboration network.",
|
||||
)
|
||||
collaboration_edges: List[CollaborationNetworkEdge] = Field(
|
||||
title="Collaboration Network Edges",
|
||||
description="The edges in the collaboration network.",
|
||||
description="The collaboration edges in the collaboration network. A collaboration edge represents a collaboration between two nodes. A -> W and A -> I",
|
||||
)
|
||||
filter_information: FilterInformation = Field(
|
||||
title="Filter Information",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,10 @@ class Settings(BaseSettings):
|
||||
"am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ=="
|
||||
)
|
||||
openalex_works_search_timeout_seconds: float = 30.0
|
||||
# OpenAlex public API config
|
||||
openalex_api_base_url: str = "https://api.openalex.org"
|
||||
openalex_api_key: Optional[str] = None
|
||||
openalex_api_timeout_seconds: float = 30.0
|
||||
|
||||
# LLM config
|
||||
llm_api_url: Optional[str] = None
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Funders domain package.
|
||||
"""
|
||||
@@ -0,0 +1,191 @@
|
||||
#!/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",
|
||||
"abstract_inverted_index",
|
||||
"publication_year",
|
||||
"publication_date",
|
||||
"type",
|
||||
"language",
|
||||
"cited_by_count",
|
||||
"is_retracted",
|
||||
"primary_location.landing_page_url",
|
||||
"primary_location.pdf_url",
|
||||
"primary_location.is_oa",
|
||||
"primary_location.license",
|
||||
"primary_location.source.display_name",
|
||||
"primary_location.source.type",
|
||||
"best_oa_location.landing_page_url",
|
||||
"best_oa_location.pdf_url",
|
||||
"best_oa_location.is_oa",
|
||||
"best_oa_location.license",
|
||||
"best_oa_location.source.display_name",
|
||||
"open_access.oa_url",
|
||||
"open_access.is_oa",
|
||||
"open_access.oa_status",
|
||||
"open_access.any_repository_has_fulltext",
|
||||
"topics.display_name",
|
||||
"topics.score",
|
||||
"primary_topic.display_name",
|
||||
"primary_topic.subfield.display_name",
|
||||
"primary_topic.field.display_name",
|
||||
"primary_topic.domain.display_name",
|
||||
"keywords.display_name",
|
||||
"keywords.score",
|
||||
"counts_by_year.year",
|
||||
"counts_by_year.cited_by_count",
|
||||
"authorships.author.id",
|
||||
"authorships.author.display_name",
|
||||
"authorships.author_position",
|
||||
"authorships.institutions.display_name",
|
||||
"authorships.institutions.country_code",
|
||||
"authorships.countries",
|
||||
"funders.id",
|
||||
"funders.display_name",
|
||||
"funders.ror",
|
||||
"awards.id",
|
||||
"awards.display_name",
|
||||
"awards.funder_id",
|
||||
"awards.funder_display_name",
|
||||
"awards.funder_award_id",
|
||||
"awards.doi",
|
||||
]
|
||||
|
||||
@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()
|
||||
@@ -0,0 +1,554 @@
|
||||
#!/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 _publication_author_names(publication: dict) -> list[str]:
|
||||
names: list[str] = []
|
||||
for authorship in publication.get("authorships", []):
|
||||
author_name = authorship.get("author", {}).get("display_name")
|
||||
if author_name:
|
||||
names.append(author_name)
|
||||
return names
|
||||
|
||||
|
||||
def _unique_strings(values: list[Any], limit: int | None = None) -> list[str]:
|
||||
seen: set[str] = set()
|
||||
unique_values: list[str] = []
|
||||
for value in values:
|
||||
if not value:
|
||||
continue
|
||||
text = str(value).strip()
|
||||
if not text or text in seen:
|
||||
continue
|
||||
seen.add(text)
|
||||
unique_values.append(text)
|
||||
if limit and len(unique_values) >= limit:
|
||||
break
|
||||
return unique_values
|
||||
|
||||
|
||||
def _publication_pdf_url(publication: dict) -> str | None:
|
||||
primary_location = publication.get("primary_location") or {}
|
||||
best_oa_location = publication.get("best_oa_location") or {}
|
||||
return primary_location.get("pdf_url") or best_oa_location.get("pdf_url")
|
||||
|
||||
|
||||
def _publication_source(publication: dict) -> dict:
|
||||
primary_location = publication.get("primary_location") or {}
|
||||
best_oa_location = publication.get("best_oa_location") or {}
|
||||
primary_source = primary_location.get("source") or {}
|
||||
best_oa_source = best_oa_location.get("source") or {}
|
||||
return primary_source or best_oa_source
|
||||
|
||||
|
||||
def _publication_license(publication: dict) -> str | None:
|
||||
primary_location = publication.get("primary_location") or {}
|
||||
best_oa_location = publication.get("best_oa_location") or {}
|
||||
return primary_location.get("license") or best_oa_location.get("license")
|
||||
|
||||
|
||||
def _publication_is_open_access(publication: dict) -> bool:
|
||||
primary_location = publication.get("primary_location") or {}
|
||||
best_oa_location = publication.get("best_oa_location") or {}
|
||||
open_access = publication.get("open_access") or {}
|
||||
return bool(
|
||||
open_access.get("is_oa")
|
||||
or open_access.get("oa_url")
|
||||
or primary_location.get("is_oa")
|
||||
or best_oa_location.get("is_oa")
|
||||
)
|
||||
|
||||
|
||||
def _publication_has_fulltext(publication: dict) -> bool:
|
||||
open_access = publication.get("open_access") or {}
|
||||
return bool(open_access.get("any_repository_has_fulltext") or _publication_pdf_url(publication))
|
||||
|
||||
|
||||
def _publication_topic_names(publication: dict) -> list[str]:
|
||||
topics = publication.get("topics")
|
||||
if not isinstance(topics, list):
|
||||
return []
|
||||
|
||||
sorted_topics = sorted(
|
||||
topics,
|
||||
key=lambda topic: topic.get("score", 0) if isinstance(topic, dict) else 0,
|
||||
reverse=True,
|
||||
)
|
||||
return _unique_strings(
|
||||
[topic.get("display_name") for topic in sorted_topics if isinstance(topic, dict)],
|
||||
limit=6,
|
||||
)
|
||||
|
||||
|
||||
def _publication_keyword_names(publication: dict) -> list[str]:
|
||||
keywords = publication.get("keywords")
|
||||
if not isinstance(keywords, list):
|
||||
return []
|
||||
|
||||
sorted_keywords = sorted(
|
||||
keywords,
|
||||
key=lambda keyword: keyword.get("score", 0) if isinstance(keyword, dict) else 0,
|
||||
reverse=True,
|
||||
)
|
||||
return _unique_strings(
|
||||
[keyword.get("display_name") for keyword in sorted_keywords if isinstance(keyword, dict)],
|
||||
limit=8,
|
||||
)
|
||||
|
||||
|
||||
def _publication_institutions(publication: dict) -> list[str]:
|
||||
institution_names: list[str] = []
|
||||
for authorship in publication.get("authorships", []):
|
||||
if not isinstance(authorship, dict):
|
||||
continue
|
||||
for institution in authorship.get("institutions") or []:
|
||||
if isinstance(institution, dict):
|
||||
institution_names.append(institution.get("display_name"))
|
||||
return _unique_strings(institution_names, limit=8)
|
||||
|
||||
|
||||
def _publication_countries(publication: dict) -> list[str]:
|
||||
countries: list[str] = []
|
||||
for authorship in publication.get("authorships", []):
|
||||
if not isinstance(authorship, dict):
|
||||
continue
|
||||
countries.extend(authorship.get("countries") or [])
|
||||
for institution in authorship.get("institutions") or []:
|
||||
if isinstance(institution, dict):
|
||||
countries.append(institution.get("country_code"))
|
||||
return _unique_strings(countries, limit=8)
|
||||
|
||||
|
||||
def _publication_counts_by_year(publication: dict) -> list[dict[str, int]]:
|
||||
counts_by_year = publication.get("counts_by_year")
|
||||
if not isinstance(counts_by_year, list):
|
||||
return []
|
||||
|
||||
sanitized_counts: list[dict[str, int]] = []
|
||||
for year_count in counts_by_year:
|
||||
if not isinstance(year_count, dict):
|
||||
continue
|
||||
year = year_count.get("year")
|
||||
cited_by_count = year_count.get("cited_by_count")
|
||||
if isinstance(year, int) and isinstance(cited_by_count, int):
|
||||
sanitized_counts.append({"year": year, "cited_by_count": cited_by_count})
|
||||
|
||||
return sorted(sanitized_counts, key=lambda year_count: year_count["year"], reverse=True)[:6]
|
||||
|
||||
|
||||
def _publication_funder_names(publication: dict) -> list[str]:
|
||||
names: list[Any] = []
|
||||
for funder in publication.get("funders", []):
|
||||
if isinstance(funder, dict):
|
||||
names.append(funder.get("display_name"))
|
||||
|
||||
for award in publication.get("awards", []):
|
||||
if isinstance(award, dict):
|
||||
names.append(award.get("funder_display_name"))
|
||||
|
||||
return sorted(_unique_strings(names), key=str.casefold)
|
||||
|
||||
|
||||
def _publication_grant_labels(
|
||||
publication: dict,
|
||||
funder_id: str | None,
|
||||
funder_name: str | None,
|
||||
) -> list[str]:
|
||||
labels: list[str] = []
|
||||
for award in publication.get("awards", []):
|
||||
if not isinstance(award, dict):
|
||||
continue
|
||||
award_funder_id = award.get("funder_id")
|
||||
award_funder_name = award.get("funder_display_name")
|
||||
matches_funder_id = bool(funder_id and award_funder_id == funder_id)
|
||||
matches_funder_name = bool(funder_name and award_funder_name == funder_name)
|
||||
has_funder_reference = bool(award_funder_id or award_funder_name)
|
||||
if has_funder_reference and not (matches_funder_id or matches_funder_name):
|
||||
continue
|
||||
|
||||
display_name = award.get("display_name")
|
||||
if display_name:
|
||||
labels.append(display_name)
|
||||
|
||||
return _unique_strings(labels, limit=6)
|
||||
|
||||
|
||||
def _publication_abstract(publication: dict) -> str | None:
|
||||
inverted_index = publication.get("abstract_inverted_index")
|
||||
if not isinstance(inverted_index, dict):
|
||||
return None
|
||||
|
||||
words: list[tuple[int, str]] = []
|
||||
for word, positions in inverted_index.items():
|
||||
if not isinstance(positions, list):
|
||||
continue
|
||||
for position in positions:
|
||||
if isinstance(position, int):
|
||||
words.append((position, word))
|
||||
|
||||
if not words:
|
||||
return None
|
||||
|
||||
return " ".join(word for _, word in sorted(words))
|
||||
|
||||
|
||||
def _publication_detail_summary(
|
||||
publication: dict,
|
||||
publication_id: str,
|
||||
publication_url: str | None,
|
||||
author_position: str,
|
||||
funder_id: str | None,
|
||||
funder_name: str | None,
|
||||
) -> dict[str, Any]:
|
||||
title = publication.get("title") or publication.get("display_name") or publication_id
|
||||
source = _publication_source(publication)
|
||||
open_access = publication.get("open_access") or {}
|
||||
primary_topic = publication.get("primary_topic") or {}
|
||||
topic_field = primary_topic.get("field") or {}
|
||||
topic_subfield = primary_topic.get("subfield") or {}
|
||||
topic_domain = primary_topic.get("domain") or {}
|
||||
return {
|
||||
"id": publication_id,
|
||||
"title": title,
|
||||
"abstract": _publication_abstract(publication),
|
||||
"doi": publication.get("doi"),
|
||||
"publication_year": publication.get("publication_year"),
|
||||
"publication_date": publication.get("publication_date"),
|
||||
"publication_type": publication.get("type"),
|
||||
"language": publication.get("language"),
|
||||
"publication_url": publication_url,
|
||||
"pdf_url": _publication_pdf_url(publication),
|
||||
"source_name": source.get("display_name"),
|
||||
"source_type": source.get("type"),
|
||||
"is_open_access": _publication_is_open_access(publication),
|
||||
"open_access_status": open_access.get("oa_status"),
|
||||
"has_fulltext": _publication_has_fulltext(publication),
|
||||
"license": _publication_license(publication),
|
||||
"cited_by_count": publication.get("cited_by_count"),
|
||||
"is_retracted": publication.get("is_retracted"),
|
||||
"primary_topic": primary_topic.get("display_name"),
|
||||
"topic_field": topic_field.get("display_name"),
|
||||
"topic_subfield": topic_subfield.get("display_name"),
|
||||
"topic_domain": topic_domain.get("display_name"),
|
||||
"author_position": author_position,
|
||||
"authors": _publication_author_names(publication),
|
||||
"funder_names": _publication_funder_names(publication),
|
||||
"institutions": _publication_institutions(publication),
|
||||
"countries": _publication_countries(publication),
|
||||
"topics": _publication_topic_names(publication),
|
||||
"keywords": _publication_keyword_names(publication),
|
||||
"grant_labels": _publication_grant_labels(publication, funder_id, funder_name),
|
||||
"counts_by_year": _publication_counts_by_year(publication),
|
||||
}
|
||||
|
||||
|
||||
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": {},
|
||||
"publication_titles": {},
|
||||
"publication_details": {},
|
||||
}
|
||||
|
||||
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
|
||||
if publication_id:
|
||||
title = publication.get("display_name") or publication.get("title") or publication_id
|
||||
entry["publication_titles"][publication_id] = title
|
||||
entry["publication_details"][publication_id] = _publication_detail_summary(
|
||||
publication,
|
||||
publication_id,
|
||||
publication_url,
|
||||
author_position,
|
||||
funder_id,
|
||||
funder_name,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
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 PublicationDetailByFunder(BaseModel):
|
||||
id: str
|
||||
title: str
|
||||
abstract: str | None = None
|
||||
doi: str | None = None
|
||||
publication_year: int | None = None
|
||||
publication_date: str | None = None
|
||||
publication_type: str | None = None
|
||||
language: str | None = None
|
||||
publication_url: str | None = None
|
||||
pdf_url: str | None = None
|
||||
source_name: str | None = None
|
||||
source_type: str | None = None
|
||||
is_open_access: bool | None = None
|
||||
open_access_status: str | None = None
|
||||
has_fulltext: bool | None = None
|
||||
license: str | None = None
|
||||
cited_by_count: int | None = None
|
||||
is_retracted: bool | None = None
|
||||
primary_topic: str | None = None
|
||||
topic_field: str | None = None
|
||||
topic_subfield: str | None = None
|
||||
topic_domain: str | None = None
|
||||
author_position: str | None = None
|
||||
authors: list[str] = Field(default_factory=list)
|
||||
funder_names: list[str] = Field(default_factory=list)
|
||||
institutions: list[str] = Field(default_factory=list)
|
||||
countries: list[str] = Field(default_factory=list)
|
||||
topics: list[str] = Field(default_factory=list)
|
||||
keywords: list[str] = Field(default_factory=list)
|
||||
grant_labels: list[str] = Field(default_factory=list)
|
||||
counts_by_year: list[dict[str, Any]] = Field(default_factory=list)
|
||||
|
||||
|
||||
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] = {}
|
||||
publication_titles: dict[str, str] = {}
|
||||
publication_details: dict[str, PublicationDetailByFunder] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class FundersByAuthorResponse(BaseModel):
|
||||
author_id: str
|
||||
author_name: str | None = None
|
||||
funder_count: int
|
||||
funders: list[FunderByAuthor]
|
||||
@@ -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)
|
||||
@@ -0,0 +1,398 @@
|
||||
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,
|
||||
award_display_name: str | None = None,
|
||||
award_number: str | None = None,
|
||||
pdf_url: str | None = None,
|
||||
abstract_inverted_index: dict | None = None,
|
||||
extra_source: dict | 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 abstract_inverted_index:
|
||||
source["abstract_inverted_index"] = abstract_inverted_index
|
||||
if extra_source:
|
||||
source.update(extra_source)
|
||||
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,
|
||||
"display_name": award_display_name,
|
||||
"funder_award_id": award_number,
|
||||
}
|
||||
)
|
||||
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",
|
||||
abstract_inverted_index={
|
||||
"This": [0],
|
||||
"is": [1],
|
||||
"an": [2],
|
||||
"abstract.": [3],
|
||||
},
|
||||
extra_source={
|
||||
"title": "Example publication: full detail",
|
||||
"funders": [
|
||||
{
|
||||
"id": "https://openalex.org/F456",
|
||||
"display_name": "Funder B",
|
||||
}
|
||||
],
|
||||
"publication_year": 2020,
|
||||
"publication_date": "2020-05-10",
|
||||
"type": "article",
|
||||
"language": "en",
|
||||
"cited_by_count": 12,
|
||||
"is_retracted": False,
|
||||
"primary_location": {
|
||||
"pdf_url": "https://example.org/w1.pdf",
|
||||
"is_oa": True,
|
||||
"license": "cc-by",
|
||||
"source": {
|
||||
"display_name": "Example Journal",
|
||||
"type": "journal",
|
||||
},
|
||||
},
|
||||
"open_access": {
|
||||
"is_oa": True,
|
||||
"oa_status": "gold",
|
||||
"any_repository_has_fulltext": True,
|
||||
},
|
||||
"primary_topic": {
|
||||
"display_name": "Clinical Trials",
|
||||
"subfield": {"display_name": "Medicine"},
|
||||
"field": {"display_name": "Health Sciences"},
|
||||
"domain": {"display_name": "Life Sciences"},
|
||||
},
|
||||
"topics": [
|
||||
{"display_name": "Trials", "score": 0.8},
|
||||
{"display_name": "Guidelines", "score": 0.6},
|
||||
],
|
||||
"keywords": [
|
||||
{"display_name": "randomised trials", "score": 0.9},
|
||||
{"display_name": "reporting guideline", "score": 0.7},
|
||||
],
|
||||
"counts_by_year": [
|
||||
{"year": 2024, "cited_by_count": 3},
|
||||
{"year": 2023, "cited_by_count": 2},
|
||||
],
|
||||
},
|
||||
),
|
||||
_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",
|
||||
award_display_name="Project Grant",
|
||||
award_number="PG-42",
|
||||
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 == 2
|
||||
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"
|
||||
publication_detail = response.funders[0].publication_details["https://openalex.org/W1"]
|
||||
assert publication_detail.title == "Example publication: full detail"
|
||||
assert publication_detail.funder_names == ["Funder A", "Funder B"]
|
||||
assert publication_detail.abstract == "This is an abstract."
|
||||
assert publication_detail.publication_date == "2020-05-10"
|
||||
assert publication_detail.publication_type == "article"
|
||||
assert publication_detail.source_name == "Example Journal"
|
||||
assert publication_detail.source_type == "journal"
|
||||
assert publication_detail.is_open_access is True
|
||||
assert publication_detail.open_access_status == "gold"
|
||||
assert publication_detail.has_fulltext is True
|
||||
assert publication_detail.license == "cc-by"
|
||||
assert publication_detail.cited_by_count == 12
|
||||
assert publication_detail.primary_topic == "Clinical Trials"
|
||||
assert publication_detail.topic_field == "Health Sciences"
|
||||
assert publication_detail.topic_subfield == "Medicine"
|
||||
assert publication_detail.topic_domain == "Life Sciences"
|
||||
assert publication_detail.topics == ["Trials", "Guidelines"]
|
||||
assert publication_detail.keywords == ["randomised trials", "reporting guideline"]
|
||||
assert publication_detail.counts_by_year == [
|
||||
{"year": 2024, "cited_by_count": 3},
|
||||
{"year": 2023, "cited_by_count": 2},
|
||||
]
|
||||
assert response.funders[0].publication_details["https://openalex.org/W2"].grant_labels == [
|
||||
"Project Grant"
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_publication_grant_labels_ignore_funder_award_id_without_display_name(monkeypatch):
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"hits": {
|
||||
"total": {"value": 1},
|
||||
"hits": [
|
||||
_funded_publication_hit(
|
||||
"https://openalex.org/W3",
|
||||
funder_id="https://openalex.org/F123",
|
||||
funder_name="Funder A",
|
||||
award_funder_id="https://openalex.org/F123",
|
||||
award_funder_name="Funder A",
|
||||
award_display_name=None,
|
||||
award_number="ANR-12-1234",
|
||||
),
|
||||
],
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
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.funders[0].publication_details["https://openalex.org/W3"].grant_labels == []
|
||||
|
||||
|
||||
@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
|
||||
@@ -0,0 +1 @@
|
||||
"""Institution lookup module."""
|
||||
@@ -0,0 +1,309 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Business logic for OpenAlex institutions.
|
||||
"""
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
from fastapi import HTTPException
|
||||
from pydantic import ValidationError
|
||||
from starlette.status import HTTP_400_BAD_REQUEST
|
||||
from starlette.status import HTTP_502_BAD_GATEWAY
|
||||
|
||||
from inse.models.autocomplete_response import AutocompleteResponse
|
||||
from inse.models.autocomplete_response_meta import AutocompleteResponseMeta
|
||||
from inse.models.autocomplete_response_results_inner import AutocompleteResponseResultsInner
|
||||
from inse.models.institutions_list_response import InstitutionsListResponse
|
||||
from .search_client import OpenAlexInstitutionsClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_VALID_INSTITUTION_TYPES = {
|
||||
"education",
|
||||
"healthcare",
|
||||
"company",
|
||||
"archive",
|
||||
"nonprofit",
|
||||
"government",
|
||||
"facility",
|
||||
"other",
|
||||
}
|
||||
|
||||
|
||||
async def list_institutions(
|
||||
*,
|
||||
search: str | None = None,
|
||||
filter: str | None = None,
|
||||
sort: str | None = None,
|
||||
group_by: str | None = None,
|
||||
per_page: int = 25,
|
||||
page: int | None = 1,
|
||||
cursor: str | None = None,
|
||||
sample: int | None = None,
|
||||
select: str | None = None,
|
||||
client: OpenAlexInstitutionsClient | None = None,
|
||||
) -> InstitutionsListResponse:
|
||||
if sample is not None and (sort or page not in (None, 1)):
|
||||
raise HTTPException(
|
||||
status_code=HTTP_400_BAD_REQUEST,
|
||||
detail="sample cannot be combined with sort or page.",
|
||||
)
|
||||
|
||||
openalex_client = client or OpenAlexInstitutionsClient()
|
||||
|
||||
try:
|
||||
data = await openalex_client.list_institutions(
|
||||
search=search,
|
||||
filter=filter,
|
||||
sort=sort,
|
||||
group_by=group_by,
|
||||
per_page=per_page,
|
||||
page=page,
|
||||
cursor=cursor,
|
||||
sample=sample,
|
||||
select=select,
|
||||
)
|
||||
except httpx.HTTPStatusError as exc:
|
||||
status_code = exc.response.status_code
|
||||
detail = "OpenAlex institutions request failed."
|
||||
try:
|
||||
error_body = exc.response.json()
|
||||
detail = error_body.get("message") or error_body.get("error") or detail
|
||||
except ValueError:
|
||||
if exc.response.text:
|
||||
detail = exc.response.text
|
||||
raise HTTPException(status_code=status_code, detail=detail) from exc
|
||||
except httpx.HTTPError as exc:
|
||||
logger.exception("OpenAlex institutions request failed.")
|
||||
raise HTTPException(
|
||||
status_code=HTTP_502_BAD_GATEWAY,
|
||||
detail="OpenAlex institutions request failed.",
|
||||
) from exc
|
||||
|
||||
try:
|
||||
normalized_data = _normalize_institutions_response(data)
|
||||
return InstitutionsListResponse.from_dict(normalized_data) or InstitutionsListResponse()
|
||||
except ValidationError as exc:
|
||||
logger.exception("OpenAlex institutions response could not be parsed.")
|
||||
raise HTTPException(
|
||||
status_code=HTTP_502_BAD_GATEWAY,
|
||||
detail="OpenAlex institutions response could not be parsed.",
|
||||
) from exc
|
||||
|
||||
|
||||
async def autocomplete_institutions(
|
||||
*,
|
||||
query: str,
|
||||
country_code: str | None = None,
|
||||
institution_type: str | None = None,
|
||||
limit: int = 10,
|
||||
client: OpenAlexInstitutionsClient | None = None,
|
||||
) -> AutocompleteResponse:
|
||||
filters = []
|
||||
if country_code:
|
||||
filters.append(f"country_code:{country_code}")
|
||||
if institution_type:
|
||||
filters.append(f"type:{institution_type}")
|
||||
|
||||
response = await list_institutions(
|
||||
search=query,
|
||||
filter=",".join(filters) if filters else None,
|
||||
sort="works_count:desc",
|
||||
per_page=limit,
|
||||
page=1,
|
||||
select=(
|
||||
"id,ror,display_name,country_code,type,works_count,"
|
||||
"cited_by_count,geo"
|
||||
),
|
||||
client=client,
|
||||
)
|
||||
|
||||
results = []
|
||||
for institution in response.results or []:
|
||||
if not institution.id or not institution.display_name:
|
||||
continue
|
||||
|
||||
hint_parts = []
|
||||
if institution.geo:
|
||||
if institution.geo.city:
|
||||
hint_parts.append(institution.geo.city)
|
||||
if institution.geo.country:
|
||||
hint_parts.append(institution.geo.country)
|
||||
elif institution.country_code:
|
||||
hint_parts.append(institution.country_code)
|
||||
if institution.type:
|
||||
hint_parts.append(institution.type)
|
||||
|
||||
results.append(
|
||||
AutocompleteResponseResultsInner(
|
||||
id=institution.id,
|
||||
display_name=institution.display_name,
|
||||
hint=" · ".join(hint_parts) if hint_parts else None,
|
||||
cited_by_count=institution.cited_by_count,
|
||||
works_count=institution.works_count,
|
||||
entity_type="institution",
|
||||
external_id=institution.ror,
|
||||
)
|
||||
)
|
||||
|
||||
return AutocompleteResponse(
|
||||
meta=AutocompleteResponseMeta(
|
||||
count=response.meta.count if response.meta else len(results),
|
||||
db_response_time_ms=(
|
||||
response.meta.db_response_time_ms if response.meta else None
|
||||
),
|
||||
),
|
||||
results=results,
|
||||
)
|
||||
|
||||
|
||||
def _normalize_institutions_response(data: dict[str, Any]) -> dict[str, Any]:
|
||||
normalized = deepcopy(data)
|
||||
|
||||
meta = normalized.get("meta")
|
||||
if isinstance(meta, dict):
|
||||
for field in ["count", "db_response_time_ms", "page", "per_page", "groups_count"]:
|
||||
meta[field] = _int_or_none(meta.get(field))
|
||||
meta["next_cursor"] = _str_or_none(meta.get("next_cursor"))
|
||||
meta["cost_usd"] = _number_or_none(meta.get("cost_usd"))
|
||||
|
||||
for institution in normalized.get("results") or []:
|
||||
if not isinstance(institution, dict):
|
||||
continue
|
||||
|
||||
for field in [
|
||||
"id",
|
||||
"ror",
|
||||
"display_name",
|
||||
"country_code",
|
||||
"homepage_url",
|
||||
"image_url",
|
||||
"image_thumbnail_url",
|
||||
"works_api_url",
|
||||
]:
|
||||
institution[field] = _str_or_none(institution.get(field))
|
||||
|
||||
institution_type = institution.get("type")
|
||||
if institution_type is not None and institution_type not in _VALID_INSTITUTION_TYPES:
|
||||
institution["type"] = None
|
||||
else:
|
||||
institution["type"] = _str_or_none(institution_type)
|
||||
|
||||
institution["display_name_acronyms"] = _str_list_or_none(
|
||||
institution.get("display_name_acronyms")
|
||||
)
|
||||
institution["display_name_alternatives"] = _str_list_or_none(
|
||||
institution.get("display_name_alternatives")
|
||||
)
|
||||
institution["lineage"] = _str_list_or_none(institution.get("lineage"))
|
||||
institution["works_count"] = _int_or_none(institution.get("works_count"))
|
||||
institution["cited_by_count"] = _int_or_none(institution.get("cited_by_count"))
|
||||
institution["created_date"] = _date_str_or_none(institution.get("created_date"))
|
||||
institution["updated_date"] = _datetime_str_or_none(institution.get("updated_date"))
|
||||
|
||||
summary_stats = institution.get("summary_stats")
|
||||
if isinstance(summary_stats, dict):
|
||||
summary_stats["2yr_mean_citedness"] = _number_or_none(
|
||||
summary_stats.get("2yr_mean_citedness")
|
||||
)
|
||||
summary_stats["h_index"] = _int_or_none(summary_stats.get("h_index"))
|
||||
summary_stats["i10_index"] = _int_or_none(summary_stats.get("i10_index"))
|
||||
|
||||
geo = institution.get("geo")
|
||||
if isinstance(geo, dict):
|
||||
for field in [
|
||||
"city",
|
||||
"geonames_city_id",
|
||||
"region",
|
||||
"country_code",
|
||||
"country",
|
||||
]:
|
||||
geo[field] = _str_or_none(geo.get(field))
|
||||
geo["latitude"] = _number_or_none(geo.get("latitude"))
|
||||
geo["longitude"] = _number_or_none(geo.get("longitude"))
|
||||
|
||||
ids = institution.get("ids")
|
||||
if isinstance(ids, dict):
|
||||
for field in ["openalex", "ror", "grid", "wikipedia", "wikidata"]:
|
||||
ids[field] = _str_or_none(ids.get(field))
|
||||
ids["mag"] = _int_or_none(ids.get("mag"))
|
||||
|
||||
for counts_by_year in institution.get("counts_by_year") or []:
|
||||
if not isinstance(counts_by_year, dict):
|
||||
continue
|
||||
for field in ["year", "works_count", "cited_by_count"]:
|
||||
counts_by_year[field] = _int_or_none(counts_by_year.get(field))
|
||||
|
||||
for group in normalized.get("group_by") or []:
|
||||
if not isinstance(group, dict):
|
||||
continue
|
||||
|
||||
group["key"] = _str_or_none(group.get("key"))
|
||||
group["key_display_name"] = _str_or_none(group.get("key_display_name"))
|
||||
group["count"] = _int_or_none(group.get("count"))
|
||||
|
||||
return normalized
|
||||
|
||||
|
||||
def _str_or_none(value: Any) -> str | None:
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, bool):
|
||||
return str(value).lower()
|
||||
return str(value)
|
||||
|
||||
|
||||
def _str_list_or_none(value: Any) -> list[str] | None:
|
||||
if value is None:
|
||||
return None
|
||||
if not isinstance(value, list):
|
||||
return None
|
||||
return [_str_or_none(item) for item in value if item is not None]
|
||||
|
||||
|
||||
def _int_or_none(value: Any) -> int | None:
|
||||
if value is None or isinstance(value, bool):
|
||||
return None
|
||||
if isinstance(value, int):
|
||||
return value
|
||||
if isinstance(value, float):
|
||||
return int(value)
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
return int(float(value))
|
||||
except ValueError:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def _number_or_none(value: Any) -> int | float | None:
|
||||
if value is None or isinstance(value, bool):
|
||||
return None
|
||||
if isinstance(value, (int, float)):
|
||||
return value
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
number = float(value)
|
||||
except ValueError:
|
||||
return None
|
||||
return int(number) if number.is_integer() else number
|
||||
return None
|
||||
|
||||
|
||||
def _date_str_or_none(value: Any) -> str | None:
|
||||
text = _str_or_none(value)
|
||||
if not text:
|
||||
return None
|
||||
return text[:10]
|
||||
|
||||
|
||||
def _datetime_str_or_none(value: Any) -> str | None:
|
||||
text = _str_or_none(value)
|
||||
if not text:
|
||||
return None
|
||||
if len(text) == 10:
|
||||
return f"{text}T00:00:00Z"
|
||||
return text
|
||||
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
HTTP client for OpenAlex institutions.
|
||||
"""
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from .. import config
|
||||
|
||||
|
||||
class OpenAlexInstitutionsClient:
|
||||
def __init__(
|
||||
self,
|
||||
base_url: 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_api_base_url).rstrip("/")
|
||||
self.api_key = api_key if api_key is not None else config.settings.openalex_api_key
|
||||
self.timeout = timeout if timeout is not None else config.settings.openalex_api_timeout_seconds
|
||||
self.transport = transport
|
||||
|
||||
def list_institutions_params(
|
||||
self,
|
||||
*,
|
||||
search: str | None = None,
|
||||
filter: str | None = None,
|
||||
sort: str | None = None,
|
||||
group_by: str | None = None,
|
||||
per_page: int = 25,
|
||||
page: int | None = 1,
|
||||
cursor: str | None = None,
|
||||
sample: int | None = None,
|
||||
select: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {"per_page": per_page}
|
||||
|
||||
if search:
|
||||
params["search"] = search
|
||||
if filter:
|
||||
params["filter"] = filter
|
||||
if sort:
|
||||
params["sort"] = sort
|
||||
if group_by:
|
||||
params["group_by"] = group_by
|
||||
if cursor:
|
||||
params["cursor"] = cursor
|
||||
elif page is not None:
|
||||
params["page"] = page
|
||||
if sample is not None:
|
||||
params["sample"] = sample
|
||||
if select:
|
||||
params["select"] = select
|
||||
if self.api_key:
|
||||
params["api_key"] = self.api_key
|
||||
|
||||
return params
|
||||
|
||||
async def list_institutions(
|
||||
self,
|
||||
*,
|
||||
search: str | None = None,
|
||||
filter: str | None = None,
|
||||
sort: str | None = None,
|
||||
group_by: str | None = None,
|
||||
per_page: int = 25,
|
||||
page: int | None = 1,
|
||||
cursor: str | None = None,
|
||||
sample: int | None = None,
|
||||
select: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
async with httpx.AsyncClient(
|
||||
base_url=self.base_url,
|
||||
timeout=self.timeout,
|
||||
transport=self.transport,
|
||||
) as client:
|
||||
response = await client.get(
|
||||
"/institutions",
|
||||
params=self.list_institutions_params(
|
||||
search=search,
|
||||
filter=filter,
|
||||
sort=sort,
|
||||
group_by=group_by,
|
||||
per_page=per_page,
|
||||
page=page,
|
||||
cursor=cursor,
|
||||
sample=sample,
|
||||
select=select,
|
||||
),
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
REST API for OpenAlex institutions.
|
||||
"""
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi import Query
|
||||
|
||||
from inse.models.autocomplete_response import AutocompleteResponse
|
||||
from inse.models.institutions_list_response import InstitutionsListResponse
|
||||
from inse.tags import Tags
|
||||
from . import logic
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/institutions", tags=[Tags.INSTITUTIONS])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/autocomplete",
|
||||
operation_id="autocompleteInstitutions",
|
||||
response_model=AutocompleteResponse,
|
||||
response_model_exclude_none=True,
|
||||
summary="Returns institution options for autocomplete inputs.",
|
||||
)
|
||||
async def autocomplete_institutions(
|
||||
query: Annotated[
|
||||
str,
|
||||
Query(description="Institution search text, for example 'Duisburg Essen'.", min_length=1),
|
||||
],
|
||||
country_code: Annotated[
|
||||
str | None,
|
||||
Query(alias="countryCode", description="Optional ISO country code filter."),
|
||||
] = None,
|
||||
institution_type: Annotated[
|
||||
str | None,
|
||||
Query(alias="type", description="Optional institution type filter."),
|
||||
] = None,
|
||||
limit: Annotated[
|
||||
int,
|
||||
Query(description="Maximum number of autocomplete options.", ge=1, le=25),
|
||||
] = 10,
|
||||
):
|
||||
return await logic.autocomplete_institutions(
|
||||
query=query,
|
||||
country_code=country_code,
|
||||
institution_type=institution_type,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"",
|
||||
operation_id="listInstitutions",
|
||||
response_model=InstitutionsListResponse,
|
||||
response_model_exclude_none=True,
|
||||
summary="Returns a list of OpenAlex institutions.",
|
||||
)
|
||||
async def list_institutions(
|
||||
search: Annotated[
|
||||
str | None,
|
||||
Query(description="Full-text search, for example 'Duisburg Essen'."),
|
||||
] = None,
|
||||
filter: Annotated[
|
||||
str | None,
|
||||
Query(description="OpenAlex filter, for example 'country_code:DE,type:education'."),
|
||||
] = None,
|
||||
sort: Annotated[
|
||||
str | None,
|
||||
Query(description="Sort field, for example 'works_count:desc'."),
|
||||
] = "works_count:desc",
|
||||
group_by: Annotated[
|
||||
str | None,
|
||||
Query(description="OpenAlex group_by field, for example 'country_code'."),
|
||||
] = None,
|
||||
per_page: Annotated[
|
||||
int,
|
||||
Query(description="Results per page.", ge=1, le=100),
|
||||
] = 25,
|
||||
page: Annotated[
|
||||
int | None,
|
||||
Query(description="Page number. Use cursor for deep pagination.", ge=1),
|
||||
] = 1,
|
||||
cursor: Annotated[
|
||||
str | None,
|
||||
Query(description="Cursor pagination token. Use '*' to start."),
|
||||
] = None,
|
||||
sample: Annotated[
|
||||
int | None,
|
||||
Query(description="Random sample size. Cannot be combined with sort or page.", ge=1, le=10000),
|
||||
] = None,
|
||||
select: Annotated[
|
||||
str | None,
|
||||
Query(description="Comma-separated fields to return."),
|
||||
] = None,
|
||||
):
|
||||
return await logic.list_institutions(
|
||||
search=search,
|
||||
filter=filter,
|
||||
sort=sort,
|
||||
group_by=group_by,
|
||||
per_page=per_page,
|
||||
page=page,
|
||||
cursor=cursor,
|
||||
sample=sample,
|
||||
select=select,
|
||||
)
|
||||
@@ -0,0 +1,236 @@
|
||||
import httpx
|
||||
import pytest
|
||||
from fastapi import HTTPException
|
||||
|
||||
from inse.institutions import logic
|
||||
from inse.institutions.search_client import OpenAlexInstitutionsClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_institutions_maps_openalex_response_to_model():
|
||||
def handler(_: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "page": 1, "per_page": 25},
|
||||
"results": [
|
||||
{
|
||||
"id": "https://openalex.org/I123",
|
||||
"ror": "https://ror.org/04mz5ra38",
|
||||
"display_name": "University of Duisburg-Essen",
|
||||
"country_code": "DE",
|
||||
"type": "education",
|
||||
"homepage_url": "https://www.uni-due.de",
|
||||
"image_url": "https://example.org/image.jpg",
|
||||
"image_thumbnail_url": "https://example.org/thumb.jpg",
|
||||
"display_name_acronyms": ["UDE"],
|
||||
"display_name_alternatives": ["Universitaet Duisburg-Essen"],
|
||||
"works_count": 123,
|
||||
"cited_by_count": 456,
|
||||
"summary_stats": {
|
||||
"2yr_mean_citedness": 1.5,
|
||||
"h_index": 42,
|
||||
"i10_index": 99,
|
||||
},
|
||||
"geo": {
|
||||
"city": "Duisburg",
|
||||
"geonames_city_id": "2934691",
|
||||
"region": "North Rhine-Westphalia",
|
||||
"country_code": "DE",
|
||||
"country": "Germany",
|
||||
"latitude": 51.4344,
|
||||
"longitude": 6.7623,
|
||||
},
|
||||
"lineage": ["https://openalex.org/I123"],
|
||||
"ids": {
|
||||
"openalex": "https://openalex.org/I123",
|
||||
"ror": "https://ror.org/04mz5ra38",
|
||||
"mag": 123,
|
||||
"grid": "grid.12345.6",
|
||||
"wikipedia": "https://en.wikipedia.org/wiki/University_of_Duisburg-Essen",
|
||||
"wikidata": "https://www.wikidata.org/wiki/Q317070",
|
||||
},
|
||||
"counts_by_year": [
|
||||
{
|
||||
"year": 2024,
|
||||
"works_count": 12,
|
||||
"cited_by_count": 34,
|
||||
}
|
||||
],
|
||||
"works_api_url": "https://api.openalex.org/works?filter=institutions.id:I123",
|
||||
"created_date": "2023-12-25",
|
||||
"updated_date": "2023-11-07T05:31:56Z",
|
||||
}
|
||||
],
|
||||
"group_by": [
|
||||
{
|
||||
"key": "DE",
|
||||
"key_display_name": "Germany",
|
||||
"count": 1,
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexInstitutionsClient(
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await logic.list_institutions(search="Duisburg Essen", client=client)
|
||||
|
||||
assert result.meta.count == 1
|
||||
institution = result.results[0]
|
||||
assert institution.display_name == "University of Duisburg-Essen"
|
||||
assert institution.summary_stats.h_index == 42
|
||||
assert institution.geo.country == "Germany"
|
||||
assert institution.ids.mag == 123
|
||||
assert institution.counts_by_year[0].year == 2024
|
||||
assert result.group_by[0].key_display_name == "Germany"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_institutions_rejects_sample_with_sort():
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
await logic.list_institutions(sample=10, sort="works_count:desc")
|
||||
|
||||
assert exc_info.value.status_code == 400
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_institutions_accepts_practical_openalex_type_variants():
|
||||
def handler(_: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "page": 1, "per_page": 25},
|
||||
"results": [
|
||||
{
|
||||
"id": 123,
|
||||
"ror": 456,
|
||||
"display_name": "Example Institute",
|
||||
"country_code": 789,
|
||||
"type": "unknown-openalex-type",
|
||||
"display_name_acronyms": ["EI", 123],
|
||||
"display_name_alternatives": "not-a-list",
|
||||
"works_count": "12",
|
||||
"cited_by_count": "34.0",
|
||||
"summary_stats": {
|
||||
"2yr_mean_citedness": "1.25",
|
||||
"h_index": "10.0",
|
||||
"i10_index": True,
|
||||
},
|
||||
"geo": {
|
||||
"city": 123,
|
||||
"geonames_city_id": 12345,
|
||||
"latitude": "51.4",
|
||||
"longitude": "6",
|
||||
},
|
||||
"ids": {"openalex": 123, "mag": "123"},
|
||||
"counts_by_year": [
|
||||
{
|
||||
"year": "2024",
|
||||
"works_count": "12.0",
|
||||
"cited_by_count": False,
|
||||
}
|
||||
],
|
||||
"created_date": "2023-12-25T10:11:12Z",
|
||||
"updated_date": "2023-12-25",
|
||||
}
|
||||
],
|
||||
"group_by": [{"key": True, "count": 1}],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexInstitutionsClient(
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await logic.list_institutions(client=client)
|
||||
|
||||
assert result.results[0].id == "123"
|
||||
assert result.results[0].ror == "456"
|
||||
assert result.results[0].country_code == "789"
|
||||
assert result.results[0].type is None
|
||||
assert result.results[0].display_name_acronyms == ["EI", "123"]
|
||||
assert result.results[0].display_name_alternatives is None
|
||||
assert result.results[0].works_count == 12
|
||||
assert result.results[0].cited_by_count == 34
|
||||
assert result.results[0].summary_stats.var_2yr_mean_citedness == 1.25
|
||||
assert result.results[0].summary_stats.h_index == 10
|
||||
assert result.results[0].summary_stats.i10_index is None
|
||||
assert result.results[0].geo.city == "123"
|
||||
assert result.results[0].geo.geonames_city_id == "12345"
|
||||
assert result.results[0].geo.latitude == 51.4
|
||||
assert result.results[0].geo.longitude == 6
|
||||
assert result.results[0].ids.openalex == "123"
|
||||
assert result.results[0].ids.mag == 123
|
||||
assert result.results[0].counts_by_year[0].year == 2024
|
||||
assert result.results[0].counts_by_year[0].works_count == 12
|
||||
assert result.results[0].counts_by_year[0].cited_by_count is None
|
||||
assert result.group_by[0].key == "true"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_autocomplete_institutions_returns_frontend_options():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
assert request.url.params["search"] == "Duisburg Essen"
|
||||
assert request.url.params["filter"] == "country_code:DE,type:education"
|
||||
assert request.url.params["sort"] == "works_count:desc"
|
||||
assert request.url.params["per_page"] == "5"
|
||||
assert request.url.params["select"] == (
|
||||
"id,ror,display_name,country_code,type,works_count,"
|
||||
"cited_by_count,geo"
|
||||
)
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "db_response_time_ms": 12},
|
||||
"results": [
|
||||
{
|
||||
"id": "https://openalex.org/I123",
|
||||
"ror": "https://ror.org/04mz5ra38",
|
||||
"display_name": "University of Duisburg-Essen",
|
||||
"country_code": "DE",
|
||||
"type": "education",
|
||||
"works_count": 123,
|
||||
"cited_by_count": 456,
|
||||
"geo": {
|
||||
"city": "Duisburg",
|
||||
"country": "Germany",
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexInstitutionsClient(
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await logic.autocomplete_institutions(
|
||||
query="Duisburg Essen",
|
||||
country_code="DE",
|
||||
institution_type="education",
|
||||
limit=5,
|
||||
client=client,
|
||||
)
|
||||
|
||||
assert result.meta.count == 1
|
||||
assert result.meta.db_response_time_ms == 12
|
||||
assert len(result.results) == 1
|
||||
option = result.results[0]
|
||||
assert option.id == "https://openalex.org/I123"
|
||||
assert option.display_name == "University of Duisburg-Essen"
|
||||
assert option.hint == "Duisburg · Germany · education"
|
||||
assert option.works_count == 123
|
||||
assert option.cited_by_count == 456
|
||||
assert option.entity_type == "institution"
|
||||
assert option.external_id == "https://ror.org/04mz5ra38"
|
||||
@@ -0,0 +1,77 @@
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from inse.institutions.search_client import OpenAlexInstitutionsClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
def test_list_institutions_params_include_openalex_query_parameters():
|
||||
client = OpenAlexInstitutionsClient(api_key="test-key")
|
||||
|
||||
params = client.list_institutions_params(
|
||||
search="Duisburg Essen",
|
||||
filter="country_code:DE,type:education",
|
||||
sort="works_count:desc",
|
||||
group_by="country_code",
|
||||
per_page=10,
|
||||
page=2,
|
||||
select="id,display_name",
|
||||
)
|
||||
|
||||
assert params == {
|
||||
"search": "Duisburg Essen",
|
||||
"filter": "country_code:DE,type:education",
|
||||
"sort": "works_count:desc",
|
||||
"group_by": "country_code",
|
||||
"per_page": 10,
|
||||
"page": 2,
|
||||
"select": "id,display_name",
|
||||
"api_key": "test-key",
|
||||
}
|
||||
|
||||
|
||||
def test_list_institutions_params_prefers_cursor_over_page():
|
||||
client = OpenAlexInstitutionsClient(api_key="test-key")
|
||||
|
||||
params = client.list_institutions_params(cursor="*", page=3)
|
||||
|
||||
assert params["cursor"] == "*"
|
||||
assert "page" not in params
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_institutions_calls_openalex_institutions_endpoint():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
assert request.method == "GET"
|
||||
assert request.url.path == "/institutions"
|
||||
assert request.url.params["search"] == "Duisburg Essen"
|
||||
assert request.url.params["api_key"] == "test-key"
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "page": 1, "per_page": 25},
|
||||
"results": [
|
||||
{
|
||||
"id": "https://openalex.org/I123",
|
||||
"display_name": "University of Duisburg-Essen",
|
||||
"country_code": "DE",
|
||||
"type": "education",
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexInstitutionsClient(
|
||||
base_url="https://api.openalex.org",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await client.list_institutions(search="Duisburg Essen")
|
||||
|
||||
assert result["meta"]["count"] == 1
|
||||
assert result["results"][0]["display_name"] == "University of Duisburg-Essen"
|
||||
@@ -5,9 +5,15 @@ from .. import config
|
||||
|
||||
def search(
|
||||
index: str,
|
||||
query_field: Optional[str] = None,
|
||||
query_value: Optional[str] = None,
|
||||
payload: Optional[dict[str, Any]] = None,
|
||||
query_field: str = None,
|
||||
query_value: str = None,
|
||||
query: dict = None,
|
||||
source = None,
|
||||
size: int = None,
|
||||
offset:int = None,
|
||||
sort: list = None,
|
||||
body: dict = None,
|
||||
track_total_hits = False
|
||||
) -> dict[str, Any]:
|
||||
|
||||
headers = {
|
||||
@@ -15,7 +21,21 @@ def search(
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
if payload is None:
|
||||
if body is not None:
|
||||
payload = body
|
||||
elif query is not None:
|
||||
payload = {"query": query}
|
||||
if source is not None:
|
||||
payload["_source"] = source
|
||||
if size is not None:
|
||||
payload["size"] = size
|
||||
if offset is not None:
|
||||
payload["from"] = offset
|
||||
if sort is not None:
|
||||
payload["sort"] = sort
|
||||
if track_total_hits:
|
||||
payload["track_total_hits"] = True
|
||||
else:
|
||||
payload = {
|
||||
"query": {
|
||||
"query_string": {
|
||||
@@ -27,9 +47,34 @@ def search(
|
||||
|
||||
with httpx.Client() as client:
|
||||
response = client.post(
|
||||
f"{config.settings.elasticsearch_url.rstrip('/')}/{index}/_search",
|
||||
f"{config.settings.elasticsearch_url}/{index}/_search",
|
||||
json=payload,
|
||||
headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
def get(
|
||||
index: str,
|
||||
doc_id: str,
|
||||
source: list = None,
|
||||
) -> dict[str, Any]:
|
||||
|
||||
headers = {
|
||||
"Authorization": f"ApiKey {config.settings.elasticsearch_api_key}",
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
params = {}
|
||||
if source is not None:
|
||||
params["_source_includes"] = ",".join(source)
|
||||
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{config.settings.elasticsearch_url}/{index}/_doc/{doc_id}",
|
||||
params=params,
|
||||
headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
|
||||
|
||||
@@ -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."
|
||||
)
|
||||
|
||||
+58
-274
@@ -12,23 +12,14 @@ from typing import Type
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy import func
|
||||
from fastapi import HTTPException
|
||||
import logging
|
||||
import httpx
|
||||
import json
|
||||
import time
|
||||
from . import schema
|
||||
from . import model
|
||||
from . import config
|
||||
from .integrations import elasticsearch
|
||||
from .integrations import llm
|
||||
from . import util
|
||||
from elasticsearch import Elasticsearch, helpers, NotFoundError, ApiError
|
||||
|
||||
|
||||
from inse.models.author import Author
|
||||
from inse.models.authors_list_response import AuthorsListResponse
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.topic import Topic
|
||||
from inse.models.topic_subfield import TopicSubfield
|
||||
from inse.models.topic_field import TopicField
|
||||
@@ -38,26 +29,11 @@ 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"
|
||||
|
||||
S = TypeVar("S", bound=schema.Base)
|
||||
M = TypeVar("M", bound=model.BaseModel)
|
||||
|
||||
S = TypeVar('S', bound=schema.Base)
|
||||
M = TypeVar('M', bound=model.BaseModel)
|
||||
|
||||
def filter_none():
|
||||
return True
|
||||
@@ -114,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:
|
||||
@@ -251,252 +231,56 @@ def count_topic_hierarchy(topic_names: List[str]) -> dict:
|
||||
|
||||
return counts
|
||||
|
||||
|
||||
### persons
|
||||
|
||||
|
||||
def list_persons(
|
||||
page_offset: int = 0,
|
||||
page_size: int = 20,
|
||||
query: Optional[str] = None,
|
||||
include: Optional[set[str]] = None,
|
||||
) -> AuthorsListResponse:
|
||||
payload = _author_list_query(page_offset, page_size, query)
|
||||
data = elasticsearch.search(index="openalex-authors", payload=payload)
|
||||
hits = data.get("hits", {}).get("hits", [])
|
||||
persons = [util.get_persons_data(hit) for hit in hits]
|
||||
total = _extract_total_hits(data)
|
||||
return AuthorsListResponse(
|
||||
results=persons,
|
||||
meta=Meta(
|
||||
count=total,
|
||||
page=page_offset // page_size + 1 if page_size > 0 else 1,
|
||||
per_page=page_size,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def _author_list_query(
|
||||
page_offset: int, page_size: int, query: Optional[str] = None
|
||||
) -> dict:
|
||||
search_query = {"match_all": {}}
|
||||
if query:
|
||||
search_query = {
|
||||
"query_string": {
|
||||
"fields": [
|
||||
"display_name^3",
|
||||
"display_name_alternatives",
|
||||
"_id",
|
||||
"ids.orcid",
|
||||
],
|
||||
"query": query,
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
"from": page_offset,
|
||||
"size": page_size,
|
||||
"query": search_query,
|
||||
"sort": [
|
||||
{"works_count": {"order": "desc", "missing": "_last"}},
|
||||
{"cited_by_count": {"order": "desc", "missing": "_last"}},
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def _extract_total_hits(data: dict) -> int:
|
||||
total = data.get("hits", {}).get("total", 0)
|
||||
if isinstance(total, dict):
|
||||
return total.get("value", 0)
|
||||
return total
|
||||
|
||||
|
||||
def search_persons(
|
||||
author_id: Optional[str] = None,
|
||||
query: Optional[str] = None,
|
||||
include: Optional[set[str]] = None,
|
||||
) -> AuthorsListResponse:
|
||||
if author_id:
|
||||
query_field = "_id"
|
||||
query_value = author_id
|
||||
elif query:
|
||||
query_field = "display_name"
|
||||
query_value = query
|
||||
else:
|
||||
return AuthorsListResponse(results=[], meta=Meta(count=0))
|
||||
|
||||
data = elasticsearch.search(
|
||||
index="openalex-authors", query_field=query_field, query_value=query_value
|
||||
)
|
||||
|
||||
authors = []
|
||||
for hit in data.get("hits", {}).get("hits", []):
|
||||
source = hit.get("_source", {})
|
||||
source_copy = dict(source)
|
||||
source_copy["id"] = source_copy.get("id") or hit.get("_id", "")
|
||||
|
||||
# Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated)
|
||||
ids = source_copy.get("ids")
|
||||
if isinstance(ids, dict):
|
||||
ids_copy = dict(ids)
|
||||
for str_field in ["openalex", "orcid", "scopus"]:
|
||||
val = ids_copy.get(str_field)
|
||||
if val is not None and not isinstance(val, str):
|
||||
ids_copy[str_field] = str(val)
|
||||
source_copy["ids"] = ids_copy
|
||||
|
||||
author = Author.from_dict(source_copy)
|
||||
if author:
|
||||
authors.append(author)
|
||||
|
||||
return AuthorsListResponse(results=authors, meta=Meta(count=len(authors)))
|
||||
|
||||
|
||||
def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str:
|
||||
start_time = time.time()
|
||||
search_result = search_persons(author_id=author_id)
|
||||
if not search_result.results:
|
||||
return "No person found."
|
||||
if len(search_result.results) > 1:
|
||||
return "Multiple persons found, cannot generate bio."
|
||||
|
||||
person = search_result.results[0]
|
||||
person_json = json.dumps(person.model_dump_json())
|
||||
|
||||
system_prompt = """\
|
||||
Erstelle auf Basis der bereitgestellten OpenAlex-Daten ein kurzes Porträt der Person in 3-5 Sätzen. Die Person selbst ist das Subjekt: Beginne mit ihrem Namen und beschreibe sie als Forschende:n (z. B. „{name} ist ein:e Forscher:in im Bereich …"). Schreibe nicht über „die Forschung" oder „die Arbeit" im Abstrakten, sondern durchgehend über die Person.
|
||||
|
||||
Gehe dabei auf folgende drei Punkte ein:
|
||||
|
||||
1. Besonderheiten: Was hebt die Person im Vergleich zu anderen Forschenden ähnlicher Karrierephase und ähnlichen Feldes hervor? (z. B. überdurchschnittlicher Impact gemessen an der aktiven Zeit, hoher Erst-/Korrespondenzautor-Anteil, einzelnes Breakout-Paper, frühe Positionierung in einem später gewachsenen Thema)
|
||||
2. Wirtschaftliche Relevanz: Arbeitet die Person in einem grundsätzlich anwendungsnahen/kommerziell interessanten Themenfeld oder eher in der Grundlagenforschung?
|
||||
3. Dynamik: Entwickelt sich ihr Publikations-/Zitationsverlauf zuletzt steigend, konstant oder abflachend?
|
||||
|
||||
Stütze jede Aussage auf konkrete Werte aus den Daten und formuliere nichts, was sich nicht belegen lässt. Wenn die Daten für einen Punkt keine klare Aussage zulassen, formuliere ihn entsprechend zurückhaltend oder lasse ihn weg, statt zu spekulieren. Gib nur das Porträt zurück, ohne Einleitung oder Schluss.\
|
||||
def get_topic_hierarchy() -> dict:
|
||||
"""
|
||||
|
||||
user_prompt = f"Daten zur Person:\n{person_json}"
|
||||
|
||||
headers = {
|
||||
"Authorization": f"Bearer {config.settings.llm_api_key}",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
payload = {
|
||||
"model": config.settings.llm_model,
|
||||
"prompt": f"{system_prompt}\n{user_prompt}",
|
||||
"stream": False,
|
||||
}
|
||||
|
||||
with httpx.Client(timeout=30.0) as client:
|
||||
response = client.post(
|
||||
config.settings.llm_api_url, json=payload, headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
data = response.json()
|
||||
bio = data.get("response", "")
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
logger.info(
|
||||
f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds"
|
||||
)
|
||||
|
||||
return bio
|
||||
|
||||
|
||||
def get_person_by_id(
|
||||
author_id: str, include: Optional[str] = None
|
||||
) -> AuthorsListResponse:
|
||||
try:
|
||||
hit = es_client.get(
|
||||
index="openalex-authors",
|
||||
id=author_id,
|
||||
source=include.split(",") if include else True,
|
||||
)
|
||||
|
||||
except NotFoundError:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"Person with id {author_id} not found"
|
||||
)
|
||||
|
||||
except ApiError as e:
|
||||
raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}")
|
||||
persons = [util.get_persons_data(hit)]
|
||||
|
||||
return AuthorsListResponse(results=persons)
|
||||
|
||||
|
||||
def search_persons_by_name(
|
||||
author_name: str, limit: Optional[int] = 10, include: Optional[str] = None
|
||||
) -> AuthorsListResponse:
|
||||
if not author_name:
|
||||
raise HTTPException(status_code=400, detail="name must be provided")
|
||||
|
||||
search_query = {
|
||||
"bool": {
|
||||
"should": [
|
||||
{"match_phrase": {"display_name": {"query": author_name, "boost": 5}}},
|
||||
{
|
||||
"match_phrase_prefix": {
|
||||
"display_name": {"query": author_name, "boost": 3}
|
||||
}
|
||||
},
|
||||
{"match": {"display_name": {"query": author_name, "fuzziness": 1}}},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
}
|
||||
try:
|
||||
response = es_client.search(
|
||||
index="openalex-authors",
|
||||
query=search_query,
|
||||
source=include.split(",") if include else True,
|
||||
size=limit,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Elasticsearch search failed: {str(e)}"
|
||||
)
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
persons = [util.get_persons_data(hit) for hit in hits]
|
||||
|
||||
return AuthorsListResponse(results=persons)
|
||||
|
||||
|
||||
def search_persons_by_institution(
|
||||
institution_name: str, limit: Optional[int] = 10, include: Optional[str] = None
|
||||
) -> AuthorsListResponse:
|
||||
|
||||
if not institution_name:
|
||||
raise HTTPException(status_code=400, detail="institution_name must be provided")
|
||||
|
||||
search_query = {
|
||||
"nested": {
|
||||
"path": "affiliations",
|
||||
"query": {
|
||||
"match_phrase": {
|
||||
"affiliations.institution.display_name": institution_name
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
print(include, institution_name)
|
||||
try:
|
||||
response = es_client.search(
|
||||
index="openalex-authors",
|
||||
source=include.split(",") if include else True,
|
||||
query=search_query,
|
||||
size=limit,
|
||||
sort=[{"works_count": {"order": "desc"}}],
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Elasticsearch search failed: {str(e)}"
|
||||
)
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
persons = [util.get_persons_data(hit) for hit in hits]
|
||||
return AuthorsListResponse(results=persons)
|
||||
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}
|
||||
|
||||
@@ -11,7 +11,11 @@ from fastapi import FastAPI
|
||||
from fastapi.responses import RedirectResponse
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from inse.collaboration_network.router import router as collaboration_network_router
|
||||
from inse.institutions.service import router as institutions_service_router
|
||||
from inse.topics.service import router as topics_service_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
|
||||
@@ -31,7 +35,11 @@ app = FastAPI(
|
||||
servers=settings.servers,
|
||||
)
|
||||
app.include_router(collaboration_network_router)
|
||||
app.include_router(institutions_service_router)
|
||||
app.include_router(topics_service_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)
|
||||
|
||||
|
||||
@@ -36,5 +36,5 @@ class Page(BaseModel, Generic[T]):
|
||||
class ItemPage(Page[Item]):
|
||||
pass
|
||||
|
||||
class PersonBio(BaseModel):
|
||||
bio: str = Field(description="The generated biography.")
|
||||
|
||||
|
||||
|
||||
@@ -125,4 +125,4 @@ from inse.models.work_types_list_response import WorkTypesListResponse
|
||||
from inse.models.works_list_response import WorksListResponse
|
||||
from inse.models.work_page import WorkPage
|
||||
|
||||
|
||||
from inse.models.lsf_person import LsfPerson
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
|
||||
|
||||
class Function(BaseModel):
|
||||
facility: StrictStr = Field(description="The facility of the function.")
|
||||
function: StrictStr = Field(description="The name of the function.")
|
||||
|
||||
|
||||
class LsfPerson(BaseModel):
|
||||
lsf_id: StrictStr = Field(description="The LSF ID of the person.")
|
||||
name: StrictStr = Field(description="The name of the person.")
|
||||
firstname: StrictStr = Field(description="The first name of the person.")
|
||||
surname: StrictStr = Field(description="The last name of the person.")
|
||||
title: Optional[StrictStr] = Field(
|
||||
default=None, description="The title of the person."
|
||||
)
|
||||
location: Optional[StrictStr] = Field(
|
||||
default=None, description="The location of the person."
|
||||
)
|
||||
room: Optional[StrictStr] = Field(
|
||||
default=None, description="The room of the person."
|
||||
)
|
||||
telefon: Optional[StrictStr] = Field(
|
||||
default=None, description="The telephone number of the person."
|
||||
)
|
||||
telefax: Optional[StrictStr] = Field(
|
||||
default=None, description="The telefax number of the person."
|
||||
)
|
||||
mail: Optional[StrictStr] = Field(
|
||||
default=None, description="The email address of the person."
|
||||
)
|
||||
website: Optional[StrictStr] = Field(
|
||||
default=None, description="The website of the person."
|
||||
)
|
||||
affiliation_university: Optional[StrictStr] = Field(
|
||||
default=None, description="The university affiliation of the person."
|
||||
)
|
||||
affiliation_faculty: Optional[StrictStr] = Field(
|
||||
default=None, description="The faculty affiliation of the person."
|
||||
)
|
||||
affiliation_institute: Optional[StrictStr] = Field(
|
||||
default=None, description="The institute affiliation of the person."
|
||||
)
|
||||
affiliation_chair: Optional[StrictStr] = Field(
|
||||
default=None, description="The chair affiliation of the person."
|
||||
)
|
||||
functions: List[Function] = Field(description="The functions of the person.")
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "LsfPerson":
|
||||
functions_data = data.get("functions", [])
|
||||
functions = [Function(**func) for func in functions_data]
|
||||
return cls(
|
||||
lsf_id=data.get("lsf_id", ""),
|
||||
name=data.get("name", ""),
|
||||
firstname=data.get("firstname", ""),
|
||||
surname=data.get("surname", ""),
|
||||
title=data.get("title"),
|
||||
location=data.get("location"),
|
||||
room=data.get("room"),
|
||||
telefon=data.get("telefon"),
|
||||
telefax=data.get("telefax"),
|
||||
mail=data.get("mail"),
|
||||
website=data.get("website"),
|
||||
affiliation_university=data.get("affiliation_university"),
|
||||
affiliation_faculty=data.get("affiliation_faculty"),
|
||||
affiliation_institute=data.get("affiliation_institute"),
|
||||
affiliation_chair=data.get("affiliation_chair"),
|
||||
functions=functions,
|
||||
)
|
||||
@@ -0,0 +1,10 @@
|
||||
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.")
|
||||
description: Optional[str] = Field(default=None, description="The topic description.")
|
||||
@@ -0,0 +1,25 @@
|
||||
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.")
|
||||
is_limited: bool = Field(
|
||||
default=False,
|
||||
description="True if the timeline contains only a limited subset of the author's publications.",
|
||||
)
|
||||
used_publications: int = Field(
|
||||
default=0,
|
||||
description="The number of publications used to build the timeline.",
|
||||
)
|
||||
total_publications: int = Field(
|
||||
default=0,
|
||||
description="The total number of publications found for this author.",
|
||||
)
|
||||
@@ -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.")
|
||||
@@ -0,0 +1,105 @@
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
|
||||
|
||||
class UdeStaff(BaseModel):
|
||||
research_interests: Union[List[StrictStr], StrictStr] = Field(
|
||||
description="Research interests of the staff member"
|
||||
)
|
||||
keywords: List[StrictStr] = Field(
|
||||
description="Keywords associated with the staff member"
|
||||
)
|
||||
telefon: StrictStr = Field(description="Phone number of the staff member")
|
||||
name: StrictStr = Field(description="Name of the staff member")
|
||||
links: List[StrictStr] = Field(description="Links associated with the staff member")
|
||||
email: StrictStr = Field(description="Email address of the staff member")
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "UdeStaff":
|
||||
return cls(
|
||||
research_interests=data.get("research_interests", ""),
|
||||
keywords=data.get("keywords", []),
|
||||
telefon=data.get("telefon", ""),
|
||||
name=data.get("name", ""),
|
||||
links=data.get("links", []),
|
||||
email=data.get("email", ""),
|
||||
)
|
||||
|
||||
|
||||
class UdeProject(BaseModel):
|
||||
project_type: StrictStr = Field(description="Type of the project")
|
||||
names: StrictStr = Field(description="Names associated with the project")
|
||||
keywords: List[StrictStr] = Field(
|
||||
description="Keywords associated with the project"
|
||||
)
|
||||
topic: StrictStr = Field(description="Topic of the project")
|
||||
links: List[StrictStr] = Field(description="Links associated with the project")
|
||||
title: StrictStr = Field(description="Title of the project")
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "UdeProject":
|
||||
return cls(
|
||||
project_type=data.get("project_type", ""),
|
||||
names=data.get("names", ""),
|
||||
keywords=data.get("keywords", []),
|
||||
topic=data.get("topic", ""),
|
||||
links=data.get("links", []),
|
||||
title=data.get("title", ""),
|
||||
)
|
||||
|
||||
|
||||
class UdeNews(BaseModel):
|
||||
date: Optional[StrictStr] = Field(description="Date of the news")
|
||||
keywords: List[StrictStr] = Field(description="Keywords associated with the news")
|
||||
topic: StrictStr = Field(description="Topic of the news")
|
||||
links: List[StrictStr] = Field(description="Links associated with the news")
|
||||
title: StrictStr = Field(description="Title of the news")
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "UdeNews":
|
||||
return cls(
|
||||
date=data.get("date"),
|
||||
keywords=data.get("keywords", []),
|
||||
topic=data.get("topic", ""),
|
||||
links=data.get("links", []),
|
||||
title=data.get("title", ""),
|
||||
)
|
||||
|
||||
|
||||
class UdeKeyword(BaseModel):
|
||||
value: StrictStr = Field(description="Value of the keyword")
|
||||
score: float = Field(description="Relevance score of the keyword")
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "UdeKeyword":
|
||||
return cls(
|
||||
value=data.get("value", ""),
|
||||
score=data.get("score", 0.0),
|
||||
)
|
||||
|
||||
|
||||
class UdeOrganization(BaseModel):
|
||||
uri: StrictStr = Field(description="URI of the organization")
|
||||
staff: List[UdeStaff] = Field(
|
||||
description="List of staff members in the organization"
|
||||
)
|
||||
projects: List[UdeProject] = Field(
|
||||
description="List of projects associated with the organization"
|
||||
)
|
||||
news: List[UdeNews] = Field(
|
||||
description="List of news items associated with the organization"
|
||||
)
|
||||
keywords: List[UdeKeyword] = Field(
|
||||
description="List of keywords associated with the organization"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: dict) -> "UdeOrganization":
|
||||
return cls(
|
||||
uri=data.get("uri", ""),
|
||||
staff=[UdeStaff.from_dict(s) for s in data.get("staff", [])],
|
||||
projects=[UdeProject.from_dict(p) for p in data.get("projects", [])],
|
||||
news=[UdeNews.from_dict(n) for n in data.get("news", [])],
|
||||
keywords=[UdeKeyword.from_dict(k) for k in data.get("keywords", [])],
|
||||
)
|
||||
@@ -0,0 +1,435 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Business logic for persons / authors.
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from typing import Optional, Callable, Any, List
|
||||
import hashlib
|
||||
import httpx
|
||||
from fastapi import HTTPException
|
||||
from .. import config
|
||||
from .. import util
|
||||
from ..integrations import llm
|
||||
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 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,
|
||||
query: Optional[str] = None,
|
||||
include: Optional[set[str]] = None,
|
||||
) -> AuthorsListResponse:
|
||||
if author_id:
|
||||
query_field = "_id"
|
||||
query_value = author_id
|
||||
elif query:
|
||||
query_field = "display_name"
|
||||
query_value = query
|
||||
else:
|
||||
return AuthorsListResponse(results=[], meta=Meta(count=0))
|
||||
|
||||
data = elasticsearch.search(
|
||||
index="openalex-authors", query_field=query_field, query_value=query_value
|
||||
)
|
||||
|
||||
authors = []
|
||||
for hit in data.get("hits", {}).get("hits", []):
|
||||
source = hit.get("_source", {})
|
||||
source_copy = dict(source)
|
||||
source_copy["id"] = source_copy.get("id") or hit.get("_id", "")
|
||||
|
||||
# Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated)
|
||||
ids = source_copy.get("ids")
|
||||
if isinstance(ids, dict):
|
||||
ids_copy = {}
|
||||
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)
|
||||
if author:
|
||||
authors.append(author)
|
||||
|
||||
return AuthorsListResponse(results=authors, meta=Meta(count=len(authors)))
|
||||
|
||||
|
||||
|
||||
def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> str:
|
||||
start_time = time.time()
|
||||
search_result = search_persons(author_id=author_id)
|
||||
if not search_result.results:
|
||||
return "No person found."
|
||||
if len(search_result.results) > 1:
|
||||
return "Multiple persons found, cannot generate bio."
|
||||
|
||||
person = search_result.results[0]
|
||||
person_json = json.dumps(person.model_dump_json())
|
||||
|
||||
system_prompt = """\
|
||||
Erstelle auf Basis der bereitgestellten OpenAlex-Daten ein kurzes Porträt der Person in 3-5 Sätzen. Die Person selbst ist das Subjekt: Beginne mit ihrem Namen und beschreibe sie als Forschende:n (z. B. „{name} ist ein:e Forscher:in im Bereich …"). Schreibe nicht über „die Forschung" oder „die Arbeit" im Abstrakten, sondern durchgehend über die Person.
|
||||
|
||||
Gehe dabei auf folgende drei Punkte ein:
|
||||
|
||||
1. Besonderheiten: Was hebt die Person im Vergleich zu anderen Forschenden ähnlicher Karrierephase und ähnlichen Feldes hervor? (z. B. überdurchschnittlicher Impact gemessen an der aktiven Zeit, hoher Erst-/Korrespondenzautor-Anteil, einzelnes Breakout-Paper, frühe Positionierung in einem später gewachsenen Thema)
|
||||
2. Wirtschaftliche Relevanz: Arbeitet die Person in einem grundsätzlich anwendungsnahen/kommerziell interessanten Themenfeld oder eher in der Grundlagenforschung?
|
||||
3. Dynamik: Entwickelt sich ihr Publikations-/Zitationsverlauf zuletzt steigend, konstant oder abflachend?
|
||||
|
||||
Stütze jede Aussage auf konkrete Werte aus den Daten und formuliere nichts, was sich nicht belegen lässt. Wenn die Daten für einen Punkt keine klare Aussage zulassen, formuliere ihn entsprechend zurückhaltend oder lasse ihn weg, statt zu spekulieren. Gib nur das Porträt zurück, ohne Einleitung oder Schluss.\
|
||||
"""
|
||||
|
||||
user_prompt = f"Daten zur Person:\n{person_json}"
|
||||
|
||||
bio = llm.call(system_prompt, user_prompt)
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
logger.info(
|
||||
f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds"
|
||||
)
|
||||
|
||||
return bio
|
||||
|
||||
def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse:
|
||||
body = {
|
||||
"_source":include.split(",") if include else True,
|
||||
}
|
||||
|
||||
try:
|
||||
hit = elasticsearch.get(
|
||||
index="openalex-authors",
|
||||
body=body,
|
||||
doc_id=author_id
|
||||
)
|
||||
except NotFoundError:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"Person with id {author_id} not found"
|
||||
)
|
||||
|
||||
except ApiError as e:
|
||||
raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}")
|
||||
persons = [util.get_persons_data(hit)]
|
||||
|
||||
return AuthorsListResponse(results=persons)
|
||||
|
||||
|
||||
|
||||
def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse:
|
||||
body = {
|
||||
"_source":include.split(",") if include else True,
|
||||
}
|
||||
|
||||
try:
|
||||
hit = elasticsearch.get(
|
||||
index="openalex-authors",
|
||||
body=body,
|
||||
doc_id=author_id
|
||||
)
|
||||
except NotFoundError:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"Person with id {author_id} not found"
|
||||
)
|
||||
|
||||
except ApiError as e:
|
||||
raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}")
|
||||
persons = [util.get_persons_data(hit)]
|
||||
|
||||
return AuthorsListResponse(results=persons)
|
||||
|
||||
|
||||
def search_persons_by_name(
|
||||
author_name: str, limit: Optional[int] = 10, page_offset: Optional[int] = 0, include: Optional[str] = None
|
||||
) -> AuthorsListResponse:
|
||||
if not author_name:
|
||||
raise HTTPException(status_code=400, detail="name must be provided")
|
||||
search_query = {
|
||||
"bool": {
|
||||
"should": [
|
||||
{"match_phrase": {"display_name": {"query": author_name, "boost": 5}}},
|
||||
{
|
||||
"match_phrase_prefix": {
|
||||
"display_name": {"query": author_name, "boost": 3}
|
||||
}
|
||||
},
|
||||
# {
|
||||
# "match": {
|
||||
# "display_name": {
|
||||
# "query": author_name,
|
||||
# "fuzziness": 1
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
}
|
||||
try:
|
||||
response = elasticsearch.search(
|
||||
index="openalex-authors",
|
||||
query=search_query,
|
||||
offset=page_offset,
|
||||
source=include.split(",") if include else True,
|
||||
size=limit,
|
||||
track_total_hits=True
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Elasticsearch search failed: {str(e)}"
|
||||
)
|
||||
total_count = response.get("hits",{}).get("total",{}).get("value",0)
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
persons = [util.get_persons_data(hit) for hit in hits]
|
||||
|
||||
return AuthorsListResponse(results=persons,meta=Meta(count=total_count,page=page_offset))
|
||||
|
||||
|
||||
def search_persons_autocomplete(author_name: str, limit: Optional[int] = 5, include: Optional[str] = None) -> AuthorsListResponse:
|
||||
if not author_name:
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail="name must be provided"
|
||||
)
|
||||
search_query = {
|
||||
"function_score": {
|
||||
"query": {
|
||||
"wildcard": {
|
||||
"display_name.keyword": {
|
||||
"value": author_name + "*",
|
||||
"case_insensitive": True
|
||||
}
|
||||
}
|
||||
},
|
||||
"functions": [
|
||||
{
|
||||
"script_score": {
|
||||
"script": {
|
||||
"lang": "painless",
|
||||
"source": "String name = doc['display_name.keyword'].value.toLowerCase(); String[] parts = name.splitOnToken(' '); Set unique = new HashSet(); for (String p : parts) { unique.add(p); } return unique.size() > 1 ? 1.0 : 0.3;"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"boost_mode": "multiply"
|
||||
}
|
||||
}
|
||||
collapse ={
|
||||
"field":"display_name.keyword"
|
||||
}
|
||||
body = {
|
||||
"size":limit,
|
||||
"query":search_query,
|
||||
"_source":include.split(",") if include else True,
|
||||
"sort":[{"works_count": {"order": "desc"}}],
|
||||
"collapse":collapse
|
||||
}
|
||||
try:
|
||||
response = elasticsearch.search(
|
||||
index="openalex-authors",
|
||||
body=body
|
||||
)
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=500,
|
||||
detail=f"Elasticsearch search failed: {str(e)}"
|
||||
)
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
persons = []
|
||||
for hit in hits:
|
||||
fields = hit.get("fields",{})
|
||||
source = hit.get("_source",{})
|
||||
source_copy = dict (source)
|
||||
source_copy["id"] = hit.get("_id", "") or source_copy.get("id")
|
||||
|
||||
# Resilient sanitization of IDs to protect against model regeneration type conflicts (#Generated)
|
||||
ids = source_copy.get("ids")
|
||||
if isinstance(ids, dict):
|
||||
ids_copy = {}
|
||||
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():
|
||||
source_copy[key] = value
|
||||
author = Author.from_dict(source_copy)
|
||||
persons.append(author)
|
||||
|
||||
return AuthorsListResponse(results=persons)
|
||||
|
||||
def search_persons_by_institution(
|
||||
institution_name: str, limit: Optional[int] = 10, page_offset: Optional[int] = 0, include: Optional[str] = None
|
||||
) -> AuthorsListResponse:
|
||||
|
||||
if not institution_name:
|
||||
raise HTTPException(status_code=400, detail="institution_name must be provided")
|
||||
|
||||
search_query = {
|
||||
"nested": {
|
||||
"path": "last_known_institutions",
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"match_phrase": {
|
||||
"last_known_institutions.display_name": institution_name
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try:
|
||||
response = elasticsearch.search(
|
||||
index="openalex-authors",
|
||||
query=search_query,
|
||||
source=include.split(",") if include else True,
|
||||
size=limit,
|
||||
offset=page_offset,
|
||||
sort=[{"works_count": {"order": "desc"}}],
|
||||
track_total_hits=True
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Elasticsearch search failed: {str(e)}"
|
||||
)
|
||||
total_count = response.get("hits",{}).get("total",{}).get("value",0)
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
persons = [util.get_persons_data(hit) for hit in hits]
|
||||
return AuthorsListResponse(results=persons,meta=Meta(count=total_count,page=page_offset))
|
||||
|
||||
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)
|
||||
|
||||
|
||||
# Experimental suitability rating
|
||||
suitability_score = h % 100
|
||||
if suitability_score < 15:
|
||||
relevance_rating = "Sehr geeignet"
|
||||
elif suitability_score < 50:
|
||||
relevance_rating = "Geeignet"
|
||||
else:
|
||||
relevance_rating = "Möglich"
|
||||
|
||||
# Resilient sanitization of IDs to protect against model type conflicts (Generated) TODO: multiple code occurrences (e.g. in util.py) => refactor into seperate utility function (if required, after all merges)
|
||||
ids = author_data.get("ids")
|
||||
if isinstance(ids, dict):
|
||||
ids_copy = {}
|
||||
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:
|
||||
query_body = build_authors_search(
|
||||
query=query,
|
||||
institution_name=institution_name,
|
||||
topics=topics,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
include=include,
|
||||
strict=strict,
|
||||
track_total_hits = True,
|
||||
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:
|
||||
logger.error(f"Elasticsearch search failed: {str(e)}")
|
||||
raise HTTPException(
|
||||
status_code=500, detail=f"Elasticsearch search failed: {str(e)}"
|
||||
)
|
||||
total_count = response_dict.get("hits",{}).get("total",{}).get("value",0)
|
||||
hits = response_dict.get("hits", {}).get("hits", [])
|
||||
total_count = response_dict.get("hits", {}).get("total", {}).get("value", 0)
|
||||
|
||||
results = []
|
||||
for hit in hits:
|
||||
raw_data = util.get_persons_data(hit)
|
||||
custom_author = _enrich_author_data(raw_data)
|
||||
if custom_author:
|
||||
results.append(custom_author)
|
||||
|
||||
return CustomAuthorsListResponse(
|
||||
results=results,
|
||||
meta=Meta(
|
||||
count=total_count,
|
||||
page=page,
|
||||
per_page=page_size
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Data models for persons / authors.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel
|
||||
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):
|
||||
placeholder: Optional[CustomAuthor] = Field(
|
||||
default=None, description="A placeholder field for generation."
|
||||
)
|
||||
# meta: Optional[Meta] = None
|
||||
# results: Optional[List[CustomAuthor]] = None
|
||||
# group_by: Optional[List[GroupByResult]] = None
|
||||
|
||||
|
||||
class PersonBio(BaseModel):
|
||||
bio: str = Field(description="The generated biography.")
|
||||
|
||||
|
||||
class PersonFilters(BaseModel):
|
||||
institution: Optional[str] = None
|
||||
cited_by_count: Optional[int] = None
|
||||
# more filters
|
||||
|
||||
|
||||
class PersonSearchRequest(BaseModel):
|
||||
name: Optional[str] = None
|
||||
filters: PersonFilters = PersonFilters()
|
||||
include: Optional[str] = None
|
||||
limit: Optional[int] = 10
|
||||
page_offset: Optional[int] = 0
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
REST API for persons / authors.
|
||||
"""
|
||||
|
||||
from typing import Annotated, Optional
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi import Path
|
||||
from fastapi import Query
|
||||
from typing import List
|
||||
from . import logic
|
||||
from . import model
|
||||
from inse.models.authors_list_response import AuthorsListResponse
|
||||
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/api/inse-service",
|
||||
tags=["Persons"],
|
||||
responses={404: {"description": "Not found"}},
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/persons/search",
|
||||
operation_id="searchPersons",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Searches for persons by ID or name.",
|
||||
response_model_exclude_none=True,
|
||||
)
|
||||
def search_persons(
|
||||
author_id: Annotated[
|
||||
str, Query(description="OpenAlex author ID (e.g., A5093075883)")
|
||||
] = None,
|
||||
query: Annotated[
|
||||
str, Query(description="Search query (e.g., Arman AND Arzani)")
|
||||
] = None,
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Comma-separated include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, sources, counts_by_year, works_api_url, dates, "
|
||||
"cited_by_count_boost"
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
):
|
||||
include_set = (
|
||||
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
|
||||
if include
|
||||
else None
|
||||
)
|
||||
return logic.search_persons(author_id, query, include_set)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/persons/bio",
|
||||
operation_id="generatePersonBio",
|
||||
response_model=model.PersonBio,
|
||||
summary="Generates a bio for a person by author ID.",
|
||||
)
|
||||
def generate_person_bio(
|
||||
author_id: Annotated[
|
||||
str, Query(description="OpenAlex author ID (e.g., A5093075883)")
|
||||
],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=("Comma-separated list to include tags"),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
):
|
||||
include_set = (
|
||||
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
|
||||
if include
|
||||
else None
|
||||
)
|
||||
bio = logic.generate_person_bio(author_id, include_set)
|
||||
return model.PersonBio(bio=bio)
|
||||
|
||||
@router.get(
|
||||
"/person/{id}",
|
||||
operation_id="getPersonByID",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Searches for person by ID.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
def get_person_by_id(
|
||||
id: Annotated[
|
||||
str, Path(description="OpenAlex author ID", examples=["A5093075883"])
|
||||
],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
):
|
||||
return logic.get_person_by_id(author_id=id, include=include)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/persons/searchByName",
|
||||
operation_id="searchPersonsByName",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Searches for person by name.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
def search_persons_by_name(
|
||||
author_name: Annotated[str, Query(description="Authors name (e.g., Arman Arzani)")],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
limit:Annotated[Optional[int], Query(description=("Limit of search page results"),example ="2")]= None,
|
||||
page_offset : Annotated[Optional[int], Query(description=("Offset of the result page"),example="2")] = None,
|
||||
):
|
||||
return logic.search_persons_by_name(author_name=author_name, include=include,page_offset=page_offset,limit=limit)
|
||||
|
||||
@router.get(
|
||||
'/persons/autocomplete',
|
||||
operation_id='searchPersonsAutocomplete',
|
||||
response_model=AuthorsListResponse,
|
||||
summary='Searches for person by name.',
|
||||
tags=[ 'Persons' ])
|
||||
def search_persons_autocomplete(
|
||||
author_name: Annotated[str, Query(description="Authors name (e.g., Arman Arzani)")],
|
||||
include : Annotated[Optional[str], Query(
|
||||
description=(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share"
|
||||
)]):
|
||||
return logic.search_persons_autocomplete(author_name=author_name,include=include)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/persons/searchByInstitution",
|
||||
operation_id="searchPersonsByInstitution",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Searches for persons by institution name.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
def search_persons_by_institution(
|
||||
institution_name: Annotated[
|
||||
str, Query(description="Institution name (e.g., MIT, Oxford University)")
|
||||
],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
limit:Annotated[Optional[int], Query(description=("Limit of search page results"),example ="2")]= None,
|
||||
page_offset : Annotated[Optional[int], Query(description=("Offset of the result page"),example="2")] = None,
|
||||
):
|
||||
return logic.search_persons_by_institution(institution_name, include=include,page_offset=page_offset,limit=limit)
|
||||
|
||||
@router.get(
|
||||
"/persons/search-list",
|
||||
operation_id="searchPersonsList",
|
||||
response_model=model.CustomAuthorsListResponse,
|
||||
summary="Searches for persons with advanced filters (Topic & Institution) and pagination.",
|
||||
response_model_exclude_none=True,
|
||||
tags=["Persons"],
|
||||
)
|
||||
def search_persons_list(
|
||||
query: Annotated[
|
||||
Optional[str], Query(description="Search query (e.g., Arman AND Arzani)")
|
||||
] = None,
|
||||
institution_name: Annotated[
|
||||
Optional[str], Query(alias="institutionName", description="Filter by institution name")
|
||||
] = None,
|
||||
topic: Annotated[
|
||||
Optional[List[str]], Query(description="Filter by topic display names")
|
||||
] = None,
|
||||
page: Annotated[
|
||||
int, Query(description="Page number (1-indexed)", ge=1)
|
||||
] = 1,
|
||||
page_size: Annotated[
|
||||
int, Query(alias="pageSize", description="Results per page", ge=1, le=100)
|
||||
] = 10,
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description="Comma-separated include tags",
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
strict: Annotated[
|
||||
Optional[bool], Query(description="Strict institution search by target year")
|
||||
] = False,
|
||||
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,
|
||||
)
|
||||
@@ -27,9 +27,7 @@ from . import schema
|
||||
from . import database
|
||||
from . import security
|
||||
from . import util
|
||||
from .works import service as works_service
|
||||
|
||||
from inse.models.authors_list_response import AuthorsListResponse
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -44,7 +42,6 @@ router = APIRouter(
|
||||
responses={404: {"description": "Not found"}},
|
||||
)
|
||||
|
||||
|
||||
# @app.get("/", include_in_schema=False)
|
||||
# async def show_api():
|
||||
# return RedirectResponse("api")
|
||||
@@ -212,145 +209,12 @@ def count_topic_hierarchy(
|
||||
):
|
||||
return logic.count_topic_hierarchy(topic_names)
|
||||
|
||||
|
||||
### persons
|
||||
|
||||
@router.get(
|
||||
"/persons",
|
||||
operation_id="getPersons",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Returns a page of OpenAlex authors.",
|
||||
response_model_exclude_none=True,
|
||||
tags=["Persons"],
|
||||
"/topics/hierarchy",
|
||||
operation_id="getTopicHierarchy",
|
||||
response_model=dict,
|
||||
summary="Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).",
|
||||
tags=["Topics"],
|
||||
)
|
||||
def get_persons(
|
||||
page_offset: Annotated[
|
||||
int, Query(alias="pageOffset", description="The page offset.", ge=0)
|
||||
] = 0,
|
||||
page_size: Annotated[
|
||||
int, Query(alias="pageSize", description="The page size.", ge=1, le=100)
|
||||
] = 20,
|
||||
query: Annotated[
|
||||
Optional[str], Query(description="Optional author search query.")
|
||||
] = None,
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Comma-separated include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, sources, counts_by_year, works_api_url, dates, "
|
||||
"cited_by_count_boost"
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
):
|
||||
include_set = (
|
||||
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
|
||||
if include
|
||||
else None
|
||||
)
|
||||
return logic.list_persons(
|
||||
page_offset=page_offset, page_size=page_size, query=query, include=include_set
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/persons/bio",
|
||||
operation_id="generatePersonBio",
|
||||
response_model=model.PersonBio,
|
||||
summary="Generates a bio for a person by author ID.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
def generate_person_bio(
|
||||
author_id: Annotated[
|
||||
str, Query(description="OpenAlex author ID (e.g., A5093075883)")
|
||||
],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=("Comma-separated list to include tags"),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
):
|
||||
include_set = (
|
||||
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
|
||||
if include
|
||||
else None
|
||||
)
|
||||
bio = logic.generate_person_bio(author_id, include_set)
|
||||
return model.PersonBio(bio=bio)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/person/{id}",
|
||||
operation_id="getPersonByID",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Searches for person by ID.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
def get_person_by_id(
|
||||
id: Annotated[
|
||||
str, Path(description="OpenAlex author ID", examples=["A5093075883"])
|
||||
],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
):
|
||||
return logic.get_person_by_id(author_id=id, include=include)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/persons/searchByName",
|
||||
operation_id="searchPersonsByName",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Searches for person by name.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
def search_persons_by_name(
|
||||
author_name: Annotated[str, Query(description="Authors name (e.g., Arman Arzani)")],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
):
|
||||
return logic.search_persons_by_name(author_name=author_name, include=include)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/persons/searchByInstitution",
|
||||
operation_id="searchPersonsByInstitution",
|
||||
response_model=AuthorsListResponse,
|
||||
summary="Searches for persons by institution name.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
def search_persons_by_institution(
|
||||
institution_name: Annotated[
|
||||
str, Query(description="Institution name (e.g., MIT, Oxford University)")
|
||||
],
|
||||
include: Annotated[
|
||||
Optional[str],
|
||||
Query(
|
||||
description=(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
):
|
||||
return logic.search_persons_by_institution(institution_name, include=include)
|
||||
def get_topic_hierarchy():
|
||||
return logic.get_topic_hierarchy()
|
||||
|
||||
@@ -4,4 +4,6 @@ from enum import Enum
|
||||
class Tags(Enum):
|
||||
PERSON = "Person"
|
||||
PERSON_NETWORK = "Person Network"
|
||||
WORKS = "Works"
|
||||
INSTITUTIONS = "Institutions"
|
||||
TOPICS = "Topics"
|
||||
WORKS = "Works"
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
from fastapi.testclient import TestClient
|
||||
from inse import logic
|
||||
from inse import model
|
||||
from inse.main import app
|
||||
from inse.models.authors_list_response import AuthorsListResponse
|
||||
from inse.models.meta import Meta
|
||||
from inse.models.author import Author
|
||||
from inse.models.author_ids import AuthorIds
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_list_persons_searches_openalex_authors(monkeypatch):
|
||||
captured = {}
|
||||
|
||||
def fake_search(index, payload=None, **_):
|
||||
captured["index"] = index
|
||||
captured["payload"] = payload
|
||||
return {
|
||||
"hits": {
|
||||
"total": {"value": 1},
|
||||
"hits": [
|
||||
{
|
||||
"_id": "A5023888391",
|
||||
"_source": {
|
||||
"display_name": "Ada Lovelace",
|
||||
"works_count": 42,
|
||||
"cited_by_count": 1234,
|
||||
"topics": [{"display_name": "Computer Science"}],
|
||||
"affiliations": [
|
||||
{
|
||||
"institution": {
|
||||
"display_name": "University of Example",
|
||||
"country_code": "DE",
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
monkeypatch.setattr(logic.elasticsearch, "search", fake_search)
|
||||
|
||||
page = logic.list_persons(page_offset=20, page_size=10, query="Ada")
|
||||
|
||||
assert captured["index"] == "openalex-authors"
|
||||
assert captured["payload"]["from"] == 20
|
||||
assert captured["payload"]["size"] == 10
|
||||
assert captured["payload"]["query"]["query_string"]["query"] == "Ada"
|
||||
assert page.meta.count == 1
|
||||
assert page.results[0].id == "A5023888391"
|
||||
assert page.results[0].display_name == "Ada Lovelace"
|
||||
assert page.results[0].topics[0].display_name == "Computer Science"
|
||||
assert page.results[0].affiliations[0].institution.display_name == "University of Example"
|
||||
|
||||
|
||||
def test_list_persons_uses_match_all_without_query(monkeypatch):
|
||||
captured = {}
|
||||
|
||||
def fake_search(index, payload=None, **_):
|
||||
captured["payload"] = payload
|
||||
return {"hits": {"total": 0, "hits": []}}
|
||||
|
||||
monkeypatch.setattr(logic.elasticsearch, "search", fake_search)
|
||||
|
||||
page = logic.list_persons(page_offset=0, page_size=20)
|
||||
|
||||
assert captured["payload"]["query"] == {"match_all": {}}
|
||||
assert page.results == []
|
||||
assert page.meta.count == 0
|
||||
|
||||
|
||||
def test_get_persons_endpoint_returns_page(monkeypatch):
|
||||
def fake_list_persons(page_offset=0, page_size=20, query=None, include=None):
|
||||
assert page_offset == 5
|
||||
assert page_size == 10
|
||||
assert query == "Ada"
|
||||
assert include == {"ids"}
|
||||
return AuthorsListResponse(
|
||||
meta=Meta(
|
||||
count=1,
|
||||
page=1,
|
||||
per_page=10
|
||||
),
|
||||
results=[
|
||||
Author(
|
||||
id="A5023888391",
|
||||
display_name="Ada Lovelace",
|
||||
works_count=42,
|
||||
cited_by_count=1234,
|
||||
affiliations=[],
|
||||
topics=[],
|
||||
ids=AuthorIds(openalex="https://openalex.org/A5023888391"),
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
monkeypatch.setattr(logic, "list_persons", fake_list_persons)
|
||||
|
||||
response = client.get("/api/inse-service/persons?pageOffset=5&pageSize=10&query=Ada&include=ids")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["meta"]["count"] == 1
|
||||
assert data["results"][0]["display_name"] == "Ada Lovelace"
|
||||
assert data["results"][0]["ids"]["openalex"] == "https://openalex.org/A5023888391"
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
OpenAlex topics module.
|
||||
"""
|
||||
@@ -0,0 +1,257 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Business logic for OpenAlex topics.
|
||||
"""
|
||||
import logging
|
||||
from copy import deepcopy
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
from fastapi import HTTPException
|
||||
from pydantic import ValidationError
|
||||
from starlette.status import HTTP_400_BAD_REQUEST
|
||||
from starlette.status import HTTP_502_BAD_GATEWAY
|
||||
|
||||
from inse.models.autocomplete_response import AutocompleteResponse
|
||||
from inse.models.autocomplete_response_meta import AutocompleteResponseMeta
|
||||
from inse.models.autocomplete_response_results_inner import (
|
||||
AutocompleteResponseResultsInner,
|
||||
)
|
||||
from inse.models.topics_list_response import TopicsListResponse
|
||||
from .search_client import OpenAlexTopicsClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def list_topics(
|
||||
*,
|
||||
search: str | None = None,
|
||||
filter: str | None = None,
|
||||
sort: str | None = None,
|
||||
group_by: str | None = None,
|
||||
per_page: int = 25,
|
||||
page: int | None = 1,
|
||||
cursor: str | None = None,
|
||||
sample: int | None = None,
|
||||
select: str | None = None,
|
||||
client: OpenAlexTopicsClient | None = None,
|
||||
) -> TopicsListResponse:
|
||||
if sample is not None and (sort or page not in (None, 1)):
|
||||
raise HTTPException(
|
||||
status_code=HTTP_400_BAD_REQUEST,
|
||||
detail="sample cannot be combined with sort or page.",
|
||||
)
|
||||
|
||||
openalex_client = client or OpenAlexTopicsClient()
|
||||
|
||||
try:
|
||||
data = await openalex_client.list_topics(
|
||||
search=search,
|
||||
filter=filter,
|
||||
sort=sort,
|
||||
group_by=group_by,
|
||||
per_page=per_page,
|
||||
page=page,
|
||||
cursor=cursor,
|
||||
sample=sample,
|
||||
select=select,
|
||||
)
|
||||
except httpx.HTTPStatusError as exc:
|
||||
status_code = exc.response.status_code
|
||||
detail = "OpenAlex topics request failed."
|
||||
try:
|
||||
error_body = exc.response.json()
|
||||
detail = error_body.get("message") or error_body.get("error") or detail
|
||||
except ValueError:
|
||||
if exc.response.text:
|
||||
detail = exc.response.text
|
||||
raise HTTPException(status_code=status_code, detail=detail) from exc
|
||||
except httpx.HTTPError as exc:
|
||||
logger.exception("OpenAlex topics request failed.")
|
||||
raise HTTPException(
|
||||
status_code=HTTP_502_BAD_GATEWAY,
|
||||
detail="OpenAlex topics request failed.",
|
||||
) from exc
|
||||
|
||||
try:
|
||||
normalized_data = _normalize_topics_response(data)
|
||||
return TopicsListResponse.from_dict(normalized_data) or TopicsListResponse()
|
||||
except ValidationError as exc:
|
||||
logger.exception("OpenAlex topics response could not be parsed.")
|
||||
raise HTTPException(
|
||||
status_code=HTTP_502_BAD_GATEWAY,
|
||||
detail="OpenAlex topics response could not be parsed.",
|
||||
) from exc
|
||||
|
||||
|
||||
async def autocomplete_topics(
|
||||
*,
|
||||
query: str,
|
||||
domain_id: str | None = None,
|
||||
field_id: str | None = None,
|
||||
subfield_id: str | None = None,
|
||||
limit: int = 10,
|
||||
client: OpenAlexTopicsClient | None = None,
|
||||
) -> AutocompleteResponse:
|
||||
filters = []
|
||||
if domain_id:
|
||||
filters.append(f"domain.id:{domain_id}")
|
||||
if field_id:
|
||||
filters.append(f"field.id:{field_id}")
|
||||
if subfield_id:
|
||||
filters.append(f"subfield.id:{subfield_id}")
|
||||
|
||||
response = await list_topics(
|
||||
search=query,
|
||||
filter=",".join(filters) if filters else None,
|
||||
sort="works_count:desc",
|
||||
per_page=limit,
|
||||
page=1,
|
||||
select=(
|
||||
"id,display_name,description,keywords,subfield,field,domain,"
|
||||
"works_count,cited_by_count,ids"
|
||||
),
|
||||
client=client,
|
||||
)
|
||||
|
||||
results = []
|
||||
for topic in response.results or []:
|
||||
if not topic.id or not topic.display_name:
|
||||
continue
|
||||
|
||||
hint_parts = []
|
||||
if topic.var_field and topic.var_field.display_name:
|
||||
hint_parts.append(topic.var_field.display_name)
|
||||
if topic.subfield and topic.subfield.display_name:
|
||||
hint_parts.append(topic.subfield.display_name)
|
||||
if topic.domain and topic.domain.display_name:
|
||||
hint_parts.append(topic.domain.display_name)
|
||||
|
||||
results.append(
|
||||
AutocompleteResponseResultsInner(
|
||||
id=topic.id,
|
||||
display_name=topic.display_name,
|
||||
hint=" · ".join(hint_parts) if hint_parts else topic.description,
|
||||
cited_by_count=topic.cited_by_count,
|
||||
works_count=topic.works_count,
|
||||
entity_type="topic",
|
||||
external_id=topic.ids.openalex if topic.ids else None,
|
||||
)
|
||||
)
|
||||
|
||||
return AutocompleteResponse(
|
||||
meta=AutocompleteResponseMeta(
|
||||
count=response.meta.count if response.meta else len(results),
|
||||
db_response_time_ms=(
|
||||
response.meta.db_response_time_ms if response.meta else None
|
||||
),
|
||||
),
|
||||
results=results,
|
||||
)
|
||||
|
||||
|
||||
def _normalize_topics_response(data: dict[str, Any]) -> dict[str, Any]:
|
||||
normalized = deepcopy(data)
|
||||
|
||||
meta = normalized.get("meta")
|
||||
if isinstance(meta, dict):
|
||||
for field in ["count", "db_response_time_ms", "page", "per_page", "groups_count"]:
|
||||
meta[field] = _int_or_none(meta.get(field))
|
||||
meta["next_cursor"] = _str_or_none(meta.get("next_cursor"))
|
||||
meta["cost_usd"] = _number_or_none(meta.get("cost_usd"))
|
||||
|
||||
for topic in normalized.get("results") or []:
|
||||
if not isinstance(topic, dict):
|
||||
continue
|
||||
|
||||
for field in ["id", "display_name", "description", "works_api_url"]:
|
||||
topic[field] = _str_or_none(topic.get(field))
|
||||
topic["keywords"] = _str_list_or_none(topic.get("keywords"))
|
||||
topic["works_count"] = _int_or_none(topic.get("works_count"))
|
||||
topic["cited_by_count"] = _int_or_none(topic.get("cited_by_count"))
|
||||
topic["created_date"] = _date_str_or_none(topic.get("created_date"))
|
||||
topic["updated_date"] = _datetime_str_or_none(topic.get("updated_date"))
|
||||
|
||||
for relation_field in ["subfield", "field", "domain"]:
|
||||
relation = topic.get(relation_field)
|
||||
if not isinstance(relation, dict):
|
||||
continue
|
||||
relation["id"] = _str_or_none(relation.get("id"))
|
||||
relation["display_name"] = _str_or_none(relation.get("display_name"))
|
||||
|
||||
ids = topic.get("ids")
|
||||
if isinstance(ids, dict):
|
||||
for field in ["openalex", "wikipedia"]:
|
||||
ids[field] = _str_or_none(ids.get(field))
|
||||
|
||||
for group in normalized.get("group_by") or []:
|
||||
if not isinstance(group, dict):
|
||||
continue
|
||||
|
||||
group["key"] = _str_or_none(group.get("key"))
|
||||
group["key_display_name"] = _str_or_none(group.get("key_display_name"))
|
||||
group["count"] = _int_or_none(group.get("count"))
|
||||
|
||||
return normalized
|
||||
|
||||
|
||||
def _str_or_none(value: Any) -> str | None:
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, bool):
|
||||
return str(value).lower()
|
||||
return str(value)
|
||||
|
||||
|
||||
def _str_list_or_none(value: Any) -> list[str] | None:
|
||||
if value is None:
|
||||
return None
|
||||
if not isinstance(value, list):
|
||||
return None
|
||||
return [_str_or_none(item) for item in value if item is not None]
|
||||
|
||||
|
||||
def _int_or_none(value: Any) -> int | None:
|
||||
if value is None or isinstance(value, bool):
|
||||
return None
|
||||
if isinstance(value, int):
|
||||
return value
|
||||
if isinstance(value, float):
|
||||
return int(value)
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
return int(float(value))
|
||||
except ValueError:
|
||||
return None
|
||||
return None
|
||||
|
||||
|
||||
def _number_or_none(value: Any) -> int | float | None:
|
||||
if value is None or isinstance(value, bool):
|
||||
return None
|
||||
if isinstance(value, (int, float)):
|
||||
return value
|
||||
if isinstance(value, str):
|
||||
try:
|
||||
number = float(value)
|
||||
except ValueError:
|
||||
return None
|
||||
return int(number) if number.is_integer() else number
|
||||
return None
|
||||
|
||||
|
||||
def _date_str_or_none(value: Any) -> str | None:
|
||||
text = _str_or_none(value)
|
||||
if not text:
|
||||
return None
|
||||
return text[:10]
|
||||
|
||||
|
||||
def _datetime_str_or_none(value: Any) -> str | None:
|
||||
text = _str_or_none(value)
|
||||
if not text:
|
||||
return None
|
||||
if len(text) == 10:
|
||||
return f"{text}T00:00:00Z"
|
||||
return text
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
HTTP client for OpenAlex topics.
|
||||
"""
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
||||
from .. import config
|
||||
|
||||
|
||||
class OpenAlexTopicsClient:
|
||||
def __init__(
|
||||
self,
|
||||
base_url: 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_api_base_url).rstrip("/")
|
||||
self.api_key = api_key if api_key is not None else config.settings.openalex_api_key
|
||||
self.timeout = (
|
||||
timeout
|
||||
if timeout is not None
|
||||
else config.settings.openalex_api_timeout_seconds
|
||||
)
|
||||
self.transport = transport
|
||||
|
||||
def list_topics_params(
|
||||
self,
|
||||
*,
|
||||
search: str | None = None,
|
||||
filter: str | None = None,
|
||||
sort: str | None = None,
|
||||
group_by: str | None = None,
|
||||
per_page: int = 25,
|
||||
page: int | None = 1,
|
||||
cursor: str | None = None,
|
||||
sample: int | None = None,
|
||||
select: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
params: dict[str, Any] = {"per_page": per_page}
|
||||
|
||||
if search:
|
||||
params["search"] = search
|
||||
if filter:
|
||||
params["filter"] = filter
|
||||
if sort:
|
||||
params["sort"] = sort
|
||||
if group_by:
|
||||
params["group_by"] = group_by
|
||||
if cursor:
|
||||
params["cursor"] = cursor
|
||||
elif page is not None:
|
||||
params["page"] = page
|
||||
if sample is not None:
|
||||
params["sample"] = sample
|
||||
if select:
|
||||
params["select"] = select
|
||||
if self.api_key:
|
||||
params["api_key"] = self.api_key
|
||||
|
||||
return params
|
||||
|
||||
async def list_topics(
|
||||
self,
|
||||
*,
|
||||
search: str | None = None,
|
||||
filter: str | None = None,
|
||||
sort: str | None = None,
|
||||
group_by: str | None = None,
|
||||
per_page: int = 25,
|
||||
page: int | None = 1,
|
||||
cursor: str | None = None,
|
||||
sample: int | None = None,
|
||||
select: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
async with httpx.AsyncClient(
|
||||
base_url=self.base_url,
|
||||
timeout=self.timeout,
|
||||
transport=self.transport,
|
||||
) as client:
|
||||
response = await client.get(
|
||||
"/topics",
|
||||
params=self.list_topics_params(
|
||||
search=search,
|
||||
filter=filter,
|
||||
sort=sort,
|
||||
group_by=group_by,
|
||||
per_page=per_page,
|
||||
page=page,
|
||||
cursor=cursor,
|
||||
sample=sample,
|
||||
select=select,
|
||||
),
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
REST API for OpenAlex topics.
|
||||
"""
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi import Query
|
||||
|
||||
from inse.models.autocomplete_response import AutocompleteResponse
|
||||
from inse.models.topics_list_response import TopicsListResponse
|
||||
from inse.tags import Tags
|
||||
from . import logic
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/topics", tags=[Tags.TOPICS])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/autocomplete",
|
||||
operation_id="autocompleteTopics",
|
||||
response_model=AutocompleteResponse,
|
||||
response_model_exclude_none=True,
|
||||
summary="Returns topic options for autocomplete inputs.",
|
||||
)
|
||||
async def autocomplete_topics(
|
||||
query: Annotated[
|
||||
str,
|
||||
Query(description="Topic search text, for example 'machine learning'.", min_length=1),
|
||||
],
|
||||
domain_id: Annotated[
|
||||
str | None,
|
||||
Query(alias="domainId", description="Optional OpenAlex domain id filter."),
|
||||
] = None,
|
||||
field_id: Annotated[
|
||||
str | None,
|
||||
Query(alias="fieldId", description="Optional OpenAlex field id filter."),
|
||||
] = None,
|
||||
subfield_id: Annotated[
|
||||
str | None,
|
||||
Query(alias="subfieldId", description="Optional OpenAlex subfield id filter."),
|
||||
] = None,
|
||||
limit: Annotated[
|
||||
int,
|
||||
Query(description="Maximum number of autocomplete options.", ge=1, le=25),
|
||||
] = 10,
|
||||
):
|
||||
return await logic.autocomplete_topics(
|
||||
query=query,
|
||||
domain_id=domain_id,
|
||||
field_id=field_id,
|
||||
subfield_id=subfield_id,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"",
|
||||
operation_id="listTopics",
|
||||
response_model=TopicsListResponse,
|
||||
response_model_exclude_none=True,
|
||||
summary="Returns a list of OpenAlex topics.",
|
||||
)
|
||||
async def list_topics(
|
||||
search: Annotated[
|
||||
str | None,
|
||||
Query(description="Full-text search, for example 'machine learning'."),
|
||||
] = None,
|
||||
filter: Annotated[
|
||||
str | None,
|
||||
Query(description="OpenAlex filter, for example 'domain.id:1,works_count:>1000'."),
|
||||
] = None,
|
||||
sort: Annotated[
|
||||
str | None,
|
||||
Query(description="Sort field, for example 'works_count:desc'."),
|
||||
] = "works_count:desc",
|
||||
group_by: Annotated[
|
||||
str | None,
|
||||
Query(description="OpenAlex group_by field, for example 'domain.id'."),
|
||||
] = None,
|
||||
per_page: Annotated[
|
||||
int,
|
||||
Query(description="Results per page.", ge=1, le=100),
|
||||
] = 25,
|
||||
page: Annotated[
|
||||
int | None,
|
||||
Query(description="Page number. Use cursor for deep pagination.", ge=1),
|
||||
] = 1,
|
||||
cursor: Annotated[
|
||||
str | None,
|
||||
Query(description="Cursor pagination token. Use '*' to start."),
|
||||
] = None,
|
||||
sample: Annotated[
|
||||
int | None,
|
||||
Query(description="Random sample size. Cannot be combined with sort or page.", ge=1, le=10000),
|
||||
] = None,
|
||||
select: Annotated[
|
||||
str | None,
|
||||
Query(description="Comma-separated fields to return."),
|
||||
] = None,
|
||||
):
|
||||
return await logic.list_topics(
|
||||
search=search,
|
||||
filter=filter,
|
||||
sort=sort,
|
||||
group_by=group_by,
|
||||
per_page=per_page,
|
||||
page=page,
|
||||
cursor=cursor,
|
||||
sample=sample,
|
||||
select=select,
|
||||
)
|
||||
@@ -0,0 +1,195 @@
|
||||
import httpx
|
||||
import pytest
|
||||
from fastapi import HTTPException
|
||||
|
||||
from inse.topics import logic
|
||||
from inse.topics.search_client import OpenAlexTopicsClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_topics_maps_openalex_response_to_model():
|
||||
def handler(_: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "page": 1, "per_page": 25},
|
||||
"results": [
|
||||
{
|
||||
"id": "https://openalex.org/T12419",
|
||||
"display_name": "Machine learning",
|
||||
"description": "Methods that learn from data.",
|
||||
"keywords": ["machine learning", "classification"],
|
||||
"subfield": {
|
||||
"id": "https://openalex.org/subfields/1702",
|
||||
"display_name": "Artificial Intelligence",
|
||||
},
|
||||
"field": {
|
||||
"id": "https://openalex.org/fields/17",
|
||||
"display_name": "Computer Science",
|
||||
},
|
||||
"domain": {
|
||||
"id": "https://openalex.org/domains/4",
|
||||
"display_name": "Physical Sciences",
|
||||
},
|
||||
"works_count": 123,
|
||||
"cited_by_count": 456,
|
||||
"ids": {
|
||||
"openalex": "https://openalex.org/T12419",
|
||||
"wikipedia": "https://en.wikipedia.org/wiki/Machine_learning",
|
||||
},
|
||||
"works_api_url": "https://api.openalex.org/works?filter=topics.id:T12419",
|
||||
"created_date": "2023-12-25",
|
||||
"updated_date": "2023-11-07T05:31:56Z",
|
||||
}
|
||||
],
|
||||
"group_by": [
|
||||
{
|
||||
"key": "https://openalex.org/domains/4",
|
||||
"key_display_name": "Physical Sciences",
|
||||
"count": 1,
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexTopicsClient(
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await logic.list_topics(search="machine learning", client=client)
|
||||
|
||||
assert result.meta.count == 1
|
||||
topic = result.results[0]
|
||||
assert topic.display_name == "Machine learning"
|
||||
assert topic.var_field.display_name == "Computer Science"
|
||||
assert topic.subfield.display_name == "Artificial Intelligence"
|
||||
assert topic.domain.display_name == "Physical Sciences"
|
||||
assert topic.ids.openalex == "https://openalex.org/T12419"
|
||||
assert result.group_by[0].key_display_name == "Physical Sciences"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_topics_rejects_sample_with_sort():
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
await logic.list_topics(sample=10, sort="works_count:desc")
|
||||
|
||||
assert exc_info.value.status_code == 400
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_topics_accepts_practical_openalex_type_variants():
|
||||
def handler(_: httpx.Request) -> httpx.Response:
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": "1", "page": "1", "per_page": "25"},
|
||||
"results": [
|
||||
{
|
||||
"id": 123,
|
||||
"display_name": 456,
|
||||
"description": True,
|
||||
"keywords": ["topic", 123],
|
||||
"subfield": {"id": 1, "display_name": 2},
|
||||
"field": {"id": 3, "display_name": 4},
|
||||
"domain": {"id": 5, "display_name": 6},
|
||||
"works_count": "12.0",
|
||||
"cited_by_count": False,
|
||||
"ids": {"openalex": 123, "wikipedia": 456},
|
||||
"created_date": "2023-12-25T10:11:12Z",
|
||||
"updated_date": "2023-12-25",
|
||||
}
|
||||
],
|
||||
"group_by": [{"key": True, "count": "1"}],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexTopicsClient(
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await logic.list_topics(client=client)
|
||||
|
||||
topic = result.results[0]
|
||||
assert topic.id == "123"
|
||||
assert topic.display_name == "456"
|
||||
assert topic.description == "true"
|
||||
assert topic.keywords == ["topic", "123"]
|
||||
assert topic.works_count == 12
|
||||
assert topic.cited_by_count is None
|
||||
assert topic.var_field.id == "3"
|
||||
assert topic.domain.display_name == "6"
|
||||
assert topic.ids.wikipedia == "456"
|
||||
assert topic.created_date.isoformat() == "2023-12-25"
|
||||
assert topic.updated_date.isoformat() == "2023-12-25T00:00:00+00:00"
|
||||
assert result.group_by[0].key == "true"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_autocomplete_topics_returns_frontend_options():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
assert request.url.params["search"] == "machine learning"
|
||||
assert request.url.params["filter"] == (
|
||||
"domain.id:https://openalex.org/domains/4,"
|
||||
"field.id:https://openalex.org/fields/17,"
|
||||
"subfield.id:https://openalex.org/subfields/1702"
|
||||
)
|
||||
assert request.url.params["sort"] == "works_count:desc"
|
||||
assert request.url.params["per_page"] == "5"
|
||||
assert request.url.params["select"] == (
|
||||
"id,display_name,description,keywords,subfield,field,domain,"
|
||||
"works_count,cited_by_count,ids"
|
||||
)
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "db_response_time_ms": 12},
|
||||
"results": [
|
||||
{
|
||||
"id": "https://openalex.org/T12419",
|
||||
"display_name": "Machine learning",
|
||||
"description": "Methods that learn from data.",
|
||||
"field": {"display_name": "Computer Science"},
|
||||
"subfield": {"display_name": "Artificial Intelligence"},
|
||||
"domain": {"display_name": "Physical Sciences"},
|
||||
"works_count": 123,
|
||||
"cited_by_count": 456,
|
||||
"ids": {"openalex": "https://openalex.org/T12419"},
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexTopicsClient(
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await logic.autocomplete_topics(
|
||||
query="machine learning",
|
||||
domain_id="https://openalex.org/domains/4",
|
||||
field_id="https://openalex.org/fields/17",
|
||||
subfield_id="https://openalex.org/subfields/1702",
|
||||
limit=5,
|
||||
client=client,
|
||||
)
|
||||
|
||||
assert result.meta.count == 1
|
||||
assert result.meta.db_response_time_ms == 12
|
||||
assert len(result.results) == 1
|
||||
option = result.results[0]
|
||||
assert option.id == "https://openalex.org/T12419"
|
||||
assert option.display_name == "Machine learning"
|
||||
assert option.hint == (
|
||||
"Computer Science · Artificial Intelligence · Physical Sciences"
|
||||
)
|
||||
assert option.works_count == 123
|
||||
assert option.cited_by_count == 456
|
||||
assert option.entity_type == "topic"
|
||||
assert option.external_id == "https://openalex.org/T12419"
|
||||
@@ -0,0 +1,75 @@
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from inse.topics.search_client import OpenAlexTopicsClient
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
def test_list_topics_params_include_openalex_query_parameters():
|
||||
client = OpenAlexTopicsClient(api_key="test-key")
|
||||
|
||||
params = client.list_topics_params(
|
||||
search="machine learning",
|
||||
filter="domain.id:4,works_count:>1000",
|
||||
sort="works_count:desc",
|
||||
group_by="domain.id",
|
||||
per_page=10,
|
||||
page=2,
|
||||
select="id,display_name",
|
||||
)
|
||||
|
||||
assert params == {
|
||||
"search": "machine learning",
|
||||
"filter": "domain.id:4,works_count:>1000",
|
||||
"sort": "works_count:desc",
|
||||
"group_by": "domain.id",
|
||||
"per_page": 10,
|
||||
"page": 2,
|
||||
"select": "id,display_name",
|
||||
"api_key": "test-key",
|
||||
}
|
||||
|
||||
|
||||
def test_list_topics_params_prefers_cursor_over_page():
|
||||
client = OpenAlexTopicsClient(api_key="test-key")
|
||||
|
||||
params = client.list_topics_params(cursor="*", page=3)
|
||||
|
||||
assert params["cursor"] == "*"
|
||||
assert "page" not in params
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_list_topics_calls_openalex_topics_endpoint():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
assert request.method == "GET"
|
||||
assert request.url.path == "/topics"
|
||||
assert request.url.params["search"] == "machine learning"
|
||||
assert request.url.params["api_key"] == "test-key"
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "page": 1, "per_page": 25},
|
||||
"results": [
|
||||
{
|
||||
"id": "https://openalex.org/T12419",
|
||||
"display_name": "Machine learning",
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexTopicsClient(
|
||||
base_url="https://api.openalex.org",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await client.list_topics(search="machine learning")
|
||||
|
||||
assert result["meta"]["count"] == 1
|
||||
assert result["results"][0]["display_name"] == "Machine learning"
|
||||
@@ -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)
|
||||
|
||||
@@ -11,12 +11,17 @@ import httpx
|
||||
from fastapi import HTTPException
|
||||
from pydantic import ValidationError
|
||||
from starlette.status import HTTP_502_BAD_GATEWAY
|
||||
from starlette.status import HTTP_404_NOT_FOUND
|
||||
from starlette.status import HTTP_503_SERVICE_UNAVAILABLE
|
||||
|
||||
from inse.integrations import elasticsearch
|
||||
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
|
||||
|
||||
@@ -30,6 +35,8 @@ async def get_author_works(
|
||||
publication_year: list[int] | None = None,
|
||||
work_type: list[str] | None = None,
|
||||
language: list[str] | None = None,
|
||||
institution_id: list[str] | None = None,
|
||||
topic_id: list[str] | None = None,
|
||||
client: OpenAlexWorksSearchClient | None = None,
|
||||
) -> WorkPage:
|
||||
search_client = client or OpenAlexWorksSearchClient()
|
||||
@@ -41,6 +48,8 @@ async def get_author_works(
|
||||
publication_year=publication_year,
|
||||
work_type=work_type,
|
||||
language=language,
|
||||
institution_id=institution_id,
|
||||
topic_id=topic_id,
|
||||
)
|
||||
|
||||
elements, total = _parse_full_work_search_response(data)
|
||||
@@ -87,6 +96,274 @@ 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)
|
||||
|
||||
topic_ids = [item["id"] for item in items if item["id"]]
|
||||
descriptions = _get_topic_descriptions(topic_ids)
|
||||
|
||||
return [
|
||||
TopicCount(
|
||||
id=item["id"],
|
||||
name=item["name"],
|
||||
count=item["count"],
|
||||
description=descriptions.get(item["id"]),
|
||||
)
|
||||
for item in items
|
||||
]
|
||||
|
||||
def _get_topic_descriptions(topic_ids: List[str]) -> dict[str, str]:
|
||||
if not topic_ids:
|
||||
return {}
|
||||
|
||||
try:
|
||||
response = elasticsearch.search(
|
||||
index="openalex-topics",
|
||||
query={"terms": {"id": topic_ids}},
|
||||
source=["id", "description"],
|
||||
size=len(topic_ids),
|
||||
)
|
||||
except httpx.HTTPError:
|
||||
logger.exception("Could not load topic descriptions from Elasticsearch.")
|
||||
return {}
|
||||
|
||||
descriptions = {}
|
||||
for hit in response.get("hits", {}).get("hits", []):
|
||||
source = hit.get("_source", {})
|
||||
topic_id = source.get("id")
|
||||
description = source.get("description")
|
||||
if topic_id and description:
|
||||
descriptions[topic_id] = description
|
||||
|
||||
return descriptions
|
||||
|
||||
|
||||
def _limit_works_by_complete_years(
|
||||
work_results: list[Work],
|
||||
target_publications: int,
|
||||
) -> list[Work]:
|
||||
works_by_year: dict[int, list[Work]] = {}
|
||||
|
||||
for work in work_results:
|
||||
if work.publication_year is None:
|
||||
continue
|
||||
|
||||
year = work.publication_year
|
||||
|
||||
if year not in works_by_year:
|
||||
works_by_year[year] = []
|
||||
|
||||
works_by_year[year].append(work)
|
||||
|
||||
selected_works: list[Work] = []
|
||||
|
||||
for year in sorted(works_by_year.keys(), reverse=True):
|
||||
selected_works.extend(works_by_year[year])
|
||||
|
||||
if len(selected_works) >= target_publications:
|
||||
break
|
||||
|
||||
return selected_works
|
||||
|
||||
async def _get_limited_author_works_by_complete_years(
|
||||
author_id: str,
|
||||
target_publications: int,
|
||||
client: OpenAlexWorksSearchClient | None = None,
|
||||
) -> tuple[list[Work], int, bool]:
|
||||
search_client = client or OpenAlexWorksSearchClient()
|
||||
page = 1
|
||||
size = 100
|
||||
total = 0
|
||||
fetched_publications = 0
|
||||
selected_works: list[Work] = []
|
||||
cutoff_year: int | None = None
|
||||
is_limited = False
|
||||
|
||||
while True:
|
||||
data = await _search_author_works_data(
|
||||
search_client,
|
||||
author_id,
|
||||
page,
|
||||
size,
|
||||
)
|
||||
elements, total = _parse_full_work_search_response(data)
|
||||
|
||||
if not elements:
|
||||
break
|
||||
|
||||
fetched_publications += len(elements)
|
||||
should_stop = False
|
||||
|
||||
for work in elements:
|
||||
year = work.publication_year
|
||||
|
||||
if year is None:
|
||||
if cutoff_year is not None:
|
||||
should_stop = True
|
||||
break
|
||||
|
||||
continue
|
||||
|
||||
if cutoff_year is not None and year != cutoff_year:
|
||||
is_limited = True
|
||||
should_stop = True
|
||||
break
|
||||
|
||||
selected_works.append(work)
|
||||
|
||||
if cutoff_year is None and len(selected_works) >= target_publications:
|
||||
cutoff_year = year
|
||||
|
||||
if should_stop or fetched_publications >= total:
|
||||
break
|
||||
|
||||
page += 1
|
||||
|
||||
return selected_works, total, is_limited
|
||||
|
||||
|
||||
def _get_total_publication_count(meta: Meta | None, work_results: list[Work]) -> int:
|
||||
if meta and meta.count is not None:
|
||||
return meta.count
|
||||
|
||||
return len(work_results)
|
||||
|
||||
|
||||
async def get_topics_by_time_by_author(
|
||||
author_id: str,
|
||||
max_topics_per_year: int = 3,
|
||||
target_publications: int = 300,
|
||||
include_all: bool = False,
|
||||
client: OpenAlexWorksSearchClient | None = None,
|
||||
) -> TopicsByTime:
|
||||
if include_all:
|
||||
works = await get_all_author_works(author_id, client=client)
|
||||
work_results = works.results or []
|
||||
total_publications = _get_total_publication_count(works.meta, work_results)
|
||||
is_limited = False
|
||||
else:
|
||||
(
|
||||
work_results,
|
||||
total_publications,
|
||||
is_limited,
|
||||
) = await _get_limited_author_works_by_complete_years(
|
||||
author_id,
|
||||
target_publications=target_publications,
|
||||
client=client,
|
||||
)
|
||||
|
||||
years = {}
|
||||
|
||||
for work in work_results:
|
||||
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"], item["name"]))
|
||||
|
||||
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"], item["name"]))
|
||||
|
||||
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),
|
||||
is_limited=is_limited,
|
||||
used_publications=sum(element.publication_count for element in elements),
|
||||
total_publications=total_publications,
|
||||
)
|
||||
|
||||
|
||||
async def _search_author_works_data(
|
||||
search_client: OpenAlexWorksSearchClient,
|
||||
author_id: str,
|
||||
@@ -95,6 +372,8 @@ async def _search_author_works_data(
|
||||
publication_year: list[int] | None = None,
|
||||
work_type: list[str] | None = None,
|
||||
language: list[str] | None = None,
|
||||
institution_id: list[str] | None = None,
|
||||
topic_id: list[str] | None = None,
|
||||
) -> dict:
|
||||
try:
|
||||
return await search_client.search_author_works(
|
||||
@@ -104,6 +383,8 @@ async def _search_author_works_data(
|
||||
publication_year=publication_year,
|
||||
work_type=work_type,
|
||||
language=language,
|
||||
institution_id=institution_id,
|
||||
topic_id=topic_id,
|
||||
)
|
||||
except MissingApiKeyError as exc:
|
||||
logger.error("OpenAlex works Elasticsearch API key is not configured.")
|
||||
|
||||
@@ -8,333 +8,11 @@ from typing import List
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic import ConfigDict
|
||||
from pydantic import Field
|
||||
|
||||
from inse.models.work import Work
|
||||
|
||||
|
||||
class OpenAlexModel(BaseModel):
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
|
||||
class Source(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The source id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The source display name."
|
||||
)
|
||||
issn_l: Optional[str] = Field(default=None, description="The linking ISSN.")
|
||||
issn: Optional[List[str]] = Field(
|
||||
default=None, description="The ISSNs of the source."
|
||||
)
|
||||
is_oa: Optional[bool] = Field(
|
||||
default=None, description="Whether the source is open access."
|
||||
)
|
||||
is_in_doaj: Optional[bool] = Field(
|
||||
default=None, description="Whether the source is in DOAJ."
|
||||
)
|
||||
is_core: Optional[bool] = Field(
|
||||
default=None, description="Whether the source is a core source."
|
||||
)
|
||||
host_organization: Optional[str] = Field(
|
||||
default=None, description="The host organization id."
|
||||
)
|
||||
host_organization_name: Optional[str] = Field(
|
||||
default=None, description="The host organization name."
|
||||
)
|
||||
host_organization_lineage: Optional[List[str]] = Field(
|
||||
default=None, description="The host organization lineage."
|
||||
)
|
||||
type: Optional[str] = Field(default=None, description="The source type.")
|
||||
|
||||
|
||||
class Location(OpenAlexModel):
|
||||
is_oa: Optional[bool] = Field(
|
||||
default=None, description="Whether this location is open access."
|
||||
)
|
||||
landing_page_url: Optional[str] = Field(
|
||||
default=None, description="The landing page URL."
|
||||
)
|
||||
pdf_url: Optional[str] = Field(default=None, description="The PDF URL.")
|
||||
source: Optional[Source] = Field(
|
||||
default=None, description="The publication source."
|
||||
)
|
||||
license: Optional[str] = Field(default=None, description="The license label.")
|
||||
license_id: Optional[str] = Field(default=None, description="The license id.")
|
||||
is_accepted: Optional[bool] = Field(
|
||||
default=None, description="Whether this manuscript is accepted."
|
||||
)
|
||||
is_published: Optional[bool] = Field(
|
||||
default=None, description="Whether this manuscript is published."
|
||||
)
|
||||
|
||||
|
||||
class OpenAccess(OpenAlexModel):
|
||||
is_oa: Optional[bool] = Field(
|
||||
default=None, description="Whether the work is open access."
|
||||
)
|
||||
oa_url: Optional[str] = Field(default=None, description="The open access URL.")
|
||||
any_repository_has_fulltext: Optional[bool] = Field(
|
||||
default=None, description="Whether a repository has full text."
|
||||
)
|
||||
|
||||
|
||||
class Author(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The author id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The display name of the author."
|
||||
)
|
||||
orcid: Optional[str] = Field(
|
||||
default=None, description="The optional ORCID of the author."
|
||||
)
|
||||
|
||||
|
||||
class Institution(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The institution id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The institution display name."
|
||||
)
|
||||
ror: Optional[str] = Field(default=None, description="The ROR id.")
|
||||
country_code: Optional[str] = Field(default=None, description="The country code.")
|
||||
type: Optional[str] = Field(default=None, description="The institution type.")
|
||||
lineage: Optional[List[str]] = Field(
|
||||
default=None, description="The institution lineage."
|
||||
)
|
||||
|
||||
|
||||
class Authorship(OpenAlexModel):
|
||||
author: Optional[Author] = Field(default=None, description="The author.")
|
||||
institutions: List[Institution] = Field(
|
||||
default_factory=list, description="The author's institutions."
|
||||
)
|
||||
countries: List[str] = Field(
|
||||
default_factory=list, description="The author's countries."
|
||||
)
|
||||
is_corresponding: Optional[bool] = Field(
|
||||
default=None, description="Whether this author is corresponding."
|
||||
)
|
||||
raw_author_name: Optional[str] = Field(
|
||||
default=None, description="The raw author name."
|
||||
)
|
||||
raw_affiliation_strings: List[str] = Field(
|
||||
default_factory=list, description="The raw affiliation strings."
|
||||
)
|
||||
|
||||
|
||||
class WorkIds(OpenAlexModel):
|
||||
openalex: Optional[str] = Field(default=None, description="The OpenAlex id.")
|
||||
doi: Optional[str] = Field(default=None, description="The DOI.")
|
||||
mag: Optional[int] = Field(default=None, description="The MAG id.")
|
||||
pmid: Optional[str] = Field(default=None, description="The PubMed id.")
|
||||
pmcid: Optional[str] = Field(default=None, description="The PubMed Central id.")
|
||||
|
||||
|
||||
class Biblio(OpenAlexModel):
|
||||
volume: Optional[str] = Field(default=None, description="The volume.")
|
||||
issue: Optional[str] = Field(default=None, description="The issue.")
|
||||
first_page: Optional[str] = Field(default=None, description="The first page.")
|
||||
last_page: Optional[str] = Field(default=None, description="The last page.")
|
||||
|
||||
|
||||
class TopicLevel(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The topic level id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The topic level display name."
|
||||
)
|
||||
|
||||
|
||||
class Topic(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The topic id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The topic display name."
|
||||
)
|
||||
score: Optional[float] = Field(default=None, description="The topic score.")
|
||||
subfield: Optional[TopicLevel] = Field(
|
||||
default=None, description="The topic subfield."
|
||||
)
|
||||
field: Optional[TopicLevel] = Field(default=None, description="The topic field.")
|
||||
domain: Optional[TopicLevel] = Field(default=None, description="The topic domain.")
|
||||
|
||||
|
||||
class Keyword(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The keyword id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The keyword display name."
|
||||
)
|
||||
score: Optional[float] = Field(default=None, description="The keyword score.")
|
||||
|
||||
|
||||
class Funder(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The funder id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The funder display name."
|
||||
)
|
||||
ror: Optional[str] = Field(default=None, description="The ROR id.")
|
||||
|
||||
|
||||
class Award(OpenAlexModel):
|
||||
id: Optional[str] = Field(default=None, description="The award id.")
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The award display name."
|
||||
)
|
||||
funder_award_id: Optional[str] = Field(
|
||||
default=None, description="The funder award id."
|
||||
)
|
||||
funder_id: Optional[str] = Field(default=None, description="The funder id.")
|
||||
funder_display_name: Optional[str] = Field(
|
||||
default=None, description="The funder display name."
|
||||
)
|
||||
doi: Optional[str] = Field(default=None, description="The award DOI.")
|
||||
|
||||
|
||||
class CitationNormalizedPercentile(OpenAlexModel):
|
||||
value: Optional[float] = Field(
|
||||
default=None, description="The normalized citation percentile."
|
||||
)
|
||||
is_in_top_1_percent: Optional[bool] = Field(
|
||||
default=None, description="Whether the work is in the top 1 percent."
|
||||
)
|
||||
is_in_top_10_percent: Optional[bool] = Field(
|
||||
default=None, description="Whether the work is in the top 10 percent."
|
||||
)
|
||||
|
||||
|
||||
class CitedByPercentileYear(OpenAlexModel):
|
||||
min: Optional[int] = Field(default=None, description="The minimum percentile year.")
|
||||
max: Optional[int] = Field(default=None, description="The maximum percentile year.")
|
||||
|
||||
|
||||
class CountByYear(OpenAlexModel):
|
||||
year: Optional[int] = Field(default=None, description="The year.")
|
||||
cited_by_count: int = Field(
|
||||
default=0, description="The citation count for the year."
|
||||
)
|
||||
|
||||
|
||||
class SustainableDevelopmentGoal(OpenAlexModel):
|
||||
id: Optional[str] = Field(
|
||||
default=None, description="The sustainable development goal id."
|
||||
)
|
||||
display_name: Optional[str] = Field(
|
||||
default=None, description="The sustainable development goal display name."
|
||||
)
|
||||
score: Optional[float] = Field(
|
||||
default=None, description="The sustainable development goal score."
|
||||
)
|
||||
|
||||
|
||||
class Mesh(OpenAlexModel):
|
||||
descriptor_ui: Optional[str] = Field(default=None, description="The descriptor UI.")
|
||||
descriptor_name: Optional[str] = Field(
|
||||
default=None, description="The descriptor name."
|
||||
)
|
||||
qualifier_ui: Optional[str] = Field(default=None, description="The qualifier UI.")
|
||||
qualifier_name: Optional[str] = Field(
|
||||
default=None, description="The qualifier name."
|
||||
)
|
||||
is_major_topic: Optional[bool] = Field(
|
||||
default=None, description="Whether this is a major topic."
|
||||
)
|
||||
|
||||
|
||||
class HasContent(OpenAlexModel):
|
||||
pdf: Optional[bool] = Field(default=None, description="Whether PDF content exists.")
|
||||
grobid_xml: Optional[bool] = Field(
|
||||
default=None, description="Whether GROBID XML content exists."
|
||||
)
|
||||
|
||||
|
||||
# class Work(OpenAlexModel):
|
||||
# id: str = Field(description="The external id of the work.")
|
||||
# doi: Optional[str] = Field(
|
||||
# default=None, description="The optional DOI of the work."
|
||||
# )
|
||||
# title: Optional[str] = Field(default=None, description="The title of the work.")
|
||||
# display_name: Optional[str] = Field(
|
||||
# default=None, description="The display name of the work."
|
||||
# )
|
||||
# publication_year: Optional[int] = Field(
|
||||
# default=None, description="The publication year."
|
||||
# )
|
||||
# publication_date: Optional[str] = Field(
|
||||
# default=None, description="The publication date."
|
||||
# )
|
||||
# type: Optional[str] = Field(default=None, description="The work type.")
|
||||
# language: Optional[str] = Field(default=None, description="The work language.")
|
||||
# cited_by_count: int = Field(default=0, description="The number of citations.")
|
||||
# is_retracted: Optional[bool] = Field(
|
||||
# default=None, description="Whether the work is retracted."
|
||||
# )
|
||||
# is_paratext: Optional[bool] = Field(
|
||||
# default=None, description="Whether the work is paratext."
|
||||
# )
|
||||
# primary_location: Optional[Location] = Field(
|
||||
# default=None, description="The primary location."
|
||||
# )
|
||||
# locations: List[Location] = Field(
|
||||
# default_factory=list, description="The work locations."
|
||||
# )
|
||||
# best_oa_location: Optional[Location] = Field(
|
||||
# default=None, description="The best open access location."
|
||||
# )
|
||||
# open_access: Optional[OpenAccess] = Field(
|
||||
# default=None, description="Open access information."
|
||||
# )
|
||||
# authorships: List[Authorship] = Field(
|
||||
# default_factory=list, description="The authorships."
|
||||
# )
|
||||
# ids: Optional[WorkIds] = Field(default=None, description="External ids.")
|
||||
# biblio: Optional[Biblio] = Field(
|
||||
# default=None, description="Bibliographic information."
|
||||
# )
|
||||
# abstract_inverted_index: dict[str, List[int]] = Field(
|
||||
# default_factory=dict, description="The inverted abstract index."
|
||||
# )
|
||||
# referenced_works: List[str] = Field(
|
||||
# default_factory=list, description="Referenced work ids."
|
||||
# )
|
||||
# referenced_works_count: int = Field(
|
||||
# default=0, description="The number of referenced works."
|
||||
# )
|
||||
# related_works: List[str] = Field(
|
||||
# default_factory=list, description="Related work ids."
|
||||
# )
|
||||
# topics: List[Topic] = Field(default_factory=list, description="The topics.")
|
||||
# primary_topic: Optional[Topic] = Field(
|
||||
# default=None, description="The primary topic."
|
||||
# )
|
||||
# keywords: List[Keyword] = Field(default_factory=list, description="The keywords.")
|
||||
# funders: List[Funder] = Field(default_factory=list, description="The funders.")
|
||||
# awards: List[Award] = Field(default_factory=list, description="The awards.")
|
||||
# fwci: Optional[float] = Field(
|
||||
# default=None, description="The field weighted citation impact."
|
||||
# )
|
||||
# citation_normalized_percentile: Optional[CitationNormalizedPercentile] = Field(
|
||||
# default=None, description="The normalized citation percentile."
|
||||
# )
|
||||
# cited_by_percentile_year: Optional[CitedByPercentileYear] = Field(
|
||||
# default=None, description="The cited by percentile year."
|
||||
# )
|
||||
# counts_by_year: List[CountByYear] = Field(
|
||||
# default_factory=list, description="Citation counts by year."
|
||||
# )
|
||||
# sustainable_development_goals: List[SustainableDevelopmentGoal] = Field(
|
||||
# default_factory=list, description="Sustainable development goals."
|
||||
# )
|
||||
# mesh: List[Mesh] = Field(default_factory=list, description="MeSH terms.")
|
||||
# indexed_in: List[str] = Field(
|
||||
# default_factory=list, description="Indexes containing the work."
|
||||
# )
|
||||
# has_content: Optional[HasContent] = Field(
|
||||
# default=None, description="Available content flags."
|
||||
# )
|
||||
# content_url: Optional[str] = Field(default=None, description="The content URL.")
|
||||
# created_date: Optional[str] = Field(default=None, description="The creation date.")
|
||||
# updated_date: Optional[str] = Field(
|
||||
# default=None, description="The last update timestamp."
|
||||
# )
|
||||
|
||||
|
||||
class WorkSummary(BaseModel):
|
||||
doi: Optional[str] = Field(
|
||||
default=None, description="The optional DOI of the work."
|
||||
|
||||
@@ -40,26 +40,52 @@ class OpenAlexWorksSearchClient:
|
||||
publication_year: list[int] | None = None,
|
||||
work_type: list[str] | None = None,
|
||||
language: list[str] | None = None,
|
||||
institution_id: list[str] | None = None,
|
||||
topic_id: list[str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
indexed_author_id = f"https://openalex.org/{author_id.strip()}"
|
||||
filters = self._work_filters(publication_year, work_type, language)
|
||||
filters = self._work_filters(
|
||||
publication_year,
|
||||
work_type,
|
||||
language,
|
||||
topic_id,
|
||||
)
|
||||
author_filters: list[dict[str, Any]] = [
|
||||
{
|
||||
"term": {
|
||||
"authorships.author.id": indexed_author_id,
|
||||
},
|
||||
},
|
||||
]
|
||||
must_clauses: list[dict[str, Any]] = [
|
||||
{
|
||||
"nested": {
|
||||
"path": "authorships",
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": author_filters,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
if institution_id:
|
||||
must_clauses.append({
|
||||
"nested": {
|
||||
"path": "authorships.institutions",
|
||||
"query": {
|
||||
"terms": {
|
||||
"authorships.institutions.id": institution_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return {
|
||||
"from": (page - 1) * size,
|
||||
"size": size,
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"nested": {
|
||||
"path": "authorships",
|
||||
"query": {
|
||||
"term": {
|
||||
"authorships.author.id": indexed_author_id,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"must": must_clauses,
|
||||
"filter": filters,
|
||||
},
|
||||
},
|
||||
@@ -74,6 +100,7 @@ class OpenAlexWorksSearchClient:
|
||||
publication_year: list[int] | None = None,
|
||||
work_type: list[str] | None = None,
|
||||
language: list[str] | None = None,
|
||||
topic_id: list[str] | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
filters: list[dict[str, Any]] = []
|
||||
if publication_year:
|
||||
@@ -82,6 +109,21 @@ class OpenAlexWorksSearchClient:
|
||||
filters.append({"terms": {"type": work_type}})
|
||||
if language:
|
||||
filters.append({"terms": {"language": language}})
|
||||
if topic_id:
|
||||
filters.append({
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"nested": {
|
||||
"path": "topics",
|
||||
"query": {"terms": {"topics.id": topic_id}},
|
||||
},
|
||||
},
|
||||
{"terms": {"primary_topic.id": topic_id}},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
})
|
||||
return filters
|
||||
|
||||
async def search_author_works(
|
||||
@@ -92,6 +134,8 @@ class OpenAlexWorksSearchClient:
|
||||
publication_year: list[int] | None = None,
|
||||
work_type: list[str] | None = None,
|
||||
language: list[str] | None = None,
|
||||
institution_id: list[str] | None = None,
|
||||
topic_id: list[str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
if not self.api_key:
|
||||
raise MissingApiKeyError("OpenAlex works Elasticsearch API key is not configured.")
|
||||
@@ -111,8 +155,31 @@ class OpenAlexWorksSearchClient:
|
||||
publication_year=publication_year,
|
||||
work_type=work_type,
|
||||
language=language,
|
||||
institution_id=institution_id,
|
||||
topic_id=topic_id,
|
||||
),
|
||||
)
|
||||
# logging.debug(f"Response: {response.text}")
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
async def search_work(self, work_id: str) -> dict[str, Any]:
|
||||
if not self.api_key:
|
||||
raise MissingApiKeyError("OpenAlex works Elasticsearch API key is not configured.")
|
||||
|
||||
indexed_work_id = f"https://openalex.org/{work_id.strip().split('/')[-1]}"
|
||||
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={
|
||||
"size": 1,
|
||||
"query": {"term": {"id": indexed_work_id}},
|
||||
},
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
@@ -16,7 +16,10 @@ from inse.tags import Tags
|
||||
from .. import security
|
||||
from . import logic
|
||||
from inse.models.work_page import WorkPage
|
||||
from inse.models.work import Work
|
||||
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])
|
||||
@@ -45,6 +48,14 @@ async def get_author_works(
|
||||
language: Annotated[
|
||||
list[str] | None, Query(description="Filter by language code. Can be repeated.")
|
||||
] = None,
|
||||
institution_id: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="Filter by OpenAlex institution id. Can be repeated."),
|
||||
] = None,
|
||||
topic_id: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="Filter by OpenAlex topic id. Can be repeated."),
|
||||
] = None,
|
||||
principal: security.Principal = Depends(
|
||||
security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])
|
||||
),
|
||||
@@ -56,6 +67,8 @@ async def get_author_works(
|
||||
publication_year=publication_year,
|
||||
work_type=work_type,
|
||||
language=language,
|
||||
institution_id=institution_id,
|
||||
topic_id=topic_id,
|
||||
)
|
||||
|
||||
|
||||
@@ -68,3 +81,59 @@ 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,
|
||||
target_publications: Annotated[
|
||||
int,
|
||||
Query(
|
||||
description="Target number of publications used for the timeline. Complete years are always included.",
|
||||
ge=1,
|
||||
),
|
||||
] = 300,
|
||||
include_all: Annotated[
|
||||
bool,
|
||||
Query(description="If true, all publications are used for the timeline."),
|
||||
] = False,
|
||||
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,
|
||||
target_publications=target_publications,
|
||||
include_all=include_all,
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/detail/{work_id}",
|
||||
operation_id="getWork",
|
||||
response_model=Work,
|
||||
summary="Returns one publication.",
|
||||
)
|
||||
async def get_work(
|
||||
work_id: Annotated[
|
||||
str, Path(description="The OpenAlex work id, for example W2741809807.")
|
||||
],
|
||||
principal: security.Principal = Depends(
|
||||
security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])
|
||||
),
|
||||
):
|
||||
return await logic.get_work(work_id)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import json
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
@@ -19,7 +21,9 @@ def test_author_works_query_searches_authorship_author_id():
|
||||
assert query["size"] == 25
|
||||
author_query = query["query"]["bool"]["must"][0]["nested"]
|
||||
assert author_query["path"] == "authorships"
|
||||
assert author_query["query"]["term"]["authorships.author.id"] == "https://openalex.org/A5023888391"
|
||||
assert author_query["query"]["bool"]["filter"] == [
|
||||
{"term": {"authorships.author.id": "https://openalex.org/A5023888391"}},
|
||||
]
|
||||
assert query["query"]["bool"]["filter"] == []
|
||||
|
||||
|
||||
@@ -33,13 +37,191 @@ def test_author_works_query_adds_publication_filters():
|
||||
publication_year=[2023, 2024],
|
||||
work_type=["article", "book-chapter"],
|
||||
language=["en", "de"],
|
||||
institution_id=["https://openalex.org/I123"],
|
||||
topic_id=["https://openalex.org/T12419"],
|
||||
)
|
||||
|
||||
assert query["query"]["bool"]["filter"] == [
|
||||
{"terms": {"publication_year": [2023, 2024]}},
|
||||
{"terms": {"type": ["article", "book-chapter"]}},
|
||||
{"terms": {"language": ["en", "de"]}},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"nested": {
|
||||
"path": "topics",
|
||||
"query": {
|
||||
"terms": {
|
||||
"topics.id": ["https://openalex.org/T12419"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{"terms": {"primary_topic.id": ["https://openalex.org/T12419"]}},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
},
|
||||
]
|
||||
assert query["query"]["bool"]["must"] == [
|
||||
{
|
||||
"nested": {
|
||||
"path": "authorships",
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{
|
||||
"term": {
|
||||
"authorships.author.id": "https://openalex.org/A5023888391"
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nested": {
|
||||
"path": "authorships.institutions",
|
||||
"query": {
|
||||
"terms": {
|
||||
"authorships.institutions.id": [
|
||||
"https://openalex.org/I123",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def test_author_works_query_uses_nested_institution_path():
|
||||
client = OpenAlexWorksSearchClient(api_key="test-key")
|
||||
|
||||
query = client.author_works_query(
|
||||
"A5023888391",
|
||||
page=1,
|
||||
size=20,
|
||||
institution_id=["https://openalex.org/I205640436"],
|
||||
)
|
||||
|
||||
assert query["query"]["bool"]["must"][1] == {
|
||||
"nested": {
|
||||
"path": "authorships.institutions",
|
||||
"query": {
|
||||
"terms": {
|
||||
"authorships.institutions.id": [
|
||||
"https://openalex.org/I205640436",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_author_works_query_adds_topic_filter():
|
||||
client = OpenAlexWorksSearchClient(api_key="test-key")
|
||||
|
||||
query = client.author_works_query(
|
||||
"A5023888391",
|
||||
page=1,
|
||||
size=20,
|
||||
topic_id=["https://openalex.org/T12419"],
|
||||
)
|
||||
|
||||
assert query["query"]["bool"]["filter"] == [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"nested": {
|
||||
"path": "topics",
|
||||
"query": {
|
||||
"terms": {
|
||||
"topics.id": ["https://openalex.org/T12419"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{"terms": {"primary_topic.id": ["https://openalex.org/T12419"]}},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_search_author_works_passes_institution_filter_to_query():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
body = json.loads(request.content)
|
||||
assert body["query"]["bool"]["must"][1]["nested"]["path"] == (
|
||||
"authorships.institutions"
|
||||
)
|
||||
assert body["query"]["bool"]["must"][1]["nested"]["query"]["terms"] == {
|
||||
"authorships.institutions.id": ["https://openalex.org/I205640436"],
|
||||
}
|
||||
return httpx.Response(200, json={"hits": {"total": {"value": 1}, "hits": []}})
|
||||
|
||||
client = OpenAlexWorksSearchClient(
|
||||
base_url="https://project.nes.uni-due.de/elastic",
|
||||
index="openalex-works",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
await client.search_author_works(
|
||||
"A5023888391",
|
||||
page=1,
|
||||
size=20,
|
||||
institution_id=["https://openalex.org/I205640436"],
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_search_author_works_passes_topic_filter_to_query():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
body = json.loads(request.content)
|
||||
assert body["query"]["bool"]["filter"] == [
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"nested": {
|
||||
"path": "topics",
|
||||
"query": {
|
||||
"terms": {
|
||||
"topics.id": ["https://openalex.org/T12419"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"terms": {
|
||||
"primary_topic.id": ["https://openalex.org/T12419"],
|
||||
},
|
||||
},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
},
|
||||
]
|
||||
return httpx.Response(200, json={"hits": {"total": {"value": 1}, "hits": []}})
|
||||
|
||||
client = OpenAlexWorksSearchClient(
|
||||
base_url="https://project.nes.uni-due.de/elastic",
|
||||
index="openalex-works",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
await client.search_author_works(
|
||||
"A5023888391",
|
||||
page=1,
|
||||
size=20,
|
||||
topic_id=["https://openalex.org/T12419"],
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
@@ -62,6 +244,26 @@ async def test_search_author_works_calls_elasticsearch_index_with_api_key():
|
||||
assert result == {"hits": {"total": {"value": 0}, "hits": []}}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_search_work_filters_by_work_id():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
body = json.loads(request.content)
|
||||
assert body == {
|
||||
"size": 1,
|
||||
"query": {"term": {"id": "https://openalex.org/W2741809807"}},
|
||||
}
|
||||
return httpx.Response(200, json={"hits": {"total": {"value": 1}, "hits": []}})
|
||||
|
||||
client = OpenAlexWorksSearchClient(
|
||||
base_url="https://project.nes.uni-due.de/elastic",
|
||||
index="openalex-works",
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
await client.search_work("W2741809807")
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_search_author_works_requires_api_key():
|
||||
client = OpenAlexWorksSearchClient(api_key="")
|
||||
|
||||
Generated
+114
@@ -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"
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
GET https://inse.nes.uni-due.de/elastic/ude_persons_1.0/_search
|
||||
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": {
|
||||
"query_string": {
|
||||
"default_field": "name",
|
||||
"query": "Tobias Janelt"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
GET https://inse.nes.uni-due.de/elastic/ude_organization_content_august_2025/_search
|
||||
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||
Content-Type: application/json
|
||||
|
||||
# {
|
||||
# "query": {"match": {"staff.name": {"query": "Peter Roch", "operator": "and"}}}
|
||||
# }
|
||||
|
||||
###
|
||||
|
||||
GET https://project.nes.uni-due.de/elastic/openalex-authors/_search
|
||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||
Content-Type: application/json
|
||||
|
||||
|
||||
# {
|
||||
# "query": {
|
||||
# "query_string": {
|
||||
# "default_field": "display_name",
|
||||
# "query": "Tobias Janelt"
|
||||
# }
|
||||
# }
|
||||
|
||||
# }
|
||||
|
||||
###
|
||||
|
||||
GET https://project.nes.uni-due.de/elastic/openalex-authors/_search
|
||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"nested": {
|
||||
"path": "affiliations",
|
||||
"query": {
|
||||
"match_phrase": {
|
||||
"affiliations.institution.display_name": "University of Duisburg-Essen"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"nested": {
|
||||
"path": "counts_by_year",
|
||||
"query": {
|
||||
"range": {
|
||||
"counts_by_year.year": {
|
||||
"gte": 2020
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"must_not": [
|
||||
|
||||
{
|
||||
|
||||
"nested": {
|
||||
|
||||
"path": "counts_by_year",
|
||||
|
||||
"query": {
|
||||
|
||||
"range": {
|
||||
|
||||
"counts_by_year.year": {
|
||||
|
||||
"lt": 2020
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
legacy-peer-deps=true
|
||||
@@ -11,7 +11,7 @@
|
||||
"additionalProperties": {
|
||||
"ngVersion": "21.2.14",
|
||||
"providedInRoot": true,
|
||||
"serviceSuffix": "OpenApiService",
|
||||
"serviceSuffix": "Service",
|
||||
"withInterfaces": true,
|
||||
"enumPropertyNaming": "original",
|
||||
"fileNaming": "kebab-case"
|
||||
|
||||
Generated
+13
-168
@@ -19,6 +19,7 @@
|
||||
"@angular/platform-browser-dynamic": "^21.2.14",
|
||||
"@angular/router": "^21.2.14",
|
||||
"echarts": "^6.1.0",
|
||||
"echarts-wordcloud": "^2.1.0",
|
||||
"ngx-echarts": "^21.0.0",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0",
|
||||
@@ -325,38 +326,6 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular-devkit/architect/node_modules/chokidar": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
|
||||
"integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"readdirp": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular-devkit/architect/node_modules/readdirp": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
|
||||
"integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular-devkit/architect/node_modules/source-map": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",
|
||||
@@ -431,38 +400,6 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular-devkit/schematics/node_modules/chokidar": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
|
||||
"integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"readdirp": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular-devkit/schematics/node_modules/readdirp": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
|
||||
"integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular-devkit/schematics/node_modules/source-map": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",
|
||||
@@ -701,38 +638,6 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular/cli/node_modules/chokidar": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
|
||||
"integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"readdirp": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular/cli/node_modules/readdirp": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
|
||||
"integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular/cli/node_modules/source-map": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",
|
||||
@@ -1264,43 +1169,6 @@
|
||||
"node": ">=0.1.90"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz",
|
||||
"integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.2.1",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/runtime": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
|
||||
"integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.27.3",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz",
|
||||
@@ -4535,38 +4403,6 @@
|
||||
"url": "https://github.com/sponsors/epoberezkin"
|
||||
}
|
||||
},
|
||||
"node_modules/@schematics/angular/node_modules/chokidar": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
|
||||
"integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"readdirp": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@schematics/angular/node_modules/readdirp": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
|
||||
"integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 20.19.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/@schematics/angular/node_modules/source-map": {
|
||||
"version": "0.7.6",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",
|
||||
@@ -6252,6 +6088,15 @@
|
||||
"zrender": "6.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/echarts-wordcloud": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/echarts-wordcloud/-/echarts-wordcloud-2.1.0.tgz",
|
||||
"integrity": "sha512-Kt1JmbcROgb+3IMI48KZECK2AP5lG6bSsOEs+AsuwaWJxQom31RTNd6NFYI01E/YaI1PFZeueaupjlmzSQasjQ==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"echarts": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/echarts/node_modules/tslib": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
|
||||
@@ -10635,9 +10480,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tmp": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz",
|
||||
"integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==",
|
||||
"version": "0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.7.tgz",
|
||||
"integrity": "sha512-e0votIpp4Uo2AJYSzVHV6xCcawuiez3DzqDAbrTc3YxBkplN6e+dM13ZeIcZnDg/QpSuU2zfZ3rzwY8ukEnaXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"@angular/platform-browser-dynamic": "^21.2.14",
|
||||
"@angular/router": "^21.2.14",
|
||||
"echarts": "^6.1.0",
|
||||
"echarts-wordcloud": "^2.1.0",
|
||||
"ngx-echarts": "^21.0.0",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0",
|
||||
|
||||
@@ -1,78 +1,117 @@
|
||||
.gitignore
|
||||
.openapi-generator-ignore
|
||||
README.md
|
||||
api.base.service.ts
|
||||
api.module.ts
|
||||
api/api.ts
|
||||
api/iNSEAccountService.service.ts
|
||||
api/iNSEService.service.ts
|
||||
api/funding.service.ts
|
||||
api/funding.serviceInterface.ts
|
||||
api/inse-account-service.service.ts
|
||||
api/inse-account-service.serviceInterface.ts
|
||||
api/inse-service.service.ts
|
||||
api/inse-service.serviceInterface.ts
|
||||
api/institutions.service.ts
|
||||
api/institutions.serviceInterface.ts
|
||||
api/items.service.ts
|
||||
api/personNetwork.service.ts
|
||||
api/items.serviceInterface.ts
|
||||
api/person-network.service.ts
|
||||
api/person-network.serviceInterface.ts
|
||||
api/persons.service.ts
|
||||
api/persons.serviceInterface.ts
|
||||
api/topics.service.ts
|
||||
api/topics.serviceInterface.ts
|
||||
api/works.service.ts
|
||||
api/works.serviceInterface.ts
|
||||
configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/accessGrant.ts
|
||||
model/authAccount.ts
|
||||
model/authScope.ts
|
||||
model/access-grant.ts
|
||||
model/auth-account.ts
|
||||
model/auth-scope.ts
|
||||
model/author-affiliations-inner.ts
|
||||
model/author-counts-by-year-inner.ts
|
||||
model/author-ids.ts
|
||||
model/author-network-node.ts
|
||||
model/author-parsed-longest-name.ts
|
||||
model/author-position-count.ts
|
||||
model/author-summary-stats.ts
|
||||
model/author.ts
|
||||
model/authorAffiliationsInner.ts
|
||||
model/authorCountsByYearInner.ts
|
||||
model/authorIds.ts
|
||||
model/authorParsedLongestName.ts
|
||||
model/authorSummaryStats.ts
|
||||
model/authorsListResponse.ts
|
||||
model/authors-filter-properties.ts
|
||||
model/authors-list-response.ts
|
||||
model/authorship.ts
|
||||
model/autocomplete-response-meta.ts
|
||||
model/autocomplete-response-results-inner.ts
|
||||
model/autocomplete-response.ts
|
||||
model/award.ts
|
||||
model/collaborationNetwork.ts
|
||||
model/collaborationNetworkEdge.ts
|
||||
model/collaborationNetworkNode.ts
|
||||
model/collaborationNetworkNodeType.ts
|
||||
model/costUsd.ts
|
||||
model/dehydratedAuthor.ts
|
||||
model/dehydratedFunder.ts
|
||||
model/dehydratedInstitution.ts
|
||||
model/dehydratedSource.ts
|
||||
model/filterInformation.ts
|
||||
model/filterProperties.ts
|
||||
model/collaboration-network-edge.ts
|
||||
model/collaboration-network-node-type.ts
|
||||
model/collaboration-network.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/groupByResult.ts
|
||||
model/hTTPValidationError.ts
|
||||
model/identityGrant.ts
|
||||
model/institutionInformation.ts
|
||||
model/group-by-result.ts
|
||||
model/http-validation-error.ts
|
||||
model/identity-grant.ts
|
||||
model/institution-geo.ts
|
||||
model/institution-ids.ts
|
||||
model/institution-information.ts
|
||||
model/institution-network-node.ts
|
||||
model/institution.ts
|
||||
model/institutions-list-response.ts
|
||||
model/item-create.ts
|
||||
model/item-page.ts
|
||||
model/item.ts
|
||||
model/itemCreate.ts
|
||||
model/itemPage.ts
|
||||
model/latitude.ts
|
||||
model/location.ts
|
||||
model/longitude.ts
|
||||
model/meta.ts
|
||||
model/model2YrMeanCitedness.ts
|
||||
model/model2-yr-mean-citedness.ts
|
||||
model/models.ts
|
||||
model/openAccess.ts
|
||||
model/personBio.ts
|
||||
model/open-access.ts
|
||||
model/person-bio.ts
|
||||
model/publication-ids-by-author-position.ts
|
||||
model/publications-by-author-response.ts
|
||||
model/score.ts
|
||||
model/validationError.ts
|
||||
model/validationErrorLocInner.ts
|
||||
model/topic-count.ts
|
||||
model/topic-domain.ts
|
||||
model/topic-field.ts
|
||||
model/topic-ids.ts
|
||||
model/topic-subfield.ts
|
||||
model/topic.ts
|
||||
model/topics-by-time.ts
|
||||
model/topics-by-year.ts
|
||||
model/topics-list-response.ts
|
||||
model/validation-error-loc-inner.ts
|
||||
model/validation-error.ts
|
||||
model/value.ts
|
||||
model/work-biblio.ts
|
||||
model/work-citation-normalized-percentile.ts
|
||||
model/work-cited-by-percentile-year.ts
|
||||
model/work-counts-by-year-inner.ts
|
||||
model/work-has-content.ts
|
||||
model/work-ids.ts
|
||||
model/work-keyword.ts
|
||||
model/work-mesh-inner.ts
|
||||
model/work-network-node.ts
|
||||
model/work-page.ts
|
||||
model/work-sustainable-development-goals-inner.ts
|
||||
model/work-topic-domain.ts
|
||||
model/work-topic-field.ts
|
||||
model/work-topic-information.ts
|
||||
model/work-topic-subfield.ts
|
||||
model/work-topic.ts
|
||||
model/work.ts
|
||||
model/workBiblio.ts
|
||||
model/workCitationNormalizedPercentile.ts
|
||||
model/workCitedByPercentileYear.ts
|
||||
model/workCountsByYearInner.ts
|
||||
model/workHasContent.ts
|
||||
model/workIds.ts
|
||||
model/workKeyword.ts
|
||||
model/workMeshInner.ts
|
||||
model/workPage.ts
|
||||
model/workSustainableDevelopmentGoalsInner.ts
|
||||
model/workTopic.ts
|
||||
model/workTopicDomain.ts
|
||||
model/workTopicField.ts
|
||||
model/workTopicInformation.ts
|
||||
model/workTopicSubfield.ts
|
||||
model/worksListResponse.ts
|
||||
model/works-filter-properties.ts
|
||||
model/works-list-response.ts
|
||||
param.ts
|
||||
provide-api.ts
|
||||
variables.ts
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
export * from './iNSEAccountService.service';
|
||||
import { INSEAccountServiceService } from './iNSEAccountService.service';
|
||||
export * from './iNSEService.service';
|
||||
import { INSEServiceService } from './iNSEService.service';
|
||||
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';
|
||||
export * from './inse-service.service';
|
||||
import { INSEServiceService } from './inse-service.service';
|
||||
export * from './inse-service.serviceInterface';
|
||||
export * from './institutions.service';
|
||||
import { InstitutionsService } from './institutions.service';
|
||||
export * from './institutions.serviceInterface';
|
||||
export * from './items.service';
|
||||
import { ItemsService } from './items.service';
|
||||
export * from './personNetwork.service';
|
||||
import { PersonNetworkService } from './personNetwork.service';
|
||||
export * from './items.serviceInterface';
|
||||
export * from './person-network.service';
|
||||
import { PersonNetworkService } from './person-network.service';
|
||||
export * from './person-network.serviceInterface';
|
||||
export * from './persons.service';
|
||||
import { PersonsService } from './persons.service';
|
||||
export * from './persons.serviceInterface';
|
||||
export * from './topics.service';
|
||||
import { TopicsService } from './topics.service';
|
||||
export * from './topics.serviceInterface';
|
||||
export * from './works.service';
|
||||
import { WorksService } from './works.service';
|
||||
export const APIS = [INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, TopicsService, WorksService];
|
||||
export * from './works.serviceInterface';
|
||||
export const APIS = [FundingService, INSEAccountServiceService, INSEServiceService, InstitutionsService, ItemsService, PersonNetworkService, PersonsService, TopicsService, WorksService];
|
||||
|
||||
@@ -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<FundersByAuthorResponse>;
|
||||
public getFundersByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<FundersByAuthorResponse>>;
|
||||
public getFundersByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<FundersByAuthorResponse>>;
|
||||
public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling 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<FundersByAuthorResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>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<PublicationsByAuthorResponse>;
|
||||
public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PublicationsByAuthorResponse>>;
|
||||
public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PublicationsByAuthorResponse>>;
|
||||
public getPublicationsByAuthor(authorId: string, page?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling getPublicationsByAuthor.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>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<PublicationsByAuthorResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,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<FundersByAuthorResponse>;
|
||||
|
||||
/**
|
||||
* 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<PublicationsByAuthorResponse>;
|
||||
|
||||
}
|
||||
@@ -16,8 +16,6 @@ import { HttpClient, HttpHeaders, HttpParams,
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { AuthorsListResponse } from '../model/authorsListResponse';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
@@ -26,8 +24,6 @@ import { Item } from '../model/item';
|
||||
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';
|
||||
@@ -295,69 +291,6 @@ export class INSEServiceService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<PersonBio>;
|
||||
public generatePersonBio(authorId: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonBio>>;
|
||||
public generatePersonBio(authorId: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonBio>>;
|
||||
public generatePersonBio(authorId: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling generatePersonBio.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>authorId, 'author_id');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/bio`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<PersonBio>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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}
|
||||
@@ -480,27 +413,15 @@ export class INSEServiceService extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for person by ID.
|
||||
* @endpoint get /api/inse-service/person/{id}
|
||||
* @param id OpenAlex author ID
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* 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 getPersonByID(id: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public getPersonByID(id: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public getPersonByID(id: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public getPersonByID(id: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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,
|
||||
<any>include, 'include');
|
||||
public getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
|
||||
public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
||||
public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
||||
public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -527,207 +448,11 @@ export class INSEServiceService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/person/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
let localVarPath = `/api/inse-service/topics/hierarchy`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
return this.httpClient.request<object>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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<AuthorsListResponse>;
|
||||
public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersons(authorId?: string, query?: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersons(authorId?: string, query?: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>authorId, 'author_id');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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<AuthorsListResponse>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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,
|
||||
<any>institutionName, 'institution_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/searchByInstitution`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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<AuthorsListResponse>;
|
||||
public searchPersonsByName(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByName(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByName(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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,
|
||||
<any>authorName, 'author_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/searchByName`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { AccessGrant } from '../model/access-grant';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { IdentityGrant } from '../model/identity-grant';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
INSEAccountServiceServiceInterface
|
||||
} from './inse-account-service.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class INSEAccountServiceService extends BaseService implements INSEAccountServiceServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Access Grant
|
||||
* @endpoint post /inse-account/auth/access
|
||||
* @param secret
|
||||
* @param account
|
||||
* @param organization
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AccessGrant>;
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AccessGrant>>;
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AccessGrant>>;
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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', <any>secret) as any || localVarFormParams;
|
||||
}
|
||||
if (account !== undefined) {
|
||||
localVarFormParams = localVarFormParams.append('account', <any>account) as any || localVarFormParams;
|
||||
}
|
||||
if (organization !== undefined) {
|
||||
localVarFormParams = localVarFormParams.append('organization', <any>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<AccessGrant>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams,
|
||||
responseType: <any>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<IdentityGrant>;
|
||||
public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<IdentityGrant>>;
|
||||
public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<IdentityGrant>>;
|
||||
public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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', <any>username) as any || localVarFormParams;
|
||||
}
|
||||
if (password !== undefined) {
|
||||
localVarFormParams = localVarFormParams.append('password', <any>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<IdentityGrant>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AccessGrant } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { IdentityGrant } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface INSEAccountServiceServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Get Access Grant
|
||||
*
|
||||
* @endpoint post /inse-account/auth/access
|
||||
* @param secret
|
||||
* @param account
|
||||
* @param organization
|
||||
*/
|
||||
getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, extraHttpRequestParams?: any): Observable<AccessGrant>;
|
||||
|
||||
/**
|
||||
* Get Identity Grant
|
||||
*
|
||||
* @endpoint post /inse-account/auth/id
|
||||
* @param username
|
||||
* @param password
|
||||
*/
|
||||
getIdentityGrantInseAccountAuthIdPost(username: string, password: string, extraHttpRequestParams?: any): Observable<IdentityGrant>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,541 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { Item } from '../model/item';
|
||||
// @ts-ignore
|
||||
import { ItemCreate } from '../model/item-create';
|
||||
// @ts-ignore
|
||||
import { ItemPage } from '../model/item-page';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
INSEServiceServiceInterface
|
||||
} from './inse-service.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class INSEServiceService extends BaseService implements INSEServiceServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new item.
|
||||
* @endpoint post /api/inse-service/items
|
||||
* @param itemCreate
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public addItem(itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Item>;
|
||||
public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
||||
public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
||||
public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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<Item>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>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<object>;
|
||||
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
||||
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
||||
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageSize, 'page_size');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>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<object>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
|
||||
public countTopicHierarchy(topic: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
||||
public countTopicHierarchy(topic: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
||||
public countTopicHierarchy(topic: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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,
|
||||
<any>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<object>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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<any>;
|
||||
public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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<any>('delete', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>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<Item>;
|
||||
public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
||||
public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
||||
public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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<Item>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>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<ItemPage>;
|
||||
public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ItemPage>>;
|
||||
public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ItemPage>>;
|
||||
public getItems(pageOffset?: number, pageSize?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageOffset, 'pageOffset');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>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<ItemPage>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).
|
||||
* @endpoint get /api/inse-service/topics/hierarchy
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
|
||||
public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
||||
public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
||||
public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
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<object>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>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<Item>;
|
||||
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
||||
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
||||
public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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<Item>('put', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: itemCreate,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { Item } from '../model/models';
|
||||
import { ItemCreate } from '../model/models';
|
||||
import { ItemPage } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface INSEServiceServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Adds a new item.
|
||||
*
|
||||
* @endpoint post /api/inse-service/items
|
||||
* @param itemCreate
|
||||
*/
|
||||
addItem(itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
/**
|
||||
* Builds the topic hierarchy cache.
|
||||
*
|
||||
* @endpoint get /api/inse-service/topics/cache
|
||||
* @param pageSize Page size for each search page.
|
||||
* @param saveJson Persist cache JSON to data folder.
|
||||
*/
|
||||
buildTopicCache(pageSize?: number, saveJson?: boolean, extraHttpRequestParams?: any): Observable<object>;
|
||||
|
||||
/**
|
||||
* Counts topic hierarchy occurrences from cache.
|
||||
*
|
||||
* @endpoint get /api/inse-service/topics/count
|
||||
* @param topic Topic names (repeat parameter).
|
||||
*/
|
||||
countTopicHierarchy(topic: Array<string>, extraHttpRequestParams?: any): Observable<object>;
|
||||
|
||||
/**
|
||||
* Deletes the item with the id.
|
||||
*
|
||||
* @endpoint delete /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
*/
|
||||
deleteItem(id: number, extraHttpRequestParams?: any): Observable<any>;
|
||||
|
||||
/**
|
||||
* Returns the item with the id.
|
||||
*
|
||||
* @endpoint get /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
*/
|
||||
getItem(id: number, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
/**
|
||||
* Returns a page of items.
|
||||
*
|
||||
* @endpoint get /api/inse-service/items
|
||||
* @param pageOffset The page offset.
|
||||
* @param pageSize The page size.
|
||||
*/
|
||||
getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable<ItemPage>;
|
||||
|
||||
/**
|
||||
* Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).
|
||||
*
|
||||
* @endpoint get /api/inse-service/topics/hierarchy
|
||||
*/
|
||||
getTopicHierarchy(extraHttpRequestParams?: any): Observable<object>;
|
||||
|
||||
/**
|
||||
* Updates the item with the id.
|
||||
*
|
||||
* @endpoint put /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* @param itemCreate
|
||||
*/
|
||||
updateItem(id: number, itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* Innovation Search Engine 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 { AutocompleteResponse } from '../model/autocomplete-response';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { InstitutionsListResponse } from '../model/institutions-list-response';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
InstitutionsServiceInterface
|
||||
} from './institutions.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class InstitutionsService extends BaseService implements InstitutionsServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns institution options for autocomplete inputs.
|
||||
* @endpoint get /api/institutions/autocomplete
|
||||
* @param query Institution search text, for example \'Duisburg Essen\'.
|
||||
* @param countryCode Optional ISO country code filter.
|
||||
* @param type Optional institution type filter.
|
||||
* @param limit Maximum number of autocomplete options.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AutocompleteResponse>;
|
||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AutocompleteResponse>>;
|
||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AutocompleteResponse>>;
|
||||
public autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (query === null || query === undefined) {
|
||||
throw new Error('Required parameter query was null or undefined when calling autocompleteInstitutions.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>countryCode, 'countryCode');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>type, 'type');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>limit, 'limit');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/institutions/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AutocompleteResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of OpenAlex institutions.
|
||||
* @endpoint get /api/institutions
|
||||
* @param search Full-text search, for example \'Duisburg Essen\'.
|
||||
* @param filter OpenAlex filter, for example \'country_code:DE,type:education\'.
|
||||
* @param sort Sort field, for example \'works_count:desc\'.
|
||||
* @param groupBy OpenAlex group_by field, for example \'country_code\'.
|
||||
* @param perPage Results per page.
|
||||
* @param page Page number. Use cursor for deep pagination.
|
||||
* @param cursor Cursor pagination token. Use \'*\' to start.
|
||||
* @param sample Random sample size. Cannot be combined with sort or page.
|
||||
* @param select Comma-separated fields to return.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionsListResponse>;
|
||||
public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionsListResponse>>;
|
||||
public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionsListResponse>>;
|
||||
public listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>search, 'search');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>filter, 'filter');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sort, 'sort');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>groupBy, 'group_by');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>perPage, 'per_page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>cursor, 'cursor');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sample, 'sample');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>select, 'select');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/institutions`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InstitutionsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Innovation Search Engine 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 { AutocompleteResponse } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { InstitutionsListResponse } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface InstitutionsServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Returns institution options for autocomplete inputs.
|
||||
*
|
||||
* @endpoint get /api/institutions/autocomplete
|
||||
* @param query Institution search text, for example \'Duisburg Essen\'.
|
||||
* @param countryCode Optional ISO country code filter.
|
||||
* @param type Optional institution type filter.
|
||||
* @param limit Maximum number of autocomplete options.
|
||||
*/
|
||||
autocompleteInstitutions(query: string, countryCode?: string, type?: string, limit?: number, extraHttpRequestParams?: any): Observable<AutocompleteResponse>;
|
||||
|
||||
/**
|
||||
* Returns a list of OpenAlex institutions.
|
||||
*
|
||||
* @endpoint get /api/institutions
|
||||
* @param search Full-text search, for example \'Duisburg Essen\'.
|
||||
* @param filter OpenAlex filter, for example \'country_code:DE,type:education\'.
|
||||
* @param sort Sort field, for example \'works_count:desc\'.
|
||||
* @param groupBy OpenAlex group_by field, for example \'country_code\'.
|
||||
* @param perPage Results per page.
|
||||
* @param page Page number. Use cursor for deep pagination.
|
||||
* @param cursor Cursor pagination token. Use \'*\' to start.
|
||||
* @param sample Random sample size. Cannot be combined with sort or page.
|
||||
* @param select Comma-separated fields to return.
|
||||
*/
|
||||
listInstitutions(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, extraHttpRequestParams?: any): Observable<InstitutionsListResponse>;
|
||||
|
||||
}
|
||||
@@ -17,25 +17,28 @@ import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { Item } from '../model/item';
|
||||
// @ts-ignore
|
||||
import { ItemCreate } from '../model/itemCreate';
|
||||
import { ItemCreate } from '../model/item-create';
|
||||
// @ts-ignore
|
||||
import { ItemPage } from '../model/itemPage';
|
||||
import { ItemPage } from '../model/item-page';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
ItemsServiceInterface
|
||||
} from './items.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ItemsService extends BaseService {
|
||||
export class ItemsService extends BaseService implements ItemsServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { Item } from '../model/models';
|
||||
import { ItemCreate } from '../model/models';
|
||||
import { ItemPage } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface ItemsServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Adds a new item.
|
||||
*
|
||||
* @endpoint post /api/inse-service/items
|
||||
* @param itemCreate
|
||||
*/
|
||||
addItem(itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
/**
|
||||
* Deletes the item with the id.
|
||||
*
|
||||
* @endpoint delete /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
*/
|
||||
deleteItem(id: number, extraHttpRequestParams?: any): Observable<any>;
|
||||
|
||||
/**
|
||||
* Returns the item with the id.
|
||||
*
|
||||
* @endpoint get /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
*/
|
||||
getItem(id: number, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
/**
|
||||
* Returns a page of items.
|
||||
*
|
||||
* @endpoint get /api/inse-service/items
|
||||
* @param pageOffset The page offset.
|
||||
* @param pageSize The page size.
|
||||
*/
|
||||
getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable<ItemPage>;
|
||||
|
||||
/**
|
||||
* Updates the item with the id.
|
||||
*
|
||||
* @endpoint put /api/inse-service/items/{id}
|
||||
* @param id The item id.
|
||||
* @param itemCreate
|
||||
*/
|
||||
updateItem(id: number, itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { CollaborationNetwork } from '../model/collaboration-network';
|
||||
// @ts-ignore
|
||||
import { FilterProperties } from '../model/filter-properties';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
PersonNetworkServiceInterface
|
||||
} from './person-network.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PersonNetworkService extends BaseService implements PersonNetworkServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a person\'s collaboration network.
|
||||
* Returns a person\'s collaboration network based on their works and co-authors.
|
||||
* @endpoint post /api/person/network/{raw_user_id}
|
||||
* @param rawUserId The raw user ID of the person.
|
||||
* @param filterProperties
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CollaborationNetwork>;
|
||||
public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CollaborationNetwork>>;
|
||||
public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CollaborationNetwork>>;
|
||||
public getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
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<CollaborationNetwork>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: filterProperties,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { CollaborationNetwork } from '../model/models';
|
||||
import { FilterProperties } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface PersonNetworkServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Get a person\'s collaboration network.
|
||||
* Returns a person\'s collaboration network based on their works and co-authors.
|
||||
* @endpoint post /api/person/network/{raw_user_id}
|
||||
* @param rawUserId The raw user ID of the person.
|
||||
* @param filterProperties
|
||||
*/
|
||||
getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, extraHttpRequestParams?: any): Observable<CollaborationNetwork>;
|
||||
|
||||
}
|
||||
@@ -17,23 +17,28 @@ import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { AuthorsListResponse } from '../model/authorsListResponse';
|
||||
import { AuthorsListResponse } from '../model/authors-list-response';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
import { CustomAuthorsListResponse } from '../model/custom-authors-list-response';
|
||||
// @ts-ignore
|
||||
import { PersonBio } from '../model/personBio';
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { PersonBio } from '../model/person-bio';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
PersonsServiceInterface
|
||||
} from './persons.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class PersonsService extends BaseService {
|
||||
export class PersonsService extends BaseService implements PersonsServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
@@ -166,6 +171,70 @@ export class PersonsService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for person by ID.
|
||||
* @endpoint get /api/inse-service/person/{id}
|
||||
* @param id OpenAlex author ID
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getPersonByID_1(id: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public getPersonByID_1(id: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public getPersonByID_1(id: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public getPersonByID_1(id: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling getPersonByID_1.');
|
||||
}
|
||||
if (include === null || include === undefined) {
|
||||
throw new Error('Required parameter include was null or undefined when calling getPersonByID_1.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/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<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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
|
||||
@@ -230,17 +299,151 @@ export class PersonsService extends BaseService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for persons by institution name.
|
||||
* @endpoint get /api/inse-service/persons/searchByInstitution
|
||||
* @param institutionName Institution name (e.g., MIT, Oxford University)
|
||||
* Searches for person by name.
|
||||
* @endpoint get /api/inse-service/persons/autocomplete
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public searchPersonsAutocomplete(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsAutocomplete(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsAutocomplete(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsAutocomplete(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorName === null || authorName === undefined) {
|
||||
throw new Error('Required parameter authorName was null or undefined when calling searchPersonsAutocomplete.');
|
||||
}
|
||||
if (include === null || include === undefined) {
|
||||
throw new Error('Required parameter include was null or undefined when calling searchPersonsAutocomplete.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>authorName, 'author_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for person by name.
|
||||
* @endpoint get /api/inse-service/persons/autocomplete
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsAutocomplete_2(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsAutocomplete_2(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorName === null || authorName === undefined) {
|
||||
throw new Error('Required parameter authorName was null or undefined when calling searchPersonsAutocomplete_2.');
|
||||
}
|
||||
if (include === null || include === undefined) {
|
||||
throw new Error('Required parameter include was null or undefined when calling searchPersonsAutocomplete_2.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>authorName, 'author_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for persons by institution name.
|
||||
* @endpoint get /api/inse-service/persons/searchByInstitution
|
||||
* @param institutionName Institution name (e.g., MIT, Oxford University)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (institutionName === null || institutionName === undefined) {
|
||||
throw new Error('Required parameter institutionName was null or undefined when calling searchPersonsByInstitution.');
|
||||
}
|
||||
@@ -253,6 +456,82 @@ export class PersonsService extends BaseService {
|
||||
<any>institutionName, 'institution_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>limit, 'limit');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageOffset, 'page_offset');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/searchByInstitution`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for persons by institution name.
|
||||
* @endpoint get /api/inse-service/persons/searchByInstitution
|
||||
* @param institutionName Institution name (e.g., MIT, Oxford University)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (institutionName === null || institutionName === undefined) {
|
||||
throw new Error('Required parameter institutionName was null or undefined when calling searchPersonsByInstitution_3.');
|
||||
}
|
||||
if (include === null || include === undefined) {
|
||||
throw new Error('Required parameter include was null or undefined when calling searchPersonsByInstitution_3.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>institutionName, 'institution_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>limit, 'limit');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageOffset, 'page_offset');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -300,13 +579,15 @@ export class PersonsService extends BaseService {
|
||||
* @endpoint get /api/inse-service/persons/searchByName
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsByName(authorName: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsByName(authorName: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByName(authorName: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByName(authorName: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorName === null || authorName === undefined) {
|
||||
throw new Error('Required parameter authorName was null or undefined when calling searchPersonsByName.');
|
||||
}
|
||||
@@ -319,6 +600,10 @@ export class PersonsService extends BaseService {
|
||||
<any>authorName, 'author_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>limit, 'limit');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageOffset, 'page_offset');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -361,4 +646,246 @@ export class PersonsService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for person by name.
|
||||
* @endpoint get /api/inse-service/persons/searchByName
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorName === null || authorName === undefined) {
|
||||
throw new Error('Required parameter authorName was null or undefined when calling searchPersonsByName_4.');
|
||||
}
|
||||
if (include === null || include === undefined) {
|
||||
throw new Error('Required parameter include was null or undefined when calling searchPersonsByName_4.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>authorName, 'author_name');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>limit, 'limit');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageOffset, 'page_offset');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/searchByName`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for persons with advanced filters (Topic & Institution) and pagination.
|
||||
* @endpoint get /api/inse-service/persons/search-list
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param institutionName Filter by institution name
|
||||
* @param topic Filter by topic display names
|
||||
* @param page Page number (1-indexed)
|
||||
* @param pageSize Results per page
|
||||
* @param include Comma-separated include tags
|
||||
* @param strict Strict institution search by target year
|
||||
* @param filterMode Filter mode: \'in\' or \'from\'
|
||||
* @param filterYear Filter year
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, 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<CustomAuthorsListResponse>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, 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<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, 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<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, 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<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>institutionName, 'institutionName');
|
||||
if (topic) {
|
||||
topic.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topic');
|
||||
})
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageSize, 'pageSize');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>strict, 'strict');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>filterMode, 'filterMode');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>filterYear, 'filterYear');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/search-list`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<CustomAuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for persons with advanced filters (Topic & Institution) and pagination.
|
||||
* @endpoint get /api/inse-service/persons/search-list
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param institutionName Filter by institution name
|
||||
* @param topic Filter by topic display names
|
||||
* @param page Page number (1-indexed)
|
||||
* @param pageSize Results per page
|
||||
* @param include Comma-separated include tags
|
||||
* @param strict Strict institution search by target year
|
||||
* @param filterMode Filter mode: \'in\' or \'from\'
|
||||
* @param filterYear Filter year
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, 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<CustomAuthorsListResponse>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, 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<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, 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<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, 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<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>institutionName, 'institutionName');
|
||||
if (topic) {
|
||||
topic.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topic');
|
||||
})
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>pageSize, 'pageSize');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>include, 'include');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>strict, 'strict');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>filterMode, 'filterMode');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>filterYear, 'filterYear');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/inse-service/persons/search-list`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<CustomAuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { AuthorsListResponse } from '../model/models';
|
||||
import { CustomAuthorsListResponse } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { PersonBio } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface PersonsServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Generates a bio for a person by author ID.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/bio
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
* @param include Comma-separated list to include tags
|
||||
*/
|
||||
generatePersonBio(authorId: string, include?: string, extraHttpRequestParams?: any): Observable<PersonBio>;
|
||||
|
||||
/**
|
||||
* Searches for person by ID.
|
||||
*
|
||||
* @endpoint get /api/inse-service/person/{id}
|
||||
* @param id OpenAlex author ID
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
*/
|
||||
getPersonByID(id: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for person by ID.
|
||||
*
|
||||
* @endpoint get /api/inse-service/person/{id}
|
||||
* @param id OpenAlex author ID
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
*/
|
||||
getPersonByID_1(id: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for persons by ID or name.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/search
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost
|
||||
*/
|
||||
searchPersons(authorId?: string, query?: string, include?: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for person by name.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/autocomplete
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
*/
|
||||
searchPersonsAutocomplete(authorName: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for person by name.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/autocomplete
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
*/
|
||||
searchPersonsAutocomplete_2(authorName: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for persons by institution name.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/searchByInstitution
|
||||
* @param institutionName Institution name (e.g., MIT, Oxford University)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
*/
|
||||
searchPersonsByInstitution(institutionName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for persons by institution name.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/searchByInstitution
|
||||
* @param institutionName Institution name (e.g., MIT, Oxford University)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
*/
|
||||
searchPersonsByInstitution_3(institutionName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for person by name.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/searchByName
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
*/
|
||||
searchPersonsByName(authorName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* Searches for person by name.
|
||||
*
|
||||
* @endpoint get /api/inse-service/persons/searchByName
|
||||
* @param authorName Authors name (e.g., Arman Arzani)
|
||||
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
|
||||
* @param limit Limit of search page results
|
||||
* @param pageOffset Offset of the result page
|
||||
*/
|
||||
searchPersonsByName_4(authorName: string, include: string, limit?: number, pageOffset?: number, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* 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 filterMode Filter mode: \'in\' or \'from\'
|
||||
* @param filterYear Filter year
|
||||
*/
|
||||
searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
|
||||
|
||||
/**
|
||||
* 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 filterMode Filter mode: \'in\' or \'from\'
|
||||
* @param filterYear Filter year
|
||||
*/
|
||||
searchPersonsList_5(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, strict?: boolean, filterMode?: string, filterYear?: number, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
|
||||
|
||||
}
|
||||
@@ -17,24 +17,103 @@ import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
import { AutocompleteResponse } from '../model/autocomplete-response';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { TopicsListResponse } from '../model/topics-list-response';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
TopicsServiceInterface
|
||||
} from './topics.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TopicsService extends BaseService {
|
||||
export class TopicsService extends BaseService implements TopicsServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns topic options for autocomplete inputs.
|
||||
* @endpoint get /api/topics/autocomplete
|
||||
* @param query Topic search text, for example \'machine learning\'.
|
||||
* @param domainId Optional OpenAlex domain id filter.
|
||||
* @param fieldId Optional OpenAlex field id filter.
|
||||
* @param subfieldId Optional OpenAlex subfield id filter.
|
||||
* @param limit Maximum number of autocomplete options.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AutocompleteResponse>;
|
||||
public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AutocompleteResponse>>;
|
||||
public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AutocompleteResponse>>;
|
||||
public autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (query === null || query === undefined) {
|
||||
throw new Error('Required parameter query was null or undefined when calling autocompleteTopics.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>query, 'query');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>domainId, 'domainId');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>fieldId, 'fieldId');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>subfieldId, 'subfieldId');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>limit, 'limit');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/topics/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AutocompleteResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>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
|
||||
@@ -159,4 +238,136 @@ export class TopicsService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<object>;
|
||||
public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
|
||||
public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
|
||||
public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
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<object>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of OpenAlex topics.
|
||||
* @endpoint get /api/topics
|
||||
* @param search Full-text search, for example \'machine learning\'.
|
||||
* @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'.
|
||||
* @param sort Sort field, for example \'works_count:desc\'.
|
||||
* @param groupBy OpenAlex group_by field, for example \'domain.id\'.
|
||||
* @param perPage Results per page.
|
||||
* @param page Page number. Use cursor for deep pagination.
|
||||
* @param cursor Cursor pagination token. Use \'*\' to start.
|
||||
* @param sample Random sample size. Cannot be combined with sort or page.
|
||||
* @param select Comma-separated fields to return.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<TopicsListResponse>;
|
||||
public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<TopicsListResponse>>;
|
||||
public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<TopicsListResponse>>;
|
||||
public listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>search, 'search');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>filter, 'filter');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sort, 'sort');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>groupBy, 'group_by');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>perPage, 'per_page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>cursor, 'cursor');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sample, 'sample');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>select, 'select');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/topics`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<TopicsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Innovation Search Engine 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 { AutocompleteResponse } from '../model/models';
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { TopicsListResponse } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface TopicsServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Returns topic options for autocomplete inputs.
|
||||
*
|
||||
* @endpoint get /api/topics/autocomplete
|
||||
* @param query Topic search text, for example \'machine learning\'.
|
||||
* @param domainId Optional OpenAlex domain id filter.
|
||||
* @param fieldId Optional OpenAlex field id filter.
|
||||
* @param subfieldId Optional OpenAlex subfield id filter.
|
||||
* @param limit Maximum number of autocomplete options.
|
||||
*/
|
||||
autocompleteTopics(query: string, domainId?: string, fieldId?: string, subfieldId?: string, limit?: number, extraHttpRequestParams?: any): Observable<AutocompleteResponse>;
|
||||
|
||||
/**
|
||||
* Builds the topic hierarchy cache.
|
||||
*
|
||||
* @endpoint get /api/inse-service/topics/cache
|
||||
* @param pageSize Page size for each search page.
|
||||
* @param saveJson Persist cache JSON to data folder.
|
||||
*/
|
||||
buildTopicCache(pageSize?: number, saveJson?: boolean, extraHttpRequestParams?: any): Observable<object>;
|
||||
|
||||
/**
|
||||
* Counts topic hierarchy occurrences from cache.
|
||||
*
|
||||
* @endpoint get /api/inse-service/topics/count
|
||||
* @param topic Topic names (repeat parameter).
|
||||
*/
|
||||
countTopicHierarchy(topic: Array<string>, extraHttpRequestParams?: any): Observable<object>;
|
||||
|
||||
/**
|
||||
* Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).
|
||||
*
|
||||
* @endpoint get /api/inse-service/topics/hierarchy
|
||||
*/
|
||||
getTopicHierarchy(extraHttpRequestParams?: any): Observable<object>;
|
||||
|
||||
/**
|
||||
* Returns a list of OpenAlex topics.
|
||||
*
|
||||
* @endpoint get /api/topics
|
||||
* @param search Full-text search, for example \'machine learning\'.
|
||||
* @param filter OpenAlex filter, for example \'domain.id:1,works_count:>1000\'.
|
||||
* @param sort Sort field, for example \'works_count:desc\'.
|
||||
* @param groupBy OpenAlex group_by field, for example \'domain.id\'.
|
||||
* @param perPage Results per page.
|
||||
* @param page Page number. Use cursor for deep pagination.
|
||||
* @param cursor Cursor pagination token. Use \'*\' to start.
|
||||
* @param sample Random sample size. Cannot be combined with sort or page.
|
||||
* @param select Comma-separated fields to return.
|
||||
*/
|
||||
listTopics(search?: string, filter?: string, sort?: string, groupBy?: string, perPage?: number, page?: number, cursor?: string, sample?: number, select?: string, extraHttpRequestParams?: any): Observable<TopicsListResponse>;
|
||||
|
||||
}
|
||||
@@ -17,23 +17,32 @@ import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
import { HTTPValidationError } from '../model/http-validation-error';
|
||||
// @ts-ignore
|
||||
import { WorkPage } from '../model/workPage';
|
||||
import { TopicCount } from '../model/topic-count';
|
||||
// @ts-ignore
|
||||
import { WorksListResponse } from '../model/worksListResponse';
|
||||
import { TopicsByTime } from '../model/topics-by-time';
|
||||
// @ts-ignore
|
||||
import { Work } from '../model/work';
|
||||
// @ts-ignore
|
||||
import { WorkPage } from '../model/work-page';
|
||||
// @ts-ignore
|
||||
import { WorksListResponse } from '../model/works-list-response';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
import {
|
||||
WorksServiceInterface
|
||||
} from './works.serviceInterface';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WorksService extends BaseService {
|
||||
export class WorksService extends BaseService implements WorksServiceInterface {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
@@ -106,13 +115,15 @@ export class WorksService extends BaseService {
|
||||
* @param publicationYear Filter by publication year. Can be repeated.
|
||||
* @param type Filter by publication type. Can be repeated.
|
||||
* @param language Filter by language code. Can be repeated.
|
||||
* @param institutionId Filter by OpenAlex institution id. Can be repeated.
|
||||
* @param topicId Filter by OpenAlex topic id. Can be repeated.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorkPage>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkPage>>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkPage>>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, institutionId?: Array<string>, topicId?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorkPage>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, institutionId?: Array<string>, topicId?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkPage>>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, institutionId?: Array<string>, topicId?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkPage>>;
|
||||
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, institutionId?: Array<string>, topicId?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling getAuthorWorks.');
|
||||
}
|
||||
@@ -140,6 +151,18 @@ export class WorksService extends BaseService {
|
||||
<any>element, 'language');
|
||||
})
|
||||
}
|
||||
if (institutionId) {
|
||||
institutionId.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'institution_id');
|
||||
})
|
||||
}
|
||||
if (topicId) {
|
||||
topicId.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topic_id');
|
||||
})
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -185,4 +208,190 @@ export class WorksService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<Array<TopicCount>>;
|
||||
public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<TopicCount>>>;
|
||||
public getPrimaryTopicCountsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<TopicCount>>>;
|
||||
public getPrimaryTopicCountsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling 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<Array<TopicCount>>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns topics grouped by publication year for an author.
|
||||
* @endpoint get /api/works/{author_id}/topics-by-time
|
||||
* @param authorId The author id, for example A5023888391.
|
||||
* @param maxTopicsPerYear The maximum number of topics per year.
|
||||
* @param targetPublications Target number of publications used for the timeline. Complete years are always included.
|
||||
* @param includeAll If true, all publications are used for the timeline.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<TopicsByTime>;
|
||||
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<TopicsByTime>>;
|
||||
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<TopicsByTime>>;
|
||||
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorId === null || authorId === undefined) {
|
||||
throw new Error('Required parameter authorId was null or undefined when calling getTopicsByTimeByAuthor.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>maxTopicsPerYear, 'max_topics_per_year');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>targetPublications, 'target_publications');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>includeAll, 'include_all');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/topics-by-time`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<TopicsByTime>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one publication.
|
||||
* @endpoint get /api/works/detail/{work_id}
|
||||
* @param workId The OpenAlex work id, for example W2741809807.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getWork(workId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Work>;
|
||||
public getWork(workId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Work>>;
|
||||
public getWork(workId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Work>>;
|
||||
public getWork(workId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (workId === null || workId === undefined) {
|
||||
throw new Error('Required parameter workId was null or undefined when calling getWork.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (bearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/works/detail/${this.configuration.encodeParam({name: "workId", value: workId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Work>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { HTTPValidationError } from '../model/models';
|
||||
import { TopicCount } from '../model/models';
|
||||
import { TopicsByTime } from '../model/models';
|
||||
import { Work } from '../model/models';
|
||||
import { WorkPage } from '../model/models';
|
||||
import { WorksListResponse } from '../model/models';
|
||||
|
||||
|
||||
import { Configuration } from '../configuration';
|
||||
|
||||
|
||||
|
||||
export interface WorksServiceInterface {
|
||||
defaultHeaders: HttpHeaders;
|
||||
configuration: Configuration;
|
||||
|
||||
/**
|
||||
* Returns all works for an author.
|
||||
*
|
||||
* @endpoint get /api/works/{author_id}/all
|
||||
* @param authorId The author id, for example A5023888391.
|
||||
*/
|
||||
getAllAuthorWorks(authorId: string, extraHttpRequestParams?: any): Observable<WorksListResponse>;
|
||||
|
||||
/**
|
||||
* Returns a page of works for an author.
|
||||
*
|
||||
* @endpoint get /api/works/{author_id}
|
||||
* @param authorId The author id, for example A5023888391.
|
||||
* @param page The page number.
|
||||
* @param size The page size.
|
||||
* @param publicationYear Filter by publication year. Can be repeated.
|
||||
* @param type Filter by publication type. Can be repeated.
|
||||
* @param language Filter by language code. Can be repeated.
|
||||
* @param institutionId Filter by OpenAlex institution id. Can be repeated.
|
||||
* @param topicId Filter by OpenAlex topic id. Can be repeated.
|
||||
*/
|
||||
getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, institutionId?: Array<string>, topicId?: Array<string>, extraHttpRequestParams?: any): Observable<WorkPage>;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
getPrimaryTopicCountsByAuthor(authorId: string, extraHttpRequestParams?: any): Observable<Array<TopicCount>>;
|
||||
|
||||
/**
|
||||
* Returns topics grouped by publication year for an author.
|
||||
*
|
||||
* @endpoint get /api/works/{author_id}/topics-by-time
|
||||
* @param authorId The author id, for example A5023888391.
|
||||
* @param maxTopicsPerYear The maximum number of topics per year.
|
||||
* @param targetPublications Target number of publications used for the timeline. Complete years are always included.
|
||||
* @param includeAll If true, all publications are used for the timeline.
|
||||
*/
|
||||
getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, targetPublications?: number, includeAll?: boolean, extraHttpRequestParams?: any): Observable<TopicsByTime>;
|
||||
|
||||
/**
|
||||
* Returns one publication.
|
||||
*
|
||||
* @endpoint get /api/works/detail/{work_id}
|
||||
* @param workId The OpenAlex work id, for example W2741809807.
|
||||
*/
|
||||
getWork(workId: string, extraHttpRequestParams?: any): Observable<Work>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AuthScope } from './auth-scope';
|
||||
|
||||
|
||||
export interface AccessGrant {
|
||||
token_type: string;
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
scope: AuthScope;
|
||||
refresh_token: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface AuthAccount {
|
||||
i: number;
|
||||
l: string;
|
||||
o: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AuthAccount } from './auth-account';
|
||||
|
||||
|
||||
export interface AuthScope {
|
||||
t: string;
|
||||
a: AuthAccount;
|
||||
d?: number | null;
|
||||
r?: Array<string>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { DehydratedInstitution } from './dehydrated-institution';
|
||||
|
||||
|
||||
/**
|
||||
* AuthorAffiliationsInner
|
||||
*/
|
||||
export interface AuthorAffiliationsInner {
|
||||
institution?: DehydratedInstitution | null;
|
||||
years?: Array<number> | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AuthorCountsByYearInner
|
||||
*/
|
||||
export interface AuthorCountsByYearInner {
|
||||
year?: number | null;
|
||||
works_count?: number | null;
|
||||
cited_by_count?: number | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* External identifiers:
|
||||
*/
|
||||
export interface AuthorIds {
|
||||
openalex?: string | null;
|
||||
orcid?: string | null;
|
||||
scopus?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { CollaborationNetworkNodeType } from './collaboration-network-node-type';
|
||||
|
||||
|
||||
export interface AuthorNetworkNode {
|
||||
/**
|
||||
* The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID.
|
||||
*/
|
||||
raw_id: string;
|
||||
/**
|
||||
* The display name of the node.
|
||||
*/
|
||||
display_name: string;
|
||||
/**
|
||||
* The category of the node, either \'author\', \'institution\', or \'work\'.
|
||||
*/
|
||||
category: CollaborationNetworkNodeType;
|
||||
}
|
||||
export namespace AuthorNetworkNode {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The longest name parsed into its component parts.
|
||||
*/
|
||||
export interface AuthorParsedLongestName {
|
||||
first?: string | null;
|
||||
middle?: string | null;
|
||||
last?: string | null;
|
||||
suffix?: string | null;
|
||||
nickname?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface AuthorPositionCount {
|
||||
first?: number;
|
||||
middle?: number;
|
||||
last?: number;
|
||||
unknown?: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Model2YrMeanCitedness } from './model2-yr-mean-citedness';
|
||||
|
||||
|
||||
/**
|
||||
* Citation metrics:
|
||||
*/
|
||||
export interface AuthorSummaryStats {
|
||||
'2yr_mean_citedness'?: Model2YrMeanCitedness | null;
|
||||
h_index?: number | null;
|
||||
i10_index?: number | null;
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AuthorAffiliationsInner } from './authorAffiliationsInner';
|
||||
import { AuthorParsedLongestName } from './authorParsedLongestName';
|
||||
import { DehydratedInstitution } from './dehydratedInstitution';
|
||||
import { AuthorCountsByYearInner } from './authorCountsByYearInner';
|
||||
import { AuthorIds } from './authorIds';
|
||||
import { AuthorSummaryStats } from './authorSummaryStats';
|
||||
import { WorkTopic } from './workTopic';
|
||||
import { AuthorAffiliationsInner } from './author-affiliations-inner';
|
||||
import { AuthorParsedLongestName } from './author-parsed-longest-name';
|
||||
import { DehydratedInstitution } from './dehydrated-institution';
|
||||
import { AuthorCountsByYearInner } from './author-counts-by-year-inner';
|
||||
import { AuthorIds } from './author-ids';
|
||||
import { AuthorSummaryStats } from './author-summary-stats';
|
||||
import { WorkTopic } from './work-topic';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType';
|
||||
|
||||
|
||||
export interface CollaborationNetworkNode {
|
||||
export interface AuthorNetworkNode {
|
||||
/**
|
||||
* The raw ID of the node. For an author node, this is the raw person ID. For an institution node, this is the raw institution ID. For a work node, this is the raw work ID.
|
||||
*/
|
||||
@@ -24,7 +24,7 @@ export interface CollaborationNetworkNode {
|
||||
*/
|
||||
category: CollaborationNetworkNodeType;
|
||||
}
|
||||
export namespace CollaborationNetworkNode {
|
||||
export namespace AuthorNetworkNode {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface AuthorPositionCount {
|
||||
first?: number;
|
||||
middle?: number;
|
||||
last?: number;
|
||||
unknown?: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface AuthorsFilterProperties {
|
||||
/**
|
||||
* The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included.
|
||||
*/
|
||||
allowed_institutions?: Array<string>;
|
||||
/**
|
||||
* The minimum number of collaborations required for an author to be included in the collaboration network.
|
||||
*/
|
||||
min_collaborations?: number;
|
||||
/**
|
||||
* The maximum number of collaborations allowed for an author to be included in the collaboration network.
|
||||
*/
|
||||
max_collaborations?: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Meta } from './meta';
|
||||
import { Author } from './author';
|
||||
import { GroupByResult } from './group-by-result';
|
||||
|
||||
|
||||
/**
|
||||
* AuthorsListResponse
|
||||
*/
|
||||
export interface AuthorsListResponse {
|
||||
meta?: Meta | null;
|
||||
results?: Array<Author> | null;
|
||||
group_by?: Array<GroupByResult> | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface AuthorsFilterProperties {
|
||||
/**
|
||||
* The list of raw institution IDs to include in the collaboration network. If empty, all institutions will be included.
|
||||
*/
|
||||
allowed_institutions?: Array<string>;
|
||||
/**
|
||||
* The minimum number of collaborations required for an author to be included in the collaboration network.
|
||||
*/
|
||||
min_collaborations?: number;
|
||||
/**
|
||||
* The maximum number of collaborations allowed for an author to be included in the collaboration network.
|
||||
*/
|
||||
max_collaborations?: number;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { DehydratedInstitution } from './dehydratedInstitution';
|
||||
import { DehydratedAuthor } from './dehydratedAuthor';
|
||||
import { DehydratedInstitution } from './dehydrated-institution';
|
||||
import { DehydratedAuthor } from './dehydrated-author';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AutocompleteResponseMeta
|
||||
*/
|
||||
export interface AutocompleteResponseMeta {
|
||||
count?: number | null;
|
||||
db_response_time_ms?: number | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AutocompleteResponseResultsInner
|
||||
*/
|
||||
export interface AutocompleteResponseResultsInner {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
hint?: string | null;
|
||||
cited_by_count?: number | null;
|
||||
works_count?: number | null;
|
||||
entity_type?: string | null;
|
||||
external_id?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AutocompleteResponseMeta } from './autocomplete-response-meta';
|
||||
import { AutocompleteResponseResultsInner } from './autocomplete-response-results-inner';
|
||||
|
||||
|
||||
/**
|
||||
* AutocompleteResponse
|
||||
*/
|
||||
export interface AutocompleteResponse {
|
||||
meta?: AutocompleteResponseMeta | null;
|
||||
results?: Array<AutocompleteResponseResultsInner> | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AutocompleteResponseMeta } from './autocompleteResponseMeta';
|
||||
import { AutocompleteResponseResultsInner } from './autocompleteResponseResultsInner';
|
||||
|
||||
|
||||
/**
|
||||
* AutocompleteResponse
|
||||
*/
|
||||
export interface AutocompleteResponse {
|
||||
meta?: AutocompleteResponseMeta | null;
|
||||
results?: Array<AutocompleteResponseResultsInner> | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AutocompleteResponseMeta
|
||||
*/
|
||||
export interface AutocompleteResponseMeta {
|
||||
count?: number | null;
|
||||
db_response_time_ms?: number | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* AutocompleteResponseResultsInner
|
||||
*/
|
||||
export interface AutocompleteResponseResultsInner {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
hint?: string | null;
|
||||
cited_by_count?: number | null;
|
||||
works_count?: number | null;
|
||||
entity_type?: string | null;
|
||||
external_id?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface CollaborationNetworkEdge {
|
||||
/**
|
||||
* The raw ID of the source node.
|
||||
*/
|
||||
raw_source_id: string;
|
||||
/**
|
||||
* The raw ID of the target node.
|
||||
*/
|
||||
raw_target_id: string;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user