Compare commits
195
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
767f532e6f | ||
|
|
a21d5eaea4 | ||
|
|
d8de0c2156 | ||
|
|
ba1c53b642 | ||
|
|
ef00947786 | ||
|
|
9a4a4de379 | ||
|
|
04e3f97b8b | ||
|
|
2bf8e03117 | ||
|
|
1219970ba8 | ||
|
|
5c50c29760 | ||
|
|
5343c3204d | ||
|
|
613640a730 | ||
|
|
3147de9fcb | ||
|
|
7d3792c7b4 | ||
|
|
eb5d6830a5 | ||
|
|
7da36d8777 | ||
|
|
21482f3c6f | ||
|
|
b772b100d5 | ||
|
|
bbce780609 | ||
|
|
d719a34ab0 | ||
|
|
57d0daa21b | ||
|
|
1ca3db5c78 | ||
|
|
c85d3fa03f | ||
|
|
ffc02a4e59 | ||
|
|
6c20dc2b58 | ||
|
|
24cc476dbe | ||
|
|
b2f55bd05a | ||
|
|
e153e2d74a | ||
|
|
171b296c2a | ||
|
|
435c4ae3db | ||
|
|
ac6b5aa72b | ||
|
|
e8be0ae8aa | ||
|
|
17e0909d69 | ||
|
|
3aa4c478f6 | ||
|
|
9ef9e334fd | ||
|
|
e7269c6bd2 | ||
|
|
5aff658c16 | ||
|
|
a40aca3dbe | ||
|
|
95662119b1 | ||
|
|
5b59aca4e6 | ||
|
|
83c809983c | ||
|
|
f5cd79a718 | ||
|
|
81b7e04b66 | ||
|
|
25cf39ff69 | ||
|
|
9a6bae2df4 | ||
|
|
6eb159cc03 | ||
|
|
6b7a036128 | ||
|
|
da70af9163 | ||
|
|
09e5af0016 | ||
|
|
203d9cb6d4 | ||
|
|
dde38bb680 | ||
|
|
e7b6255e54 | ||
|
|
0f9991b618 | ||
|
|
ac97c9f496 | ||
|
|
8261de4a02 | ||
|
|
f69b3cf871 | ||
|
|
6e7a8237ef | ||
|
|
c8e5a65f5d | ||
|
|
a6c4668d13 | ||
|
|
4338b1cc0e | ||
|
|
d5164f9863 | ||
|
|
86fc87f507 | ||
|
|
156e31643c | ||
|
|
dbe8f2449a | ||
|
|
9c593a0d09 | ||
|
|
a21030309e | ||
|
|
a8db8194cf | ||
|
|
ce218cbfa1 | ||
|
|
ae80f0f812 | ||
|
|
df5f131320 | ||
|
|
2f22240d94 | ||
|
|
77095c8549 | ||
|
|
c733442300 | ||
|
|
fed1e56c81 | ||
|
|
e0d1f0df5c | ||
|
|
27301bf6a5 | ||
|
|
bbd4ff8685 | ||
|
|
dbc53a9a49 | ||
|
|
0f0f30f08c | ||
|
|
6c3c43ef4f | ||
|
|
a5f6ccc75b | ||
|
|
cfa2c768eb | ||
|
|
54e0701698 | ||
|
|
4a61c00642 | ||
|
|
49c45cb924 | ||
|
|
ad14f60a2c | ||
|
|
2bcd1d4586 | ||
|
|
5d2d694a20 | ||
|
|
dc31b21dac | ||
|
|
d28a662da3 | ||
|
|
8a418a99b4 | ||
|
|
17100024e5 | ||
|
|
9b95728c7b | ||
|
|
4937889968 | ||
|
|
36773c4ae2 | ||
|
|
353d938d3e | ||
|
|
f02e510847 | ||
|
|
6e0acb9cde | ||
|
|
a0fdc8799b | ||
|
|
f4656fcf39 | ||
|
|
d73ee592ea | ||
|
|
c6e1051059 | ||
|
|
014364ec03 | ||
|
|
024724b51d | ||
|
|
7798cdaea5 | ||
|
|
a1b9f5a084 | ||
|
|
6f79733b3e | ||
|
|
9cb01cab45 | ||
|
|
fc30865f34 | ||
|
|
b2a8af532d | ||
|
|
bee9b6e8fd | ||
|
|
8d7323a387 | ||
|
|
6a6ec8662c | ||
|
|
c70e6bf489 | ||
|
|
82fa2e816b | ||
|
|
fbcee778d2 | ||
|
|
1758227f1e | ||
|
|
cbd2e902a7 | ||
|
|
2cb6d1f660 | ||
|
|
ae2230ff0e | ||
|
|
12914208cd | ||
|
|
abb11077de | ||
|
|
ef1a5ad7a1 | ||
|
|
ed919832d8 | ||
|
|
ef2ea46882 | ||
|
|
da9516331e | ||
|
|
bd581e6004 | ||
|
|
e37f636236 | ||
|
|
0ec47e42e4 | ||
|
|
1369a2bf29 | ||
|
|
e0704bc8a5 | ||
|
|
d8041751c5 | ||
|
|
87b283ccfb | ||
|
|
16d44a0b88 | ||
|
|
07f8e8bcca | ||
|
|
cbfa60ae46 | ||
|
|
89ce894066 | ||
|
|
66487c20e7 | ||
|
|
08bc87e764 | ||
|
|
22afd0fbb5 | ||
|
|
5633b412d4 | ||
|
|
bd030ccb9f | ||
|
|
41037efd6f | ||
|
|
81c4094708 | ||
|
|
6382987990 | ||
|
|
3276bf46a7 | ||
|
|
da1a5b732d | ||
|
|
5702223716 | ||
|
|
21da33be11 | ||
|
|
545f38bc3d | ||
|
|
92e421a61c | ||
|
|
15f55af4c4 | ||
|
|
8b150a81a0 | ||
|
|
91efbdffeb | ||
|
|
c8fa70e7f0 | ||
|
|
934c49bf49 | ||
|
|
70d6b3d698 | ||
|
|
e6e9628837 | ||
|
|
0dd2a5743d | ||
|
|
f8678af87e | ||
|
|
5e7f968808 | ||
|
|
e1b3318e68 | ||
|
|
4d8a7405ca | ||
|
|
a3eebedb02 | ||
|
|
f8e5cd90a5 | ||
|
|
3d092b02f3 | ||
|
|
deb6448739 | ||
|
|
bfb3224684 | ||
|
|
aed1f33935 | ||
|
|
33192efa33 | ||
|
|
d48435b948 | ||
|
|
567b5ecd4f | ||
|
|
b21d8d3e88 | ||
|
|
727c3fde67 | ||
|
|
de880fb9f0 | ||
|
|
c054cf99fe | ||
|
|
98a742f024 | ||
|
|
bb791138cd | ||
|
|
0b6a74a8e3 | ||
|
|
da59e8137f | ||
|
|
103b6180d0 | ||
|
|
6edca93c1c | ||
|
|
a7548d59c0 | ||
|
|
8b1f7d6eb3 | ||
|
|
ff3ac03520 | ||
|
|
e51d3095bc | ||
|
|
d19003d531 | ||
|
|
6d5dd88e50 | ||
|
|
de70973296 | ||
|
|
2a5f104739 | ||
|
|
71bd10b303 | ||
|
|
97b7fe6a6f | ||
|
|
eb84d3014f | ||
|
|
2bdee21169 | ||
|
|
a278ad300f |
+3
-1
@@ -19,4 +19,6 @@ angular-app/.angular
|
|||||||
# Ignore sentence-transformer local model cache
|
# Ignore sentence-transformer local model cache
|
||||||
service/sentence_transformer/models/
|
service/sentence_transformer/models/
|
||||||
|
|
||||||
llm_evaluations/bio_generation/.venv
|
llm_evaluations/bio_generation/.venv
|
||||||
|
|
||||||
|
.devcontainer
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -88,6 +88,25 @@ class Organization(Durable, table=True):
|
|||||||
accounts: list["Account"] = Relationship(back_populates="organization")
|
accounts: list["Account"] = Relationship(back_populates="organization")
|
||||||
|
|
||||||
|
|
||||||
|
class OrganizationInstitution(SQLModel, table=True):
|
||||||
|
__tablename__ = "organization_institution"
|
||||||
|
__table_args__ = (
|
||||||
|
UniqueConstraint(
|
||||||
|
"organization_id",
|
||||||
|
"position",
|
||||||
|
name="uq_organization_institution_position",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
organization_id: uuid.UUID = Field(
|
||||||
|
foreign_key="organization.id",
|
||||||
|
primary_key=True,
|
||||||
|
index=True,
|
||||||
|
)
|
||||||
|
openalex_institution_id: str = Field(primary_key=True, index=True)
|
||||||
|
position: int = Field(nullable=False)
|
||||||
|
|
||||||
|
|
||||||
class Account(Durable, table=True):
|
class Account(Durable, table=True):
|
||||||
@model_validator(mode="before")
|
@model_validator(mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ async def change_password(
|
|||||||
operation_id="canFetchGdprRelevantData",
|
operation_id="canFetchGdprRelevantData",
|
||||||
)
|
)
|
||||||
async def can_fetch_gdpr_relevant_data(
|
async def can_fetch_gdpr_relevant_data(
|
||||||
|
session: SessionDep,
|
||||||
access_token: Annotated[
|
access_token: Annotated[
|
||||||
AccessTokenMetadata,
|
AccessTokenMetadata,
|
||||||
auth_service.CurrentUserAccessTokenPayloadDep,
|
auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
@@ -227,6 +228,7 @@ async def can_fetch_gdpr_relevant_data(
|
|||||||
] = None,
|
] = None,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
return await auth_service.can_fetch_gdpr_relevant_data(
|
return await auth_service.can_fetch_gdpr_relevant_data(
|
||||||
|
session=session,
|
||||||
access_token=access_token,
|
access_token=access_token,
|
||||||
raw_oa_author_id=raw_oa_author_id,
|
raw_oa_author_id=raw_oa_author_id,
|
||||||
raw_oa_institution_id=raw_oa_institution_id,
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ from inse.auth.model import (
|
|||||||
IdTokenMetadata,
|
IdTokenMetadata,
|
||||||
LoginResponse,
|
LoginResponse,
|
||||||
Organization,
|
Organization,
|
||||||
|
OrganizationInstitution,
|
||||||
OtkResponse,
|
OtkResponse,
|
||||||
RefreshTokenMetadata,
|
RefreshTokenMetadata,
|
||||||
Secret,
|
Secret,
|
||||||
@@ -98,9 +99,12 @@ def create_predefined_accounts(session: Session, file_path: str):
|
|||||||
with open(file_path, "r") as file:
|
with open(file_path, "r") as file:
|
||||||
data: dict[str, Any] = json.loads(file.read())
|
data: dict[str, Any] = json.loads(file.read())
|
||||||
for organization_data in data.get("organizations", []):
|
for organization_data in data.get("organizations", []):
|
||||||
organization_id = organization_data.get("id")
|
organization_id_value = organization_data.get("id")
|
||||||
if organization_id is not None:
|
organization_id = (
|
||||||
organization_id = uuid.UUID(organization_id)
|
uuid.UUID(organization_id_value)
|
||||||
|
if organization_id_value is not None
|
||||||
|
else uuid.uuid4()
|
||||||
|
)
|
||||||
organization_name = organization_data["name"]
|
organization_name = organization_data["name"]
|
||||||
openalex_institution_id = organization_data.get(
|
openalex_institution_id = organization_data.get(
|
||||||
"openalex_institution_id"
|
"openalex_institution_id"
|
||||||
@@ -113,6 +117,14 @@ def create_predefined_accounts(session: Session, file_path: str):
|
|||||||
openalex_institution_id=openalex_institution_id,
|
openalex_institution_id=openalex_institution_id,
|
||||||
)
|
)
|
||||||
session.add(organization)
|
session.add(organization)
|
||||||
|
if openalex_institution_id:
|
||||||
|
session.add(
|
||||||
|
OrganizationInstitution(
|
||||||
|
organization_id=organization.id,
|
||||||
|
openalex_institution_id=openalex_institution_id,
|
||||||
|
position=0,
|
||||||
|
)
|
||||||
|
)
|
||||||
for account_data in data.get("accounts", []):
|
for account_data in data.get("accounts", []):
|
||||||
organization_id = uuid.UUID(account_data["organization_id"])
|
organization_id = uuid.UUID(account_data["organization_id"])
|
||||||
roles = normalize_roles(
|
roles = normalize_roles(
|
||||||
@@ -1455,6 +1467,7 @@ def change_password(
|
|||||||
|
|
||||||
|
|
||||||
async def can_fetch_gdpr_relevant_data(
|
async def can_fetch_gdpr_relevant_data(
|
||||||
|
session: Session,
|
||||||
access_token: AccessTokenMetadata,
|
access_token: AccessTokenMetadata,
|
||||||
raw_oa_author_id: str | None = None,
|
raw_oa_author_id: str | None = None,
|
||||||
raw_oa_institution_id: str | None = None,
|
raw_oa_institution_id: str | None = None,
|
||||||
@@ -1481,40 +1494,71 @@ async def can_fetch_gdpr_relevant_data(
|
|||||||
logger.debug("No OpenAlex author ID or institution ID provided")
|
logger.debug("No OpenAlex author ID or institution ID provided")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
effective_institution_id = access_token.effective_institution_id
|
institution_ids = list(
|
||||||
# Current user does not belong to any institution
|
session.exec(
|
||||||
if not effective_institution_id:
|
select(OrganizationInstitution.openalex_institution_id)
|
||||||
|
.where(
|
||||||
|
OrganizationInstitution.organization_id
|
||||||
|
== access_token.effective_organization_id
|
||||||
|
)
|
||||||
|
.order_by(OrganizationInstitution.position)
|
||||||
|
).all()
|
||||||
|
)
|
||||||
|
if not institution_ids and access_token.effective_institution_id:
|
||||||
|
institution_ids = [access_token.effective_institution_id]
|
||||||
|
|
||||||
|
if not institution_ids:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Current user does not belong to any institution, cannot fetch GDPR-relevant data"
|
"Current user does not belong to any institution, cannot fetch GDPR-relevant data"
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Current user belongs to an institution, but the request is for a different institution
|
from inse.organization_management import service as organization_service
|
||||||
|
|
||||||
|
association_groups = await organization_service.resolve_institution_associations(
|
||||||
|
institution_ids
|
||||||
|
)
|
||||||
|
organization_institution_ids = set(institution_ids)
|
||||||
|
for group in association_groups:
|
||||||
|
organization_institution_ids.add(group.id.rstrip("/").split("/")[-1])
|
||||||
|
organization_institution_ids.update(
|
||||||
|
association.id.rstrip("/").split("/")[-1]
|
||||||
|
for association in group.associated_institutions
|
||||||
|
)
|
||||||
|
|
||||||
|
requested_institution_id = (
|
||||||
|
raw_oa_institution_id.rstrip("/").split("/")[-1]
|
||||||
|
if raw_oa_institution_id
|
||||||
|
else None
|
||||||
|
)
|
||||||
if (
|
if (
|
||||||
raw_oa_institution_id
|
requested_institution_id
|
||||||
and effective_institution_id
|
and requested_institution_id not in organization_institution_ids
|
||||||
and raw_oa_institution_id != effective_institution_id
|
|
||||||
):
|
):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Current user belongs to institution %s, but request is for institution %s, cannot fetch GDPR-relevant data",
|
"Current user belongs to institution %s, but request is for institution %s, cannot fetch GDPR-relevant data",
|
||||||
effective_institution_id,
|
organization_institution_ids,
|
||||||
raw_oa_institution_id,
|
requested_institution_id,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Current user belongs to an institution, but request is for author not belonging to that institution
|
# Current user belongs to an institution, but request is for author not belonging to that institution
|
||||||
if raw_oa_author_id:
|
if raw_oa_author_id:
|
||||||
author_belongs_to_institution = (
|
for institution_id in organization_institution_ids:
|
||||||
await authors_service.author_currently_belongs_to_institution(
|
if await authors_service.author_currently_belongs_to_institution(
|
||||||
raw_oa_author_id or "", effective_institution_id
|
raw_oa_author_id, institution_id
|
||||||
)
|
):
|
||||||
)
|
logger.debug(
|
||||||
|
"Author %s belongs to organization institution %s",
|
||||||
|
raw_oa_author_id,
|
||||||
|
institution_id,
|
||||||
|
)
|
||||||
|
return True
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Author %s belongs to institution %s: %s",
|
"Author %s does not belong to any organization institution %s",
|
||||||
raw_oa_author_id,
|
raw_oa_author_id,
|
||||||
effective_institution_id,
|
organization_institution_ids,
|
||||||
author_belongs_to_institution,
|
|
||||||
)
|
)
|
||||||
return author_belongs_to_institution
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import datetime as _dt
|
import datetime as _dt
|
||||||
import uuid
|
import uuid
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi import HTTPException, Response
|
from fastapi import HTTPException, Response
|
||||||
@@ -14,11 +15,16 @@ from inse.auth.model import (
|
|||||||
Account,
|
Account,
|
||||||
IdTokenMetadata,
|
IdTokenMetadata,
|
||||||
Organization,
|
Organization,
|
||||||
|
OrganizationInstitution,
|
||||||
RefreshTokenMetadata,
|
RefreshTokenMetadata,
|
||||||
Secret,
|
Secret,
|
||||||
SecretPurpose,
|
SecretPurpose,
|
||||||
UserRole,
|
UserRole,
|
||||||
)
|
)
|
||||||
|
from inse.organization_management.model import (
|
||||||
|
InstitutionAssociation,
|
||||||
|
InstitutionAssociationsResponse,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
@@ -81,6 +87,74 @@ def test_hash_and_verify_password():
|
|||||||
assert auth_service._verify_password("wrong", h) is False
|
assert auth_service._verify_password("wrong", h) is False
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_gdpr_access_allows_every_organization_institution(in_memory_session):
|
||||||
|
org, account = create_org_and_account(
|
||||||
|
in_memory_session, "multi-institution@example.com", "pw"
|
||||||
|
)
|
||||||
|
in_memory_session.add_all(
|
||||||
|
[
|
||||||
|
OrganizationInstitution(
|
||||||
|
organization_id=org.id,
|
||||||
|
openalex_institution_id="I111",
|
||||||
|
position=0,
|
||||||
|
),
|
||||||
|
OrganizationInstitution(
|
||||||
|
organization_id=org.id,
|
||||||
|
openalex_institution_id="I222",
|
||||||
|
position=1,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
in_memory_session.commit()
|
||||||
|
token = AccessTokenMetadata(
|
||||||
|
real_account_id=account.id,
|
||||||
|
expires_at=_dt.datetime.now(_dt.UTC) + timedelta(hours=1),
|
||||||
|
user_fingerprint_hash="fingerprint",
|
||||||
|
effective_account_id=account.id,
|
||||||
|
effective_organization_id=org.id,
|
||||||
|
effective_institution_id="I111",
|
||||||
|
)
|
||||||
|
|
||||||
|
associations = [
|
||||||
|
InstitutionAssociationsResponse(
|
||||||
|
id="I111",
|
||||||
|
display_name="Root institution",
|
||||||
|
associated_institutions=[
|
||||||
|
InstitutionAssociation(
|
||||||
|
id="I333",
|
||||||
|
display_name="Child institution",
|
||||||
|
relationship="child",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
InstitutionAssociationsResponse(
|
||||||
|
id="I222",
|
||||||
|
display_name="Second institution",
|
||||||
|
associated_institutions=[],
|
||||||
|
),
|
||||||
|
]
|
||||||
|
with patch(
|
||||||
|
"inse.organization_management.service.resolve_institution_associations",
|
||||||
|
new=AsyncMock(return_value=associations),
|
||||||
|
):
|
||||||
|
assert await auth_service.can_fetch_gdpr_relevant_data(
|
||||||
|
session=in_memory_session,
|
||||||
|
access_token=token,
|
||||||
|
raw_oa_institution_id="https://openalex.org/I222",
|
||||||
|
)
|
||||||
|
assert await auth_service.can_fetch_gdpr_relevant_data(
|
||||||
|
session=in_memory_session,
|
||||||
|
access_token=token,
|
||||||
|
raw_oa_institution_id="I333",
|
||||||
|
)
|
||||||
|
assert not await auth_service.can_fetch_gdpr_relevant_data(
|
||||||
|
session=in_memory_session,
|
||||||
|
access_token=token,
|
||||||
|
raw_oa_institution_id="I444",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_request_otk_and_login_flow(in_memory_session, settings_backup):
|
def test_request_otk_and_login_flow(in_memory_session, settings_backup):
|
||||||
config_module.settings.token_hmac_key = "test-hmac-key"
|
config_module.settings.token_hmac_key = "test-hmac-key"
|
||||||
config_module.settings.token_issuer_id = "test-issuer"
|
config_module.settings.token_issuer_id = "test-issuer"
|
||||||
@@ -113,7 +187,9 @@ def test_request_otk_and_login_flow(in_memory_session, settings_backup):
|
|||||||
assert login_result.id_token.real_account_id == acc.id
|
assert login_result.id_token.real_account_id == acc.id
|
||||||
|
|
||||||
raw_id_token = _get_cookie_value(response, auth_service.ID_TOKEN_COOKIE_KEY)
|
raw_id_token = _get_cookie_value(response, auth_service.ID_TOKEN_COOKIE_KEY)
|
||||||
payload = auth_service._verify_id_token(raw_id_token=raw_id_token, session=in_memory_session)
|
payload = auth_service._verify_id_token(
|
||||||
|
raw_id_token=raw_id_token, session=in_memory_session
|
||||||
|
)
|
||||||
assert payload[auth_service.REAL_ACCOUNT_ID_KEY] == str(acc.id)
|
assert payload[auth_service.REAL_ACCOUNT_ID_KEY] == str(acc.id)
|
||||||
|
|
||||||
|
|
||||||
@@ -175,7 +251,9 @@ def test_access_and_refresh_token_flow(in_memory_session, settings_backup):
|
|||||||
)
|
)
|
||||||
assert isinstance(access_response.access_token, AccessTokenMetadata)
|
assert isinstance(access_response.access_token, AccessTokenMetadata)
|
||||||
|
|
||||||
raw_refresh_token = _get_cookie_value(response, auth_service.REFRESH_TOKEN_COOKIE_KEY)
|
raw_refresh_token = _get_cookie_value(
|
||||||
|
response, auth_service.REFRESH_TOKEN_COOKIE_KEY
|
||||||
|
)
|
||||||
refresh_payload = auth_service._verify_refresh_token(
|
refresh_payload = auth_service._verify_refresh_token(
|
||||||
raw_refresh_token=raw_refresh_token,
|
raw_refresh_token=raw_refresh_token,
|
||||||
session=in_memory_session,
|
session=in_memory_session,
|
||||||
@@ -185,9 +263,7 @@ def test_access_and_refresh_token_flow(in_memory_session, settings_backup):
|
|||||||
effective_account_id=uuid.UUID(
|
effective_account_id=uuid.UUID(
|
||||||
refresh_payload[auth_service.EFFECTIVE_ACCOUNT_ID_KEY]
|
refresh_payload[auth_service.EFFECTIVE_ACCOUNT_ID_KEY]
|
||||||
),
|
),
|
||||||
expires_at=_dt.datetime.fromtimestamp(
|
expires_at=_dt.datetime.fromtimestamp(refresh_payload["exp"], tz=_dt.UTC),
|
||||||
refresh_payload["exp"], tz=_dt.UTC
|
|
||||||
),
|
|
||||||
epoch=refresh_payload[auth_service.EPOCH_KEY],
|
epoch=refresh_payload[auth_service.EPOCH_KEY],
|
||||||
effective_role=UserRole(refresh_payload[auth_service.EFFECTIVE_ROLE_KEY]),
|
effective_role=UserRole(refresh_payload[auth_service.EFFECTIVE_ROLE_KEY]),
|
||||||
effective_organization_id=uuid.UUID(
|
effective_organization_id=uuid.UUID(
|
||||||
@@ -240,7 +316,9 @@ def test_access_and_refresh_token_preserve_multiple_roles(
|
|||||||
UserRole.USER.value,
|
UserRole.USER.value,
|
||||||
]
|
]
|
||||||
|
|
||||||
raw_refresh_token = _get_cookie_value(response, auth_service.REFRESH_TOKEN_COOKIE_KEY)
|
raw_refresh_token = _get_cookie_value(
|
||||||
|
response, auth_service.REFRESH_TOKEN_COOKIE_KEY
|
||||||
|
)
|
||||||
refresh_payload = auth_service._verify_refresh_token(
|
refresh_payload = auth_service._verify_refresh_token(
|
||||||
raw_refresh_token=raw_refresh_token,
|
raw_refresh_token=raw_refresh_token,
|
||||||
session=in_memory_session,
|
session=in_memory_session,
|
||||||
@@ -634,7 +712,6 @@ def test_get_account_epoch_not_found(in_memory_session):
|
|||||||
auth_service._get_account_epoch(in_memory_session, random_id)
|
auth_service._get_account_epoch(in_memory_session, random_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_request_password_reset_creates_secret(in_memory_session, settings_backup):
|
def test_request_password_reset_creates_secret(in_memory_session, settings_backup):
|
||||||
email = "reset@example.com"
|
email = "reset@example.com"
|
||||||
password = "oldpw123"
|
password = "oldpw123"
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
import hashlib
|
||||||
|
from collections import defaultdict
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from inse.institutions.institutions_search_client import InstitutionsSearchClient
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.model import ESCluster, ESIndex
|
||||||
|
from inse.projects import service as projects_service
|
||||||
|
|
||||||
|
from .model import BundProjectTopics, DfgProjectKeyword, DfgProjectTopic
|
||||||
|
from .common import (
|
||||||
|
dashboard_period as _dashboard_period,
|
||||||
|
normalize_institution_id as _normalize_institution_id,
|
||||||
|
raw_institution_id as _raw_institution_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_bund_topics(
|
||||||
|
institution_id: str,
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> BundProjectTopics:
|
||||||
|
normalized_id = _normalize_institution_id(institution_id)
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
page_size = 1000
|
||||||
|
page_number = 0
|
||||||
|
project_ids: set[str] = set()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
projects = await projects_service.search_bund_projects_with_filters(
|
||||||
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
|
executing_agency=None,
|
||||||
|
raw_oa_institution_id=_raw_institution_id(normalized_id),
|
||||||
|
title=None,
|
||||||
|
keywords=None,
|
||||||
|
funding_arts=None,
|
||||||
|
topic_ids=None,
|
||||||
|
filter_topic_ids=None,
|
||||||
|
funding_start_years=None,
|
||||||
|
funding_end_years=None,
|
||||||
|
active_from_year=period[0],
|
||||||
|
active_to_year=period[1],
|
||||||
|
countries=None,
|
||||||
|
page=page_number,
|
||||||
|
size=page_size,
|
||||||
|
sort_by="id",
|
||||||
|
sort_direction="asc",
|
||||||
|
fuzzy=False,
|
||||||
|
)
|
||||||
|
project_ids.update(
|
||||||
|
project.funding_code
|
||||||
|
for project in projects.elements
|
||||||
|
if project.funding_code
|
||||||
|
)
|
||||||
|
if len(project_ids) >= projects.total or not projects.elements:
|
||||||
|
break
|
||||||
|
page_number += 1
|
||||||
|
|
||||||
|
topics: dict[str, dict[str, Any]] = {}
|
||||||
|
matched_project_ids: set[str] = set()
|
||||||
|
if project_ids:
|
||||||
|
mapping_project_ids = sorted(
|
||||||
|
hashlib.sha256(project_id.encode("utf-8")).hexdigest()
|
||||||
|
for project_id in project_ids
|
||||||
|
)
|
||||||
|
async for hit in elasticsearch.scan(
|
||||||
|
index=str(ESIndex.PROJECTS_BUND_TOPICS),
|
||||||
|
query={"terms": {"project_id": mapping_project_ids}},
|
||||||
|
source=["project_id", "keyword", "topic_matches"],
|
||||||
|
page_size=1000,
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
):
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
project_id = str(source.get("project_id") or "")
|
||||||
|
if not project_id:
|
||||||
|
continue
|
||||||
|
keyword = str(source.get("keyword") or "").strip()
|
||||||
|
matched_project_ids.add(project_id)
|
||||||
|
for match in source.get("topic_matches", []):
|
||||||
|
topic_id = str(match.get("topic_id") or "")
|
||||||
|
if not topic_id:
|
||||||
|
continue
|
||||||
|
topic = topics.setdefault(
|
||||||
|
topic_id,
|
||||||
|
{
|
||||||
|
"id": topic_id,
|
||||||
|
"name": str(match.get("topic_display_name") or topic_id),
|
||||||
|
"subfield": match.get("subfield"),
|
||||||
|
"field": match.get("field"),
|
||||||
|
"domain": match.get("domain"),
|
||||||
|
"project_ids": set(),
|
||||||
|
"keywords": {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
topic["project_ids"].add(project_id)
|
||||||
|
if keyword:
|
||||||
|
topic["keywords"].setdefault(keyword, set()).add(project_id)
|
||||||
|
|
||||||
|
field_project_ids: dict[str, set[str]] = defaultdict(set)
|
||||||
|
subfield_project_ids: dict[tuple[str, str], set[str]] = defaultdict(set)
|
||||||
|
for topic in topics.values():
|
||||||
|
field_name = str(topic["field"] or "")
|
||||||
|
subfield_name = str(topic["subfield"] or "")
|
||||||
|
field_project_ids[field_name].update(topic["project_ids"])
|
||||||
|
subfield_project_ids[(field_name, subfield_name)].update(topic["project_ids"])
|
||||||
|
|
||||||
|
topic_list = [
|
||||||
|
DfgProjectTopic(
|
||||||
|
id=topic["id"],
|
||||||
|
name=topic["name"],
|
||||||
|
subfield=topic["subfield"],
|
||||||
|
field=topic["field"],
|
||||||
|
domain=topic["domain"],
|
||||||
|
project_count=len(topic["project_ids"]),
|
||||||
|
field_project_count=len(field_project_ids[str(topic["field"] or "")]),
|
||||||
|
subfield_project_count=len(
|
||||||
|
subfield_project_ids[
|
||||||
|
(str(topic["field"] or ""), str(topic["subfield"] or ""))
|
||||||
|
]
|
||||||
|
),
|
||||||
|
keywords=sorted(
|
||||||
|
[
|
||||||
|
DfgProjectKeyword(
|
||||||
|
name=keyword,
|
||||||
|
project_count=len(keyword_project_ids),
|
||||||
|
)
|
||||||
|
for keyword, keyword_project_ids in topic["keywords"].items()
|
||||||
|
],
|
||||||
|
key=lambda entry: (-entry.project_count, entry.name),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
for topic in topics.values()
|
||||||
|
]
|
||||||
|
topic_list.sort(key=lambda topic: (-topic.project_count, topic.name, topic.id))
|
||||||
|
return BundProjectTopics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
project_count=len(project_ids),
|
||||||
|
matched_project_count=len(matched_project_ids),
|
||||||
|
topics=topic_list,
|
||||||
|
)
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
from typing import Any, Literal
|
||||||
|
|
||||||
|
from fastapi import HTTPException, status
|
||||||
|
|
||||||
|
DashboardPeriod = tuple[int | None, int | None]
|
||||||
|
|
||||||
|
|
||||||
|
def dashboard_period(
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> DashboardPeriod:
|
||||||
|
if from_year is not None and to_year is not None and from_year > to_year:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||||
|
detail="from_year must be less than or equal to to_year.",
|
||||||
|
)
|
||||||
|
return from_year, to_year
|
||||||
|
|
||||||
|
|
||||||
|
def project_overlap_filter(
|
||||||
|
start_field: str,
|
||||||
|
end_field: str,
|
||||||
|
period: DashboardPeriod,
|
||||||
|
*,
|
||||||
|
missing_end_is_ongoing: bool = False,
|
||||||
|
) -> dict[str, Any] | None:
|
||||||
|
from_year, to_year = period
|
||||||
|
filters: list[dict[str, Any]] = []
|
||||||
|
if to_year is not None:
|
||||||
|
filters.append({"range": {start_field: {"lte": to_year}}})
|
||||||
|
if from_year is not None:
|
||||||
|
end_filter: dict[str, Any] = {"range": {end_field: {"gte": from_year}}}
|
||||||
|
if missing_end_is_ongoing:
|
||||||
|
end_filter = {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
end_filter,
|
||||||
|
{"bool": {"must_not": {"exists": {"field": end_field}}}},
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filters.append(end_filter)
|
||||||
|
return {"bool": {"filter": filters}} if filters else None
|
||||||
|
|
||||||
|
|
||||||
|
def project_boundary_year_filter(
|
||||||
|
start_field: str,
|
||||||
|
end_field: str,
|
||||||
|
period: DashboardPeriod,
|
||||||
|
date_format: Literal["iso", "de", "year"],
|
||||||
|
) -> dict[str, Any] | None:
|
||||||
|
from_year, to_year = period
|
||||||
|
filters: list[dict[str, Any]] = []
|
||||||
|
if to_year is not None:
|
||||||
|
if date_format == "year":
|
||||||
|
filters.append({"range": {start_field: {"lte": to_year}}})
|
||||||
|
else:
|
||||||
|
last_day = (
|
||||||
|
f"{to_year}-12-31" if date_format == "iso" else f"31.12.{to_year}"
|
||||||
|
)
|
||||||
|
filters.append({"range": {start_field: {"lte": last_day}}})
|
||||||
|
if from_year is not None:
|
||||||
|
if date_format == "year":
|
||||||
|
filters.append({"range": {end_field: {"gte": from_year}}})
|
||||||
|
else:
|
||||||
|
first_day = (
|
||||||
|
f"{from_year}-01-01" if date_format == "iso" else f"01.01.{from_year}"
|
||||||
|
)
|
||||||
|
filters.append({"range": {end_field: {"gte": first_day}}})
|
||||||
|
return {"bool": {"filter": filters}} if filters else None
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_institution_id(value: str) -> str:
|
||||||
|
return (
|
||||||
|
value
|
||||||
|
if value.startswith("https://openalex.org/")
|
||||||
|
else f"https://openalex.org/{value}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def raw_institution_id(value: str) -> str:
|
||||||
|
return normalize_institution_id(value).removeprefix("https://openalex.org/")
|
||||||
|
|
||||||
|
|
||||||
|
def institution_works_query(institution_id: str) -> dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships.institutions",
|
||||||
|
"query": {"term": {"authorships.institutions.id": institution_id}},
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
from collections import defaultdict
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.model import ESCluster, ESIndex
|
||||||
|
|
||||||
|
from .model import DfgProjectKeyword, DfgProjectTopic, DfgProjectTopics
|
||||||
|
from .common import normalize_institution_id as _normalize_institution_id
|
||||||
|
from .project_ids_service import _get_dfg_project_ids_from_projects_service
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_dfg_topics(
|
||||||
|
institution_id: str,
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> DfgProjectTopics:
|
||||||
|
normalized_id = _normalize_institution_id(institution_id)
|
||||||
|
project_ids = await _get_dfg_project_ids_from_projects_service(
|
||||||
|
normalized_id,
|
||||||
|
from_year=from_year,
|
||||||
|
to_year=to_year,
|
||||||
|
)
|
||||||
|
topics: dict[str, dict[str, Any]] = {}
|
||||||
|
matched_project_ids: set[str] = set()
|
||||||
|
|
||||||
|
if project_ids:
|
||||||
|
async for hit in elasticsearch.scan(
|
||||||
|
index=str(ESIndex.PROJECTS_DFG_OPENALEX_TOPICS),
|
||||||
|
query={"terms": {"project_id": project_ids}},
|
||||||
|
source=["project_id", "keyword", "topic_matches"],
|
||||||
|
page_size=1000,
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
):
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
project_id = str(source.get("project_id") or "")
|
||||||
|
if not project_id:
|
||||||
|
continue
|
||||||
|
keyword = str(source.get("keyword") or "").strip()
|
||||||
|
matched_project_ids.add(project_id)
|
||||||
|
for match in source.get("topic_matches", []):
|
||||||
|
topic_id = str(match.get("topic_id") or "")
|
||||||
|
if not topic_id:
|
||||||
|
continue
|
||||||
|
topic = topics.setdefault(
|
||||||
|
topic_id,
|
||||||
|
{
|
||||||
|
"id": topic_id,
|
||||||
|
"name": str(match.get("topic_display_name") or topic_id),
|
||||||
|
"subfield": match.get("subfield"),
|
||||||
|
"field": match.get("field"),
|
||||||
|
"domain": match.get("domain"),
|
||||||
|
"project_ids": set(),
|
||||||
|
"keywords": {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
topic["project_ids"].add(project_id)
|
||||||
|
if keyword:
|
||||||
|
topic["keywords"].setdefault(keyword, set()).add(project_id)
|
||||||
|
|
||||||
|
field_project_ids: dict[str, set[str]] = defaultdict(set)
|
||||||
|
subfield_project_ids: dict[tuple[str, str], set[str]] = defaultdict(set)
|
||||||
|
for topic in topics.values():
|
||||||
|
field_name = str(topic["field"] or "")
|
||||||
|
subfield_name = str(topic["subfield"] or "")
|
||||||
|
field_project_ids[field_name].update(topic["project_ids"])
|
||||||
|
subfield_project_ids[(field_name, subfield_name)].update(topic["project_ids"])
|
||||||
|
|
||||||
|
topic_list = [
|
||||||
|
DfgProjectTopic(
|
||||||
|
id=topic["id"],
|
||||||
|
name=topic["name"],
|
||||||
|
subfield=topic["subfield"],
|
||||||
|
field=topic["field"],
|
||||||
|
domain=topic["domain"],
|
||||||
|
project_count=len(topic["project_ids"]),
|
||||||
|
field_project_count=len(field_project_ids[str(topic["field"] or "")]),
|
||||||
|
subfield_project_count=len(
|
||||||
|
subfield_project_ids[
|
||||||
|
(str(topic["field"] or ""), str(topic["subfield"] or ""))
|
||||||
|
]
|
||||||
|
),
|
||||||
|
keywords=sorted(
|
||||||
|
[
|
||||||
|
DfgProjectKeyword(
|
||||||
|
name=keyword,
|
||||||
|
project_count=len(keyword_project_ids),
|
||||||
|
)
|
||||||
|
for keyword, keyword_project_ids in topic["keywords"].items()
|
||||||
|
],
|
||||||
|
key=lambda entry: (-entry.project_count, entry.name),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
for topic in topics.values()
|
||||||
|
]
|
||||||
|
topic_list.sort(key=lambda topic: (-topic.project_count, topic.name, topic.id))
|
||||||
|
return DfgProjectTopics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
project_count=len(project_ids),
|
||||||
|
matched_project_count=len(matched_project_ids),
|
||||||
|
topics=topic_list,
|
||||||
|
)
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
from collections import defaultdict
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.model import ESCluster, ESIndex
|
||||||
|
|
||||||
|
from .model import DfgProjectKeyword, DfgProjectTopic, EuProjectTopics
|
||||||
|
from .common import normalize_institution_id as _normalize_institution_id
|
||||||
|
from .project_ids_service import _get_eu_project_ids_from_projects_service
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_eu_topics(
|
||||||
|
institution_id: str,
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> EuProjectTopics:
|
||||||
|
normalized_id = _normalize_institution_id(institution_id)
|
||||||
|
project_ids = await _get_eu_project_ids_from_projects_service(
|
||||||
|
normalized_id,
|
||||||
|
from_year=from_year,
|
||||||
|
to_year=to_year,
|
||||||
|
)
|
||||||
|
topics: dict[str, dict[str, Any]] = {}
|
||||||
|
matched_project_ids: set[str] = set()
|
||||||
|
|
||||||
|
if project_ids:
|
||||||
|
mapping_indices = (
|
||||||
|
ESIndex.PROJECTS_CORDIS_EU_FP7_TOPICS_MAPPING,
|
||||||
|
ESIndex.PROJECTS_CORDIS_EU_H2020_TOPICS,
|
||||||
|
ESIndex.PROJECTS_CORDIS_EU_HEUROPE_TOPICS,
|
||||||
|
)
|
||||||
|
for mapping_index in mapping_indices:
|
||||||
|
async for hit in elasticsearch.scan(
|
||||||
|
index=str(mapping_index),
|
||||||
|
query={"terms": {"project_id": project_ids}},
|
||||||
|
source=["project_id", "keyword", "topic_matches"],
|
||||||
|
page_size=1000,
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
):
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
project_id = str(source.get("project_id") or "")
|
||||||
|
if not project_id:
|
||||||
|
continue
|
||||||
|
keyword = str(source.get("keyword") or "").strip()
|
||||||
|
matched_project_ids.add(project_id)
|
||||||
|
for match in source.get("topic_matches", []):
|
||||||
|
topic_id = str(match.get("topic_id") or "")
|
||||||
|
if not topic_id:
|
||||||
|
continue
|
||||||
|
topic = topics.setdefault(
|
||||||
|
topic_id,
|
||||||
|
{
|
||||||
|
"id": topic_id,
|
||||||
|
"name": str(match.get("topic_display_name") or topic_id),
|
||||||
|
"subfield": match.get("subfield"),
|
||||||
|
"field": match.get("field"),
|
||||||
|
"domain": match.get("domain"),
|
||||||
|
"project_ids": set(),
|
||||||
|
"keywords": {},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
topic["project_ids"].add(project_id)
|
||||||
|
if keyword:
|
||||||
|
topic["keywords"].setdefault(keyword, set()).add(project_id)
|
||||||
|
|
||||||
|
field_project_ids: dict[str, set[str]] = defaultdict(set)
|
||||||
|
subfield_project_ids: dict[tuple[str, str], set[str]] = defaultdict(set)
|
||||||
|
for topic in topics.values():
|
||||||
|
field_name = str(topic["field"] or "")
|
||||||
|
subfield_name = str(topic["subfield"] or "")
|
||||||
|
field_project_ids[field_name].update(topic["project_ids"])
|
||||||
|
subfield_project_ids[(field_name, subfield_name)].update(topic["project_ids"])
|
||||||
|
|
||||||
|
topic_list = [
|
||||||
|
DfgProjectTopic(
|
||||||
|
id=topic["id"],
|
||||||
|
name=topic["name"],
|
||||||
|
subfield=topic["subfield"],
|
||||||
|
field=topic["field"],
|
||||||
|
domain=topic["domain"],
|
||||||
|
project_count=len(topic["project_ids"]),
|
||||||
|
field_project_count=len(field_project_ids[str(topic["field"] or "")]),
|
||||||
|
subfield_project_count=len(
|
||||||
|
subfield_project_ids[
|
||||||
|
(str(topic["field"] or ""), str(topic["subfield"] or ""))
|
||||||
|
]
|
||||||
|
),
|
||||||
|
keywords=sorted(
|
||||||
|
[
|
||||||
|
DfgProjectKeyword(
|
||||||
|
name=keyword,
|
||||||
|
project_count=len(keyword_project_ids),
|
||||||
|
)
|
||||||
|
for keyword, keyword_project_ids in topic["keywords"].items()
|
||||||
|
],
|
||||||
|
key=lambda entry: (-entry.project_count, entry.name),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
for topic in topics.values()
|
||||||
|
]
|
||||||
|
topic_list.sort(key=lambda topic: (-topic.project_count, topic.name, topic.id))
|
||||||
|
return EuProjectTopics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
project_count=len(project_ids),
|
||||||
|
matched_project_count=len(matched_project_ids),
|
||||||
|
topics=topic_list,
|
||||||
|
)
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class DashboardInstitution(BaseModel):
|
||||||
|
id: str
|
||||||
|
display_name: str
|
||||||
|
|
||||||
|
|
||||||
class DashboardStatistics(BaseModel):
|
class DashboardStatistics(BaseModel):
|
||||||
institution_id: str
|
institution_id: str
|
||||||
organization_name: str
|
organization_name: str
|
||||||
@@ -54,6 +59,8 @@ class DfgProjectTopic(BaseModel):
|
|||||||
field: str | None = None
|
field: str | None = None
|
||||||
domain: str | None = None
|
domain: str | None = None
|
||||||
project_count: int
|
project_count: int
|
||||||
|
field_project_count: int
|
||||||
|
subfield_project_count: int
|
||||||
keywords: list[DfgProjectKeyword]
|
keywords: list[DfgProjectKeyword]
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +72,22 @@ class DfgProjectTopics(BaseModel):
|
|||||||
topics: list[DfgProjectTopic]
|
topics: list[DfgProjectTopic]
|
||||||
|
|
||||||
|
|
||||||
|
class EuProjectTopics(BaseModel):
|
||||||
|
institution_id: str
|
||||||
|
organization_name: str
|
||||||
|
project_count: int
|
||||||
|
matched_project_count: int
|
||||||
|
topics: list[DfgProjectTopic]
|
||||||
|
|
||||||
|
|
||||||
|
class BundProjectTopics(BaseModel):
|
||||||
|
institution_id: str
|
||||||
|
organization_name: str
|
||||||
|
project_count: int
|
||||||
|
matched_project_count: int
|
||||||
|
topics: list[DfgProjectTopic]
|
||||||
|
|
||||||
|
|
||||||
class TopAuthor(BaseModel):
|
class TopAuthor(BaseModel):
|
||||||
id: str | None = None
|
id: str | None = None
|
||||||
name: str
|
name: str
|
||||||
@@ -80,6 +103,11 @@ class TopAuthorStatistics(BaseModel):
|
|||||||
news: list[TopAuthor]
|
news: list[TopAuthor]
|
||||||
|
|
||||||
|
|
||||||
|
class TopAuthorAnalysis(BaseModel):
|
||||||
|
institution_id: str
|
||||||
|
authors: list[TopAuthor]
|
||||||
|
|
||||||
|
|
||||||
class TopicHeatmapValue(BaseModel):
|
class TopicHeatmapValue(BaseModel):
|
||||||
year: int
|
year: int
|
||||||
count: int
|
count: int
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
from inse.institutions.institutions_search_client import InstitutionsSearchClient
|
||||||
|
from inse.projects import service as projects_service
|
||||||
|
from inse.projects.model import EuCordisProjectType
|
||||||
|
|
||||||
|
from .common import (
|
||||||
|
dashboard_period as _dashboard_period,
|
||||||
|
raw_institution_id as _raw_institution_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def _get_dfg_project_ids_from_projects_service(
|
||||||
|
institution_id: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> list[str]:
|
||||||
|
"""Returns every matching DFG project ID through the canonical project service."""
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
page_size = 1000
|
||||||
|
page_number = 0
|
||||||
|
project_ids: set[str] = set()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
projects = await projects_service.get_dfg_projects(
|
||||||
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
|
raw_oa_institution_id=_raw_institution_id(institution_id),
|
||||||
|
author_id=None,
|
||||||
|
author_filter_ids=None,
|
||||||
|
institution_ids=None,
|
||||||
|
keywords=None,
|
||||||
|
topic_ids=None,
|
||||||
|
filter_topic_ids=None,
|
||||||
|
title=None,
|
||||||
|
funding_start_years=(
|
||||||
|
[str(year) for year in range(1900, period[1] + 1)]
|
||||||
|
if period[1] is not None
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
funding_end_years=(
|
||||||
|
[str(year) for year in range(period[0], 2101)]
|
||||||
|
if period[0] is not None
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
page=page_number,
|
||||||
|
size=page_size,
|
||||||
|
sort_by="id",
|
||||||
|
sort_direction="asc",
|
||||||
|
fuzzy=False,
|
||||||
|
skip_enrichment=True,
|
||||||
|
)
|
||||||
|
project_ids.update(project.id for project in projects.elements if project.id)
|
||||||
|
if len(project_ids) >= projects.total or not projects.elements:
|
||||||
|
break
|
||||||
|
page_number += 1
|
||||||
|
|
||||||
|
return sorted(project_ids)
|
||||||
|
|
||||||
|
|
||||||
|
async def _get_eu_project_ids_from_projects_service(
|
||||||
|
institution_id: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> list[str]:
|
||||||
|
"""Loads all organization EU project IDs from the canonical project service."""
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
page_size = 1000
|
||||||
|
page_number = 0
|
||||||
|
project_ids: set[str] = set()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
projects = await projects_service.search_eu_cordis_projects(
|
||||||
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
|
raw_oa_institution_id=_raw_institution_id(institution_id),
|
||||||
|
author_id=None,
|
||||||
|
author_ids=None,
|
||||||
|
organization_ids=None,
|
||||||
|
organization_names=None,
|
||||||
|
project_types=list(EuCordisProjectType),
|
||||||
|
keywords=None,
|
||||||
|
topic_ids=None,
|
||||||
|
filter_topic_ids=None,
|
||||||
|
title=None,
|
||||||
|
funding_start_years=None,
|
||||||
|
funding_end_years=None,
|
||||||
|
active_from_year=period[0],
|
||||||
|
active_to_year=period[1],
|
||||||
|
countries=None,
|
||||||
|
framework_programmes=None,
|
||||||
|
funding_schemes=None,
|
||||||
|
statuses=None,
|
||||||
|
page=page_number,
|
||||||
|
size=page_size,
|
||||||
|
sort_by="id",
|
||||||
|
sort_direction="asc",
|
||||||
|
fuzzy=False,
|
||||||
|
skip_enrichment=True,
|
||||||
|
)
|
||||||
|
project_ids.update(project.id for project in projects.elements if project.id)
|
||||||
|
if len(project_ids) >= projects.total or not projects.elements:
|
||||||
|
break
|
||||||
|
page_number += 1
|
||||||
|
|
||||||
|
return sorted(project_ids)
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
import asyncio
|
||||||
|
|
||||||
|
from inse.institutions.institutions_search_client import InstitutionsSearchClient
|
||||||
|
from inse.projects import service as projects_service
|
||||||
|
from inse.projects.model import EuCordisProjectType
|
||||||
|
|
||||||
|
from .common import (
|
||||||
|
dashboard_period as _dashboard_period,
|
||||||
|
normalize_institution_id as _normalize_institution_id,
|
||||||
|
raw_institution_id as _raw_institution_id,
|
||||||
|
)
|
||||||
|
from .model import DashboardStatisticValue
|
||||||
|
|
||||||
|
|
||||||
|
def _institution_ids(value: str | list[str]) -> list[str]:
|
||||||
|
return value if isinstance(value, list) else [value]
|
||||||
|
|
||||||
|
|
||||||
|
def _scope_id(institution_ids: list[str]) -> str:
|
||||||
|
return (
|
||||||
|
_normalize_institution_id(institution_ids[0])
|
||||||
|
if len(institution_ids) == 1
|
||||||
|
else "all"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def _institution_aliases(institution_ids: list[str]) -> list[str]:
|
||||||
|
client = InstitutionsSearchClient()
|
||||||
|
aliases = await asyncio.gather(
|
||||||
|
*(
|
||||||
|
client.get_institution_aliases_by_oa_institution_id(
|
||||||
|
_raw_institution_id(institution_id)
|
||||||
|
)
|
||||||
|
for institution_id in institution_ids
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return list(dict.fromkeys(alias for group in aliases for alias in group))
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_eu_projects(
|
||||||
|
institution_id: str | list[str],
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> DashboardStatisticValue:
|
||||||
|
institution_ids = _institution_ids(institution_id)
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
multiple_institutions = len(institution_ids) > 1
|
||||||
|
projects = await projects_service.search_eu_cordis_projects(
|
||||||
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
|
raw_oa_institution_id=(
|
||||||
|
None if multiple_institutions else _raw_institution_id(institution_ids[0])
|
||||||
|
),
|
||||||
|
author_id=None,
|
||||||
|
author_ids=None,
|
||||||
|
organization_ids=None,
|
||||||
|
organization_names=(
|
||||||
|
await _institution_aliases(institution_ids)
|
||||||
|
if multiple_institutions
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
project_types=list(EuCordisProjectType),
|
||||||
|
keywords=None,
|
||||||
|
topic_ids=None,
|
||||||
|
filter_topic_ids=None,
|
||||||
|
title=None,
|
||||||
|
funding_start_years=None,
|
||||||
|
funding_end_years=None,
|
||||||
|
active_from_year=period[0],
|
||||||
|
active_to_year=period[1],
|
||||||
|
countries=None,
|
||||||
|
framework_programmes=None,
|
||||||
|
funding_schemes=None,
|
||||||
|
statuses=None,
|
||||||
|
page=0,
|
||||||
|
size=1,
|
||||||
|
sort_by="id",
|
||||||
|
sort_direction="asc",
|
||||||
|
fuzzy=False,
|
||||||
|
)
|
||||||
|
return DashboardStatisticValue(
|
||||||
|
institution_id=_scope_id(institution_ids),
|
||||||
|
organization_name=organization_name,
|
||||||
|
value=projects.total,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_bmbf_projects(
|
||||||
|
institution_id: str | list[str],
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> DashboardStatisticValue:
|
||||||
|
institution_ids = _institution_ids(institution_id)
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
multiple_institutions = len(institution_ids) > 1
|
||||||
|
projects = await projects_service.search_bund_projects_with_filters(
|
||||||
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
|
executing_agency=None,
|
||||||
|
raw_oa_institution_id=(
|
||||||
|
None if multiple_institutions else _raw_institution_id(institution_ids[0])
|
||||||
|
),
|
||||||
|
title=None,
|
||||||
|
keywords=None,
|
||||||
|
funding_arts=None,
|
||||||
|
topic_ids=None,
|
||||||
|
filter_topic_ids=None,
|
||||||
|
funding_start_years=None,
|
||||||
|
funding_end_years=None,
|
||||||
|
active_from_year=period[0],
|
||||||
|
active_to_year=period[1],
|
||||||
|
countries=None,
|
||||||
|
page=0,
|
||||||
|
size=1,
|
||||||
|
sort_by="id",
|
||||||
|
sort_direction="asc",
|
||||||
|
fuzzy=False,
|
||||||
|
oa_institution_aliases=(
|
||||||
|
await _institution_aliases(institution_ids)
|
||||||
|
if multiple_institutions
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return DashboardStatisticValue(
|
||||||
|
institution_id=_scope_id(institution_ids),
|
||||||
|
organization_name=organization_name,
|
||||||
|
value=projects.total,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_dfg_projects(
|
||||||
|
institution_id: str | list[str],
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> DashboardStatisticValue:
|
||||||
|
institution_ids = _institution_ids(institution_id)
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
multiple_institutions = len(institution_ids) > 1
|
||||||
|
projects = await projects_service.get_dfg_projects(
|
||||||
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
|
raw_oa_institution_id=(
|
||||||
|
None if multiple_institutions else _raw_institution_id(institution_ids[0])
|
||||||
|
),
|
||||||
|
author_id=None,
|
||||||
|
author_filter_ids=None,
|
||||||
|
institution_ids=None,
|
||||||
|
keywords=None,
|
||||||
|
topic_ids=None,
|
||||||
|
filter_topic_ids=None,
|
||||||
|
title=None,
|
||||||
|
funding_start_years=None,
|
||||||
|
funding_end_years=None,
|
||||||
|
active_from_year=period[0],
|
||||||
|
active_to_year=period[1],
|
||||||
|
page=0,
|
||||||
|
size=1,
|
||||||
|
sort_by="id",
|
||||||
|
sort_direction="asc",
|
||||||
|
fuzzy=False,
|
||||||
|
skip_enrichment=True,
|
||||||
|
institution_aliases=(
|
||||||
|
await _institution_aliases(institution_ids)
|
||||||
|
if multiple_institutions
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
)
|
||||||
|
return DashboardStatisticValue(
|
||||||
|
institution_id=_scope_id(institution_ids),
|
||||||
|
organization_name=organization_name,
|
||||||
|
value=projects.total,
|
||||||
|
)
|
||||||
@@ -0,0 +1,545 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
from inse.institutions.institutions_search_client import InstitutionsSearchClient
|
||||||
|
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.model import ESCluster, ESIndex
|
||||||
|
|
||||||
|
from .common import (
|
||||||
|
DashboardPeriod,
|
||||||
|
dashboard_period as _dashboard_period,
|
||||||
|
normalize_institution_id as _normalize_institution_id,
|
||||||
|
project_boundary_year_filter as _project_boundary_year_filter,
|
||||||
|
project_overlap_filter as _project_overlap_filter,
|
||||||
|
raw_institution_id as _raw_institution_id,
|
||||||
|
)
|
||||||
|
from .institute_helper import get_openalex_institution
|
||||||
|
from .model import (
|
||||||
|
BmbfProjectStatusStatistics,
|
||||||
|
DfgProjectStatusStatistics,
|
||||||
|
EuProjectStatusStatistics,
|
||||||
|
)
|
||||||
|
from .project_statistics_service import (
|
||||||
|
get_dashboard_bmbf_projects,
|
||||||
|
get_dashboard_dfg_projects,
|
||||||
|
get_dashboard_eu_projects,
|
||||||
|
)
|
||||||
|
from .project_ids_service import _get_dfg_project_ids_from_projects_service
|
||||||
|
|
||||||
|
|
||||||
|
def _status_count(aggregations: dict[str, Any], status_name: str) -> int:
|
||||||
|
return int(aggregations.get(status_name, {}).get("projects", {}).get("value", 0))
|
||||||
|
|
||||||
|
|
||||||
|
def reconcile_status_counts(
|
||||||
|
total: int, ongoing: int, upcoming: int, completed: int
|
||||||
|
) -> tuple[int, int, int]:
|
||||||
|
"""Make status buckets add up to the authoritative project-service total."""
|
||||||
|
counts = [max(0, ongoing), max(0, upcoming), max(0, completed)]
|
||||||
|
difference = total - sum(counts)
|
||||||
|
if difference >= 0:
|
||||||
|
counts[0] += difference
|
||||||
|
return counts[0], counts[1], counts[2]
|
||||||
|
|
||||||
|
excess = -difference
|
||||||
|
for index in (0, 1, 2):
|
||||||
|
reduction = min(counts[index], excess)
|
||||||
|
counts[index] -= reduction
|
||||||
|
excess -= reduction
|
||||||
|
if excess == 0:
|
||||||
|
break
|
||||||
|
return counts[0], counts[1], counts[2]
|
||||||
|
|
||||||
|
|
||||||
|
def _status_filter_aggregations(
|
||||||
|
start_field: str, end_field: str, today: str
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"ongoing": {
|
||||||
|
"filter": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{"range": {start_field: {"lte": today}}},
|
||||||
|
{"range": {end_field: {"gte": today}}},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"upcoming": {"filter": {"range": {start_field: {"gt": today}}}},
|
||||||
|
"completed": {"filter": {"range": {end_field: {"lt": today}}}},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_eu_project_statuses(
|
||||||
|
institution_id: str,
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> EuProjectStatusStatistics:
|
||||||
|
normalized_id = _normalize_institution_id(institution_id)
|
||||||
|
total = (
|
||||||
|
await get_dashboard_eu_projects(
|
||||||
|
normalized_id, organization_name, from_year=from_year, to_year=to_year
|
||||||
|
)
|
||||||
|
).value
|
||||||
|
if total == 0:
|
||||||
|
return EuProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=0,
|
||||||
|
upcoming=0,
|
||||||
|
completed=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
aliases = await _institution_aliases(normalized_id, organization_name)
|
||||||
|
project_ids = await _eu_project_ids_for_aliases(aliases)
|
||||||
|
if not project_ids:
|
||||||
|
return EuProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=total,
|
||||||
|
upcoming=0,
|
||||||
|
completed=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
today = datetime.now().date().isoformat()
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
filters: list[dict[str, Any]] = [{"terms": {"id": sorted(project_ids)}}]
|
||||||
|
if period_filter := _project_boundary_year_filter(
|
||||||
|
"startDate", "endDate", period, "iso"
|
||||||
|
):
|
||||||
|
filters.append(period_filter)
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=ESIndex.CORDIS_EU_PROJECTS_WILDCARD,
|
||||||
|
body={
|
||||||
|
"size": 0,
|
||||||
|
"query": filters[0] if len(filters) == 1 else {"bool": {"filter": filters}},
|
||||||
|
"aggs": {
|
||||||
|
"ongoing": {
|
||||||
|
"filter": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{"range": {"startDate": {"lte": today}}},
|
||||||
|
{"range": {"endDate": {"gte": today}}},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aggs": {"projects": {"cardinality": {"field": "id"}}},
|
||||||
|
},
|
||||||
|
"upcoming": {
|
||||||
|
"filter": {"range": {"startDate": {"gt": today}}},
|
||||||
|
"aggs": {"projects": {"cardinality": {"field": "id"}}},
|
||||||
|
},
|
||||||
|
"completed": {
|
||||||
|
"filter": {"range": {"endDate": {"lt": today}}},
|
||||||
|
"aggs": {"projects": {"cardinality": {"field": "id"}}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
)
|
||||||
|
aggregations = response.get("aggregations", {})
|
||||||
|
ongoing, upcoming, completed = reconcile_status_counts(
|
||||||
|
total,
|
||||||
|
_status_count(aggregations, "ongoing"),
|
||||||
|
_status_count(aggregations, "upcoming"),
|
||||||
|
_status_count(aggregations, "completed"),
|
||||||
|
)
|
||||||
|
return EuProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=ongoing,
|
||||||
|
upcoming=upcoming,
|
||||||
|
completed=completed,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_bmbf_project_statuses(
|
||||||
|
institution_id: str,
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> BmbfProjectStatusStatistics:
|
||||||
|
normalized_id = _normalize_institution_id(institution_id)
|
||||||
|
total = (
|
||||||
|
await get_dashboard_bmbf_projects(
|
||||||
|
normalized_id, organization_name, from_year=from_year, to_year=to_year
|
||||||
|
)
|
||||||
|
).value
|
||||||
|
if total == 0:
|
||||||
|
return BmbfProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=0,
|
||||||
|
upcoming=0,
|
||||||
|
completed=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
aliases = await _institution_aliases(normalized_id, organization_name)
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
filters = [_alias_match_query("Zuwendungsempfänger", aliases)]
|
||||||
|
if period_filter := _project_boundary_year_filter(
|
||||||
|
"funding_start", "funding_end", period, "de"
|
||||||
|
):
|
||||||
|
filters.append(period_filter)
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=ESIndex.PROJECTS_BUND_V1,
|
||||||
|
body={
|
||||||
|
"size": 0,
|
||||||
|
"query": filters[0] if len(filters) == 1 else {"bool": {"filter": filters}},
|
||||||
|
"aggs": _status_filter_aggregations(
|
||||||
|
"funding_start", "funding_end", datetime.now().strftime("%d.%m.%Y")
|
||||||
|
),
|
||||||
|
},
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
)
|
||||||
|
aggregations = response.get("aggregations", {})
|
||||||
|
ongoing, upcoming, completed = reconcile_status_counts(
|
||||||
|
total,
|
||||||
|
int(aggregations.get("ongoing", {}).get("doc_count", 0)),
|
||||||
|
int(aggregations.get("upcoming", {}).get("doc_count", 0)),
|
||||||
|
int(aggregations.get("completed", {}).get("doc_count", 0)),
|
||||||
|
)
|
||||||
|
return BmbfProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=ongoing,
|
||||||
|
upcoming=upcoming,
|
||||||
|
completed=completed,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dashboard_dfg_project_statuses(
|
||||||
|
institution_id: str,
|
||||||
|
organization_name: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> DfgProjectStatusStatistics:
|
||||||
|
normalized_id = _normalize_institution_id(institution_id)
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
total = (
|
||||||
|
await get_dashboard_dfg_projects(
|
||||||
|
normalized_id, organization_name, from_year=from_year, to_year=to_year
|
||||||
|
)
|
||||||
|
).value
|
||||||
|
if total == 0:
|
||||||
|
return DfgProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=0,
|
||||||
|
upcoming=0,
|
||||||
|
completed=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
project_ids = await _get_dfg_project_ids_from_projects_service(
|
||||||
|
normalized_id,
|
||||||
|
from_year=from_year,
|
||||||
|
to_year=to_year,
|
||||||
|
)
|
||||||
|
if not project_ids:
|
||||||
|
return DfgProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=total,
|
||||||
|
upcoming=0,
|
||||||
|
completed=0,
|
||||||
|
)
|
||||||
|
|
||||||
|
filters: list[dict[str, Any]] = [
|
||||||
|
{
|
||||||
|
"terms": {
|
||||||
|
"projects.project_id": [int(project_id) for project_id in project_ids]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
if period_filter := _project_boundary_year_filter(
|
||||||
|
"projects.funding_start", "projects.funding_end", period, "year"
|
||||||
|
):
|
||||||
|
filters.append(period_filter)
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=ESIndex.DFG_INSTITUTES_V2,
|
||||||
|
body={
|
||||||
|
"size": 0,
|
||||||
|
"aggs": {
|
||||||
|
"projects_nested": {
|
||||||
|
"nested": {"path": "projects"},
|
||||||
|
"aggs": {
|
||||||
|
"selected_projects": {
|
||||||
|
"filter": filters[0]
|
||||||
|
if len(filters) == 1
|
||||||
|
else {"bool": {"filter": filters}},
|
||||||
|
"aggs": {
|
||||||
|
"ongoing": {
|
||||||
|
"filter": {
|
||||||
|
"match_phrase": {
|
||||||
|
"projects.status_de": "laufend"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"projects": {
|
||||||
|
"cardinality": {
|
||||||
|
"field": "projects.project_id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"completed": {
|
||||||
|
"filter": {
|
||||||
|
"match_phrase": {
|
||||||
|
"projects.status_de": "abgeschlossen"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"projects": {
|
||||||
|
"cardinality": {
|
||||||
|
"field": "projects.project_id"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
)
|
||||||
|
aggregations = (
|
||||||
|
response.get("aggregations", {})
|
||||||
|
.get("projects_nested", {})
|
||||||
|
.get("selected_projects", {})
|
||||||
|
)
|
||||||
|
ongoing, upcoming, completed = reconcile_status_counts(
|
||||||
|
total,
|
||||||
|
_status_count(aggregations, "ongoing"),
|
||||||
|
0,
|
||||||
|
_status_count(aggregations, "completed"),
|
||||||
|
)
|
||||||
|
return DfgProjectStatusStatistics(
|
||||||
|
institution_id=normalized_id,
|
||||||
|
organization_name=organization_name,
|
||||||
|
ongoing=ongoing,
|
||||||
|
upcoming=upcoming,
|
||||||
|
completed=completed,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def _get_dfg_project_ids_for_institution(
|
||||||
|
institution_id: str,
|
||||||
|
from_year: int | None = None,
|
||||||
|
to_year: int | None = None,
|
||||||
|
) -> list[str]:
|
||||||
|
period = _dashboard_period(from_year, to_year)
|
||||||
|
institution = await get_openalex_institution(institution_id)
|
||||||
|
institution_names = _openalex_institution_names(institution)
|
||||||
|
|
||||||
|
institutes_response = await elasticsearch.search(
|
||||||
|
index=ESIndex.DFG_INSTITUTES_V2,
|
||||||
|
body={
|
||||||
|
"size": 0,
|
||||||
|
"query": _dfg_institute_name_query(institution_names),
|
||||||
|
"aggs": {
|
||||||
|
"institute_ids": {"terms": {"field": "institute_id", "size": 1000}}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
)
|
||||||
|
institute_ids = [
|
||||||
|
bucket["key"]
|
||||||
|
for bucket in (
|
||||||
|
institutes_response.get("aggregations", {})
|
||||||
|
.get("institute_ids", {})
|
||||||
|
.get("buckets", [])
|
||||||
|
)
|
||||||
|
if bucket.get("key") is not None
|
||||||
|
]
|
||||||
|
if not institute_ids:
|
||||||
|
return []
|
||||||
|
|
||||||
|
projects_response = await elasticsearch.search(
|
||||||
|
index=ESIndex.DFG_INSTITUTES_V2,
|
||||||
|
body={
|
||||||
|
"size": 0,
|
||||||
|
"query": {"terms": {"institute_id": institute_ids}},
|
||||||
|
"aggs": {
|
||||||
|
"projects_nested": {
|
||||||
|
"nested": {"path": "projects"},
|
||||||
|
"aggs": {
|
||||||
|
"project_ids": {
|
||||||
|
"filter": {
|
||||||
|
"terms": {"projects.institute_ref_id": institute_ids}
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"values": {
|
||||||
|
"terms": {
|
||||||
|
"field": "projects.project_id",
|
||||||
|
"size": 10000,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
)
|
||||||
|
project_ids = [
|
||||||
|
str(bucket["key"])
|
||||||
|
for bucket in (
|
||||||
|
projects_response.get("aggregations", {})
|
||||||
|
.get("projects_nested", {})
|
||||||
|
.get("project_ids", {})
|
||||||
|
.get("values", {})
|
||||||
|
.get("buckets", [])
|
||||||
|
)
|
||||||
|
if bucket.get("key") is not None
|
||||||
|
]
|
||||||
|
return await _filter_dfg_project_ids_by_period(project_ids, period)
|
||||||
|
|
||||||
|
|
||||||
|
async def _eu_project_ids_for_aliases(aliases: list[str]) -> set[str]:
|
||||||
|
project_ids: set[str] = set()
|
||||||
|
async for hit in elasticsearch.scan(
|
||||||
|
index=str(ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD),
|
||||||
|
query=_eu_organization_query(aliases),
|
||||||
|
source=["projectID"],
|
||||||
|
page_size=1000,
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
):
|
||||||
|
project_id = hit.get("_source", {}).get("projectID")
|
||||||
|
if project_id is not None:
|
||||||
|
project_ids.add(str(project_id))
|
||||||
|
return project_ids
|
||||||
|
|
||||||
|
|
||||||
|
async def _filter_dfg_project_ids_by_period(
|
||||||
|
project_ids: list[str],
|
||||||
|
period: DashboardPeriod,
|
||||||
|
) -> list[str]:
|
||||||
|
period_filter = _project_overlap_filter(
|
||||||
|
"funding_start",
|
||||||
|
"funding_end",
|
||||||
|
period,
|
||||||
|
missing_end_is_ongoing=True,
|
||||||
|
)
|
||||||
|
if not project_ids or not period_filter:
|
||||||
|
return project_ids
|
||||||
|
|
||||||
|
numeric_project_ids = [
|
||||||
|
int(project_id) for project_id in project_ids if str(project_id).isdigit()
|
||||||
|
]
|
||||||
|
if not numeric_project_ids:
|
||||||
|
return []
|
||||||
|
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=ESIndex.DFG_PROJECTS,
|
||||||
|
body={
|
||||||
|
"size": 0,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{"terms": {"id": numeric_project_ids}},
|
||||||
|
period_filter,
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"project_ids": {
|
||||||
|
"terms": {
|
||||||
|
"field": "id",
|
||||||
|
"size": len(numeric_project_ids),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cluster=ESCluster.INSE,
|
||||||
|
)
|
||||||
|
return [
|
||||||
|
str(bucket["key"])
|
||||||
|
for bucket in (
|
||||||
|
response.get("aggregations", {}).get("project_ids", {}).get("buckets", [])
|
||||||
|
)
|
||||||
|
if bucket.get("key") is not None
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
async def _institution_aliases(
|
||||||
|
institution_id: str,
|
||||||
|
organization_name: str,
|
||||||
|
) -> list[str]:
|
||||||
|
aliases = (
|
||||||
|
await InstitutionsSearchClient().get_institution_aliases_by_oa_institution_id(
|
||||||
|
_raw_institution_id(institution_id)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return sorted(
|
||||||
|
{
|
||||||
|
alias.strip()
|
||||||
|
for alias in [organization_name, *aliases]
|
||||||
|
if alias and alias.strip()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _eu_organization_query(aliases: list[str]) -> dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"terms": {
|
||||||
|
"name.keyword": [alias.upper() for alias in aliases],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _alias_match_query(field: str, aliases: list[str]) -> dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{
|
||||||
|
"match": {
|
||||||
|
field: {
|
||||||
|
"query": alias,
|
||||||
|
"operator": "and",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for alias in aliases
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _openalex_institution_names(institution: Any) -> list[str]:
|
||||||
|
return sorted(
|
||||||
|
{
|
||||||
|
name.strip()
|
||||||
|
for name in [
|
||||||
|
institution.display_name,
|
||||||
|
*(institution.display_name_alternatives or []),
|
||||||
|
*(institution.display_name_acronyms or []),
|
||||||
|
]
|
||||||
|
if name and name.strip()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _dfg_institute_name_query(institution_names: list[str]) -> dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{
|
||||||
|
"terms": {
|
||||||
|
"institute_name_de.keyword": institution_names,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"terms": {
|
||||||
|
"institute_name_en.keyword": institution_names,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,36 +10,69 @@ from inse.tags import Tags
|
|||||||
|
|
||||||
from .model import (
|
from .model import (
|
||||||
BmbfProjectStatusStatistics,
|
BmbfProjectStatusStatistics,
|
||||||
|
BundProjectTopics,
|
||||||
|
DashboardInstitution,
|
||||||
DashboardStatistics,
|
DashboardStatistics,
|
||||||
DashboardStatisticValue,
|
DashboardStatisticValue,
|
||||||
DfgProjectStatusStatistics,
|
DfgProjectStatusStatistics,
|
||||||
DfgProjectTopics,
|
DfgProjectTopics,
|
||||||
|
EuProjectTopics,
|
||||||
EuProjectStatusStatistics,
|
EuProjectStatusStatistics,
|
||||||
TopAuthorStatistics,
|
TopAuthorStatistics,
|
||||||
|
TopAuthorAnalysis,
|
||||||
TopicHeatmap,
|
TopicHeatmap,
|
||||||
TopicWordCloud,
|
TopicWordCloud,
|
||||||
)
|
)
|
||||||
from .service import (
|
from .service import (
|
||||||
get_dashboard_bmbf_project_statuses,
|
get_dashboard_analytical_institution,
|
||||||
get_dashboard_bmbf_projects,
|
get_dashboard_institutions,
|
||||||
get_dashboard_dfg_project_statuses,
|
|
||||||
get_dashboard_dfg_projects,
|
|
||||||
get_dashboard_dfg_topics,
|
|
||||||
get_dashboard_eu_project_statuses,
|
|
||||||
get_dashboard_eu_projects,
|
|
||||||
get_dashboard_organization,
|
get_dashboard_organization,
|
||||||
get_dashboard_patents,
|
get_dashboard_patents,
|
||||||
get_dashboard_persons,
|
get_dashboard_persons,
|
||||||
get_dashboard_publications,
|
get_dashboard_publications,
|
||||||
|
get_dashboard_statistic_institution_ids,
|
||||||
get_dashboard_statistics,
|
get_dashboard_statistics,
|
||||||
get_top_authors,
|
|
||||||
get_topic_heatmap,
|
get_topic_heatmap,
|
||||||
get_topic_word_cloud,
|
get_topic_word_cloud,
|
||||||
)
|
)
|
||||||
|
from .project_statistics_service import (
|
||||||
|
get_dashboard_bmbf_projects,
|
||||||
|
get_dashboard_dfg_projects,
|
||||||
|
get_dashboard_eu_projects,
|
||||||
|
)
|
||||||
|
from .bund_topics_service import get_dashboard_bund_topics
|
||||||
|
from .dfg_topics_service import get_dashboard_dfg_topics
|
||||||
|
from .eu_topics_service import get_dashboard_eu_topics
|
||||||
|
from .project_status_service import (
|
||||||
|
get_dashboard_bmbf_project_statuses,
|
||||||
|
get_dashboard_dfg_project_statuses,
|
||||||
|
get_dashboard_eu_project_statuses,
|
||||||
|
)
|
||||||
|
from .top_authors_service import (
|
||||||
|
get_top_authors,
|
||||||
|
get_top_eu_project_authors,
|
||||||
|
get_top_news_authors,
|
||||||
|
get_top_patent_authors,
|
||||||
|
get_top_project_authors,
|
||||||
|
get_top_work_authors,
|
||||||
|
)
|
||||||
|
|
||||||
router = APIRouter(prefix="/api/dashboard", tags=[Tags.DASHBOARD])
|
router = APIRouter(prefix="/api/dashboard", tags=[Tags.DASHBOARD])
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/institutions",
|
||||||
|
operation_id="getDashboardInstitutions",
|
||||||
|
response_model=list[DashboardInstitution],
|
||||||
|
)
|
||||||
|
async def dashboard_institutions(
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> list[DashboardInstitution]:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
return await get_dashboard_institutions(session, organization)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/statistics",
|
"/statistics",
|
||||||
operation_id="getDashboardStatistics",
|
operation_id="getDashboardStatistics",
|
||||||
@@ -62,14 +95,18 @@ async def dashboard_statistics(
|
|||||||
response_model=DashboardStatisticValue,
|
response_model=DashboardStatisticValue,
|
||||||
)
|
)
|
||||||
async def dashboard_publications(
|
async def dashboard_publications(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DashboardStatisticValue:
|
) -> DashboardStatisticValue:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
institution_ids = await get_dashboard_statistic_institution_ids(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
return await get_dashboard_publications(
|
return await get_dashboard_publications(
|
||||||
organization.openalex_institution_id,
|
institution_ids,
|
||||||
organization.name,
|
organization.name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
@@ -82,14 +119,18 @@ async def dashboard_publications(
|
|||||||
response_model=DashboardStatisticValue,
|
response_model=DashboardStatisticValue,
|
||||||
)
|
)
|
||||||
async def dashboard_persons(
|
async def dashboard_persons(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DashboardStatisticValue:
|
) -> DashboardStatisticValue:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
institution_ids = await get_dashboard_statistic_institution_ids(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
return await get_dashboard_persons(
|
return await get_dashboard_persons(
|
||||||
organization.openalex_institution_id,
|
institution_ids,
|
||||||
organization.name,
|
organization.name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
@@ -102,14 +143,18 @@ async def dashboard_persons(
|
|||||||
response_model=DashboardStatisticValue,
|
response_model=DashboardStatisticValue,
|
||||||
)
|
)
|
||||||
async def dashboard_patents(
|
async def dashboard_patents(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DashboardStatisticValue:
|
) -> DashboardStatisticValue:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
institution_ids = await get_dashboard_statistic_institution_ids(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
return await get_dashboard_patents(
|
return await get_dashboard_patents(
|
||||||
organization.openalex_institution_id,
|
institution_ids,
|
||||||
organization.name,
|
organization.name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
@@ -122,14 +167,18 @@ async def dashboard_patents(
|
|||||||
response_model=DashboardStatisticValue,
|
response_model=DashboardStatisticValue,
|
||||||
)
|
)
|
||||||
async def dashboard_eu_projects(
|
async def dashboard_eu_projects(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DashboardStatisticValue:
|
) -> DashboardStatisticValue:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
institution_ids = await get_dashboard_statistic_institution_ids(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
return await get_dashboard_eu_projects(
|
return await get_dashboard_eu_projects(
|
||||||
organization.openalex_institution_id,
|
institution_ids,
|
||||||
organization.name,
|
organization.name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
@@ -142,15 +191,21 @@ async def dashboard_eu_projects(
|
|||||||
response_model=EuProjectStatusStatistics,
|
response_model=EuProjectStatusStatistics,
|
||||||
)
|
)
|
||||||
async def dashboard_eu_project_statuses(
|
async def dashboard_eu_project_statuses(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> EuProjectStatusStatistics:
|
) -> EuProjectStatusStatistics:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
return await get_dashboard_eu_project_statuses(
|
return await get_dashboard_eu_project_statuses(
|
||||||
organization.openalex_institution_id,
|
selected_institution_id,
|
||||||
organization.name,
|
selected_institution_name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
)
|
)
|
||||||
@@ -162,14 +217,18 @@ async def dashboard_eu_project_statuses(
|
|||||||
response_model=DashboardStatisticValue,
|
response_model=DashboardStatisticValue,
|
||||||
)
|
)
|
||||||
async def dashboard_bmbf_projects(
|
async def dashboard_bmbf_projects(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DashboardStatisticValue:
|
) -> DashboardStatisticValue:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
institution_ids = await get_dashboard_statistic_institution_ids(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
return await get_dashboard_bmbf_projects(
|
return await get_dashboard_bmbf_projects(
|
||||||
organization.openalex_institution_id,
|
institution_ids,
|
||||||
organization.name,
|
organization.name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
@@ -182,15 +241,21 @@ async def dashboard_bmbf_projects(
|
|||||||
response_model=BmbfProjectStatusStatistics,
|
response_model=BmbfProjectStatusStatistics,
|
||||||
)
|
)
|
||||||
async def dashboard_bmbf_project_statuses(
|
async def dashboard_bmbf_project_statuses(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> BmbfProjectStatusStatistics:
|
) -> BmbfProjectStatusStatistics:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
return await get_dashboard_bmbf_project_statuses(
|
return await get_dashboard_bmbf_project_statuses(
|
||||||
organization.openalex_institution_id,
|
selected_institution_id,
|
||||||
organization.name,
|
selected_institution_name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
)
|
)
|
||||||
@@ -202,14 +267,18 @@ async def dashboard_bmbf_project_statuses(
|
|||||||
response_model=DashboardStatisticValue,
|
response_model=DashboardStatisticValue,
|
||||||
)
|
)
|
||||||
async def dashboard_dfg_projects(
|
async def dashboard_dfg_projects(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DashboardStatisticValue:
|
) -> DashboardStatisticValue:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
institution_ids = await get_dashboard_statistic_institution_ids(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
return await get_dashboard_dfg_projects(
|
return await get_dashboard_dfg_projects(
|
||||||
organization.openalex_institution_id,
|
institution_ids,
|
||||||
organization.name,
|
organization.name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
@@ -222,15 +291,21 @@ async def dashboard_dfg_projects(
|
|||||||
response_model=DfgProjectStatusStatistics,
|
response_model=DfgProjectStatusStatistics,
|
||||||
)
|
)
|
||||||
async def dashboard_dfg_project_statuses(
|
async def dashboard_dfg_project_statuses(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DfgProjectStatusStatistics:
|
) -> DfgProjectStatusStatistics:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
return await get_dashboard_dfg_project_statuses(
|
return await get_dashboard_dfg_project_statuses(
|
||||||
organization.openalex_institution_id,
|
selected_institution_id,
|
||||||
organization.name,
|
selected_institution_name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
)
|
)
|
||||||
@@ -242,15 +317,73 @@ async def dashboard_dfg_project_statuses(
|
|||||||
response_model=DfgProjectTopics,
|
response_model=DfgProjectTopics,
|
||||||
)
|
)
|
||||||
async def dashboard_dfg_project_topics(
|
async def dashboard_dfg_project_topics(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> DfgProjectTopics:
|
) -> DfgProjectTopics:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
return await get_dashboard_dfg_topics(
|
return await get_dashboard_dfg_topics(
|
||||||
organization.openalex_institution_id,
|
selected_institution_id,
|
||||||
organization.name,
|
selected_institution_name,
|
||||||
|
from_year=from_year,
|
||||||
|
to_year=to_year,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/projects/eu/topics",
|
||||||
|
operation_id="getDashboardEuProjectTopics",
|
||||||
|
response_model=EuProjectTopics,
|
||||||
|
)
|
||||||
|
async def dashboard_eu_project_topics(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> EuProjectTopics:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return await get_dashboard_eu_topics(
|
||||||
|
selected_institution_id,
|
||||||
|
selected_institution_name,
|
||||||
|
from_year=from_year,
|
||||||
|
to_year=to_year,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/projects/bund/topics",
|
||||||
|
operation_id="getDashboardBundProjectTopics",
|
||||||
|
response_model=BundProjectTopics,
|
||||||
|
)
|
||||||
|
async def dashboard_bund_project_topics(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> BundProjectTopics:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return await get_dashboard_bund_topics(
|
||||||
|
selected_institution_id,
|
||||||
|
selected_institution_name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
)
|
)
|
||||||
@@ -266,27 +399,144 @@ async def dashboard_top_authors(
|
|||||||
default="all_time",
|
default="all_time",
|
||||||
pattern="^(all_time|last_5_years)$",
|
pattern="^(all_time|last_5_years)$",
|
||||||
),
|
),
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
session: Session = Depends(get_session),
|
session: Session = Depends(get_session),
|
||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> TopAuthorStatistics:
|
) -> TopAuthorStatistics:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
return await get_top_authors(
|
return await get_top_authors(
|
||||||
organization.openalex_institution_id,
|
selected_institution_id,
|
||||||
organization.name,
|
selected_institution_name,
|
||||||
works_period=works_period,
|
works_period=works_period,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/top-authors/works",
|
||||||
|
operation_id="getDashboardTopWorkAuthors",
|
||||||
|
response_model=TopAuthorAnalysis,
|
||||||
|
)
|
||||||
|
async def dashboard_top_work_authors(
|
||||||
|
works_period: Literal["all_time", "last_5_years"] = Query(
|
||||||
|
default="all_time", pattern="^(all_time|last_5_years)$"
|
||||||
|
),
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> TopAuthorAnalysis:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, _ = await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
return await get_top_work_authors(
|
||||||
|
selected_institution_id, works_period, from_year, to_year
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/top-authors/projects",
|
||||||
|
operation_id="getDashboardTopProjectAuthors",
|
||||||
|
response_model=TopAuthorAnalysis,
|
||||||
|
)
|
||||||
|
async def dashboard_top_project_authors(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> TopAuthorAnalysis:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return await get_top_project_authors(
|
||||||
|
selected_institution_id, selected_institution_name, from_year, to_year
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/top-authors/eu-projects",
|
||||||
|
operation_id="getDashboardTopEuProjectAuthors",
|
||||||
|
response_model=TopAuthorAnalysis,
|
||||||
|
)
|
||||||
|
async def dashboard_top_eu_project_authors(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> TopAuthorAnalysis:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, _ = await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
return await get_top_eu_project_authors(
|
||||||
|
selected_institution_id, from_year, to_year
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/top-authors/patents",
|
||||||
|
operation_id="getDashboardTopPatentAuthors",
|
||||||
|
response_model=TopAuthorAnalysis,
|
||||||
|
)
|
||||||
|
async def dashboard_top_patent_authors(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> TopAuthorAnalysis:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, _ = await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
return await get_top_patent_authors(
|
||||||
|
selected_institution_id, from_year, to_year
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/top-authors/news",
|
||||||
|
operation_id="getDashboardTopNewsAuthors",
|
||||||
|
response_model=TopAuthorAnalysis,
|
||||||
|
)
|
||||||
|
async def dashboard_top_news_authors(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
|
session: Session = Depends(get_session),
|
||||||
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> TopAuthorAnalysis:
|
||||||
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, _ = await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
return await get_top_news_authors(
|
||||||
|
selected_institution_id, from_year, to_year
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/topic-heatmap",
|
"/topic-heatmap",
|
||||||
operation_id="getDashboardTopicHeatmap",
|
operation_id="getDashboardTopicHeatmap",
|
||||||
response_model=TopicHeatmap,
|
response_model=TopicHeatmap,
|
||||||
)
|
)
|
||||||
async def dashboard_topic_heatmap(
|
async def dashboard_topic_heatmap(
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
limit: int = Query(default=25, ge=1, le=50),
|
limit: int = Query(default=25, ge=1, le=50),
|
||||||
@@ -294,9 +544,14 @@ async def dashboard_topic_heatmap(
|
|||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> TopicHeatmap:
|
) -> TopicHeatmap:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, selected_institution_name = (
|
||||||
|
await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
return await get_topic_heatmap(
|
return await get_topic_heatmap(
|
||||||
institution_id=organization.openalex_institution_id,
|
institution_id=selected_institution_id,
|
||||||
organization_name=organization.name,
|
organization_name=selected_institution_name,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
@@ -310,6 +565,7 @@ async def dashboard_topic_heatmap(
|
|||||||
)
|
)
|
||||||
async def dashboard_topic_word_cloud(
|
async def dashboard_topic_word_cloud(
|
||||||
topic_id: str = Query(alias="topicId", min_length=1),
|
topic_id: str = Query(alias="topicId", min_length=1),
|
||||||
|
institution_id: str | None = Query(default=None),
|
||||||
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
from_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
to_year: int | None = Query(default=None, ge=1900, le=2100),
|
||||||
limit: int = Query(default=30, ge=1, le=100),
|
limit: int = Query(default=30, ge=1, le=100),
|
||||||
@@ -317,8 +573,11 @@ async def dashboard_topic_word_cloud(
|
|||||||
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
access_token: AccessToken = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
) -> TopicWordCloud:
|
) -> TopicWordCloud:
|
||||||
organization = get_dashboard_organization(session, access_token)
|
organization = get_dashboard_organization(session, access_token)
|
||||||
|
selected_institution_id, _ = await get_dashboard_analytical_institution(
|
||||||
|
session, organization, institution_id
|
||||||
|
)
|
||||||
return await get_topic_word_cloud(
|
return await get_topic_word_cloud(
|
||||||
institution_id=organization.openalex_institution_id,
|
institution_id=selected_institution_id,
|
||||||
topic_id=topic_id,
|
topic_id=topic_id,
|
||||||
from_year=from_year,
|
from_year=from_year,
|
||||||
to_year=to_year,
|
to_year=to_year,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -107,6 +107,30 @@ def create_db_and_tables():
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Preserve the former single institution as the first manually selected
|
||||||
|
# institution.
|
||||||
|
# The legacy column remains synchronized for portal sections that have not yet
|
||||||
|
# been migrated to organization-wide institution lists.
|
||||||
|
with engine.begin() as connection:
|
||||||
|
connection.execute(
|
||||||
|
text(
|
||||||
|
"""
|
||||||
|
INSERT INTO organization_institution (
|
||||||
|
organization_id, openalex_institution_id, position
|
||||||
|
)
|
||||||
|
SELECT id, openalex_institution_id, 0
|
||||||
|
FROM organization
|
||||||
|
WHERE openalex_institution_id IS NOT NULL
|
||||||
|
AND TRIM(openalex_institution_id) != ''
|
||||||
|
AND NOT EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM organization_institution oi
|
||||||
|
WHERE oi.organization_id = organization.id
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_session():
|
def get_session():
|
||||||
"""Yields a database session for use in FastAPI endpoints.
|
"""Yields a database session for use in FastAPI endpoints.
|
||||||
|
|||||||
@@ -29,12 +29,17 @@ async def get_institution_by_id(
|
|||||||
raw_oa_institution_id=institution_id,
|
raw_oa_institution_id=institution_id,
|
||||||
source=[
|
source=[
|
||||||
"id",
|
"id",
|
||||||
|
"ror",
|
||||||
"display_name",
|
"display_name",
|
||||||
|
"country_code",
|
||||||
|
"type",
|
||||||
|
"homepage_url",
|
||||||
"display_name_alternatives",
|
"display_name_alternatives",
|
||||||
"works_count",
|
"works_count",
|
||||||
"cited_by_count",
|
"cited_by_count",
|
||||||
"geo",
|
"geo",
|
||||||
"summary_stats",
|
"summary_stats",
|
||||||
|
"associated_institutions",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ async def call(
|
|||||||
)
|
)
|
||||||
except APIConnectionError:
|
except APIConnectionError:
|
||||||
return "Etwas ist schiefgelaufen. Bitte versuche es später erneut."
|
return "Etwas ist schiefgelaufen. Bitte versuche es später erneut."
|
||||||
|
finally:
|
||||||
|
await client.close()
|
||||||
|
|
||||||
return response.choices[0].message.content or (
|
return response.choices[0].message.content or (
|
||||||
"Etwas ist schiefgelaufen. Bitte versuche es erneut."
|
"Etwas ist schiefgelaufen. Bitte versuche es erneut."
|
||||||
@@ -126,5 +128,7 @@ async def call_stream(
|
|||||||
print(f"LLM streaming failed: {type(e).__name__}: {e}")
|
print(f"LLM streaming failed: {type(e).__name__}: {e}")
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return ""
|
return ""
|
||||||
|
finally:
|
||||||
|
await client.close()
|
||||||
|
|
||||||
return full_content
|
return full_content
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
|
|
||||||
"""
|
|
||||||
This module defines the business logic for our
|
|
||||||
web service.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from inse.integrations import elasticsearch
|
|
||||||
from inse.models.openalex.topic import Topic
|
|
||||||
from inse.models.openalex.topic_domain import TopicDomain
|
|
||||||
from inse.models.openalex.topic_field import TopicField
|
|
||||||
from inse.models.openalex.topic_subfield import TopicSubfield
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
topic_cache_filename: str = "topic_hierarchy_cache.json"
|
|
||||||
|
|
||||||
|
|
||||||
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:
|
|
||||||
logger.warning("Failed to load topic hierarchy cache: %s", exc)
|
|
||||||
return {}
|
|
||||||
|
|
||||||
|
|
||||||
async def build_topic_cache(save_json: bool = True) -> dict:
|
|
||||||
"""
|
|
||||||
Fetch topics from the hosted OpenAlex topics index and build a lookup cache (scheduled task).
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
save_json (bool): Whether to save the cache as a JSON file (default: True)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
taxonomy_cache (dict): The topic hierarchy dictionary.
|
|
||||||
"""
|
|
||||||
output_filename: str = "topic_hierarchy_cache.json"
|
|
||||||
|
|
||||||
taxonomy_cache = {}
|
|
||||||
|
|
||||||
try:
|
|
||||||
async for hit in elasticsearch.scan(
|
|
||||||
index="openalex-topics",
|
|
||||||
query={"match_all": {}},
|
|
||||||
source=["display_name", "name", "id", "subfield", "field", "domain"],
|
|
||||||
cluster="nes",
|
|
||||||
):
|
|
||||||
source = hit.get("_source", {})
|
|
||||||
topic_name = source.get("display_name") or source.get("name")
|
|
||||||
if not topic_name:
|
|
||||||
continue
|
|
||||||
|
|
||||||
taxonomy_cache[topic_name] = {
|
|
||||||
"topic_id": source.get("id") or hit.get("_id", ""),
|
|
||||||
"subfield": source.get("subfield", {}).get("display_name", ""),
|
|
||||||
"field": source.get("field", {}).get("display_name", ""),
|
|
||||||
"domain": source.get("domain", {}).get("display_name", ""),
|
|
||||||
}
|
|
||||||
except Exception as exc:
|
|
||||||
logger.error("Failed to scan topics from Elasticsearch: %s", exc)
|
|
||||||
|
|
||||||
logger.info("Processed %s topics total", len(taxonomy_cache))
|
|
||||||
|
|
||||||
if save_json:
|
|
||||||
data_json = json.dumps(taxonomy_cache, indent=2, ensure_ascii=True)
|
|
||||||
try:
|
|
||||||
output_path = "/data/" + output_filename
|
|
||||||
with open(output_path, "w", encoding="utf-8") as f:
|
|
||||||
f.write(data_json)
|
|
||||||
logger.info("Topic hierarchy cache written to %s", output_path)
|
|
||||||
except Exception as exc:
|
|
||||||
logger.warning("Failed to write topic hierarchy cache: %s", exc)
|
|
||||||
|
|
||||||
return taxonomy_cache
|
|
||||||
|
|
||||||
|
|
||||||
def get_topics_from_cache(topic_names: list[str]) -> list[Topic]:
|
|
||||||
"""
|
|
||||||
Given a list of topic names, retrieves their hierarchy information from the cache and returns a list of Topic models.
|
|
||||||
Arguments:
|
|
||||||
topic_names (List[str]): A list of topic names to retrieve.
|
|
||||||
Returns:
|
|
||||||
List[Topic]: A list of Topic models.
|
|
||||||
"""
|
|
||||||
cache = _load_topic_cache()
|
|
||||||
topics = []
|
|
||||||
for name in topic_names:
|
|
||||||
data = cache.get(name)
|
|
||||||
if not data:
|
|
||||||
continue
|
|
||||||
subfield_name = data.get("subfield", "")
|
|
||||||
field_name = data.get("field", "")
|
|
||||||
domain_name = data.get("domain", "")
|
|
||||||
topics.append(
|
|
||||||
Topic(
|
|
||||||
id=data.get("topic_id", ""),
|
|
||||||
display_name=name,
|
|
||||||
works_count=data.get("count", 1),
|
|
||||||
subfield=TopicSubfield(display_name=subfield_name)
|
|
||||||
if subfield_name
|
|
||||||
else None,
|
|
||||||
field=TopicField(display_name=field_name) if field_name else None,
|
|
||||||
domain=TopicDomain(display_name=domain_name) if domain_name else None,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return topics
|
|
||||||
|
|
||||||
|
|
||||||
def count_topic_hierarchy(topic_names: list[str]) -> dict:
|
|
||||||
"""
|
|
||||||
Given a list of topic names, counts the occurrences of each topic and their hierarchy levels (subfield, field, domain) using the cache.
|
|
||||||
Arguments:
|
|
||||||
topic_names (List[str]): A list of topic names to count.
|
|
||||||
Returns:
|
|
||||||
dict: A dictionary containing the counts of each hierarchy level.
|
|
||||||
"""
|
|
||||||
cache = _load_topic_cache()
|
|
||||||
counts = {"topics": {}, "subfields": {}, "fields": {}, "domains": {}}
|
|
||||||
|
|
||||||
for name in topic_names:
|
|
||||||
data = cache.get(name)
|
|
||||||
if not data:
|
|
||||||
continue
|
|
||||||
|
|
||||||
counts["topics"][name] = counts["topics"].get(name, 0) + 1
|
|
||||||
|
|
||||||
subfield = data.get("subfield", "")
|
|
||||||
if subfield:
|
|
||||||
counts["subfields"][subfield] = counts["subfields"].get(subfield, 0) + 1
|
|
||||||
|
|
||||||
field = data.get("field", "")
|
|
||||||
if field:
|
|
||||||
counts["fields"][field] = counts["fields"].get(field, 0) + 1
|
|
||||||
|
|
||||||
domain = data.get("domain", "")
|
|
||||||
if domain:
|
|
||||||
counts["domains"][domain] = counts["domains"].get(domain, 0) + 1
|
|
||||||
|
|
||||||
return counts
|
|
||||||
|
|
||||||
|
|
||||||
def get_topic_hierarchy() -> dict:
|
|
||||||
"""
|
|
||||||
Builds and returns a hierarchical tree structure of topics:
|
|
||||||
Domains -> Fields -> Subfields -> Topics
|
|
||||||
"""
|
|
||||||
flat_cache = _load_topic_cache()
|
|
||||||
tree = {}
|
|
||||||
|
|
||||||
for topic_name, info in flat_cache.items():
|
|
||||||
domain = info.get("domain") or "Unbekannter Bereich"
|
|
||||||
field = info.get("field") or "Unbekanntes Feld"
|
|
||||||
subfield = info.get("subfield") or "Unbekanntes Teilfeld"
|
|
||||||
topic_id = info.get("topic_id", "")
|
|
||||||
|
|
||||||
# Clean topic ID to just be the trailing ID or keep full URL
|
|
||||||
# For querying, display name is used in persons search, but ID is useful
|
|
||||||
|
|
||||||
if domain not in tree:
|
|
||||||
tree[domain] = {}
|
|
||||||
if field not in tree[domain]:
|
|
||||||
tree[domain][field] = {}
|
|
||||||
if subfield not in tree[domain][field]:
|
|
||||||
tree[domain][field][subfield] = []
|
|
||||||
|
|
||||||
tree[domain][field][subfield].append({"id": topic_id, "name": topic_name})
|
|
||||||
|
|
||||||
formatted_domains = []
|
|
||||||
for d_name, d_fields in tree.items():
|
|
||||||
formatted_fields = []
|
|
||||||
for f_name, f_subfields in d_fields.items():
|
|
||||||
formatted_subfields = []
|
|
||||||
for sf_name, sf_topics in f_subfields.items():
|
|
||||||
sf_topics.sort(key=lambda x: x["name"])
|
|
||||||
formatted_subfields.append({"name": sf_name, "topics": sf_topics})
|
|
||||||
formatted_subfields.sort(key=lambda x: x["name"])
|
|
||||||
formatted_fields.append({"name": f_name, "subfields": formatted_subfields})
|
|
||||||
formatted_fields.sort(key=lambda x: x["name"])
|
|
||||||
formatted_domains.append({"name": d_name, "fields": formatted_fields})
|
|
||||||
formatted_domains.sort(key=lambda x: x["name"])
|
|
||||||
|
|
||||||
return {"domains": formatted_domains}
|
|
||||||
@@ -64,7 +64,6 @@ from inse.works.service import router as works_service_router
|
|||||||
from inse.works.v2.router import router as works_v2_router
|
from inse.works.v2.router import router as works_v2_router
|
||||||
|
|
||||||
from . import config
|
from . import config
|
||||||
from .service import router as service_router
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -119,8 +118,6 @@ app.include_router(patents_all_router)
|
|||||||
app.include_router(keywords_service_router)
|
app.include_router(keywords_service_router)
|
||||||
app.include_router(keywords_patents_router)
|
app.include_router(keywords_patents_router)
|
||||||
|
|
||||||
app.include_router(service_router)
|
|
||||||
|
|
||||||
app.include_router(auth_router)
|
app.include_router(auth_router)
|
||||||
app.include_router(account_management_router)
|
app.include_router(account_management_router)
|
||||||
app.include_router(organization_management_router)
|
app.include_router(organization_management_router)
|
||||||
|
|||||||
@@ -108,10 +108,10 @@ class BundProject(BaseModel):
|
|||||||
examples=["Deutschland"],
|
examples=["Deutschland"],
|
||||||
)
|
)
|
||||||
|
|
||||||
implementing_agency: str | None = Field(
|
executing_agency: str | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
validation_alias="Ausführende Stelle",
|
validation_alias="Ausführende Stelle",
|
||||||
description="The implementing agency of the project",
|
description="The executing agency of the project",
|
||||||
examples=[
|
examples=[
|
||||||
"Universität Duisburg-Essen - Fachbereich Allgemeine Informatik - Lehrstuhl Networked Embedded Systems (NES)"
|
"Universität Duisburg-Essen - Fachbereich Allgemeine Informatik - Lehrstuhl Networked Embedded Systems (NES)"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ from pydantic_core import to_jsonable_python
|
|||||||
|
|
||||||
from inse.models.openalex.author_counts_by_year_inner import AuthorCountsByYearInner
|
from inse.models.openalex.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||||
from inse.models.openalex.author_summary_stats import AuthorSummaryStats
|
from inse.models.openalex.author_summary_stats import AuthorSummaryStats
|
||||||
|
from inse.models.openalex.dehydrated_institution import DehydratedInstitution
|
||||||
from inse.models.openalex.institution_geo import InstitutionGeo
|
from inse.models.openalex.institution_geo import InstitutionGeo
|
||||||
from inse.models.openalex.institution_ids import InstitutionIds
|
from inse.models.openalex.institution_ids import InstitutionIds
|
||||||
|
|
||||||
@@ -51,9 +52,10 @@ class Institution(BaseModel):
|
|||||||
ids: InstitutionIds | None = None
|
ids: InstitutionIds | None = None
|
||||||
counts_by_year: list[AuthorCountsByYearInner] | None = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
counts_by_year: list[AuthorCountsByYearInner] | None = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||||
works_api_url: StrictStr | None = Field(default=None, description="A URL that will get you a list of all works affiliated with this institution.")
|
works_api_url: StrictStr | None = Field(default=None, description="A URL that will get you a list of all works affiliated with this institution.")
|
||||||
|
associated_institutions: list[DehydratedInstitution] | None = Field(default=None, description="Associated institutions list.")
|
||||||
created_date: date | None = Field(default=None, description="When this institution was added to OpenAlex (ISO 8601 date).")
|
created_date: date | None = Field(default=None, description="When this institution was added to OpenAlex (ISO 8601 date).")
|
||||||
updated_date: datetime | None = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).")
|
updated_date: datetime | None = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).")
|
||||||
__properties: ClassVar[list[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"]
|
__properties: ClassVar[list[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "associated_institutions", "created_date", "updated_date"]
|
||||||
|
|
||||||
@field_validator('type')
|
@field_validator('type')
|
||||||
def type_validate_enum(cls, value):
|
def type_validate_enum(cls, value):
|
||||||
@@ -151,6 +153,7 @@ class Institution(BaseModel):
|
|||||||
"ids": InstitutionIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
"ids": InstitutionIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||||
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||||
"works_api_url": obj.get("works_api_url"),
|
"works_api_url": obj.get("works_api_url"),
|
||||||
|
"associated_institutions": [DehydratedInstitution.from_dict(_item) for _item in obj["associated_institutions"]] if obj.get("associated_institutions") is not None else None,
|
||||||
"created_date": obj.get("created_date"),
|
"created_date": obj.get("created_date"),
|
||||||
"updated_date": obj.get("updated_date")
|
"updated_date": obj.get("updated_date")
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -874,3 +874,4 @@ async def _related_search_terms(query_text: str) -> list:
|
|||||||
terms.append(term)
|
terms.append(term)
|
||||||
|
|
||||||
return terms
|
return terms
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import uuid
|
import uuid
|
||||||
|
from typing import Literal
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
@@ -7,6 +8,7 @@ class OrganizationProfile(BaseModel):
|
|||||||
id: uuid.UUID
|
id: uuid.UUID
|
||||||
name: str
|
name: str
|
||||||
other_inst_id: str | None = None
|
other_inst_id: str | None = None
|
||||||
|
selected_openalex_institution_ids: list[str] = Field(default_factory=list)
|
||||||
deleted: bool
|
deleted: bool
|
||||||
member_count: int
|
member_count: int
|
||||||
|
|
||||||
@@ -21,9 +23,25 @@ class OrganizationPage(BaseModel):
|
|||||||
class CreateOrganizationRequest(BaseModel):
|
class CreateOrganizationRequest(BaseModel):
|
||||||
name: str = Field(min_length=1)
|
name: str = Field(min_length=1)
|
||||||
other_inst_id: str | None = None
|
other_inst_id: str | None = None
|
||||||
|
selected_openalex_institution_ids: list[str] | None = None
|
||||||
|
|
||||||
|
|
||||||
class UpdateOrganizationRequest(BaseModel):
|
class UpdateOrganizationRequest(BaseModel):
|
||||||
name: str | None = Field(default=None, min_length=1)
|
name: str | None = Field(default=None, min_length=1)
|
||||||
other_inst_id: str | None = None
|
other_inst_id: str | None = None
|
||||||
|
selected_openalex_institution_ids: list[str] | None = None
|
||||||
deleted: bool | None = None
|
deleted: bool | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class InstitutionAssociation(BaseModel):
|
||||||
|
id: str
|
||||||
|
display_name: str
|
||||||
|
relationship: Literal["child", "related"]
|
||||||
|
|
||||||
|
|
||||||
|
class InstitutionAssociationsResponse(BaseModel):
|
||||||
|
id: str
|
||||||
|
display_name: str
|
||||||
|
associated_institutions: list[InstitutionAssociation] = Field(
|
||||||
|
default_factory=list
|
||||||
|
)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from inse.tags import Tags
|
|||||||
from . import service
|
from . import service
|
||||||
from .model import (
|
from .model import (
|
||||||
CreateOrganizationRequest,
|
CreateOrganizationRequest,
|
||||||
|
InstitutionAssociationsResponse,
|
||||||
OrganizationPage,
|
OrganizationPage,
|
||||||
OrganizationProfile,
|
OrganizationProfile,
|
||||||
UpdateOrganizationRequest,
|
UpdateOrganizationRequest,
|
||||||
@@ -19,6 +20,18 @@ from .model import (
|
|||||||
router = APIRouter(prefix="/api/organizations", tags=[Tags.ORGANIZATION])
|
router = APIRouter(prefix="/api/organizations", tags=[Tags.ORGANIZATION])
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/institutions/associations",
|
||||||
|
operation_id="getOrganizationInstitutionAssociations",
|
||||||
|
response_model=list[InstitutionAssociationsResponse],
|
||||||
|
)
|
||||||
|
async def get_organization_institution_associations(
|
||||||
|
institution_ids: list[str] = Query(),
|
||||||
|
access_token: AccessTokenMetadata = auth_service.CurrentUserAccessTokenPayloadDep,
|
||||||
|
) -> list[InstitutionAssociationsResponse]:
|
||||||
|
return await service.get_institution_associations(access_token, institution_ids)
|
||||||
|
|
||||||
|
|
||||||
@router.get("", operation_id="getOrganisations", response_model=OrganizationPage)
|
@router.get("", operation_id="getOrganisations", response_model=OrganizationPage)
|
||||||
async def get_organizations(
|
async def get_organizations(
|
||||||
page: int = Query(default=0, ge=0),
|
page: int = Query(default=0, ge=0),
|
||||||
|
|||||||
@@ -1,18 +1,43 @@
|
|||||||
|
import logging
|
||||||
|
import re
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from fastapi import HTTPException, status
|
from fastapi import HTTPException, status
|
||||||
from sqlmodel import Session, func, select
|
from sqlmodel import Session, func, select
|
||||||
|
|
||||||
from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole
|
from inse.auth.model import (
|
||||||
|
AccessTokenMetadata,
|
||||||
|
Account,
|
||||||
|
Organization,
|
||||||
|
OrganizationInstitution,
|
||||||
|
UserRole,
|
||||||
|
)
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.model import ESIndex
|
||||||
|
|
||||||
from .model import (
|
from .model import (
|
||||||
CreateOrganizationRequest,
|
CreateOrganizationRequest,
|
||||||
|
InstitutionAssociation,
|
||||||
|
InstitutionAssociationsResponse,
|
||||||
OrganizationPage,
|
OrganizationPage,
|
||||||
OrganizationProfile,
|
OrganizationProfile,
|
||||||
UpdateOrganizationRequest,
|
UpdateOrganizationRequest,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
OPENALEX_INSTITUTION_ID_PATTERN = re.compile(
|
||||||
|
r"^(?:https?://openalex\.org/)?(I\d+)/?$", re.IGNORECASE
|
||||||
|
)
|
||||||
|
KNOWN_ASSOCIATION_TYPES = {
|
||||||
|
"parent",
|
||||||
|
"child",
|
||||||
|
"related",
|
||||||
|
"predecessor",
|
||||||
|
"successor",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _require_super_admin(access_token: AccessTokenMetadata) -> None:
|
def _require_super_admin(access_token: AccessTokenMetadata) -> None:
|
||||||
if access_token.effective_role != UserRole.SUPER_ADMIN:
|
if access_token.effective_role != UserRole.SUPER_ADMIN:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
@@ -31,6 +56,27 @@ def _normalize_name(name: str) -> str:
|
|||||||
return normalized_name
|
return normalized_name
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_institution_id(institution_id: str) -> str:
|
||||||
|
match = OPENALEX_INSTITUTION_ID_PATTERN.fullmatch(institution_id.strip())
|
||||||
|
if match is None:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||||
|
detail=f"Invalid OpenAlex institution ID: {institution_id}",
|
||||||
|
)
|
||||||
|
return f"I{match.group(1)[1:]}"
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_institution_ids(institution_ids: list[str]) -> list[str]:
|
||||||
|
normalized: list[str] = []
|
||||||
|
seen: set[str] = set()
|
||||||
|
for institution_id in institution_ids:
|
||||||
|
clean_id = _normalize_institution_id(institution_id)
|
||||||
|
if clean_id not in seen:
|
||||||
|
normalized.append(clean_id)
|
||||||
|
seen.add(clean_id)
|
||||||
|
return normalized
|
||||||
|
|
||||||
|
|
||||||
def _ensure_name_available(
|
def _ensure_name_available(
|
||||||
session: Session,
|
session: Session,
|
||||||
name: str,
|
name: str,
|
||||||
@@ -79,18 +125,76 @@ def _member_counts(
|
|||||||
return {organization_id: count for organization_id, count in rows}
|
return {organization_id: count for organization_id, count in rows}
|
||||||
|
|
||||||
|
|
||||||
|
def _institution_data(
|
||||||
|
session: Session, organization_ids: list[uuid.UUID]
|
||||||
|
) -> dict[uuid.UUID, list[str]]:
|
||||||
|
ids_by_organization: dict[uuid.UUID, list[str]] = {
|
||||||
|
organization_id: [] for organization_id in organization_ids
|
||||||
|
}
|
||||||
|
if not organization_ids:
|
||||||
|
return ids_by_organization
|
||||||
|
|
||||||
|
institution_rows = session.exec(
|
||||||
|
select(OrganizationInstitution)
|
||||||
|
.where(OrganizationInstitution.organization_id.in_(organization_ids))
|
||||||
|
.order_by(
|
||||||
|
OrganizationInstitution.organization_id,
|
||||||
|
OrganizationInstitution.position,
|
||||||
|
)
|
||||||
|
).all()
|
||||||
|
for row in institution_rows:
|
||||||
|
ids_by_organization[row.organization_id].append(
|
||||||
|
row.openalex_institution_id
|
||||||
|
)
|
||||||
|
|
||||||
|
return ids_by_organization
|
||||||
|
|
||||||
|
|
||||||
def _to_profile(
|
def _to_profile(
|
||||||
organization: Organization, member_count: int
|
organization: Organization,
|
||||||
|
member_count: int,
|
||||||
|
institution_ids: list[str],
|
||||||
) -> OrganizationProfile:
|
) -> OrganizationProfile:
|
||||||
|
if not institution_ids and organization.openalex_institution_id:
|
||||||
|
legacy_id = _normalize_institution_id(organization.openalex_institution_id)
|
||||||
|
institution_ids = [legacy_id]
|
||||||
return OrganizationProfile(
|
return OrganizationProfile(
|
||||||
id=organization.id,
|
id=organization.id,
|
||||||
name=organization.name,
|
name=organization.name,
|
||||||
other_inst_id=organization.openalex_institution_id,
|
other_inst_id=institution_ids[0] if institution_ids else None,
|
||||||
|
selected_openalex_institution_ids=institution_ids,
|
||||||
deleted=organization.deleted,
|
deleted=organization.deleted,
|
||||||
member_count=member_count,
|
member_count=member_count,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _replace_organization_institutions(
|
||||||
|
session: Session,
|
||||||
|
organization: Organization,
|
||||||
|
institution_ids: list[str],
|
||||||
|
) -> None:
|
||||||
|
normalized_ids = _normalize_institution_ids(institution_ids)
|
||||||
|
for row in session.exec(
|
||||||
|
select(OrganizationInstitution).where(
|
||||||
|
OrganizationInstitution.organization_id == organization.id
|
||||||
|
)
|
||||||
|
).all():
|
||||||
|
session.delete(row)
|
||||||
|
session.flush()
|
||||||
|
|
||||||
|
for position, institution_id in enumerate(normalized_ids):
|
||||||
|
session.add(
|
||||||
|
OrganizationInstitution(
|
||||||
|
organization_id=organization.id,
|
||||||
|
openalex_institution_id=institution_id,
|
||||||
|
position=position,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
organization.openalex_institution_id = (
|
||||||
|
normalized_ids[0] if normalized_ids else None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _deactivate_organization_accounts(
|
def _deactivate_organization_accounts(
|
||||||
session: Session, organization_id: uuid.UUID
|
session: Session, organization_id: uuid.UUID
|
||||||
) -> None:
|
) -> None:
|
||||||
@@ -106,6 +210,27 @@ def _deactivate_organization_accounts(
|
|||||||
session.add(account)
|
session.add(account)
|
||||||
|
|
||||||
|
|
||||||
|
def _ensure_not_current_organization(
|
||||||
|
session: Session,
|
||||||
|
access_token: AccessTokenMetadata,
|
||||||
|
organization_id: uuid.UUID,
|
||||||
|
) -> None:
|
||||||
|
protected_organization_ids = {access_token.effective_organization_id}
|
||||||
|
if access_token.real_account_id is not None:
|
||||||
|
real_account = session.get(Account, access_token.real_account_id)
|
||||||
|
if real_account is not None:
|
||||||
|
protected_organization_ids.add(real_account.organization_id)
|
||||||
|
|
||||||
|
if organization_id in protected_organization_ids:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_409_CONFLICT,
|
||||||
|
detail=(
|
||||||
|
"The organization of the real or effective account "
|
||||||
|
"cannot be deleted."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_organizations(
|
def get_organizations(
|
||||||
session: Session,
|
session: Session,
|
||||||
access_token: AccessTokenMetadata,
|
access_token: AccessTokenMetadata,
|
||||||
@@ -130,10 +255,15 @@ def get_organizations(
|
|||||||
).all()
|
).all()
|
||||||
organization_ids = [organization.id for organization in organizations]
|
organization_ids = [organization.id for organization in organizations]
|
||||||
counts = _member_counts(session, organization_ids)
|
counts = _member_counts(session, organization_ids)
|
||||||
|
institution_ids = _institution_data(session, organization_ids)
|
||||||
|
|
||||||
return OrganizationPage(
|
return OrganizationPage(
|
||||||
items=[
|
items=[
|
||||||
_to_profile(organization, counts.get(organization.id, 0))
|
_to_profile(
|
||||||
|
organization,
|
||||||
|
counts.get(organization.id, 0),
|
||||||
|
institution_ids.get(organization.id, []),
|
||||||
|
)
|
||||||
for organization in organizations
|
for organization in organizations
|
||||||
],
|
],
|
||||||
total=total,
|
total=total,
|
||||||
@@ -153,12 +283,25 @@ def create_organization(
|
|||||||
|
|
||||||
organization = Organization(
|
organization = Organization(
|
||||||
name=name,
|
name=name,
|
||||||
openalex_institution_id=(payload.other_inst_id or '').strip() or None,
|
|
||||||
)
|
)
|
||||||
session.add(organization)
|
session.add(organization)
|
||||||
|
session.flush()
|
||||||
|
requested_ids = payload.selected_openalex_institution_ids
|
||||||
|
if requested_ids is None:
|
||||||
|
requested_ids = [payload.other_inst_id] if payload.other_inst_id else []
|
||||||
|
_replace_organization_institutions(
|
||||||
|
session,
|
||||||
|
organization,
|
||||||
|
requested_ids,
|
||||||
|
)
|
||||||
session.commit()
|
session.commit()
|
||||||
session.refresh(organization)
|
session.refresh(organization)
|
||||||
return _to_profile(organization, 0)
|
institution_ids = _institution_data(session, [organization.id])
|
||||||
|
return _to_profile(
|
||||||
|
organization,
|
||||||
|
0,
|
||||||
|
institution_ids[organization.id],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def update_organization(
|
def update_organization(
|
||||||
@@ -174,10 +317,21 @@ def update_organization(
|
|||||||
name = _normalize_name(payload.name)
|
name = _normalize_name(payload.name)
|
||||||
_ensure_name_available(session, name, organization.id)
|
_ensure_name_available(session, name, organization.id)
|
||||||
organization.name = name
|
organization.name = name
|
||||||
if payload.other_inst_id is not None:
|
if payload.selected_openalex_institution_ids is not None:
|
||||||
organization.openalex_institution_id = payload.other_inst_id.strip() or None
|
_replace_organization_institutions(
|
||||||
|
session,
|
||||||
|
organization,
|
||||||
|
payload.selected_openalex_institution_ids,
|
||||||
|
)
|
||||||
|
elif payload.other_inst_id is not None:
|
||||||
|
_replace_organization_institutions(
|
||||||
|
session,
|
||||||
|
organization,
|
||||||
|
[payload.other_inst_id] if payload.other_inst_id.strip() else [],
|
||||||
|
)
|
||||||
if payload.deleted is not None:
|
if payload.deleted is not None:
|
||||||
if payload.deleted and not organization.deleted:
|
if payload.deleted and not organization.deleted:
|
||||||
|
_ensure_not_current_organization(session, access_token, organization.id)
|
||||||
_deactivate_organization_accounts(session, organization.id)
|
_deactivate_organization_accounts(session, organization.id)
|
||||||
organization.deleted = payload.deleted
|
organization.deleted = payload.deleted
|
||||||
|
|
||||||
@@ -185,7 +339,113 @@ def update_organization(
|
|||||||
session.commit()
|
session.commit()
|
||||||
session.refresh(organization)
|
session.refresh(organization)
|
||||||
counts = _member_counts(session, [organization.id])
|
counts = _member_counts(session, [organization.id])
|
||||||
return _to_profile(organization, counts.get(organization.id, 0))
|
institution_ids = _institution_data(session, [organization.id])
|
||||||
|
return _to_profile(
|
||||||
|
organization,
|
||||||
|
counts.get(organization.id, 0),
|
||||||
|
institution_ids[organization.id],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_institution_associations(
|
||||||
|
access_token: AccessTokenMetadata,
|
||||||
|
institution_ids: list[str],
|
||||||
|
) -> list[InstitutionAssociationsResponse]:
|
||||||
|
_require_super_admin(access_token)
|
||||||
|
return await resolve_institution_associations(institution_ids)
|
||||||
|
|
||||||
|
|
||||||
|
async def resolve_institution_associations(
|
||||||
|
institution_ids: list[str],
|
||||||
|
) -> list[InstitutionAssociationsResponse]:
|
||||||
|
clean_ids = _normalize_institution_ids(institution_ids)
|
||||||
|
if not clean_ids:
|
||||||
|
return []
|
||||||
|
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=ESIndex.OPENALEX_INSTITUTIONS,
|
||||||
|
query={
|
||||||
|
"terms": {
|
||||||
|
"id": [
|
||||||
|
f"https://openalex.org/{institution_id}"
|
||||||
|
for institution_id in clean_ids
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
source=["id", "display_name", "associated_institutions"],
|
||||||
|
size=len(clean_ids),
|
||||||
|
)
|
||||||
|
sources_by_id: dict[str, dict] = {}
|
||||||
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
|
source = hit.get("_source") or {}
|
||||||
|
raw_id = source.get("id")
|
||||||
|
if isinstance(raw_id, str):
|
||||||
|
sources_by_id[_normalize_institution_id(raw_id)] = source
|
||||||
|
|
||||||
|
missing_id = next(
|
||||||
|
(
|
||||||
|
institution_id
|
||||||
|
for institution_id in clean_ids
|
||||||
|
if institution_id not in sources_by_id
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
if missing_id is not None:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_404_NOT_FOUND,
|
||||||
|
detail=f"OpenAlex institution {missing_id} not found.",
|
||||||
|
)
|
||||||
|
|
||||||
|
results: list[InstitutionAssociationsResponse] = []
|
||||||
|
for clean_id in clean_ids:
|
||||||
|
source = sources_by_id[clean_id]
|
||||||
|
display_name = source.get("display_name")
|
||||||
|
if not isinstance(display_name, str) or not display_name.strip():
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_502_BAD_GATEWAY,
|
||||||
|
detail=f"OpenAlex institution {clean_id} has no display name.",
|
||||||
|
)
|
||||||
|
|
||||||
|
associations_by_id: dict[str, InstitutionAssociation] = {}
|
||||||
|
for association in source.get("associated_institutions") or []:
|
||||||
|
if not isinstance(association, dict):
|
||||||
|
continue
|
||||||
|
relationship = str(association.get("relationship") or "").lower()
|
||||||
|
if relationship not in KNOWN_ASSOCIATION_TYPES:
|
||||||
|
logger.warning(
|
||||||
|
"Ignoring unknown OpenAlex institution relationship %r for %s",
|
||||||
|
relationship,
|
||||||
|
clean_id,
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
if relationship not in {"child", "related"}:
|
||||||
|
continue
|
||||||
|
raw_association_id = association.get("id")
|
||||||
|
association_name = association.get("display_name")
|
||||||
|
if not isinstance(raw_association_id, str) or not isinstance(
|
||||||
|
association_name, str
|
||||||
|
):
|
||||||
|
continue
|
||||||
|
associated_id = _normalize_institution_id(raw_association_id)
|
||||||
|
candidate = InstitutionAssociation(
|
||||||
|
id=associated_id,
|
||||||
|
display_name=association_name,
|
||||||
|
relationship=relationship,
|
||||||
|
)
|
||||||
|
existing = associations_by_id.get(associated_id)
|
||||||
|
if existing is None or (
|
||||||
|
existing.relationship == "related" and relationship == "child"
|
||||||
|
):
|
||||||
|
associations_by_id[associated_id] = candidate
|
||||||
|
|
||||||
|
results.append(
|
||||||
|
InstitutionAssociationsResponse(
|
||||||
|
id=clean_id,
|
||||||
|
display_name=display_name,
|
||||||
|
associated_institutions=list(associations_by_id.values()),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
def delete_organization(
|
def delete_organization(
|
||||||
@@ -196,6 +456,7 @@ def delete_organization(
|
|||||||
_require_super_admin(access_token)
|
_require_super_admin(access_token)
|
||||||
organization = _get_organization_or_404(session, organization_id)
|
organization = _get_organization_or_404(session, organization_id)
|
||||||
if not organization.deleted:
|
if not organization.deleted:
|
||||||
|
_ensure_not_current_organization(session, access_token, organization.id)
|
||||||
_deactivate_organization_accounts(session, organization.id)
|
_deactivate_organization_accounts(session, organization.id)
|
||||||
organization.deleted = True
|
organization.deleted = True
|
||||||
session.add(organization)
|
session.add(organization)
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
|
import asyncio
|
||||||
from types import SimpleNamespace
|
from types import SimpleNamespace
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
from sqlmodel import Session, SQLModel, create_engine
|
from sqlmodel import Session, SQLModel, create_engine, select
|
||||||
|
|
||||||
from inse.auth.model import Account, Organization, UserRole
|
from inse.auth.model import (
|
||||||
|
Account,
|
||||||
|
Organization,
|
||||||
|
OrganizationInstitution,
|
||||||
|
UserRole,
|
||||||
|
)
|
||||||
from inse.organization_management import service
|
from inse.organization_management import service
|
||||||
from inse.organization_management.model import (
|
from inse.organization_management.model import (
|
||||||
CreateOrganizationRequest,
|
CreateOrganizationRequest,
|
||||||
@@ -22,10 +28,11 @@ def session():
|
|||||||
yield database_session
|
yield database_session
|
||||||
|
|
||||||
|
|
||||||
def token(role: UserRole, organization_id):
|
def token(role: UserRole, organization_id, real_account_id=None):
|
||||||
return SimpleNamespace(
|
return SimpleNamespace(
|
||||||
effective_role=role,
|
effective_role=role,
|
||||||
effective_organization_id=organization_id,
|
effective_organization_id=organization_id,
|
||||||
|
real_account_id=real_account_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -105,8 +112,115 @@ def test_superadmin_can_create_update_and_soft_delete(session):
|
|||||||
assert session.get(Organization, created.id).deleted is True
|
assert session.get(Organization, created.id).deleted is True
|
||||||
|
|
||||||
|
|
||||||
|
def test_organization_stores_ordered_selected_institution_ids(session):
|
||||||
|
scope = Organization(name="Scope")
|
||||||
|
session.add(scope)
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
created = service.create_organization(
|
||||||
|
session,
|
||||||
|
token(UserRole.SUPER_ADMIN, scope.id),
|
||||||
|
CreateOrganizationRequest(
|
||||||
|
name="Institution list",
|
||||||
|
selected_openalex_institution_ids=[
|
||||||
|
"https://openalex.org/I123",
|
||||||
|
"I456",
|
||||||
|
"I123",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
assert created.selected_openalex_institution_ids == ["I123", "I456"]
|
||||||
|
assert created.other_inst_id == "I123"
|
||||||
|
assert session.get(Organization, created.id).openalex_institution_id == "I123"
|
||||||
|
rows = session.exec(
|
||||||
|
select(OrganizationInstitution)
|
||||||
|
.where(OrganizationInstitution.organization_id == created.id)
|
||||||
|
.order_by(OrganizationInstitution.position)
|
||||||
|
).all()
|
||||||
|
assert [row.openalex_institution_id for row in rows] == ["I123", "I456"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_empty_institution_list_clears_legacy_primary_institution(session):
|
||||||
|
organization = Organization(name="Organization", openalex_institution_id="I123")
|
||||||
|
session.add(organization)
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
updated = service.update_organization(
|
||||||
|
session,
|
||||||
|
token(UserRole.SUPER_ADMIN, organization.id),
|
||||||
|
organization.id,
|
||||||
|
UpdateOrganizationRequest(selected_openalex_institution_ids=[]),
|
||||||
|
)
|
||||||
|
|
||||||
|
assert updated.selected_openalex_institution_ids == []
|
||||||
|
assert updated.other_inst_id is None
|
||||||
|
assert session.get(Organization, organization.id).openalex_institution_id is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_association_expansion_adds_only_child_and_related_with_child_priority(
|
||||||
|
monkeypatch,
|
||||||
|
):
|
||||||
|
async def fake_search(**kwargs):
|
||||||
|
return {
|
||||||
|
"hits": {
|
||||||
|
"hits": [
|
||||||
|
{
|
||||||
|
"_source": {
|
||||||
|
"id": "https://openalex.org/I100",
|
||||||
|
"display_name": "Selected institution",
|
||||||
|
"associated_institutions": [
|
||||||
|
{
|
||||||
|
"id": "https://openalex.org/I200",
|
||||||
|
"display_name": "Duplicate",
|
||||||
|
"relationship": "related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "https://openalex.org/I200",
|
||||||
|
"display_name": "Duplicate",
|
||||||
|
"relationship": "child",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "https://openalex.org/I300",
|
||||||
|
"display_name": "Related",
|
||||||
|
"relationship": "related",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "https://openalex.org/I400",
|
||||||
|
"display_name": "Parent",
|
||||||
|
"relationship": "parent",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "https://openalex.org/I500",
|
||||||
|
"display_name": "Successor",
|
||||||
|
"relationship": "successor",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
monkeypatch.setattr(service.elasticsearch, "search", fake_search)
|
||||||
|
|
||||||
|
result = asyncio.run(
|
||||||
|
service.get_institution_associations(
|
||||||
|
token(UserRole.SUPER_ADMIN, None), ["https://openalex.org/I100"]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result[0].id == "I100"
|
||||||
|
assert [
|
||||||
|
(association.id, association.relationship)
|
||||||
|
for association in result[0].associated_institutions
|
||||||
|
] == [("I200", "child"), ("I300", "related")]
|
||||||
|
|
||||||
|
|
||||||
def test_deleting_organization_deactivates_all_its_accounts(session):
|
def test_deleting_organization_deactivates_all_its_accounts(session):
|
||||||
|
admin_scope = Organization(name="Admin scope for delete")
|
||||||
organization = Organization(name="Organization to delete")
|
organization = Organization(name="Organization to delete")
|
||||||
|
session.add(admin_scope)
|
||||||
session.add(organization)
|
session.add(organization)
|
||||||
session.flush()
|
session.flush()
|
||||||
active_account = Account(
|
active_account = Account(
|
||||||
@@ -129,7 +243,7 @@ def test_deleting_organization_deactivates_all_its_accounts(session):
|
|||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
service.delete_organization(
|
service.delete_organization(
|
||||||
session, token(UserRole.SUPER_ADMIN, organization.id), organization.id
|
session, token(UserRole.SUPER_ADMIN, admin_scope.id), organization.id
|
||||||
)
|
)
|
||||||
|
|
||||||
session.refresh(active_account)
|
session.refresh(active_account)
|
||||||
@@ -141,7 +255,9 @@ def test_deleting_organization_deactivates_all_its_accounts(session):
|
|||||||
|
|
||||||
|
|
||||||
def test_marking_organization_deleted_deactivates_its_accounts(session):
|
def test_marking_organization_deleted_deactivates_its_accounts(session):
|
||||||
|
admin_scope = Organization(name="Admin scope for update")
|
||||||
organization = Organization(name="Organization to update")
|
organization = Organization(name="Organization to update")
|
||||||
|
session.add(admin_scope)
|
||||||
session.add(organization)
|
session.add(organization)
|
||||||
session.flush()
|
session.flush()
|
||||||
account = Account(
|
account = Account(
|
||||||
@@ -155,7 +271,7 @@ def test_marking_organization_deleted_deactivates_its_accounts(session):
|
|||||||
|
|
||||||
service.update_organization(
|
service.update_organization(
|
||||||
session,
|
session,
|
||||||
token(UserRole.SUPER_ADMIN, organization.id),
|
token(UserRole.SUPER_ADMIN, admin_scope.id),
|
||||||
organization.id,
|
organization.id,
|
||||||
UpdateOrganizationRequest(deleted=True),
|
UpdateOrganizationRequest(deleted=True),
|
||||||
)
|
)
|
||||||
@@ -165,6 +281,61 @@ def test_marking_organization_deleted_deactivates_its_accounts(session):
|
|||||||
assert account.epoch == 1
|
assert account.epoch == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("delete_via_update", [False, True])
|
||||||
|
def test_current_organization_cannot_be_deleted(session, delete_via_update):
|
||||||
|
organization = Organization(name="Current organization")
|
||||||
|
session.add(organization)
|
||||||
|
session.commit()
|
||||||
|
access_token = token(UserRole.SUPER_ADMIN, organization.id)
|
||||||
|
|
||||||
|
with pytest.raises(HTTPException) as error:
|
||||||
|
if delete_via_update:
|
||||||
|
service.update_organization(
|
||||||
|
session,
|
||||||
|
access_token,
|
||||||
|
organization.id,
|
||||||
|
UpdateOrganizationRequest(deleted=True),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
service.delete_organization(session, access_token, organization.id)
|
||||||
|
|
||||||
|
assert error.value.status_code == 409
|
||||||
|
assert session.get(Organization, organization.id).deleted is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_real_account_organization_cannot_be_deleted_while_impersonating(session):
|
||||||
|
real_organization = Organization(name="Real organization")
|
||||||
|
effective_organization = Organization(name="Effective organization")
|
||||||
|
session.add(real_organization)
|
||||||
|
session.add(effective_organization)
|
||||||
|
session.flush()
|
||||||
|
real_account = Account(
|
||||||
|
email="real-superadmin@example.org",
|
||||||
|
name="Real superadmin",
|
||||||
|
password_hash="hash",
|
||||||
|
organization_id=real_organization.id,
|
||||||
|
roles=[UserRole.SUPER_ADMIN],
|
||||||
|
)
|
||||||
|
session.add(real_account)
|
||||||
|
session.commit()
|
||||||
|
|
||||||
|
access_token = token(
|
||||||
|
UserRole.SUPER_ADMIN,
|
||||||
|
effective_organization.id,
|
||||||
|
real_account.id,
|
||||||
|
)
|
||||||
|
with pytest.raises(HTTPException) as error:
|
||||||
|
service.delete_organization(
|
||||||
|
session,
|
||||||
|
access_token,
|
||||||
|
real_organization.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert error.value.status_code == 409
|
||||||
|
assert session.get(Organization, real_organization.id).deleted is False
|
||||||
|
assert session.get(Account, real_account.id).activated is True
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("role", [UserRole.ADMIN, UserRole.MANAGER, UserRole.USER])
|
@pytest.mark.parametrize("role", [UserRole.ADMIN, UserRole.MANAGER, UserRole.USER])
|
||||||
def test_only_superadmin_can_create_organizations(session, role):
|
def test_only_superadmin_can_create_organizations(session, role):
|
||||||
organization = Organization(name="Scope")
|
organization = Organization(name="Scope")
|
||||||
|
|||||||
@@ -12,19 +12,89 @@ from inse.patents.common import model
|
|||||||
from inse.patents.ipc_lookup import extract_ipc_symbol, parse_ipc_symbol
|
from inse.patents.ipc_lookup import extract_ipc_symbol, parse_ipc_symbol
|
||||||
|
|
||||||
MAPPING_FILENAME = "ipc_openalex_topic_mapping.json"
|
MAPPING_FILENAME = "ipc_openalex_topic_mapping.json"
|
||||||
TOPIC_CACHE_FILENAME = "topic_hierarchy_cache.json"
|
|
||||||
LEVELS = ("section", "class", "subclass", "group", "subgroup")
|
LEVELS = ("section", "class", "subclass", "group", "subgroup")
|
||||||
MATCH_LEVELS = ("subgroup", "group", "subclass")
|
MATCH_LEVELS = ("subgroup", "group", "subclass")
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class MappedOpenAlexTopic:
|
||||||
|
topic_id: str
|
||||||
|
topic_display_name: str | None = None
|
||||||
|
subfield_id: str | None = None
|
||||||
|
field_id: str | None = None
|
||||||
|
domain_id: str | None = None
|
||||||
|
subfield_name: str | None = None
|
||||||
|
field_name: str | None = None
|
||||||
|
domain_name: str | None = None
|
||||||
|
ipc_level: str | None = None
|
||||||
|
ipc_symbol: str | None = None
|
||||||
|
|
||||||
|
|
||||||
# High-frequency IPC subclasses missing from the ES-built mapping file.
|
# High-frequency IPC subclasses missing from the ES-built mapping file.
|
||||||
SUBCLASS_TOPIC_OVERRIDES: dict[str, str] = {
|
SUBCLASS_TOPIC_OVERRIDES: dict[str, MappedOpenAlexTopic] = {
|
||||||
"A61B": "Cardiac electrophysiology and arrhythmias",
|
"A61B": MappedOpenAlexTopic(
|
||||||
"A61K": "Pharmaceutical studies and practices",
|
topic_id="https://openalex.org/T10217",
|
||||||
"A61P": "Cancer Immunotherapy and Biomarkers",
|
topic_display_name="Cardiac electrophysiology and arrhythmias",
|
||||||
"C07K": "Cancer Immunotherapy and Biomarkers",
|
subfield_name="Cardiology and Cardiovascular Medicine",
|
||||||
"C12N": "Biotechnology and Related Fields",
|
field_name="Medicine",
|
||||||
"C12Q": "Cancer Immunotherapy and Biomarkers",
|
domain_name="Health Sciences",
|
||||||
"G01N": "Analytical Methods in Pharmaceuticals",
|
ipc_level="subclass",
|
||||||
|
ipc_symbol="A61B",
|
||||||
|
),
|
||||||
|
"A61K": MappedOpenAlexTopic(
|
||||||
|
topic_id="https://openalex.org/T12015",
|
||||||
|
topic_display_name="Pharmaceutical studies and practices",
|
||||||
|
subfield_name="Pharmacology",
|
||||||
|
field_name="Pharmacology, Toxicology and Pharmaceutics",
|
||||||
|
domain_name="Health Sciences",
|
||||||
|
ipc_level="subclass",
|
||||||
|
ipc_symbol="A61K",
|
||||||
|
),
|
||||||
|
"A61P": MappedOpenAlexTopic(
|
||||||
|
topic_id="https://openalex.org/T11537",
|
||||||
|
topic_display_name="Cancer Immunotherapy and Biomarkers",
|
||||||
|
subfield_name="Oncology",
|
||||||
|
field_name="Medicine",
|
||||||
|
domain_name="Health Sciences",
|
||||||
|
ipc_level="subclass",
|
||||||
|
ipc_symbol="A61P",
|
||||||
|
),
|
||||||
|
"C07K": MappedOpenAlexTopic(
|
||||||
|
topic_id="https://openalex.org/T11537",
|
||||||
|
topic_display_name="Cancer Immunotherapy and Biomarkers",
|
||||||
|
subfield_name="Oncology",
|
||||||
|
field_name="Medicine",
|
||||||
|
domain_name="Health Sciences",
|
||||||
|
ipc_level="subclass",
|
||||||
|
ipc_symbol="C07K",
|
||||||
|
),
|
||||||
|
"C12N": MappedOpenAlexTopic(
|
||||||
|
topic_id="https://openalex.org/T10041",
|
||||||
|
topic_display_name="Biotechnology and Related Fields",
|
||||||
|
subfield_name="Biotechnology",
|
||||||
|
field_name="Immunology and Microbiology",
|
||||||
|
domain_name="Life Sciences",
|
||||||
|
ipc_level="subclass",
|
||||||
|
ipc_symbol="C12N",
|
||||||
|
),
|
||||||
|
"C12Q": MappedOpenAlexTopic(
|
||||||
|
topic_id="https://openalex.org/T11537",
|
||||||
|
topic_display_name="Cancer Immunotherapy and Biomarkers",
|
||||||
|
subfield_name="Oncology",
|
||||||
|
field_name="Medicine",
|
||||||
|
domain_name="Health Sciences",
|
||||||
|
ipc_level="subclass",
|
||||||
|
ipc_symbol="C12Q",
|
||||||
|
),
|
||||||
|
"G01N": MappedOpenAlexTopic(
|
||||||
|
topic_id="https://openalex.org/T10487",
|
||||||
|
topic_display_name="Analytical Methods in Pharmaceuticals",
|
||||||
|
subfield_name="Analytical Chemistry",
|
||||||
|
field_name="Chemistry",
|
||||||
|
domain_name="Physical Sciences",
|
||||||
|
ipc_level="subclass",
|
||||||
|
ipc_symbol="G01N",
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
_TOPIC_LABEL_STOPWORDS = frozenset({
|
_TOPIC_LABEL_STOPWORDS = frozenset({
|
||||||
@@ -92,20 +162,6 @@ def _meaningful_topic_tokens(label: str) -> set[str]:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class MappedOpenAlexTopic:
|
|
||||||
topic_id: str
|
|
||||||
topic_display_name: str | None = None
|
|
||||||
subfield_id: str | None = None
|
|
||||||
field_id: str | None = None
|
|
||||||
domain_id: str | None = None
|
|
||||||
subfield_name: str | None = None
|
|
||||||
field_name: str | None = None
|
|
||||||
domain_name: str | None = None
|
|
||||||
ipc_level: str | None = None
|
|
||||||
ipc_symbol: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class OpenAlexTopicRefs:
|
class OpenAlexTopicRefs:
|
||||||
topic_ids: frozenset[str]
|
topic_ids: frozenset[str]
|
||||||
@@ -141,84 +197,11 @@ def _mapping_path() -> str:
|
|||||||
return os.path.join(_data_dir(), MAPPING_FILENAME)
|
return os.path.join(_data_dir(), MAPPING_FILENAME)
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
|
||||||
def _load_topic_cache() -> dict[str, dict[str, str]]:
|
|
||||||
path = os.path.join(_data_dir(), TOPIC_CACHE_FILENAME)
|
|
||||||
try:
|
|
||||||
with open(path, encoding="utf-8") as handle:
|
|
||||||
raw = json.load(handle)
|
|
||||||
except (OSError, json.JSONDecodeError):
|
|
||||||
return {}
|
|
||||||
if not isinstance(raw, dict):
|
|
||||||
return {}
|
|
||||||
return {
|
|
||||||
display_name: {
|
|
||||||
"topic_id": str(info.get("topic_id", "")),
|
|
||||||
"subfield": info.get("subfield"),
|
|
||||||
"field": info.get("field"),
|
|
||||||
"domain": info.get("domain"),
|
|
||||||
}
|
|
||||||
for display_name, info in raw.items()
|
|
||||||
if isinstance(info, dict) and info.get("topic_id")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _enrich_mapped_topic(mapped: MappedOpenAlexTopic) -> MappedOpenAlexTopic:
|
|
||||||
cache = _load_topic_cache()
|
|
||||||
topic_name = mapped.topic_display_name or ""
|
|
||||||
info = cache.get(topic_name)
|
|
||||||
if info is None:
|
|
||||||
for candidate in cache.values():
|
|
||||||
if candidate.get("topic_id") == mapped.topic_id:
|
|
||||||
info = candidate
|
|
||||||
break
|
|
||||||
if info is None:
|
|
||||||
return mapped
|
|
||||||
return MappedOpenAlexTopic(
|
|
||||||
topic_id=mapped.topic_id,
|
|
||||||
topic_display_name=mapped.topic_display_name or topic_name,
|
|
||||||
subfield_id=mapped.subfield_id,
|
|
||||||
field_id=mapped.field_id,
|
|
||||||
domain_id=mapped.domain_id,
|
|
||||||
subfield_name=info.get("subfield"),
|
|
||||||
field_name=info.get("field"),
|
|
||||||
domain_name=info.get("domain"),
|
|
||||||
ipc_level=mapped.ipc_level,
|
|
||||||
ipc_symbol=mapped.ipc_symbol,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _mapped_from_topic_name(
|
|
||||||
topic_display_name: str,
|
|
||||||
*,
|
|
||||||
ipc_level: str,
|
|
||||||
ipc_symbol: str,
|
|
||||||
) -> MappedOpenAlexTopic | None:
|
|
||||||
cache = _load_topic_cache()
|
|
||||||
info = cache.get(topic_display_name)
|
|
||||||
if info is None:
|
|
||||||
return None
|
|
||||||
return _enrich_mapped_topic(
|
|
||||||
MappedOpenAlexTopic(
|
|
||||||
topic_id=info["topic_id"],
|
|
||||||
topic_display_name=topic_display_name,
|
|
||||||
ipc_level=ipc_level,
|
|
||||||
ipc_symbol=ipc_symbol,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _apply_subclass_overrides(
|
def _apply_subclass_overrides(
|
||||||
parsed: dict[str, dict[str, MappedOpenAlexTopic]],
|
parsed: dict[str, dict[str, MappedOpenAlexTopic]],
|
||||||
) -> None:
|
) -> None:
|
||||||
for symbol, topic_name in SUBCLASS_TOPIC_OVERRIDES.items():
|
for symbol, mapped in SUBCLASS_TOPIC_OVERRIDES.items():
|
||||||
mapped = _mapped_from_topic_name(
|
parsed["subclass"][_normalize_symbol(symbol)] = mapped
|
||||||
topic_name,
|
|
||||||
ipc_level="subclass",
|
|
||||||
ipc_symbol=_normalize_symbol(symbol),
|
|
||||||
)
|
|
||||||
if mapped is not None:
|
|
||||||
parsed["subclass"][_normalize_symbol(symbol)] = mapped
|
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
@lru_cache(maxsize=1)
|
||||||
@@ -239,19 +222,17 @@ def load_ipc_openalex_mapping() -> dict[str, dict[str, MappedOpenAlexTopic]]:
|
|||||||
if not topic_id:
|
if not topic_id:
|
||||||
continue
|
continue
|
||||||
normalized_symbol = _normalize_symbol(symbol)
|
normalized_symbol = _normalize_symbol(symbol)
|
||||||
mapped = _enrich_mapped_topic(
|
mapped = MappedOpenAlexTopic(
|
||||||
MappedOpenAlexTopic(
|
topic_id=str(topic_id),
|
||||||
topic_id=str(topic_id),
|
topic_display_name=entry.get("topic_display_name"),
|
||||||
topic_display_name=entry.get("topic_display_name"),
|
subfield_id=entry.get("subfield_id"),
|
||||||
subfield_id=entry.get("subfield_id"),
|
field_id=entry.get("field_id"),
|
||||||
field_id=entry.get("field_id"),
|
domain_id=entry.get("domain_id"),
|
||||||
domain_id=entry.get("domain_id"),
|
subfield_name=entry.get("subfield"),
|
||||||
subfield_name=entry.get("subfield"),
|
field_name=entry.get("field"),
|
||||||
field_name=entry.get("field"),
|
domain_name=entry.get("domain"),
|
||||||
domain_name=entry.get("domain"),
|
ipc_level=level,
|
||||||
ipc_level=level,
|
ipc_symbol=normalized_symbol,
|
||||||
ipc_symbol=normalized_symbol,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
parsed[level][normalized_symbol] = mapped
|
parsed[level][normalized_symbol] = mapped
|
||||||
_apply_subclass_overrides(parsed)
|
_apply_subclass_overrides(parsed)
|
||||||
@@ -260,7 +241,6 @@ def load_ipc_openalex_mapping() -> dict[str, dict[str, MappedOpenAlexTopic]]:
|
|||||||
|
|
||||||
def clear_mapping_cache() -> None:
|
def clear_mapping_cache() -> None:
|
||||||
load_ipc_openalex_mapping.cache_clear()
|
load_ipc_openalex_mapping.cache_clear()
|
||||||
_load_topic_cache.cache_clear()
|
|
||||||
from inse.patents.patents_openalex_keywords.resolver import clear_resolver_caches
|
from inse.patents.patents_openalex_keywords.resolver import clear_resolver_caches
|
||||||
|
|
||||||
clear_resolver_caches()
|
clear_resolver_caches()
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from typing import Any
|
|||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
from inse.patents.authors.ipc_openalex_mapping import (
|
from inse.patents.authors.ipc_openalex_mapping import (
|
||||||
_load_topic_cache,
|
|
||||||
normalize_openalex_id,
|
normalize_openalex_id,
|
||||||
)
|
)
|
||||||
from inse.patents.common.elastic_search_client import MissingApiKeyError
|
from inse.patents.common.elastic_search_client import MissingApiKeyError
|
||||||
@@ -65,17 +64,7 @@ def _topic_id_variants(topic_id: str | None) -> list[str]:
|
|||||||
|
|
||||||
|
|
||||||
def _topic_id_variants_for_item(item: KeywordPatentSearchItem) -> list[str]:
|
def _topic_id_variants_for_item(item: KeywordPatentSearchItem) -> list[str]:
|
||||||
variants = _topic_id_variants(item.topic_id)
|
return _topic_id_variants(item.topic_id)
|
||||||
if variants:
|
|
||||||
return variants
|
|
||||||
|
|
||||||
display_name = (item.topic_display_name or "").strip()
|
|
||||||
if display_name:
|
|
||||||
info = _load_topic_cache().get(display_name)
|
|
||||||
if info and info.get("topic_id"):
|
|
||||||
return _topic_id_variants(str(info["topic_id"]))
|
|
||||||
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
def _weighted_score(
|
def _weighted_score(
|
||||||
|
|||||||
@@ -1086,19 +1086,12 @@ def test_json_lookup_resolves_topic_id_from_display_name(monkeypatch) -> None:
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
monkeypatch.setattr(
|
|
||||||
"inse.patents.keywords.reverse_lookup._load_topic_cache",
|
|
||||||
lambda: {
|
|
||||||
"Science and Climate Studies": {
|
|
||||||
"topic_id": "https://openalex.org/T14329",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
clear_reverse_lookup_caches()
|
clear_reverse_lookup_caches()
|
||||||
|
|
||||||
items = [
|
items = [
|
||||||
KeywordPatentSearchItem(
|
KeywordPatentSearchItem(
|
||||||
keyword="Science and Climate Studies",
|
keyword="Science and Climate Studies",
|
||||||
|
topic_id="https://openalex.org/T14329",
|
||||||
topic_display_name="Science and Climate Studies",
|
topic_display_name="Science and Climate Studies",
|
||||||
relevance_score=1.0,
|
relevance_score=1.0,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ class OrgPatentsSearchClient:
|
|||||||
|
|
||||||
async def search_by_institution(
|
async def search_by_institution(
|
||||||
self,
|
self,
|
||||||
institution_id: str,
|
institution_id: str | list[str],
|
||||||
match_type: MatchTypeFilter = "all",
|
match_type: MatchTypeFilter = "all",
|
||||||
page: int = 0,
|
page: int = 0,
|
||||||
size: int = DEFAULT_PAGE_SIZE,
|
size: int = DEFAULT_PAGE_SIZE,
|
||||||
@@ -259,8 +259,16 @@ class OrgPatentsSearchClient:
|
|||||||
from_year: int | None = None,
|
from_year: int | None = None,
|
||||||
to_year: int | None = None,
|
to_year: int | None = None,
|
||||||
) -> tuple[list[OrgPatentEntry], int]:
|
) -> tuple[list[OrgPatentEntry], int]:
|
||||||
short_id = institution_id.replace("https://openalex.org/", "").upper()
|
institution_ids = (
|
||||||
filters: list[dict[str, Any]] = [{"term": {"institution_id": short_id}}]
|
institution_id if isinstance(institution_id, list) else [institution_id]
|
||||||
|
)
|
||||||
|
short_ids = [
|
||||||
|
value.replace("https://openalex.org/", "").upper()
|
||||||
|
for value in institution_ids
|
||||||
|
]
|
||||||
|
filters: list[dict[str, Any]] = [
|
||||||
|
{"terms": {"institution_id": short_ids}}
|
||||||
|
]
|
||||||
|
|
||||||
if match_type == "institution":
|
if match_type == "institution":
|
||||||
filters.append({"terms": {"match_type": ["institution", "both"]}})
|
filters.append({"terms": {"match_type": ["institution", "both"]}})
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ from inse.util import get_model
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
TOPIC_CACHE_FILENAME = "topic_hierarchy_cache.json"
|
|
||||||
MATCH_METHOD = "sentence_transformer"
|
MATCH_METHOD = "sentence_transformer"
|
||||||
TOPIC_VECTORS_INDEX = "topicvectors"
|
TOPIC_VECTORS_INDEX = "topicvectors"
|
||||||
|
|
||||||
@@ -39,31 +38,6 @@ class KeywordCandidate:
|
|||||||
topic_display_name: str | None = None
|
topic_display_name: str | None = None
|
||||||
|
|
||||||
|
|
||||||
def _data_dir() -> Path:
|
|
||||||
return Path(__file__).resolve().parents[4] / "data"
|
|
||||||
|
|
||||||
|
|
||||||
def load_topic_cache(cache_path: Path | None = None) -> list[TopicCandidate]:
|
|
||||||
path = cache_path or (_data_dir() / TOPIC_CACHE_FILENAME)
|
|
||||||
with path.open(encoding="utf-8") as handle:
|
|
||||||
raw = json.load(handle)
|
|
||||||
topics: list[TopicCandidate] = []
|
|
||||||
for display_name, info in raw.items():
|
|
||||||
topic_id = info.get("topic_id")
|
|
||||||
if not topic_id:
|
|
||||||
continue
|
|
||||||
topics.append(
|
|
||||||
TopicCandidate(
|
|
||||||
topic_id=str(topic_id),
|
|
||||||
display_name=display_name,
|
|
||||||
subfield=info.get("subfield"),
|
|
||||||
field=info.get("field"),
|
|
||||||
domain=info.get("domain"),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return topics
|
|
||||||
|
|
||||||
|
|
||||||
def topic_embedding_text(topic: TopicCandidate) -> str:
|
def topic_embedding_text(topic: TopicCandidate) -> str:
|
||||||
parts = [topic.display_name]
|
parts = [topic.display_name]
|
||||||
for label in (topic.subfield, topic.field, topic.domain):
|
for label in (topic.subfield, topic.field, topic.domain):
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ from functools import lru_cache
|
|||||||
|
|
||||||
from inse.patents.authors.ipc_openalex_mapping import (
|
from inse.patents.authors.ipc_openalex_mapping import (
|
||||||
MappedOpenAlexTopic,
|
MappedOpenAlexTopic,
|
||||||
_enrich_mapped_topic,
|
|
||||||
load_ipc_openalex_mapping,
|
load_ipc_openalex_mapping,
|
||||||
normalize_openalex_id,
|
normalize_openalex_id,
|
||||||
resolve_mapped_topics_for_code,
|
resolve_mapped_topics_for_code,
|
||||||
@@ -91,16 +90,14 @@ def mapped_topics_from_index_doc(doc: dict) -> list[MappedOpenAlexTopic]:
|
|||||||
continue
|
continue
|
||||||
seen.add(key)
|
seen.add(key)
|
||||||
mapped.append(
|
mapped.append(
|
||||||
_enrich_mapped_topic(
|
MappedOpenAlexTopic(
|
||||||
MappedOpenAlexTopic(
|
topic_id=str(topic_id),
|
||||||
topic_id=str(topic_id),
|
topic_display_name=match.get("topic_display_name"),
|
||||||
topic_display_name=match.get("topic_display_name"),
|
subfield_name=match.get("subfield"),
|
||||||
subfield_name=match.get("subfield"),
|
field_name=match.get("field"),
|
||||||
field_name=match.get("field"),
|
domain_name=match.get("domain"),
|
||||||
domain_name=match.get("domain"),
|
ipc_level=ipc_level,
|
||||||
ipc_level=ipc_level,
|
ipc_symbol=ipc_symbol,
|
||||||
ipc_symbol=ipc_symbol,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -113,13 +110,11 @@ def mapped_topics_from_index_doc(doc: dict) -> list[MappedOpenAlexTopic]:
|
|||||||
continue
|
continue
|
||||||
seen.add(key)
|
seen.add(key)
|
||||||
mapped.append(
|
mapped.append(
|
||||||
_enrich_mapped_topic(
|
MappedOpenAlexTopic(
|
||||||
MappedOpenAlexTopic(
|
topic_id=str(topic_id),
|
||||||
topic_id=str(topic_id),
|
topic_display_name=match.get("topic_display_name"),
|
||||||
topic_display_name=match.get("topic_display_name"),
|
ipc_level=ipc_level,
|
||||||
ipc_level=ipc_level,
|
ipc_symbol=ipc_symbol,
|
||||||
ipc_symbol=ipc_symbol,
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,186 @@
|
|||||||
|
"""
|
||||||
|
Bio generation for persons / authors.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import json
|
||||||
|
import logging
|
||||||
|
import time
|
||||||
|
|
||||||
|
from pydantic import ValidationError
|
||||||
|
|
||||||
|
from inse.exceptions import NotFoundException, UpstreamAPIException
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
from inse.model import ESIndex
|
||||||
|
from inse.persons.model import PersonBio
|
||||||
|
|
||||||
|
from .. import config
|
||||||
|
from ..integrations import llm
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
async def _fetch_author_display_name(author_id: str) -> str | None:
|
||||||
|
query = {
|
||||||
|
"query_string": {
|
||||||
|
"default_field": "_id",
|
||||||
|
"query": author_id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=ESIndex.OPENALEX_AUTHORS,
|
||||||
|
query=query,
|
||||||
|
source=["display_name"],
|
||||||
|
)
|
||||||
|
|
||||||
|
hits = response.get("hits", {}).get("hits", [])
|
||||||
|
|
||||||
|
if not hits:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return hits[0].get("_source", {}).get("display_name")
|
||||||
|
|
||||||
|
|
||||||
|
async def _fetch_works_and_topics(author_id: str) -> tuple[list, list]:
|
||||||
|
WORK_SOURCE_FIELDS = [
|
||||||
|
"title",
|
||||||
|
"display_name",
|
||||||
|
"abstract",
|
||||||
|
"cited_by_count",
|
||||||
|
"primary_topic",
|
||||||
|
]
|
||||||
|
|
||||||
|
author_url = f"https://openalex.org/{author_id.strip()}"
|
||||||
|
|
||||||
|
authorship_query = {
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships",
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [{"term": {"authorships.author.id": author_url}}],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body = {
|
||||||
|
"size": 100,
|
||||||
|
"sort": [{"cited_by_count": {"order": "desc"}}],
|
||||||
|
"_source": WORK_SOURCE_FIELDS,
|
||||||
|
"query": authorship_query,
|
||||||
|
"aggs": {
|
||||||
|
"primary_topics": {
|
||||||
|
"terms": {"field": "primary_topic.id", "size": 5},
|
||||||
|
"aggs": {
|
||||||
|
"topic_name": {
|
||||||
|
"top_hits": {
|
||||||
|
"size": 1,
|
||||||
|
"_source": ["primary_topic.display_name"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=config.settings.openalex_works_search_index,
|
||||||
|
body=body,
|
||||||
|
)
|
||||||
|
|
||||||
|
works = []
|
||||||
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
|
works.append(hit.get("_source", {}))
|
||||||
|
|
||||||
|
topics = []
|
||||||
|
buckets = (
|
||||||
|
response.get("aggregations", {}).get("primary_topics", {}).get("buckets", [])
|
||||||
|
)
|
||||||
|
for bucket in buckets:
|
||||||
|
topic_hits = bucket.get("topic_name", {}).get("hits", {}).get("hits", [])
|
||||||
|
display_name = None
|
||||||
|
if topic_hits:
|
||||||
|
primary_topic = topic_hits[0].get("_source", {}).get("primary_topic", {})
|
||||||
|
display_name = primary_topic.get("display_name")
|
||||||
|
topics.append(
|
||||||
|
{
|
||||||
|
"id": bucket.get("key"),
|
||||||
|
"display_name": display_name,
|
||||||
|
"count": bucket.get("doc_count"),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
return works, topics
|
||||||
|
|
||||||
|
|
||||||
|
def _build_papers(works: list) -> list:
|
||||||
|
papers = []
|
||||||
|
for work in works:
|
||||||
|
name = work.get("title") or work.get("display_name")
|
||||||
|
abstract = work.get("abstract")
|
||||||
|
papers.append(
|
||||||
|
{
|
||||||
|
"name": name,
|
||||||
|
"abstract": abstract,
|
||||||
|
"stats": {
|
||||||
|
"cited_by_count": work.get("cited_by_count"),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return papers
|
||||||
|
|
||||||
|
|
||||||
|
async def get_data_for_bio(author_id: str) -> dict | None:
|
||||||
|
display_name = await _fetch_author_display_name(author_id)
|
||||||
|
if display_name is None:
|
||||||
|
return None
|
||||||
|
|
||||||
|
works, top_topics = await _fetch_works_and_topics(author_id)
|
||||||
|
papers = _build_papers(works)
|
||||||
|
|
||||||
|
author_data = {
|
||||||
|
"display_name": display_name,
|
||||||
|
"topics": top_topics,
|
||||||
|
"papers": papers,
|
||||||
|
}
|
||||||
|
return author_data
|
||||||
|
|
||||||
|
|
||||||
|
async def generate_person_bio(author_id: str) -> str:
|
||||||
|
start_time = time.time()
|
||||||
|
author_data = await get_data_for_bio(author_id)
|
||||||
|
if author_data is None:
|
||||||
|
raise NotFoundException(f"No person found for author ID {author_id}.")
|
||||||
|
|
||||||
|
person_json = json.dumps(author_data, ensure_ascii=False)
|
||||||
|
|
||||||
|
system_prompt = """\
|
||||||
|
Beschreibe in zwei Sätzen das Hauptforschungsfeld des Autors. Formuliere dabei allgemeinverständlich, sodass auch Personen ohne Fachwissen einen Einblick in die Forschung gewinnen. Nenne keine konkreten Publikationen oder Einzelwerke, sondern konzentriere dich auf die übergeordneten Forschungsinteressen und Themen. Verzichte auf bloße Aufzählungen und verbinde die Informationen zu einem flüssigen Text.
|
||||||
|
Beschreibe anschließend in ein bis zwei Sätzen die wirtschaftliche Relevanz der Forschung anhand von Anwendungen, Technologien oder Branchen, die davon profitieren könnten.
|
||||||
|
Verwende insgesamt maximal 100 bis 120 Wörter. Formuliere die Antwort so, dass sie ohne weitere Anpassungen direkt als Kurzbiografie verwendet werden kann. Verwende keine Superlative oder übertriebene Formulierungen, sondern bleibe sachlich und informativ. Gebe den Text als One-Liner zurück, ohne Zeilenumbrüche oder Aufzählungen. Verwende keine Gedankenstriche (– oder —) zur Gliederung von Sätzen. Formuliere stattdessen mit Kommas, Klammern oder zwei getrennten Sätzen.
|
||||||
|
Gib ausschließlich ein JSON-Objekt zurück, das den Text im Feld "bio" enthält.
|
||||||
|
"""
|
||||||
|
|
||||||
|
user_prompt = f"Daten zur Person:\n{person_json}"
|
||||||
|
|
||||||
|
response = await llm.call(
|
||||||
|
system_prompt=system_prompt,
|
||||||
|
user_prompt=user_prompt,
|
||||||
|
json_schema=PersonBio.model_json_schema(),
|
||||||
|
schema_name="bio",
|
||||||
|
temperature=0.8,
|
||||||
|
top_p=0.95,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
bio = PersonBio.model_validate_json(response).bio
|
||||||
|
except ValidationError as error:
|
||||||
|
logger.warning(
|
||||||
|
f"Bio generation for author {author_id} returned no valid bio: {response}"
|
||||||
|
)
|
||||||
|
raise UpstreamAPIException("Bio generation failed.") from error
|
||||||
|
|
||||||
|
elapsed_time = time.time() - start_time
|
||||||
|
logger.info(f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds")
|
||||||
|
|
||||||
|
return bio
|
||||||
@@ -4,13 +4,10 @@ Business logic for persons / authors.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from pydantic import ValidationError
|
|
||||||
|
|
||||||
from inse.exceptions import (
|
from inse.exceptions import (
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
ElasticsearchException,
|
ElasticsearchException,
|
||||||
@@ -26,13 +23,11 @@ from inse.persons.model import (
|
|||||||
CareerMetrics,
|
CareerMetrics,
|
||||||
CustomAuthor,
|
CustomAuthor,
|
||||||
CustomAuthorsListResponse,
|
CustomAuthorsListResponse,
|
||||||
PersonBio,
|
|
||||||
)
|
)
|
||||||
from inse.persons.query_builder import build_authors_search_rescored
|
from inse.persons.query_builder import build_authors_search_rescored
|
||||||
from inse.works.logic import enrich_topic_descriptions
|
from inse.works.logic import enrich_topic_descriptions
|
||||||
|
|
||||||
from .. import config, util
|
from .. import config, util
|
||||||
from ..integrations import llm
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
INDEX_NAME = "openalex-authors"
|
INDEX_NAME = "openalex-authors"
|
||||||
@@ -220,100 +215,6 @@ async def count_authors_by_last_name(last_name: str) -> int:
|
|||||||
return await _count_authors(query)
|
return await _count_authors(query)
|
||||||
|
|
||||||
|
|
||||||
async def _fetch_author_display_name(author_id: str) -> str | None:
|
|
||||||
query = {
|
|
||||||
"query_string": {
|
|
||||||
"default_field": "_id",
|
|
||||||
"query": author_id,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
response = await elasticsearch.search(
|
|
||||||
index=INDEX_NAME,
|
|
||||||
query=query,
|
|
||||||
source=["display_name"],
|
|
||||||
)
|
|
||||||
|
|
||||||
hits = response.get("hits", {}).get("hits", [])
|
|
||||||
|
|
||||||
if not hits:
|
|
||||||
return None
|
|
||||||
|
|
||||||
return hits[0].get("_source", {}).get("display_name")
|
|
||||||
|
|
||||||
|
|
||||||
async def _fetch_works_and_topics(author_id: str) -> tuple[list, list]:
|
|
||||||
WORK_SOURCE_FIELDS = [
|
|
||||||
"title",
|
|
||||||
"display_name",
|
|
||||||
"abstract",
|
|
||||||
"cited_by_count",
|
|
||||||
"primary_topic",
|
|
||||||
]
|
|
||||||
|
|
||||||
author_url = f"https://openalex.org/{author_id.strip()}"
|
|
||||||
|
|
||||||
authorship_query = {
|
|
||||||
"nested": {
|
|
||||||
"path": "authorships",
|
|
||||||
"query": {
|
|
||||||
"bool": {
|
|
||||||
"filter": [{"term": {"authorships.author.id": author_url}}],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body = {
|
|
||||||
"size": 100,
|
|
||||||
"sort": [{"cited_by_count": {"order": "desc"}}],
|
|
||||||
"_source": WORK_SOURCE_FIELDS,
|
|
||||||
"query": authorship_query,
|
|
||||||
"aggs": {
|
|
||||||
"primary_topics": {
|
|
||||||
"terms": {"field": "primary_topic.id", "size": 5},
|
|
||||||
"aggs": {
|
|
||||||
"topic_name": {
|
|
||||||
"top_hits": {
|
|
||||||
"size": 1,
|
|
||||||
"_source": ["primary_topic.display_name"],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
response = await elasticsearch.search(
|
|
||||||
index=config.settings.openalex_works_search_index,
|
|
||||||
body=body,
|
|
||||||
)
|
|
||||||
|
|
||||||
works = []
|
|
||||||
for hit in response.get("hits", {}).get("hits", []):
|
|
||||||
works.append(hit.get("_source", {}))
|
|
||||||
|
|
||||||
topics = []
|
|
||||||
buckets = (
|
|
||||||
response.get("aggregations", {}).get("primary_topics", {}).get("buckets", [])
|
|
||||||
)
|
|
||||||
for bucket in buckets:
|
|
||||||
topic_hits = bucket.get("topic_name", {}).get("hits", {}).get("hits", [])
|
|
||||||
display_name = None
|
|
||||||
if topic_hits:
|
|
||||||
primary_topic = topic_hits[0].get("_source", {}).get("primary_topic", {})
|
|
||||||
display_name = primary_topic.get("display_name")
|
|
||||||
topics.append(
|
|
||||||
{
|
|
||||||
"id": bucket.get("key"),
|
|
||||||
"display_name": display_name,
|
|
||||||
"count": bucket.get("doc_count"),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
return works, topics
|
|
||||||
|
|
||||||
|
|
||||||
async def _get_publication_years_for_author(author_id: str) -> list[int]:
|
async def _get_publication_years_for_author(author_id: str) -> list[int]:
|
||||||
author_url = f"https://openalex.org/{author_id.strip()}"
|
author_url = f"https://openalex.org/{author_id.strip()}"
|
||||||
|
|
||||||
@@ -427,79 +328,6 @@ async def get_career_metrics_for_author(author_id: str) -> CareerMetrics:
|
|||||||
return _compute_career_metrics(publication_years)
|
return _compute_career_metrics(publication_years)
|
||||||
|
|
||||||
|
|
||||||
def _build_papers(works: list) -> list:
|
|
||||||
papers = []
|
|
||||||
for work in works:
|
|
||||||
name = work.get("title") or work.get("display_name")
|
|
||||||
abstract = work.get("abstract")
|
|
||||||
papers.append(
|
|
||||||
{
|
|
||||||
"name": name,
|
|
||||||
"abstract": abstract,
|
|
||||||
"stats": {
|
|
||||||
"cited_by_count": work.get("cited_by_count"),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
return papers
|
|
||||||
|
|
||||||
|
|
||||||
async def get_data_for_bio(author_id: str) -> dict | None:
|
|
||||||
display_name = await _fetch_author_display_name(author_id)
|
|
||||||
if display_name is None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
works, top_topics = await _fetch_works_and_topics(author_id)
|
|
||||||
papers = _build_papers(works)
|
|
||||||
|
|
||||||
author_data = {
|
|
||||||
"display_name": display_name,
|
|
||||||
"topics": top_topics,
|
|
||||||
"papers": papers,
|
|
||||||
}
|
|
||||||
return author_data
|
|
||||||
|
|
||||||
|
|
||||||
async def generate_person_bio(
|
|
||||||
author_id: str, include: set[str] | None = None
|
|
||||||
) -> str:
|
|
||||||
start_time = time.time()
|
|
||||||
author_data = await get_data_for_bio(author_id)
|
|
||||||
if author_data is None:
|
|
||||||
return "No person found."
|
|
||||||
|
|
||||||
person_json = json.dumps(author_data, ensure_ascii=False)
|
|
||||||
|
|
||||||
system_prompt = """\
|
|
||||||
Beschreibe in zwei Sätzen das Hauptforschungsfeld des Autors. Formuliere dabei allgemeinverständlich, sodass auch Personen ohne Fachwissen einen Einblick in die Forschung gewinnen. Nenne keine konkreten Publikationen oder Einzelwerke, sondern konzentriere dich auf die übergeordneten Forschungsinteressen und Themen. Verzichte auf bloße Aufzählungen und verbinde die Informationen zu einem flüssigen Text.
|
|
||||||
Beschreibe anschließend in ein bis zwei Sätzen die wirtschaftliche Relevanz der Forschung anhand von Anwendungen, Technologien oder Branchen, die davon profitieren könnten.
|
|
||||||
Verwende insgesamt maximal 100 bis 120 Wörter. Formuliere die Antwort so, dass sie ohne weitere Anpassungen direkt als Kurzbiografie verwendet werden kann. Verwende keine Superlative oder übertriebene Formulierungen, sondern bleibe sachlich und informativ. Gebe den Text als One-Liner zurück, ohne Zeilenumbrüche oder Aufzählungen. Verwende keine Gedankenstriche (– oder —) zur Gliederung von Sätzen. Formuliere stattdessen mit Kommas, Klammern oder zwei getrennten Sätzen.
|
|
||||||
Gib ausschließlich ein JSON-Objekt zurück, das den Text im Feld "bio" enthält.
|
|
||||||
"""
|
|
||||||
|
|
||||||
user_prompt = f"Daten zur Person:\n{person_json}"
|
|
||||||
|
|
||||||
response = await llm.call(
|
|
||||||
system_prompt=system_prompt,
|
|
||||||
user_prompt=user_prompt,
|
|
||||||
json_schema=PersonBio.model_json_schema(),
|
|
||||||
schema_name="bio",
|
|
||||||
temperature=0.8,
|
|
||||||
top_p=0.95,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
bio = PersonBio.model_validate_json(response).bio
|
|
||||||
except ValidationError:
|
|
||||||
logger.warning(f"Bio generation for author {author_id} returned no valid JSON: {response}")
|
|
||||||
bio = "Etwas ist schiefgelaufen."
|
|
||||||
|
|
||||||
elapsed_time = time.time() - start_time
|
|
||||||
logger.info(f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds")
|
|
||||||
|
|
||||||
return bio
|
|
||||||
|
|
||||||
|
|
||||||
async def get_person_by_id(
|
async def get_person_by_id(
|
||||||
author_id: str, include: str | None = None
|
author_id: str, include: str | None = None
|
||||||
) -> CustomAuthorsListResponse:
|
) -> CustomAuthorsListResponse:
|
||||||
@@ -528,6 +356,9 @@ async def get_person_by_id(
|
|||||||
career_metrics=career_metrics,
|
career_metrics=career_metrics,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if custom_author.topics:
|
||||||
|
await enrich_topic_descriptions(custom_author.topics)
|
||||||
|
|
||||||
return CustomAuthorsListResponse(results=[custom_author])
|
return CustomAuthorsListResponse(results=[custom_author])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from fastapi import APIRouter, HTTPException, Path, Query, status
|
|||||||
|
|
||||||
from inse.models.openalex.authors_list_response import AuthorsListResponse
|
from inse.models.openalex.authors_list_response import AuthorsListResponse
|
||||||
|
|
||||||
from . import logic, model
|
from . import bio as bio_logic, logic, model
|
||||||
|
|
||||||
router = APIRouter(
|
router = APIRouter(
|
||||||
prefix="/api/inse-service",
|
prefix="/api/inse-service",
|
||||||
@@ -32,23 +32,7 @@ async def search_persons(
|
|||||||
query: Annotated[
|
query: Annotated[
|
||||||
str, Query(description="Search query (e.g., Arman AND Arzani)")
|
str, Query(description="Search query (e.g., Arman AND Arzani)")
|
||||||
] = None,
|
] = None,
|
||||||
include: Annotated[
|
|
||||||
str | None,
|
|
||||||
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 await logic.search_persons(author_id, query)
|
return await logic.search_persons(author_id, query)
|
||||||
|
|
||||||
|
|
||||||
@@ -62,20 +46,8 @@ async def generate_person_bio(
|
|||||||
author_id: Annotated[
|
author_id: Annotated[
|
||||||
str, Query(description="OpenAlex author ID (e.g., A5093075883)")
|
str, Query(description="OpenAlex author ID (e.g., A5093075883)")
|
||||||
],
|
],
|
||||||
include: Annotated[
|
|
||||||
str | None,
|
|
||||||
Query(
|
|
||||||
description=("Comma-separated list to include tags"),
|
|
||||||
example="topics_full,topic_share",
|
|
||||||
),
|
|
||||||
] = None,
|
|
||||||
):
|
):
|
||||||
include_set = (
|
bio = await bio_logic.generate_person_bio(author_id)
|
||||||
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
|
|
||||||
if include
|
|
||||||
else None
|
|
||||||
)
|
|
||||||
bio = await logic.generate_person_bio(author_id, include_set)
|
|
||||||
return model.PersonBio(bio=bio)
|
return model.PersonBio(bio=bio)
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
@@ -96,7 +68,7 @@ async def get_person_by_id(
|
|||||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||||
"last_known_institutions, ..."
|
"last_known_institutions, ..."
|
||||||
),
|
),
|
||||||
example="topics_full,topic_share",
|
examples="topics_full,topic_share",
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
):
|
):
|
||||||
@@ -119,11 +91,11 @@ async def search_persons_by_name(
|
|||||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||||
"last_known_institutions, ..."
|
"last_known_institutions, ..."
|
||||||
),
|
),
|
||||||
example="topics_full,topic_share",
|
examples="topics_full,topic_share",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
limit:Annotated[int | None, Query(description=("Limit of search page results"),example ="2")]= None,
|
limit:Annotated[int | None, Query(description=("Limit of search page results"),examples ="2")]= None,
|
||||||
page_offset : Annotated[int | None, Query(description=("Offset of the result page"),example="2")] = None,
|
page_offset : Annotated[int | None, Query(description=("Offset of the result page"),examples="2")] = None,
|
||||||
):
|
):
|
||||||
return await logic.search_persons_by_name(author_name=author_name, include=include, page_offset=page_offset, limit=limit)
|
return await logic.search_persons_by_name(author_name=author_name, include=include, page_offset=page_offset, limit=limit)
|
||||||
|
|
||||||
@@ -141,7 +113,7 @@ async def search_persons_autocomplete(
|
|||||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||||
"last_known_institutions, ..."
|
"last_known_institutions, ..."
|
||||||
),
|
),
|
||||||
example="topics_full,topic_share"
|
examples="topics_full,topic_share"
|
||||||
)]):
|
)]):
|
||||||
return await logic.search_persons_autocomplete(author_name=author_name, include=include)
|
return await logic.search_persons_autocomplete(author_name=author_name, include=include)
|
||||||
|
|
||||||
@@ -181,7 +153,7 @@ async def search_persons_list(
|
|||||||
str | None,
|
str | None,
|
||||||
Query(
|
Query(
|
||||||
description="Comma-separated include tags",
|
description="Comma-separated include tags",
|
||||||
example="topics_full,topic_share",
|
examples="topics_full,topic_share",
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
year_filter_enabled: Annotated[
|
year_filter_enabled: Annotated[
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from inse import config
|
||||||
|
from inse.exceptions import NotFoundException
|
||||||
|
from inse.persons import service
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture()
|
||||||
|
def anyio_backend():
|
||||||
|
return "asyncio"
|
||||||
|
|
||||||
|
|
||||||
|
def elasticsearch_configured():
|
||||||
|
return bool(
|
||||||
|
config.settings.elasticsearch_url and config.settings.elasticsearch_api_key
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def llm_configured():
|
||||||
|
return bool(
|
||||||
|
config.settings.llm_api_url
|
||||||
|
and config.settings.llm_api_key
|
||||||
|
and config.settings.llm_model
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
requires_elasticsearch = pytest.mark.skipif(
|
||||||
|
not elasticsearch_configured(), reason="Elasticsearch is not configured"
|
||||||
|
)
|
||||||
|
requires_elasticsearch_and_llm = pytest.mark.skipif(
|
||||||
|
not (elasticsearch_configured() and llm_configured()),
|
||||||
|
reason="Elasticsearch and/or LLM are not configured",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
@requires_elasticsearch_and_llm
|
||||||
|
async def test_bio_is_generated_for_person():
|
||||||
|
response = await service.generate_person_bio(author_id="A5093075883")
|
||||||
|
|
||||||
|
assert len(response.bio) >= 10, f"bio is too short: {response.bio!r}"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
@requires_elasticsearch
|
||||||
|
async def test_bio_generation_fails_for_unknown_author():
|
||||||
|
with pytest.raises(NotFoundException):
|
||||||
|
await service.generate_person_bio(author_id="A000")
|
||||||
@@ -508,7 +508,7 @@ def _eu_sort_field(sort_by: str) -> str:
|
|||||||
"id": "id",
|
"id": "id",
|
||||||
"project_type": "_index",
|
"project_type": "_index",
|
||||||
}
|
}
|
||||||
return mapping.get(sort_by, "title.keyword")
|
return mapping.get(sort_by, "")
|
||||||
|
|
||||||
|
|
||||||
async def get_eu_project_ids_by_organization_filters(
|
async def get_eu_project_ids_by_organization_filters(
|
||||||
@@ -741,6 +741,8 @@ async def _build_eu_cordis_search_query(
|
|||||||
title: str | None = None,
|
title: str | None = None,
|
||||||
funding_start_years: list[str] | None = None,
|
funding_start_years: list[str] | None = None,
|
||||||
funding_end_years: list[str] | None = None,
|
funding_end_years: list[str] | None = None,
|
||||||
|
active_from_year: int | None = None,
|
||||||
|
active_to_year: int | None = None,
|
||||||
countries: list[str] | None = None,
|
countries: list[str] | None = None,
|
||||||
framework_programmes: list[str] | None = None,
|
framework_programmes: list[str] | None = None,
|
||||||
funding_schemes: list[str] | None = None,
|
funding_schemes: list[str] | None = None,
|
||||||
@@ -779,6 +781,7 @@ async def _build_eu_cordis_search_query(
|
|||||||
topic_project_ids_by_type = await get_eu_project_ids_by_openalex_topic_ids(
|
topic_project_ids_by_type = await get_eu_project_ids_by_openalex_topic_ids(
|
||||||
project_types=project_types,
|
project_types=project_types,
|
||||||
topic_ids=topic_ids,
|
topic_ids=topic_ids,
|
||||||
|
match_all=False
|
||||||
)
|
)
|
||||||
|
|
||||||
topic_filter = _eu_project_type_index_filter(topic_project_ids_by_type)
|
topic_filter = _eu_project_type_index_filter(topic_project_ids_by_type)
|
||||||
@@ -827,13 +830,14 @@ async def _build_eu_cordis_search_query(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if keyword_clauses:
|
if keyword_clauses:
|
||||||
must_clauses.append({"bool": {"must": keyword_clauses}})
|
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
|
||||||
|
|
||||||
# === Independent OpenAlex topic filters ===
|
# === Independent OpenAlex topic filters ===
|
||||||
if filter_topic_ids:
|
if filter_topic_ids:
|
||||||
filter_topic_project_ids_by_type = await get_eu_project_ids_by_openalex_topic_ids(
|
filter_topic_project_ids_by_type = await get_eu_project_ids_by_openalex_topic_ids(
|
||||||
project_types=project_types,
|
project_types=project_types,
|
||||||
topic_ids=filter_topic_ids,
|
topic_ids=filter_topic_ids,
|
||||||
|
match_all=True
|
||||||
)
|
)
|
||||||
|
|
||||||
topic_filter = _eu_project_type_index_filter(filter_topic_project_ids_by_type)
|
topic_filter = _eu_project_type_index_filter(filter_topic_project_ids_by_type)
|
||||||
@@ -876,6 +880,18 @@ async def _build_eu_cordis_search_query(
|
|||||||
if funding_end_years:
|
if funding_end_years:
|
||||||
must_clauses.append(_eu_year_filters("endDate", funding_end_years))
|
must_clauses.append(_eu_year_filters("endDate", funding_end_years))
|
||||||
|
|
||||||
|
# Period-overlap filter: a project was active in the selected interval when
|
||||||
|
# it started no later than the interval end and ended no earlier than the
|
||||||
|
# interval start. This is intentionally separate from exact-year filters.
|
||||||
|
if active_to_year is not None:
|
||||||
|
must_clauses.append(
|
||||||
|
{"range": {"startDate": {"lte": f"{active_to_year}-12-31"}}}
|
||||||
|
)
|
||||||
|
if active_from_year is not None:
|
||||||
|
must_clauses.append(
|
||||||
|
{"range": {"endDate": {"gte": f"{active_from_year}-01-01"}}}
|
||||||
|
)
|
||||||
|
|
||||||
# === Project core filters ===
|
# === Project core filters ===
|
||||||
if framework_programmes:
|
if framework_programmes:
|
||||||
must_clauses.append({"terms": {"frameworkProgramme": framework_programmes}})
|
must_clauses.append({"terms": {"frameworkProgramme": framework_programmes}})
|
||||||
@@ -937,11 +953,13 @@ async def search_eu_cordis_projects(
|
|||||||
title: str | None = None,
|
title: str | None = None,
|
||||||
funding_start_years: list[str] | None = None,
|
funding_start_years: list[str] | None = None,
|
||||||
funding_end_years: list[str] | None = None,
|
funding_end_years: list[str] | None = None,
|
||||||
|
active_from_year: int | None = None,
|
||||||
|
active_to_year: int | None = None,
|
||||||
countries: list[str] | None = None,
|
countries: list[str] | None = None,
|
||||||
framework_programmes: list[str] | None = None,
|
framework_programmes: list[str] | None = None,
|
||||||
funding_schemes: list[str] | None = None,
|
funding_schemes: list[str] | None = None,
|
||||||
statuses: list[str] | None = None,
|
statuses: list[str] | None = None,
|
||||||
sort_by: str = "title",
|
sort_by: str = "",
|
||||||
sort_direction: str = "asc",
|
sort_direction: str = "asc",
|
||||||
fuzzy: bool = False,
|
fuzzy: bool = False,
|
||||||
skip_enrichment: bool = False,
|
skip_enrichment: bool = False,
|
||||||
@@ -965,6 +983,8 @@ async def search_eu_cordis_projects(
|
|||||||
title=title,
|
title=title,
|
||||||
funding_start_years=funding_start_years,
|
funding_start_years=funding_start_years,
|
||||||
funding_end_years=funding_end_years,
|
funding_end_years=funding_end_years,
|
||||||
|
active_from_year=active_from_year,
|
||||||
|
active_to_year=active_to_year,
|
||||||
countries=countries,
|
countries=countries,
|
||||||
framework_programmes=framework_programmes,
|
framework_programmes=framework_programmes,
|
||||||
funding_schemes=funding_schemes,
|
funding_schemes=funding_schemes,
|
||||||
@@ -985,13 +1005,13 @@ async def search_eu_cordis_projects(
|
|||||||
body={
|
body={
|
||||||
"size": size,
|
"size": size,
|
||||||
"from": page * size,
|
"from": page * size,
|
||||||
"track_total_hits": True,
|
|
||||||
"_source": [
|
"_source": [
|
||||||
"id",
|
"id",
|
||||||
"title",
|
"title",
|
||||||
"acronym",
|
"acronym",
|
||||||
"objective",
|
"objective",
|
||||||
"keywords",
|
"keywords",
|
||||||
|
"topics",
|
||||||
"frameworkProgramme",
|
"frameworkProgramme",
|
||||||
"fundingScheme",
|
"fundingScheme",
|
||||||
"status",
|
"status",
|
||||||
@@ -1001,12 +1021,28 @@ async def search_eu_cordis_projects(
|
|||||||
"totalCost",
|
"totalCost",
|
||||||
],
|
],
|
||||||
"query": query,
|
"query": query,
|
||||||
|
"highlight": {
|
||||||
|
"fields": {
|
||||||
|
"title": {},
|
||||||
|
"acronym": {},
|
||||||
|
"objective": {},
|
||||||
|
"keywords": {},
|
||||||
|
"topics": {},
|
||||||
|
},
|
||||||
|
"pre_tags": ["<em>"],
|
||||||
|
"post_tags": ["</em>"],
|
||||||
|
"require_field_match": True,
|
||||||
|
},
|
||||||
"sort": [
|
"sort": [
|
||||||
{
|
{
|
||||||
sort_field: {
|
sort_field: {
|
||||||
"order": sort_direction,
|
"order": sort_direction,
|
||||||
"missing": "_last",
|
"missing": "_last",
|
||||||
"unmapped_type": "keyword" if sort_field.endswith(".keyword") else "date",
|
"unmapped_type": (
|
||||||
|
"keyword"
|
||||||
|
if sort_field.endswith(".keyword")
|
||||||
|
else "date"
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1130,7 +1166,6 @@ async def get_eu_cordis_projects_funding_data(
|
|||||||
while True:
|
while True:
|
||||||
body: dict[str, Any] = {
|
body: dict[str, Any] = {
|
||||||
"size": page_size,
|
"size": page_size,
|
||||||
"track_total_hits": False,
|
|
||||||
"_source": ["id", "startDate", "endDate", "ecMaxContribution"],
|
"_source": ["id", "startDate", "endDate", "ecMaxContribution"],
|
||||||
"query": query,
|
"query": query,
|
||||||
"sort": [{"id": {"order": "asc", "unmapped_type": "keyword"}}],
|
"sort": [{"id": {"order": "asc", "unmapped_type": "keyword"}}],
|
||||||
|
|||||||
@@ -115,134 +115,133 @@ async def get_person_ids_by_institution_ids(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def get_bund_project_ids_by_topic_ids(
|
||||||
async def get_bund_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
topic_ids: list[str],
|
||||||
|
match_all: bool = True,
|
||||||
|
) -> list[str]:
|
||||||
"""
|
"""
|
||||||
Query the `projects_bund_openalex_topics` index to find BUND project IDs
|
Query the `projects_bund_openalex_topics` index to find BUND project IDs
|
||||||
that match any of the given OpenAlex topic IDs.
|
that match:
|
||||||
|
|
||||||
|
- ALL of the given OpenAlex topic IDs if match_all=True
|
||||||
|
- ANY of the given OpenAlex topic IDs if match_all=False
|
||||||
|
|
||||||
|
Topics may be distributed across multiple documents for the same project.
|
||||||
"""
|
"""
|
||||||
if not topic_ids:
|
if not topic_ids:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
required_topics = set(topic_ids)
|
required_topics = set(topic_ids)
|
||||||
|
|
||||||
project_topics: dict[str, set[str]] = defaultdict(set)
|
project_topics: dict[str, set[str]] = defaultdict(set)
|
||||||
|
|
||||||
page_size = 1000
|
body = {
|
||||||
from_ = 0
|
"size": 10000,
|
||||||
|
"_source": ["project_id", "topic_matches"],
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"topic_matches.topic_id.keyword": topic_ids
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
while True:
|
response = await elasticsearch.search(
|
||||||
body = {
|
index=ESIndex.PROJECTS_BUND_TOPICS,
|
||||||
"size": page_size,
|
cluster=ESCluster.INSE,
|
||||||
"from": from_,
|
body=body,
|
||||||
"_source": ["project_id", "topic_matches"],
|
)
|
||||||
"query": {
|
|
||||||
"terms": {
|
|
||||||
"topic_matches.topic_id.keyword": topic_ids
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
response = await elasticsearch.search(
|
hits = response.get("hits", {}).get("hits", [])
|
||||||
index=ESIndex.PROJECTS_BUND_TOPICS,
|
|
||||||
cluster=ESCluster.INSE,
|
|
||||||
body=body,
|
|
||||||
)
|
|
||||||
hits = response.get("hits", {}).get("hits", [])
|
|
||||||
if not hits:
|
|
||||||
break
|
|
||||||
|
|
||||||
for hit in hits:
|
for hit in hits:
|
||||||
source = hit["_source"]
|
source = hit["_source"]
|
||||||
|
|
||||||
project_id = source.get("project_id")
|
project_id = source.get("project_id")
|
||||||
if not project_id:
|
if not project_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
topic_matches = source.get("topic_matches") or []
|
topic_matches = source.get("topic_matches") or []
|
||||||
|
|
||||||
if isinstance(topic_matches, dict):
|
if isinstance(topic_matches, dict):
|
||||||
topic_matches = [topic_matches]
|
topic_matches = [topic_matches]
|
||||||
|
|
||||||
for match in topic_matches:
|
for match in topic_matches:
|
||||||
topic_id = match.get("topic_id")
|
topic_id = match.get("topic_id")
|
||||||
if topic_id in required_topics:
|
if topic_id in required_topics:
|
||||||
project_topics[project_id].add(topic_id)
|
project_topics[project_id].add(topic_id)
|
||||||
|
|
||||||
if len(hits) < page_size:
|
if match_all:
|
||||||
break
|
return [
|
||||||
|
project_id
|
||||||
|
for project_id, found_topics in project_topics.items()
|
||||||
|
if required_topics.issubset(found_topics)
|
||||||
|
]
|
||||||
|
|
||||||
from_ += page_size
|
# OR match: project has at least one requested topic
|
||||||
|
return list(project_topics.keys())
|
||||||
|
|
||||||
return [
|
|
||||||
project_id
|
|
||||||
for project_id, found_topics in project_topics.items()
|
|
||||||
if required_topics.issubset(found_topics)
|
|
||||||
]
|
|
||||||
|
|
||||||
async def get_dfg_project_ids_by_topic_ids(topic_ids: list[str]) -> list[str]:
|
async def get_dfg_project_ids_by_topic_ids(
|
||||||
"""Fetches project IDs whose topic_matches contain EVERY given topic ID,
|
topic_ids: list[str],
|
||||||
even if the topics are distributed across multiple documents for the same project.
|
match_all: bool = True,
|
||||||
|
) -> list[str]:
|
||||||
|
"""
|
||||||
|
Fetches project IDs whose topic_matches contain:
|
||||||
|
|
||||||
|
- ALL given topic IDs if match_all=True
|
||||||
|
- ANY given topic ID if match_all=False
|
||||||
|
|
||||||
|
Topics may be distributed across multiple documents for the same project.
|
||||||
"""
|
"""
|
||||||
if not topic_ids:
|
if not topic_ids:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
required_topics = set(topic_ids)
|
required_topics = set(topic_ids)
|
||||||
|
|
||||||
project_topics: dict[str, set[str]] = defaultdict(set)
|
project_topics: dict[str, set[str]] = defaultdict(set)
|
||||||
|
|
||||||
page_size = 1000
|
body = {
|
||||||
from_ = 0
|
"size": 10000,
|
||||||
|
"_source": ["project_id", "topic_matches"],
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"topic_matches.topic_id.keyword": topic_ids
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
while True:
|
response = await elasticsearch.search(
|
||||||
body = {
|
index=ESIndex.PROJECTS_DFG_TOPICS,
|
||||||
"size": page_size,
|
cluster=ESCluster.INSE,
|
||||||
"from": from_,
|
body=body,
|
||||||
"_source": ["project_id", "topic_matches"],
|
)
|
||||||
"query": {
|
|
||||||
"terms": {
|
|
||||||
"topic_matches.topic_id.keyword": topic_ids
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
response = await elasticsearch.search(
|
hits = response.get("hits", {}).get("hits", [])
|
||||||
index=ESIndex.PROJECTS_DFG_TOPICS,
|
|
||||||
cluster=ESCluster.INSE,
|
|
||||||
body=body,
|
|
||||||
)
|
|
||||||
|
|
||||||
hits = response.get("hits", {}).get("hits", [])
|
for hit in hits:
|
||||||
if not hits:
|
source = hit["_source"]
|
||||||
break
|
|
||||||
|
|
||||||
for hit in hits:
|
project_id = source.get("project_id")
|
||||||
source = hit["_source"]
|
if not project_id:
|
||||||
|
continue
|
||||||
|
|
||||||
project_id = source.get("project_id")
|
topic_matches = source.get("topic_matches") or []
|
||||||
if not project_id:
|
|
||||||
continue
|
|
||||||
|
|
||||||
topic_matches = source.get("topic_matches") or []
|
if isinstance(topic_matches, dict):
|
||||||
|
topic_matches = [topic_matches]
|
||||||
|
|
||||||
if isinstance(topic_matches, dict):
|
for match in topic_matches:
|
||||||
topic_matches = [topic_matches]
|
topic_id = match.get("topic_id")
|
||||||
|
if topic_id in required_topics:
|
||||||
|
project_topics[project_id].add(topic_id)
|
||||||
|
|
||||||
for match in topic_matches:
|
if match_all:
|
||||||
topic_id = match.get("topic_id")
|
return [
|
||||||
if topic_id in required_topics:
|
project_id
|
||||||
project_topics[project_id].add(topic_id)
|
for project_id, found_topics in project_topics.items()
|
||||||
|
if required_topics.issubset(found_topics)
|
||||||
|
]
|
||||||
|
|
||||||
if len(hits) < page_size:
|
# OR match: project has at least one requested topic
|
||||||
break
|
return list(project_topics.keys())
|
||||||
|
|
||||||
from_ += page_size
|
|
||||||
|
|
||||||
return [
|
|
||||||
project_id
|
|
||||||
for project_id, found_topics in project_topics.items()
|
|
||||||
if required_topics.issubset(found_topics)
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
async def get_openalex_topics_for_bund_projects(project_ids: list[str]) -> dict[str, list[dict]]:
|
async def get_openalex_topics_for_bund_projects(project_ids: list[str]) -> dict[str, list[dict]]:
|
||||||
@@ -271,17 +270,34 @@ async def get_openalex_topics_for_bund_projects(project_ids: list[str]) -> dict[
|
|||||||
|
|
||||||
lookup: dict[str, list[dict]] = {}
|
lookup: dict[str, list[dict]] = {}
|
||||||
for hit in response.get("hits", {}).get("hits", []):
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
src = hit["_source"]
|
src = hit["_source"]
|
||||||
pid = src.get("project_id")
|
pid = src.get("project_id")
|
||||||
if pid:
|
|
||||||
lookup[pid] = src.get("topic_matches", [])
|
if not pid:
|
||||||
return lookup
|
continue
|
||||||
|
|
||||||
|
pid = str(pid)
|
||||||
|
|
||||||
|
if pid not in lookup:
|
||||||
|
lookup[pid] = {}
|
||||||
|
|
||||||
|
for topic in src.get("topic_matches", []):
|
||||||
|
topic_id = topic.get("topic_id")
|
||||||
|
|
||||||
|
if topic_id:
|
||||||
|
lookup[pid][str(topic_id)] = topic
|
||||||
|
|
||||||
|
result = {
|
||||||
|
pid: list(topics.values())
|
||||||
|
for pid, topics in lookup.items()
|
||||||
|
}
|
||||||
|
return result
|
||||||
async def get_openalex_topics_for_dfg_projects(
|
async def get_openalex_topics_for_dfg_projects(
|
||||||
project_ids: list[str],
|
project_ids: list[str],
|
||||||
) -> dict[str, list[dict]]:
|
) -> dict[str, list[dict]]:
|
||||||
"""
|
"""
|
||||||
Retrieve OpenAlex topic details for a list of DFG project IDs.
|
Retrieve unique OpenAlex topic details for a list of DFG project IDs.
|
||||||
Returns a dict mapping `project_id` -> list of topic_match objects.
|
Returns a dict mapping `project_id` -> unique list of topic_match objects.
|
||||||
"""
|
"""
|
||||||
if not project_ids:
|
if not project_ids:
|
||||||
return {}
|
return {}
|
||||||
@@ -293,23 +309,41 @@ async def get_openalex_topics_for_dfg_projects(
|
|||||||
"project_id.keyword": project_ids
|
"project_id.keyword": project_ids
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"_source": ["project_id", "topic_matches"]
|
"_source": ["project_id", "topic_matches"],
|
||||||
}
|
}
|
||||||
|
|
||||||
response = await elasticsearch.search(
|
response = await elasticsearch.search(
|
||||||
index=ESIndex.PROJECTS_DFG_TOPICS,
|
index=ESIndex.PROJECTS_DFG_TOPICS,
|
||||||
body=body,
|
body=body,
|
||||||
cluster=ESCluster.INSE
|
cluster=ESCluster.INSE,
|
||||||
)
|
)
|
||||||
|
|
||||||
lookup: dict[str, list[dict]] = {}
|
lookup: dict[str, dict[str, dict]] = {}
|
||||||
|
|
||||||
for hit in response.get("hits", {}).get("hits", []):
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
src = hit["_source"]
|
src = hit["_source"]
|
||||||
pid = src.get("project_id")
|
pid = src.get("project_id")
|
||||||
if pid:
|
|
||||||
lookup[str(pid)] = src.get("topic_matches", [])
|
|
||||||
|
|
||||||
return lookup
|
if not pid:
|
||||||
|
continue
|
||||||
|
|
||||||
|
pid = str(pid)
|
||||||
|
|
||||||
|
if pid not in lookup:
|
||||||
|
lookup[pid] = {}
|
||||||
|
|
||||||
|
for topic in src.get("topic_matches", []):
|
||||||
|
topic_id = topic.get("topic_id")
|
||||||
|
|
||||||
|
if topic_id:
|
||||||
|
lookup[pid][str(topic_id)] = topic
|
||||||
|
|
||||||
|
result = {
|
||||||
|
pid: list(topics.values())
|
||||||
|
for pid, topics in lookup.items()
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
async def get_person_institutes(
|
async def get_person_institutes(
|
||||||
person_ids: list[int],
|
person_ids: list[int],
|
||||||
@@ -411,14 +445,18 @@ async def get_dfg_institutes_by_ids(
|
|||||||
#EU Cordis Projects
|
#EU Cordis Projects
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def get_eu_project_ids_by_openalex_topic_ids(
|
async def get_eu_project_ids_by_openalex_topic_ids(
|
||||||
project_types: list[EuCordisProjectType],
|
project_types: list[EuCordisProjectType],
|
||||||
topic_ids: list[str],
|
topic_ids: list[str],
|
||||||
|
match_all: bool = True,
|
||||||
) -> dict[EuCordisProjectType, list[str]]:
|
) -> dict[EuCordisProjectType, list[str]]:
|
||||||
"""
|
"""
|
||||||
Returns EU CORDIS project IDs whose mapped OpenAlex topic_matches contain
|
Returns EU CORDIS project IDs whose mapped OpenAlex topic_matches contain:
|
||||||
EVERY given topic ID. Same semantics as DFG topic filtering.
|
|
||||||
|
- ALL given topic IDs if match_all=True
|
||||||
|
- ANY given topic ID if match_all=False
|
||||||
|
|
||||||
|
Topics may be distributed across multiple documents for the same project.
|
||||||
"""
|
"""
|
||||||
if not topic_ids:
|
if not topic_ids:
|
||||||
return {project_type: [] for project_type in project_types}
|
return {project_type: [] for project_type in project_types}
|
||||||
@@ -457,15 +495,18 @@ async def get_eu_project_ids_by_openalex_topic_ids(
|
|||||||
for hit in hits:
|
for hit in hits:
|
||||||
source = hit.get("_source", {})
|
source = hit.get("_source", {})
|
||||||
project_id = source.get("project_id")
|
project_id = source.get("project_id")
|
||||||
|
|
||||||
if not project_id:
|
if not project_id:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
topic_matches = source.get("topic_matches") or []
|
topic_matches = source.get("topic_matches") or []
|
||||||
|
|
||||||
if isinstance(topic_matches, dict):
|
if isinstance(topic_matches, dict):
|
||||||
topic_matches = [topic_matches]
|
topic_matches = [topic_matches]
|
||||||
|
|
||||||
for match in topic_matches:
|
for match in topic_matches:
|
||||||
topic_id = match.get("topic_id")
|
topic_id = match.get("topic_id")
|
||||||
|
|
||||||
if topic_id in required_topics:
|
if topic_id in required_topics:
|
||||||
project_topics[project_id].add(topic_id)
|
project_topics[project_id].add(topic_id)
|
||||||
|
|
||||||
@@ -474,11 +515,15 @@ async def get_eu_project_ids_by_openalex_topic_ids(
|
|||||||
|
|
||||||
from_ += page_size
|
from_ += page_size
|
||||||
|
|
||||||
result[project_type] = [
|
if match_all:
|
||||||
project_id
|
result[project_type] = [
|
||||||
for project_id, found_topics in project_topics.items()
|
project_id
|
||||||
if required_topics.issubset(found_topics)
|
for project_id, found_topics in project_topics.items()
|
||||||
]
|
if required_topics.issubset(found_topics)
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
# OR match: project has at least one requested topic
|
||||||
|
result[project_type] = list(project_topics.keys())
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,25 @@ class Page(BaseModel):
|
|||||||
page: int = Field(default=0, description="The current page number.")
|
page: int = Field(default=0, description="The current page number.")
|
||||||
size: int = Field(default=20, description="The requested page size.")
|
size: int = Field(default=20, description="The requested page size.")
|
||||||
total: int = Field(default=0, description="The total number of items.")
|
total: int = Field(default=0, description="The total number of items.")
|
||||||
|
class BundProjectHighlight(BaseModel):
|
||||||
|
"""Highlighted matching fragments from a BUND project search."""
|
||||||
|
|
||||||
|
joint_project: list[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description='Highlights from the Elasticsearch field "Verbundprojekt".',
|
||||||
|
)
|
||||||
|
topic: list[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description='Highlights from the Elasticsearch field "Thema".',
|
||||||
|
)
|
||||||
|
recipient: list[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description='Highlights from the Elasticsearch field "Zuwendungsempfänger".',
|
||||||
|
)
|
||||||
|
executing_agency: list[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description='Highlights from the Elasticsearch field "Ausführende Stelle".',
|
||||||
|
)
|
||||||
class BundProjectSummary(BundProject):
|
class BundProjectSummary(BundProject):
|
||||||
oa_topics: list[Topic] | None = Field(
|
oa_topics: list[Topic] | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
@@ -86,22 +104,34 @@ class BundProjectSummary(BundProject):
|
|||||||
description="The executing agency / recipient institution for this project, "
|
description="The executing agency / recipient institution for this project, "
|
||||||
"derived from the project's own agency fields.",
|
"derived from the project's own agency fields.",
|
||||||
)
|
)
|
||||||
|
highlight: BundProjectHighlight | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Highlighted matching fragments from the project search.",
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_hit(cls, hit: dict) -> "BundProjectSummary":
|
def from_hit(cls, hit: dict[str, Any]) -> "BundProjectSummary":
|
||||||
"""Create a BundProjectSummary from an Elasticsearch hit."""
|
"""Create a BundProjectSummary from an Elasticsearch hit."""
|
||||||
|
|
||||||
source = hit.get("_source", {})
|
source = hit.get("_source", {})
|
||||||
|
|
||||||
|
|
||||||
topics_raw = source.get("oa_topics") or []
|
topics_raw = source.get("oa_topics") or []
|
||||||
oa_topics = None
|
oa_topics = None
|
||||||
if isinstance(topics_raw, list) and topics_raw:
|
|
||||||
|
|
||||||
|
if isinstance(topics_raw, list) and topics_raw:
|
||||||
sorted_topics_raw = sorted(
|
sorted_topics_raw = sorted(
|
||||||
(t for t in topics_raw if isinstance(t, dict)),
|
(topic for topic in topics_raw if isinstance(topic, dict)),
|
||||||
key=lambda t: t.get("rank") if t.get("rank") is not None else float("inf"),
|
key=lambda topic: (
|
||||||
|
topic.get("rank")
|
||||||
|
if topic.get("rank") is not None
|
||||||
|
else float("inf")
|
||||||
|
),
|
||||||
)
|
)
|
||||||
oa_topics = [cls._topic_from_match(t) for t in sorted_topics_raw]
|
oa_topics = [
|
||||||
|
cls._topic_from_match(topic)
|
||||||
|
for topic in sorted_topics_raw
|
||||||
|
]
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
funding_code=source.get("Förderkennzeichen"),
|
funding_code=source.get("Förderkennzeichen"),
|
||||||
department=source.get("Ressort"),
|
department=source.get("Ressort"),
|
||||||
@@ -116,10 +146,12 @@ class BundProjectSummary(BundProject):
|
|||||||
place=source.get("Ort"),
|
place=source.get("Ort"),
|
||||||
state=source.get("Bundesland"),
|
state=source.get("Bundesland"),
|
||||||
country=source.get("Staat"),
|
country=source.get("Staat"),
|
||||||
implementing_agency=source.get("Ausführende Stelle"),
|
executing_agency=source.get("Ausführende Stelle"),
|
||||||
topic=source.get("Thema"),
|
topic=source.get("Thema"),
|
||||||
performance_plan_system=source.get("Leistungsplansystematik"),
|
performance_plan_system=source.get("Leistungsplansystematik"),
|
||||||
performance_plan_system_text=source.get("Klartext Leistungsplansystematik"),
|
performance_plan_system_text=source.get(
|
||||||
|
"Klartext Leistungsplansystematik"
|
||||||
|
),
|
||||||
funding_start=source.get("funding_start"),
|
funding_start=source.get("funding_start"),
|
||||||
funding_end=source.get("funding_end"),
|
funding_end=source.get("funding_end"),
|
||||||
grant_amount=source.get("Fördersumme"),
|
grant_amount=source.get("Fördersumme"),
|
||||||
@@ -133,8 +165,61 @@ class BundProjectSummary(BundProject):
|
|||||||
duration=source.get("Laufzeit"),
|
duration=source.get("Laufzeit"),
|
||||||
oa_topics=oa_topics,
|
oa_topics=oa_topics,
|
||||||
institution=BundInstitutionSummary.from_source(source),
|
institution=BundInstitutionSummary.from_source(source),
|
||||||
|
highlight=cls._highlight_from_hit(hit),
|
||||||
)
|
)
|
||||||
|
@staticmethod
|
||||||
|
def _highlight_fragments(value: Any) -> list[str]:
|
||||||
|
"""Normalize an Elasticsearch highlight value to a list of strings."""
|
||||||
|
|
||||||
|
if isinstance(value, str):
|
||||||
|
return [value]
|
||||||
|
|
||||||
|
if isinstance(value, list):
|
||||||
|
return [
|
||||||
|
fragment
|
||||||
|
for fragment in value
|
||||||
|
if isinstance(fragment, str)
|
||||||
|
]
|
||||||
|
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _highlight_from_hit(
|
||||||
|
cls,
|
||||||
|
hit: dict[str, Any],
|
||||||
|
) -> BundProjectHighlight | None:
|
||||||
|
"""Extract BUND project highlights from an Elasticsearch hit."""
|
||||||
|
|
||||||
|
raw_highlight = hit.get("highlight")
|
||||||
|
if not isinstance(raw_highlight, dict):
|
||||||
|
return None
|
||||||
|
|
||||||
|
highlight = BundProjectHighlight(
|
||||||
|
joint_project=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("Verbundprojekt")
|
||||||
|
),
|
||||||
|
topic=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("Thema")
|
||||||
|
),
|
||||||
|
recipient=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("Zuwendungsempfänger")
|
||||||
|
),
|
||||||
|
executing_agency=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("Ausführende Stelle")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
has_highlights = any(
|
||||||
|
(
|
||||||
|
highlight.joint_project,
|
||||||
|
highlight.topic,
|
||||||
|
highlight.recipient,
|
||||||
|
highlight.executing_agency,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return highlight if has_highlights else None
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _topic_from_match(match: dict[str, Any]) -> Topic:
|
def _topic_from_match(match: dict[str, Any]) -> Topic:
|
||||||
"""Builds a Topic model from a flattened topic_match dict.
|
"""Builds a Topic model from a flattened topic_match dict.
|
||||||
@@ -163,16 +248,42 @@ class BundProjectPage(Page):
|
|||||||
default_factory=list, description="The bund projects on this page."
|
default_factory=list, description="The bund projects on this page."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BundProjectList(BaseModel):
|
class BundProjectList(BaseModel):
|
||||||
elements: list[BundProjectSummary] = Field(
|
elements: list[BundProjectSummary] = Field(
|
||||||
default_factory=list, description="All bund projects."
|
default_factory=list, description="All bund projects."
|
||||||
)
|
)
|
||||||
total: int = Field(default=0, description="The total number of bund projects.")
|
total: int = Field(default=0, description="The total number of bund projects.")
|
||||||
|
class DfgSubjectClassificationHighlight(BaseModel):
|
||||||
|
"""A highlighted nested subject classification."""
|
||||||
|
|
||||||
|
query: str = Field(
|
||||||
|
description="The keyword/inner_hits group which produced this match.",
|
||||||
|
)
|
||||||
|
|
||||||
|
offset: int | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Index of the matched item in subject_classifications.",
|
||||||
|
)
|
||||||
|
|
||||||
|
fach: list[str] = Field(default_factory=list)
|
||||||
|
fachkollegium: list[str] = Field(default_factory=list)
|
||||||
|
fachgebiet: list[str] = Field(default_factory=list)
|
||||||
|
fachgebiet_de: list[str] = Field(default_factory=list)
|
||||||
|
wissenschaftsbereich: list[str] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
class DfgProjectHighlight(BaseModel):
|
||||||
|
"""Highlighted fragments returned for a DFG project."""
|
||||||
|
|
||||||
|
title_de: list[str] = Field(default_factory=list)
|
||||||
|
title_en: list[str] = Field(default_factory=list)
|
||||||
|
|
||||||
|
abstract_de: list[str] = Field(default_factory=list)
|
||||||
|
abstract_en: list[str] = Field(default_factory=list)
|
||||||
|
|
||||||
|
subject_classifications: list[DfgSubjectClassificationHighlight] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
)
|
||||||
class DfgInstitutionSummary(BaseModel):
|
class DfgInstitutionSummary(BaseModel):
|
||||||
"""A summary of a DFG institution."""
|
"""A summary of a DFG institution."""
|
||||||
id: int
|
id: int
|
||||||
@@ -205,16 +316,22 @@ class DfgProjectSummary(BaseModel):
|
|||||||
description="The link to the DFG project details."
|
description="The link to the DFG project details."
|
||||||
)
|
)
|
||||||
|
|
||||||
title: str | None = Field(
|
title_de: str | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
description="The title of the DFG project."
|
description="The title of the DFG project in German."
|
||||||
)
|
)
|
||||||
|
|
||||||
professional_classification: str | None = Field(
|
title_en: str | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
description="The professional classification of the DFG project."
|
description="The title of the DFG project in English."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
subject_classifications_raw: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="The subject classifications of the DFG project."
|
||||||
|
)
|
||||||
|
abstract_de: str | None = Field( default=None, description="The abstract of the DFG project in German.")
|
||||||
|
abstract_en: str | None = Field( default=None, description="The abstract of the DFG project in English.")
|
||||||
|
|
||||||
funding_start: str | None = Field(
|
funding_start: str | None = Field(
|
||||||
default=None,
|
default=None,
|
||||||
@@ -246,11 +363,17 @@ class DfgProjectSummary(BaseModel):
|
|||||||
default=None,
|
default=None,
|
||||||
description="The topics associated with the DFG project.",
|
description="The topics associated with the DFG project.",
|
||||||
)
|
)
|
||||||
|
highlight: DfgProjectHighlight | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Highlighted matching fragments.",
|
||||||
|
)
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_hit(cls, hit: dict) -> "DfgProjectSummary":
|
def from_hit(cls, hit: dict) -> "DfgProjectSummary":
|
||||||
source = hit.get("_source", {})
|
source = hit.get("_source", {})
|
||||||
fields = hit.get("fields", {})
|
|
||||||
|
source_id = source.get("id")
|
||||||
|
project_id = source_id if source_id is not None else hit.get("_id", "")
|
||||||
|
|
||||||
names = []
|
names = []
|
||||||
institutions = {}
|
institutions = {}
|
||||||
project_persons = []
|
project_persons = []
|
||||||
@@ -338,7 +461,6 @@ class DfgProjectSummary(BaseModel):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
topics_raw = source.get("topics") or []
|
topics_raw = source.get("topics") or []
|
||||||
print(f"Raw topics for DFG project {hit.get('_id', '')}: {topics_raw}")
|
|
||||||
topics = None
|
topics = None
|
||||||
if isinstance(topics_raw, list) and topics_raw:
|
if isinstance(topics_raw, list) and topics_raw:
|
||||||
# Sort by rank if present, so the most relevant topic comes first
|
# Sort by rank if present, so the most relevant topic comes first
|
||||||
@@ -348,34 +470,51 @@ class DfgProjectSummary(BaseModel):
|
|||||||
)
|
)
|
||||||
topics = [cls._topic_from_match(t) for t in sorted_topics_raw]
|
topics = [cls._topic_from_match(t) for t in sorted_topics_raw]
|
||||||
|
|
||||||
|
|
||||||
|
subject_classifications = source.get("subject_classifications")
|
||||||
|
if not isinstance(subject_classifications, list):
|
||||||
|
subject_classifications = []
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
id=hit.get("_id", ""),
|
id=str(project_id),
|
||||||
|
|
||||||
link=source.get("link") or source.get("page_url"),
|
link=source.get("link") or source.get("page_url"),
|
||||||
title=(
|
page_url=source.get("page_url"),
|
||||||
source.get("title")
|
|
||||||
or source.get("title_de")
|
title_de=source.get("title_de"),
|
||||||
or source.get("title_en")
|
title_en=source.get("title_en"),
|
||||||
),
|
|
||||||
professional_classification=(
|
abstract_de=source.get("abstract_de"),
|
||||||
source.get("Fachliche Zuordnung")
|
abstract_en=source.get("abstract_en"),
|
||||||
or source.get("subject_area_de")
|
|
||||||
|
subject_classifications_raw=(
|
||||||
|
source.get("subject_area_de")
|
||||||
or source.get("subject_area_en")
|
or source.get("subject_area_en")
|
||||||
),
|
),
|
||||||
|
|
||||||
funding_start=(
|
funding_start=(
|
||||||
str(source.get("funding_start"))
|
str(source["funding_start"])
|
||||||
if source.get("funding_start") is not None
|
if source.get("funding_start") is not None
|
||||||
else None
|
else None
|
||||||
),
|
),
|
||||||
funding_end=(
|
funding_end=(
|
||||||
str(source.get("funding_end"))
|
str(source["funding_end"])
|
||||||
if source.get("funding_end") is not None
|
if source.get("funding_end") is not None
|
||||||
else None
|
else None
|
||||||
),
|
),
|
||||||
|
|
||||||
institutions=list(institutions.values()),
|
institutions=list(institutions.values()),
|
||||||
names=names,
|
names=names,
|
||||||
persons=project_persons,
|
persons=project_persons,
|
||||||
subject_classifications=[DFGProjectFachgebieteInner.from_dict(cls) for cls in source.get('subject_classifications', [])],
|
|
||||||
topics=topics
|
subject_classifications=[
|
||||||
|
DFGProjectFachgebieteInner.from_dict(classification)
|
||||||
|
for classification in subject_classifications
|
||||||
|
if isinstance(classification, dict)
|
||||||
|
],
|
||||||
|
|
||||||
|
topics=topics or [],
|
||||||
|
highlight=cls._highlight_from_hit(hit),
|
||||||
)
|
)
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _topic_from_match(match: dict[str, Any]) -> Topic:
|
def _topic_from_match(match: dict[str, Any]) -> Topic:
|
||||||
@@ -412,13 +551,146 @@ class DfgProjectSummary(BaseModel):
|
|||||||
field=field,
|
field=field,
|
||||||
subfield=subfield,
|
subfield=subfield,
|
||||||
)
|
)
|
||||||
|
@staticmethod
|
||||||
|
def _highlight_fragments(value: Any) -> list[str]:
|
||||||
|
"""Normalize an Elasticsearch highlight value."""
|
||||||
|
|
||||||
|
if isinstance(value, str):
|
||||||
|
return [value]
|
||||||
|
|
||||||
|
if isinstance(value, list):
|
||||||
|
return [
|
||||||
|
fragment
|
||||||
|
for fragment in value
|
||||||
|
if isinstance(fragment, str)
|
||||||
|
]
|
||||||
|
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _highlight_from_hit(
|
||||||
|
cls,
|
||||||
|
hit: dict[str, Any],
|
||||||
|
) -> DfgProjectHighlight | None:
|
||||||
|
"""Parse top-level and nested highlights from an Elasticsearch hit."""
|
||||||
|
|
||||||
|
raw_highlight = hit.get("highlight")
|
||||||
|
if not isinstance(raw_highlight, dict):
|
||||||
|
raw_highlight = {}
|
||||||
|
|
||||||
|
result = DfgProjectHighlight(
|
||||||
|
title_de=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("title_de")
|
||||||
|
),
|
||||||
|
title_en=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("title_en")
|
||||||
|
),
|
||||||
|
abstract_de=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("abstract_de")
|
||||||
|
),
|
||||||
|
abstract_en=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("abstract_en")
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
raw_inner_hits = hit.get("inner_hits")
|
||||||
|
|
||||||
|
if isinstance(raw_inner_hits, dict):
|
||||||
|
for query_name, inner_hit_group in raw_inner_hits.items():
|
||||||
|
if not isinstance(inner_hit_group, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
inner_hits_block = inner_hit_group.get("hits")
|
||||||
|
if not isinstance(inner_hits_block, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
nested_hits = inner_hits_block.get("hits", [])
|
||||||
|
if not isinstance(nested_hits, list):
|
||||||
|
continue
|
||||||
|
|
||||||
|
for nested_hit in nested_hits:
|
||||||
|
if not isinstance(nested_hit, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
nested_highlight = nested_hit.get("highlight")
|
||||||
|
if not isinstance(nested_highlight, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
nested_metadata = nested_hit.get("_nested")
|
||||||
|
offset = None
|
||||||
|
|
||||||
|
if isinstance(nested_metadata, dict):
|
||||||
|
raw_offset = nested_metadata.get("offset")
|
||||||
|
if isinstance(raw_offset, int):
|
||||||
|
offset = raw_offset
|
||||||
|
|
||||||
|
parsed_nested_highlight = (
|
||||||
|
DfgSubjectClassificationHighlight(
|
||||||
|
query=str(query_name),
|
||||||
|
offset=offset,
|
||||||
|
fach=cls._highlight_fragments(
|
||||||
|
nested_highlight.get(
|
||||||
|
"subject_classifications.fach"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
fachkollegium=cls._highlight_fragments(
|
||||||
|
nested_highlight.get(
|
||||||
|
"subject_classifications.fachkollegium"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
fachgebiet=cls._highlight_fragments(
|
||||||
|
nested_highlight.get(
|
||||||
|
"subject_classifications.fachgebiet"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
fachgebiet_de=cls._highlight_fragments(
|
||||||
|
nested_highlight.get(
|
||||||
|
"subject_classifications.fachgebiet_de"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
wissenschaftsbereich=cls._highlight_fragments(
|
||||||
|
nested_highlight.get(
|
||||||
|
"subject_classifications."
|
||||||
|
"wissenschaftsbereich"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
# Do not expose empty nested highlight objects.
|
||||||
|
has_nested_fragments = any(
|
||||||
|
(
|
||||||
|
parsed_nested_highlight.fach,
|
||||||
|
parsed_nested_highlight.fachkollegium,
|
||||||
|
parsed_nested_highlight.fachgebiet,
|
||||||
|
parsed_nested_highlight.fachgebiet_de,
|
||||||
|
parsed_nested_highlight.wissenschaftsbereich,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if has_nested_fragments:
|
||||||
|
result.subject_classifications.append(
|
||||||
|
parsed_nested_highlight
|
||||||
|
)
|
||||||
|
|
||||||
|
has_highlights = any(
|
||||||
|
(
|
||||||
|
result.title_de,
|
||||||
|
result.title_en,
|
||||||
|
result.abstract_de,
|
||||||
|
result.abstract_en,
|
||||||
|
result.subject_classifications,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return result if has_highlights else None
|
||||||
|
|
||||||
class DfgProjectPage(Page):
|
class DfgProjectPage(Page):
|
||||||
elements: list[DfgProjectSummary] = Field(
|
elements: list[DfgProjectSummary] = Field(
|
||||||
default_factory=list, description="The DFG projects on this page."
|
default_factory=list, description="The DFG projects on this page."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class InstitutionFunderSummary(BaseModel):
|
class InstitutionFunderSummary(BaseModel):
|
||||||
type: ProjectType = Field(
|
type: ProjectType = Field(
|
||||||
description="The type of funding data (e.g., 'bund', 'eu', 'dfg')."
|
description="The type of funding data (e.g., 'bund', 'eu', 'dfg')."
|
||||||
@@ -706,7 +978,20 @@ class EuCordisEurosciVocSummary(BaseModel):
|
|||||||
description=source.get("description"),
|
description=source.get("description"),
|
||||||
path=source.get("path"),
|
path=source.get("path"),
|
||||||
)
|
)
|
||||||
|
class EuCordisProjectHighlight(BaseModel):
|
||||||
|
"""Highlighted fragments returned by Elasticsearch."""
|
||||||
|
|
||||||
|
title: list[str] = Field(default_factory=list)
|
||||||
|
acronym: list[str] = Field(default_factory=list)
|
||||||
|
objective: list[str] = Field(default_factory=list)
|
||||||
|
keywords: list[str] = Field(default_factory=list)
|
||||||
|
|
||||||
|
# Elasticsearch source/highlight field is "topics", but "topics" is already
|
||||||
|
# used by the API model for mapped OpenAlex Topic objects.
|
||||||
|
cordis_topic_text: list[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="Highlighted fragments from the CORDIS topics text field.",
|
||||||
|
)
|
||||||
|
|
||||||
class EuCordisProjectSummary(BaseModel):
|
class EuCordisProjectSummary(BaseModel):
|
||||||
id: str
|
id: str
|
||||||
@@ -731,7 +1016,18 @@ class EuCordisProjectSummary(BaseModel):
|
|||||||
cordis_topics: list[EuCordisTopicSummary] = Field(default_factory=list)
|
cordis_topics: list[EuCordisTopicSummary] = Field(default_factory=list)
|
||||||
eurosci_voc: list[EuCordisEurosciVocSummary] = Field(default_factory=list)
|
eurosci_voc: list[EuCordisEurosciVocSummary] = Field(default_factory=list)
|
||||||
topics: list[Topic] = Field(default_factory=list, description="Mapped OpenAlex topics.")
|
topics: list[Topic] = Field(default_factory=list, description="Mapped OpenAlex topics.")
|
||||||
|
cordis_topic_text: str | None = Field(
|
||||||
|
default=None,
|
||||||
|
description=(
|
||||||
|
"Original CORDIS topics text from the Elasticsearch project "
|
||||||
|
"document, for example 'MSCA-IF-2018'."
|
||||||
|
),
|
||||||
|
)
|
||||||
|
highlight: EuCordisProjectHighlight | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Highlighted matching fragments from the project search.",
|
||||||
|
)
|
||||||
|
@classmethod
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_hit(
|
def from_hit(
|
||||||
cls,
|
cls,
|
||||||
@@ -743,16 +1039,23 @@ class EuCordisProjectSummary(BaseModel):
|
|||||||
topics: list[Topic] | None = None,
|
topics: list[Topic] | None = None,
|
||||||
) -> "EuCordisProjectSummary":
|
) -> "EuCordisProjectSummary":
|
||||||
source = hit.get("_source", {})
|
source = hit.get("_source", {})
|
||||||
project_type = EuCordisProjectType.from_index_name(hit.get("_index", ""))
|
project_type = EuCordisProjectType.from_index_name(
|
||||||
|
hit.get("_index", "")
|
||||||
|
)
|
||||||
|
|
||||||
|
project_id = source.get("id")
|
||||||
|
if project_id is None:
|
||||||
|
project_id = hit.get("_id", "")
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
id=source.get("id") or hit.get("_id", ""),
|
id=str(project_id),
|
||||||
project_type=project_type,
|
project_type=project_type,
|
||||||
|
|
||||||
title=source.get("title"),
|
title=source.get("title"),
|
||||||
acronym=source.get("acronym"),
|
acronym=source.get("acronym"),
|
||||||
objective=source.get("objective"),
|
objective=source.get("objective"),
|
||||||
keywords=source.get("keywords"),
|
keywords=source.get("keywords"),
|
||||||
|
cordis_topic_text=source.get("topics"),
|
||||||
|
|
||||||
framework_programme=source.get("frameworkProgramme"),
|
framework_programme=source.get("frameworkProgramme"),
|
||||||
funding_scheme=source.get("fundingScheme"),
|
funding_scheme=source.get("fundingScheme"),
|
||||||
@@ -764,13 +1067,71 @@ class EuCordisProjectSummary(BaseModel):
|
|||||||
ec_max_contribution=source.get("ecMaxContribution"),
|
ec_max_contribution=source.get("ecMaxContribution"),
|
||||||
total_cost=source.get("totalCost"),
|
total_cost=source.get("totalCost"),
|
||||||
|
|
||||||
authors=authors or None,
|
authors=authors,
|
||||||
organizations=organizations or [],
|
organizations=organizations or [],
|
||||||
cordis_topics=cordis_topics or [],
|
cordis_topics=cordis_topics or [],
|
||||||
eurosci_voc=eurosci_voc or [],
|
eurosci_voc=eurosci_voc or [],
|
||||||
topics=topics or [],
|
topics=topics or [],
|
||||||
|
|
||||||
|
highlight=cls._highlight_from_hit(hit),
|
||||||
|
)
|
||||||
|
@staticmethod
|
||||||
|
def _highlight_fragments(value: Any) -> list[str]:
|
||||||
|
"""Normalize an Elasticsearch highlight value to a list of strings."""
|
||||||
|
|
||||||
|
if isinstance(value, str):
|
||||||
|
return [value]
|
||||||
|
|
||||||
|
if isinstance(value, list):
|
||||||
|
return [
|
||||||
|
fragment
|
||||||
|
for fragment in value
|
||||||
|
if isinstance(fragment, str)
|
||||||
|
]
|
||||||
|
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _highlight_from_hit(
|
||||||
|
cls,
|
||||||
|
hit: dict[str, Any],
|
||||||
|
) -> EuCordisProjectHighlight | None:
|
||||||
|
"""Extract project highlights from an Elasticsearch hit."""
|
||||||
|
|
||||||
|
raw_highlight = hit.get("highlight")
|
||||||
|
if not isinstance(raw_highlight, dict):
|
||||||
|
return None
|
||||||
|
|
||||||
|
highlight = EuCordisProjectHighlight(
|
||||||
|
title=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("title")
|
||||||
|
),
|
||||||
|
acronym=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("acronym")
|
||||||
|
),
|
||||||
|
objective=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("objective")
|
||||||
|
),
|
||||||
|
keywords=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("keywords")
|
||||||
|
),
|
||||||
|
cordis_topic_text=cls._highlight_fragments(
|
||||||
|
raw_highlight.get("topics")
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
has_highlights = any(
|
||||||
|
(
|
||||||
|
highlight.title,
|
||||||
|
highlight.acronym,
|
||||||
|
highlight.objective,
|
||||||
|
highlight.keywords,
|
||||||
|
highlight.cordis_topic_text,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return highlight if has_highlights else None
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def topic_from_match(match: dict[str, Any]) -> Topic:
|
def topic_from_match(match: dict[str, Any]) -> Topic:
|
||||||
domain_name = match.get("domain")
|
domain_name = match.get("domain")
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ async def search_bund_projects(
|
|||||||
|
|
||||||
response = await elasticsearch.search(
|
response = await elasticsearch.search(
|
||||||
index=ESIndex.PROJECTS_BUND_V1,
|
index=ESIndex.PROJECTS_BUND_V1,
|
||||||
track_total_hits=True,
|
|
||||||
query=query,
|
query=query,
|
||||||
sort=sort,
|
sort=sort,
|
||||||
size=filter_properties.size,
|
size=filter_properties.size,
|
||||||
@@ -365,10 +364,12 @@ async def search_dfg_projects(
|
|||||||
title: str | None = None,
|
title: str | None = None,
|
||||||
funding_start_years: list[str] | None = None,
|
funding_start_years: list[str] | None = None,
|
||||||
funding_end_years: list[str] | None = None,
|
funding_end_years: list[str] | None = None,
|
||||||
sort_by: str = "id",
|
sort_by: str = "",
|
||||||
sort_direction: str = "asc",
|
sort_direction: str = "asc",
|
||||||
fuzzy: bool = False,
|
fuzzy: bool = False,
|
||||||
skip_enrichment: bool = False,
|
skip_enrichment: bool = False,
|
||||||
|
active_from_year: int | None = None,
|
||||||
|
active_to_year: int | None = None,
|
||||||
) -> DfgProjectPage:
|
) -> DfgProjectPage:
|
||||||
"""Searches for DFG projects based on the provided filtering and sorting criteria.
|
"""Searches for DFG projects based on the provided filtering and sorting criteria.
|
||||||
|
|
||||||
@@ -399,7 +400,6 @@ async def search_dfg_projects(
|
|||||||
body: dict[str, Any] = {
|
body: dict[str, Any] = {
|
||||||
"size": size,
|
"size": size,
|
||||||
"from": from_,
|
"from": from_,
|
||||||
"track_total_hits": True,
|
|
||||||
"_source": [
|
"_source": [
|
||||||
"id",
|
"id",
|
||||||
"link",
|
"link",
|
||||||
@@ -407,9 +407,10 @@ async def search_dfg_projects(
|
|||||||
"title",
|
"title",
|
||||||
"title_de",
|
"title_de",
|
||||||
"title_en",
|
"title_en",
|
||||||
|
"abstract_de",
|
||||||
|
"abstract_en",
|
||||||
"funding_start",
|
"funding_start",
|
||||||
"funding_end",
|
"funding_end",
|
||||||
"Fachliche Zuordnung",
|
|
||||||
"subject_area_de",
|
"subject_area_de",
|
||||||
"subject_area_en",
|
"subject_area_en",
|
||||||
"persons",
|
"persons",
|
||||||
@@ -425,9 +426,8 @@ async def search_dfg_projects(
|
|||||||
# === Primary search clause: mutually exclusive fuzzy(topic_ids) vs keyword phrase search ===
|
# === Primary search clause: mutually exclusive fuzzy(topic_ids) vs keyword phrase search ===
|
||||||
if fuzzy and topic_ids:
|
if fuzzy and topic_ids:
|
||||||
matching_project_ids = await get_dfg_project_ids_by_topic_ids(
|
matching_project_ids = await get_dfg_project_ids_by_topic_ids(
|
||||||
topic_ids=topic_ids
|
topic_ids=topic_ids, match_all = False
|
||||||
)
|
)
|
||||||
|
|
||||||
if not matching_project_ids:
|
if not matching_project_ids:
|
||||||
return DfgProjectPage(elements=[], total=0, page=page, size=size)
|
return DfgProjectPage(elements=[], total=0, page=page, size=size)
|
||||||
|
|
||||||
@@ -435,35 +435,94 @@ async def search_dfg_projects(
|
|||||||
|
|
||||||
elif keywords:
|
elif keywords:
|
||||||
keyword_clauses = []
|
keyword_clauses = []
|
||||||
|
#Add highlighting for the title and abstract fields
|
||||||
|
title_abstract_query = {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{
|
||||||
|
"multi_match": {
|
||||||
|
"query": keyword,
|
||||||
|
"fields": ["title_de", "title_en", "abstract_de", "abstract_en"],
|
||||||
|
"type": "phrase_prefix",
|
||||||
|
"max_expansions": 100,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for keyword in keywords if keyword.strip()
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body["highlight"] = {
|
||||||
|
"fragment_size": 200,
|
||||||
|
"number_of_fragments": 0,
|
||||||
|
"pre_tags": ["<em>"],
|
||||||
|
"post_tags": ["</em>"],
|
||||||
|
"require_field_match": True,
|
||||||
|
"fields": {
|
||||||
|
"title_de": {"highlight_query": title_abstract_query},
|
||||||
|
"title_en": {"highlight_query": title_abstract_query},
|
||||||
|
"abstract_de": {"highlight_query": title_abstract_query},
|
||||||
|
"abstract_en": {"highlight_query": title_abstract_query},
|
||||||
|
},
|
||||||
|
}
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
if keyword.strip() == "":
|
if keyword.strip() == "":
|
||||||
continue
|
continue
|
||||||
keyword_clauses.append(
|
keyword_clauses.append({
|
||||||
{
|
"bool": {
|
||||||
"multi_match": {
|
"should": [
|
||||||
"query": keyword,
|
{
|
||||||
"fields": [
|
"multi_match": {
|
||||||
"title", "title_de", "title_en",
|
"query": keyword,
|
||||||
"abstract_de", "abstract_en",
|
"fields": ["title_de^4", "title_en^4", "abstract_de^2", "abstract_en^2"],
|
||||||
"subject_area_de", "subject_area_en",
|
"type": "phrase_prefix",
|
||||||
"subject_classifications.fach",
|
"max_expansions": 100,
|
||||||
"subject_classifications.fachkollegium",
|
}
|
||||||
"subject_classifications.fachgebiet",
|
},
|
||||||
"subject_classifications.fachgebiet_de",
|
{
|
||||||
"subject_classifications.wissenschaftsbereich",
|
"nested": {
|
||||||
],
|
"path": "subject_classifications",
|
||||||
"type": "phrase_prefix",
|
"query": {
|
||||||
"max_expansions": 100,
|
"multi_match": {
|
||||||
}
|
"query": keyword,
|
||||||
|
"fields": [
|
||||||
|
"subject_classifications.fach^4",
|
||||||
|
"subject_classifications.fachkollegium^4",
|
||||||
|
"subject_classifications.fachgebiet^4",
|
||||||
|
"subject_classifications.fachgebiet_de^4",
|
||||||
|
"subject_classifications.wissenschaftsbereich^4",
|
||||||
|
],
|
||||||
|
"type": "phrase_prefix",
|
||||||
|
"max_expansions": 100,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inner_hits": {
|
||||||
|
"name": keyword,
|
||||||
|
"highlight": {
|
||||||
|
"fields": {
|
||||||
|
"subject_classifications.fach": {},
|
||||||
|
"subject_classifications.fachkollegium": {},
|
||||||
|
"subject_classifications.fachgebiet": {},
|
||||||
|
"subject_classifications.fachgebiet_de": {},
|
||||||
|
"subject_classifications.wissenschaftsbereich": {},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
}
|
}
|
||||||
)
|
})
|
||||||
if keyword_clauses:
|
if keyword_clauses:
|
||||||
must_clauses.append({"bool": {"must": keyword_clauses}})
|
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
|
||||||
|
|
||||||
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
|
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
|
||||||
if filter_topic_ids:
|
if filter_topic_ids:
|
||||||
matching_filter_project_ids = await get_dfg_project_ids_by_topic_ids(
|
matching_filter_project_ids = await get_dfg_project_ids_by_topic_ids(
|
||||||
topic_ids=filter_topic_ids
|
topic_ids=filter_topic_ids, match_all=True
|
||||||
)
|
)
|
||||||
|
|
||||||
if not matching_filter_project_ids:
|
if not matching_filter_project_ids:
|
||||||
@@ -489,6 +548,11 @@ async def search_dfg_projects(
|
|||||||
if funding_end_years:
|
if funding_end_years:
|
||||||
must_clauses.append({"terms": {"funding_end": funding_end_years}})
|
must_clauses.append({"terms": {"funding_end": funding_end_years}})
|
||||||
|
|
||||||
|
if active_to_year is not None:
|
||||||
|
must_clauses.append({"range": {"funding_start": {"lte": str(active_to_year)}}})
|
||||||
|
if active_from_year is not None:
|
||||||
|
must_clauses.append({"range": {"funding_end": {"gte": str(active_from_year)}}})
|
||||||
|
|
||||||
if names:
|
if names:
|
||||||
name_must_clauses = []
|
name_must_clauses = []
|
||||||
for full_name in names:
|
for full_name in names:
|
||||||
@@ -518,7 +582,7 @@ async def search_dfg_projects(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if name_must_clauses:
|
if name_must_clauses:
|
||||||
must_clauses.append({"bool": {"must": name_must_clauses}})
|
must_clauses.append({"bool": {"should": name_must_clauses, "minimum_should_match": 1}})
|
||||||
|
|
||||||
if institution_aliases:
|
if institution_aliases:
|
||||||
matching_institution_ids = await get_institution_ids_by_institution_aliases(
|
matching_institution_ids = await get_institution_ids_by_institution_aliases(
|
||||||
@@ -546,7 +610,7 @@ async def search_dfg_projects(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
print("MATCHING_INSTITUTION_IDS", matching_institution_ids)
|
#print("MATCHING_INSTITUTION_IDS", matching_institution_ids)
|
||||||
|
|
||||||
if institution_ids:
|
if institution_ids:
|
||||||
#prevously we were filtering by person_ids, but now we are filtering by institution_ids directly
|
#prevously we were filtering by person_ids, but now we are filtering by institution_ids directly
|
||||||
@@ -595,23 +659,27 @@ async def search_dfg_projects(
|
|||||||
elif sort_by == "professional_classification":
|
elif sort_by == "professional_classification":
|
||||||
sort_config = {"subject_area_de.keyword": {"order": sort_direction}}
|
sort_config = {"subject_area_de.keyword": {"order": sort_direction}}
|
||||||
else:
|
else:
|
||||||
sort_config = {"id": {"order": sort_direction}}
|
sort_config = {"_score": {"order": "desc"}}
|
||||||
|
|
||||||
body["sort"] = [sort_config]
|
body["sort"] = [sort_config]
|
||||||
|
|
||||||
# print(f"Executing DFG project search with body: {json.dumps(body, indent=2)}")
|
# print(f"Executing DFG project search with body: {json.dumps(body, indent=2)}")
|
||||||
# === Execute Search ===
|
# === Execute Search ===
|
||||||
print(f"Executing DFG project search with body: {json.dumps(body, indent=2)}")
|
print(f"Executing DFG project search with body: {body}")
|
||||||
response = await elasticsearch.search(
|
response = await elasticsearch.search(
|
||||||
index=ESIndex.DFG_PROJECTS,
|
index=ESIndex.DFG_PROJECTS,
|
||||||
body=body,
|
body=body,
|
||||||
cluster=ESCluster.INSE,
|
cluster=ESCluster.INSE,
|
||||||
)
|
)
|
||||||
|
# print(f"Received DFG project search response: {response}")
|
||||||
hits = response.get("hits", {}).get("hits", [])
|
hits = response.get("hits", {}).get("hits", [])
|
||||||
|
|
||||||
if skip_enrichment:
|
if skip_enrichment:
|
||||||
return _complete_response_to_dfg_project_page(response, page, size)
|
return _complete_response_to_dfg_project_page(response, page, size)
|
||||||
|
|
||||||
|
if not hits:
|
||||||
|
return _complete_response_to_dfg_project_page(response, page, size)
|
||||||
|
|
||||||
project_ids = [hit["_source"]["id"] for hit in hits]
|
project_ids = [hit["_source"]["id"] for hit in hits]
|
||||||
topic_lookup = await get_openalex_topics_for_dfg_projects(project_ids=project_ids)
|
topic_lookup = await get_openalex_topics_for_dfg_projects(project_ids=project_ids)
|
||||||
|
|
||||||
@@ -854,10 +922,12 @@ async def search_bund_projects_with_filters(
|
|||||||
countries: list[str] | None = None,
|
countries: list[str] | None = None,
|
||||||
page: int = 0,
|
page: int = 0,
|
||||||
size: int = 10,
|
size: int = 10,
|
||||||
sort_by: str = "title",
|
sort_by: str = "",
|
||||||
sort_direction: str = "asc",
|
sort_direction: str = "asc",
|
||||||
fuzzy: bool = False,
|
fuzzy: bool = False,
|
||||||
skip_topic_enrichment: bool = False,
|
skip_topic_enrichment: bool = False,
|
||||||
|
active_from_year: int | None = None,
|
||||||
|
active_to_year: int | None = None,
|
||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
"""
|
"""
|
||||||
Main search function for BUND projects, analogous to the DFG search.
|
Main search function for BUND projects, analogous to the DFG search.
|
||||||
@@ -929,30 +999,42 @@ async def search_bund_projects_with_filters(
|
|||||||
)
|
)
|
||||||
# === Primary search clause: fuzzy(topic_ids) vs keyword phrase search ===
|
# === Primary search clause: fuzzy(topic_ids) vs keyword phrase search ===
|
||||||
if fuzzy and topic_ids:
|
if fuzzy and topic_ids:
|
||||||
matching_project_ids = await get_bund_project_ids_by_topic_ids(topic_ids=topic_ids)
|
matching_project_ids = await get_bund_project_ids_by_topic_ids(topic_ids=topic_ids, match_all=False)
|
||||||
if not matching_project_ids:
|
if not matching_project_ids:
|
||||||
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
||||||
must_clauses.append({"terms": {"_id": matching_project_ids}})
|
must_clauses.append({"terms": {"_id": matching_project_ids}})
|
||||||
|
|
||||||
elif keywords:
|
elif keywords:
|
||||||
keyword_clauses = []
|
keyword_clauses = []
|
||||||
|
#Add highlighting for the title and abstract fields
|
||||||
|
body["highlight"] = {
|
||||||
|
"fields": {
|
||||||
|
"Verbundprojekt": {},
|
||||||
|
"Thema": {},
|
||||||
|
"Zuwendungsempfänger": {},
|
||||||
|
"Ausführende Stelle": {},
|
||||||
|
},
|
||||||
|
"pre_tags": ["<em>"],
|
||||||
|
"post_tags": ["</em>"],
|
||||||
|
"require_field_match": True,
|
||||||
|
}
|
||||||
for kw in keywords:
|
for kw in keywords:
|
||||||
if kw.strip() == "":
|
if kw.strip() == "":
|
||||||
continue
|
continue
|
||||||
keyword_clauses.append({
|
keyword_clauses.append({
|
||||||
"multi_match": {
|
"multi_match": {
|
||||||
"query": kw,
|
"query": kw,
|
||||||
"fields": ["Verbundprojekt","Thema"], # searching title/acronym field
|
"fields": ["Verbundprojekt^4","Thema^4"],
|
||||||
"type": "phrase_prefix",
|
"type": "phrase_prefix",
|
||||||
"max_expansions": 100,
|
"max_expansions": 100,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if keyword_clauses:
|
if keyword_clauses:
|
||||||
must_clauses.append({"bool": {"must": keyword_clauses}})
|
must_clauses.append({"bool": {"should": keyword_clauses, "minimum_should_match": 1}})
|
||||||
|
|
||||||
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
|
# === Additional independent filters (applied regardless of fuzzy/keyword mode) ===
|
||||||
if filter_topic_ids:
|
if filter_topic_ids:
|
||||||
matching_filter_ids = await get_bund_project_ids_by_topic_ids(topic_ids=filter_topic_ids)
|
matching_filter_ids = await get_bund_project_ids_by_topic_ids(topic_ids=filter_topic_ids, match_all=True)
|
||||||
if not matching_filter_ids:
|
if not matching_filter_ids:
|
||||||
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
||||||
must_clauses.append({"terms": {"_id": matching_filter_ids}})
|
must_clauses.append({"terms": {"_id": matching_filter_ids}})
|
||||||
@@ -999,13 +1081,22 @@ async def search_bund_projects_with_filters(
|
|||||||
if funding_end_years:
|
if funding_end_years:
|
||||||
must_clauses.append(_bund_year_filters("funding_end", funding_end_years))
|
must_clauses.append(_bund_year_filters("funding_end", funding_end_years))
|
||||||
|
|
||||||
|
if active_to_year is not None:
|
||||||
|
must_clauses.append(
|
||||||
|
{"range": {"funding_start": {"lte": f"31.12.{active_to_year}"}}}
|
||||||
|
)
|
||||||
|
if active_from_year is not None:
|
||||||
|
must_clauses.append(
|
||||||
|
{"range": {"funding_end": {"gte": f"01.01.{active_from_year}"}}}
|
||||||
|
)
|
||||||
|
|
||||||
body["query"] = {"bool": {"must": must_clauses}} if must_clauses else {"match_all": {}}
|
body["query"] = {"bool": {"must": must_clauses}} if must_clauses else {"match_all": {}}
|
||||||
# === Sorting ===
|
# === Sorting ===
|
||||||
sort_by = sort_by.strip().lower()
|
sort_by = sort_by.strip().lower()
|
||||||
sort_direction = sort_direction.strip().lower()
|
sort_direction = sort_direction.strip().lower()
|
||||||
if sort_direction not in ("asc", "desc"):
|
if sort_direction not in ("asc", "desc"):
|
||||||
sort_direction = "asc"
|
sort_direction = "asc"
|
||||||
|
sort_config = {}
|
||||||
if sort_by == "title":
|
if sort_by == "title":
|
||||||
sort_config = {"Verbundprojekt.keyword": {"order": sort_direction}}
|
sort_config = {"Verbundprojekt.keyword": {"order": sort_direction}}
|
||||||
elif sort_by == "funding_start":
|
elif sort_by == "funding_start":
|
||||||
@@ -1013,8 +1104,7 @@ async def search_bund_projects_with_filters(
|
|||||||
elif sort_by == "funding_end":
|
elif sort_by == "funding_end":
|
||||||
sort_config = {"funding_end": {"order": sort_direction}}
|
sort_config = {"funding_end": {"order": sort_direction}}
|
||||||
else:
|
else:
|
||||||
# Fallback to project ID
|
sort_config = "_score"
|
||||||
sort_config = {"Förderkennzeichen.keyword": {"order": sort_direction}}
|
|
||||||
|
|
||||||
body["sort"] = [sort_config]
|
body["sort"] = [sort_config]
|
||||||
# print(f"Executing BUND project search with body: {json.dumps(body, indent=2)}")
|
# print(f"Executing BUND project search with body: {json.dumps(body, indent=2)}")
|
||||||
@@ -1023,7 +1113,6 @@ async def search_bund_projects_with_filters(
|
|||||||
index=ESIndex.PROJECTS_BUND_V1,
|
index=ESIndex.PROJECTS_BUND_V1,
|
||||||
body=body,
|
body=body,
|
||||||
cluster=ESCluster.INSE,
|
cluster=ESCluster.INSE,
|
||||||
track_total_hits=True,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
hits = response.get("hits", {}).get("hits", [])
|
hits = response.get("hits", {}).get("hits", [])
|
||||||
@@ -1157,7 +1246,6 @@ async def search_all_projects(
|
|||||||
offset=offset,
|
offset=offset,
|
||||||
query=query,
|
query=query,
|
||||||
sort=sort,
|
sort=sort,
|
||||||
track_total_hits=True,
|
|
||||||
)
|
)
|
||||||
return _response_to_funding_project_page(response=response, page=page, size=size)
|
return _response_to_funding_project_page(response=response, page=page, size=size)
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ from inse.projects.model import (
|
|||||||
SortDirection,
|
SortDirection,
|
||||||
)
|
)
|
||||||
from inse.tags import Tags
|
from inse.tags import Tags
|
||||||
|
from inse.database import SessionDep
|
||||||
from inse.auth.service import can_fetch_gdpr_relevant_data
|
from inse.auth.service import can_fetch_gdpr_relevant_data
|
||||||
from fastapi import HTTPException as HttpException
|
from fastapi import HTTPException as HttpException
|
||||||
|
|
||||||
@@ -78,26 +79,36 @@ async def search_bund_projects(
|
|||||||
"model": DfgProjectPage,
|
"model": DfgProjectPage,
|
||||||
},
|
},
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
status.HTTP_403_FORBIDDEN: {"description": "Access denied for the provided institution ID"},
|
status.HTTP_403_FORBIDDEN: {
|
||||||
|
"description": "Access denied for the provided institution ID"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def get_dfg_projects(
|
async def get_dfg_projects(
|
||||||
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
session: SessionDep,
|
||||||
|
access_token_metadata: Annotated[
|
||||||
|
AccessTokenMetadata, CurrentUserAccessTokenPayloadDep
|
||||||
|
],
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
raw_oa_institution_id: Annotated[
|
raw_oa_institution_id: Annotated[
|
||||||
str | None, Query(description="The openalex institution ID to filter by.")
|
str | None, Query(description="The openalex institution ID to filter by.")
|
||||||
] = None,
|
] = None,
|
||||||
author_id: Annotated[str | None, Query(description="The openalex author ID to filter by.")] = None,
|
author_id: Annotated[
|
||||||
author_filter_ids: Annotated[list[str] | None, Query(description="The dfg author IDs to filter by.")] = None,
|
str | None, Query(description="The openalex author ID to filter by.")
|
||||||
institution_ids: Annotated[list[str] | None, Query(description="The institution IDs to filter by.")] = None,
|
|
||||||
title: Annotated[
|
|
||||||
str | None, Query(description="The title to filter by.")
|
|
||||||
] = None,
|
] = None,
|
||||||
|
author_filter_ids: Annotated[
|
||||||
|
list[str] | None, Query(description="The dfg author IDs to filter by.")
|
||||||
|
] = None,
|
||||||
|
institution_ids: Annotated[
|
||||||
|
list[str] | None, Query(description="The institution IDs to filter by.")
|
||||||
|
] = None,
|
||||||
|
title: Annotated[str | None, Query(description="The title to filter by.")] = None,
|
||||||
keywords: Annotated[
|
keywords: Annotated[
|
||||||
list[str] | None, Query(description="Raw keywords to search in title/abstract/subject fields.")
|
list[str] | None,
|
||||||
|
Query(description="Raw keywords to search in title/abstract/subject fields."),
|
||||||
] = None,
|
] = None,
|
||||||
topic_ids: Annotated[
|
topic_ids: Annotated[
|
||||||
list[str] | None, Query(description="The openalex topic IDs to filter by.")
|
list[str] | None, Query(description="The openalex topic IDs to filter by.")
|
||||||
@@ -106,23 +117,27 @@ async def get_dfg_projects(
|
|||||||
list[str] | None,
|
list[str] | None,
|
||||||
Query(
|
Query(
|
||||||
description="Additional topic IDs to merge into the fuzzy topic-id resolution "
|
description="Additional topic IDs to merge into the fuzzy topic-id resolution "
|
||||||
"(union with topic_ids). Only used when fuzzy=True."
|
"(union with topic_ids). Only used when fuzzy=True."
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
funding_start_years: Annotated[list[str] | None, Query(description="The funding start years to filter by.")] = None,
|
funding_start_years: Annotated[
|
||||||
funding_end_years: Annotated[list[str] | None, Query(description="The funding end years to filter by.")] = None,
|
list[str] | None, Query(description="The funding start years to filter by.")
|
||||||
|
] = None,
|
||||||
|
funding_end_years: Annotated[
|
||||||
|
list[str] | None, Query(description="The funding end years to filter by.")
|
||||||
|
] = None,
|
||||||
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
||||||
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
||||||
sort_by: Annotated[str, Query(description="The field to sort by.")] = "title",
|
sort_by: Annotated[str, Query(description="The field to sort by.")] = "",
|
||||||
sort_direction: Annotated[
|
sort_direction: Annotated[
|
||||||
str, Query(description="The sort direction (asc or desc).")
|
str, Query(description="The sort direction (asc or desc).")
|
||||||
] = "asc",
|
] = "asc",
|
||||||
fuzzy: Annotated[
|
fuzzy: Annotated[
|
||||||
bool,
|
bool,
|
||||||
Query(description="Use topic_id resolution if True, otherwise use raw keyword search."),
|
Query(
|
||||||
|
description="Use topic_id resolution if True, otherwise use raw keyword search."
|
||||||
|
),
|
||||||
] = False,
|
] = False,
|
||||||
|
|
||||||
) -> DfgProjectPage:
|
) -> DfgProjectPage:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Received request to get DFG projects for author_id=%s, author_filter_ids=%s, "
|
"Received request to get DFG projects for author_id=%s, author_filter_ids=%s, "
|
||||||
@@ -144,8 +159,13 @@ async def get_dfg_projects(
|
|||||||
sort_direction,
|
sort_direction,
|
||||||
fuzzy,
|
fuzzy,
|
||||||
)
|
)
|
||||||
if (author_id or raw_oa_institution_id):
|
if author_id or raw_oa_institution_id:
|
||||||
is_allowed = await can_fetch_gdpr_relevant_data(access_token = access_token_metadata, raw_oa_author_id = author_id, raw_oa_institution_id = raw_oa_institution_id)
|
is_allowed = await can_fetch_gdpr_relevant_data(
|
||||||
|
session=session,
|
||||||
|
access_token=access_token_metadata,
|
||||||
|
raw_oa_author_id=author_id,
|
||||||
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
|
)
|
||||||
if not is_allowed:
|
if not is_allowed:
|
||||||
raise HttpException(
|
raise HttpException(
|
||||||
status_code=403,
|
status_code=403,
|
||||||
@@ -170,6 +190,7 @@ async def get_dfg_projects(
|
|||||||
fuzzy=fuzzy,
|
fuzzy=fuzzy,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/dfg/{id}",
|
"/dfg/{id}",
|
||||||
summary="Get a single DFG project.",
|
summary="Get a single DFG project.",
|
||||||
@@ -204,12 +225,17 @@ async def get_single_dfg_project(
|
|||||||
"model": BundProjectPage,
|
"model": BundProjectPage,
|
||||||
},
|
},
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
status.HTTP_403_FORBIDDEN: {"description": "Access denied for the provided institution ID"},
|
status.HTTP_403_FORBIDDEN: {
|
||||||
|
"description": "Access denied for the provided institution ID"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def search_bund_projects(
|
async def search_bund_projects(
|
||||||
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
session: SessionDep,
|
||||||
|
access_token_metadata: Annotated[
|
||||||
|
AccessTokenMetadata, CurrentUserAccessTokenPayloadDep
|
||||||
|
],
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -255,18 +281,25 @@ async def search_bund_projects(
|
|||||||
] = None,
|
] = None,
|
||||||
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
||||||
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
||||||
sort_by: Annotated[str, Query(description="Sort field.")] = "title",
|
sort_by: Annotated[str, Query(description="Sort field.")] = "",
|
||||||
sort_direction: Annotated[
|
sort_direction: Annotated[
|
||||||
str,
|
str,
|
||||||
Query(description="Sort direction: asc or desc."),
|
Query(description="Sort direction: asc or desc."),
|
||||||
] = "asc",
|
] = "asc",
|
||||||
fuzzy: Annotated[
|
fuzzy: Annotated[
|
||||||
bool,
|
bool,
|
||||||
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
Query(
|
||||||
|
description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."
|
||||||
|
),
|
||||||
] = False,
|
] = False,
|
||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
if (raw_oa_institution_id):
|
if raw_oa_institution_id:
|
||||||
is_allowed = await can_fetch_gdpr_relevant_data(access_token = access_token_metadata, raw_oa_author_id = None, raw_oa_institution_id = raw_oa_institution_id)
|
is_allowed = await can_fetch_gdpr_relevant_data(
|
||||||
|
session=session,
|
||||||
|
access_token=access_token_metadata,
|
||||||
|
raw_oa_author_id=None,
|
||||||
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
|
)
|
||||||
if not is_allowed:
|
if not is_allowed:
|
||||||
raise HttpException(
|
raise HttpException(
|
||||||
status_code=403,
|
status_code=403,
|
||||||
@@ -288,9 +321,10 @@ async def search_bund_projects(
|
|||||||
size=size,
|
size=size,
|
||||||
sort_by=sort_by,
|
sort_by=sort_by,
|
||||||
sort_direction=sort_direction,
|
sort_direction=sort_direction,
|
||||||
fuzzy=fuzzy
|
fuzzy=fuzzy,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/bund/{id}",
|
"/bund/{id}",
|
||||||
summary="Get a single BUND project.",
|
summary="Get a single BUND project.",
|
||||||
@@ -313,6 +347,7 @@ async def get_single_bund_project(
|
|||||||
project_id=id,
|
project_id=id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
from inse.projects.model import EuCordisProjectSearchPage, EuCordisProjectType
|
from inse.projects.model import EuCordisProjectSearchPage, EuCordisProjectType
|
||||||
from inse.projects.service import search_eu_cordis_projects
|
from inse.projects.service import search_eu_cordis_projects
|
||||||
@@ -334,12 +369,17 @@ from inse.projects.service import search_eu_cordis_projects
|
|||||||
"model": EuCordisProjectSearchPage,
|
"model": EuCordisProjectSearchPage,
|
||||||
},
|
},
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
status.HTTP_403_FORBIDDEN: {"description": "Access denied for the provided institution ID"},
|
status.HTTP_403_FORBIDDEN: {
|
||||||
|
"description": "Access denied for the provided institution ID"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def search_eu_cordis_projects_endpoint(
|
async def search_eu_cordis_projects_endpoint(
|
||||||
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
session: SessionDep,
|
||||||
|
access_token_metadata: Annotated[
|
||||||
|
AccessTokenMetadata, CurrentUserAccessTokenPayloadDep
|
||||||
|
],
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -353,15 +393,21 @@ async def search_eu_cordis_projects_endpoint(
|
|||||||
] = None,
|
] = None,
|
||||||
author_ids: Annotated[
|
author_ids: Annotated[
|
||||||
list[str] | None,
|
list[str] | None,
|
||||||
Query(description="Additional OpenAlex author IDs to filter by. All selected authors must match."),
|
Query(
|
||||||
|
description="Additional OpenAlex author IDs to filter by. All selected authors must match."
|
||||||
|
),
|
||||||
] = None,
|
] = None,
|
||||||
organization_ids: Annotated[
|
organization_ids: Annotated[
|
||||||
list[str] | None,
|
list[str] | None,
|
||||||
Query(description="CORDIS organisation IDs. All selected organizations must match."),
|
Query(
|
||||||
|
description="CORDIS organisation IDs. All selected organizations must match."
|
||||||
|
),
|
||||||
] = None,
|
] = None,
|
||||||
organization_names: Annotated[
|
organization_names: Annotated[
|
||||||
list[str] | None,
|
list[str] | None,
|
||||||
Query(description="CORDIS organization names. All selected organizations must match."),
|
Query(
|
||||||
|
description="CORDIS organization names. All selected organizations must match."
|
||||||
|
),
|
||||||
] = None,
|
] = None,
|
||||||
project_types: Annotated[
|
project_types: Annotated[
|
||||||
list[EuCordisProjectType] | None,
|
list[EuCordisProjectType] | None,
|
||||||
@@ -409,16 +455,17 @@ async def search_eu_cordis_projects_endpoint(
|
|||||||
] = None,
|
] = None,
|
||||||
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
||||||
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
||||||
sort_by: Annotated[str, Query(description="Sort field.")] = "title",
|
sort_by: Annotated[str, Query(description="Sort field.")] = "",
|
||||||
sort_direction: Annotated[
|
sort_direction: Annotated[
|
||||||
str,
|
str,
|
||||||
Query(description="Sort direction: asc or desc."),
|
Query(description="Sort direction: asc or desc."),
|
||||||
] = "asc",
|
] = "asc",
|
||||||
fuzzy: Annotated[
|
fuzzy: Annotated[
|
||||||
bool,
|
bool,
|
||||||
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
Query(
|
||||||
|
description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."
|
||||||
|
),
|
||||||
] = False,
|
] = False,
|
||||||
|
|
||||||
) -> EuCordisProjectSearchPage:
|
) -> EuCordisProjectSearchPage:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Received EU CORDIS search request: raw_oa_institution_id=%s, "
|
"Received EU CORDIS search request: raw_oa_institution_id=%s, "
|
||||||
@@ -450,8 +497,13 @@ async def search_eu_cordis_projects_endpoint(
|
|||||||
sort_direction,
|
sort_direction,
|
||||||
fuzzy,
|
fuzzy,
|
||||||
)
|
)
|
||||||
if (author_id or raw_oa_institution_id):
|
if author_id or raw_oa_institution_id:
|
||||||
is_allowed = await can_fetch_gdpr_relevant_data(access_token = access_token_metadata, raw_oa_author_id = author_id, raw_oa_institution_id = raw_oa_institution_id)
|
is_allowed = await can_fetch_gdpr_relevant_data(
|
||||||
|
session=session,
|
||||||
|
access_token=access_token_metadata,
|
||||||
|
raw_oa_author_id=author_id,
|
||||||
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
|
)
|
||||||
if not is_allowed:
|
if not is_allowed:
|
||||||
raise HttpException(
|
raise HttpException(
|
||||||
status_code=403,
|
status_code=403,
|
||||||
@@ -482,6 +534,7 @@ async def search_eu_cordis_projects_endpoint(
|
|||||||
fuzzy=fuzzy,
|
fuzzy=fuzzy,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/eu/{id}",
|
"/eu/{id}",
|
||||||
summary="Get a single EU Cordis project.",
|
summary="Get a single EU Cordis project.",
|
||||||
@@ -494,27 +547,29 @@ async def search_eu_cordis_projects_endpoint(
|
|||||||
},
|
},
|
||||||
status.HTTP_404_NOT_FOUND: {
|
status.HTTP_404_NOT_FOUND: {
|
||||||
"description": "Project not found",
|
"description": "Project not found",
|
||||||
"model": EuCordisProjectResponse
|
"model": EuCordisProjectResponse,
|
||||||
},
|
},
|
||||||
status.HTTP_500_INTERNAL_SERVER_ERROR: {
|
status.HTTP_500_INTERNAL_SERVER_ERROR: {
|
||||||
"description": "Internal server error",
|
"description": "Internal server error",
|
||||||
"model": EuCordisProjectResponse
|
"model": EuCordisProjectResponse,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
async def get_single_eu_cordis_project(
|
async def get_single_eu_cordis_project(
|
||||||
id: Annotated[str, Path(description="The ID of the EU Cordis project to retrieve.")],
|
id: Annotated[
|
||||||
|
str, Path(description="The ID of the EU Cordis project to retrieve.")
|
||||||
|
],
|
||||||
) -> EuCordisProjectResponse:
|
) -> EuCordisProjectResponse:
|
||||||
"""
|
"""
|
||||||
Get a single EU Cordis project by ID.
|
Get a single EU Cordis project by ID.
|
||||||
Returns a wrapper response containing the project data or error information.
|
Returns a wrapper response containing the project data or error information.
|
||||||
"""
|
"""
|
||||||
logger.debug(f"Received request to get single EU Cordis project for id={id}")
|
logger.debug(f"Received request to get single EU Cordis project for id={id}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the project from the service
|
# Get the project from the service
|
||||||
project = await projects_service.get_single_eu_cordis_project(project_id=id)
|
project = await projects_service.get_single_eu_cordis_project(project_id=id)
|
||||||
|
|
||||||
# Check if project exists
|
# Check if project exists
|
||||||
if project is None:
|
if project is None:
|
||||||
logger.warning(f"Project with ID {id} not found")
|
logger.warning(f"Project with ID {id} not found")
|
||||||
@@ -522,9 +577,9 @@ async def get_single_eu_cordis_project(
|
|||||||
success=False,
|
success=False,
|
||||||
project_type=None,
|
project_type=None,
|
||||||
eu_project_data=None,
|
eu_project_data=None,
|
||||||
error=f"Project with ID {id} not found"
|
error=f"Project with ID {id} not found",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Determine the project type
|
# Determine the project type
|
||||||
if isinstance(project, Fp7ProjectDetails):
|
if isinstance(project, Fp7ProjectDetails):
|
||||||
project_type = "fp7"
|
project_type = "fp7"
|
||||||
@@ -539,24 +594,21 @@ async def get_single_eu_cordis_project(
|
|||||||
success=False,
|
success=False,
|
||||||
project_type=None,
|
project_type=None,
|
||||||
eu_project_data=None,
|
eu_project_data=None,
|
||||||
error=f"Unknown project type for ID {id}"
|
error=f"Unknown project type for ID {id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Return success with the project data
|
# Return success with the project data
|
||||||
return EuCordisProjectResponse(
|
return EuCordisProjectResponse(
|
||||||
success=True,
|
success=True, project_type=project_type, eu_project_data=project, error=None
|
||||||
project_type=project_type,
|
|
||||||
eu_project_data=project,
|
|
||||||
error=None
|
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error retrieving project with ID {id}: {e!s}", exc_info=True)
|
logger.error(f"Error retrieving project with ID {id}: {e!s}", exc_info=True)
|
||||||
return EuCordisProjectResponse(
|
return EuCordisProjectResponse(
|
||||||
success=False,
|
success=False,
|
||||||
project_type=None,
|
project_type=None,
|
||||||
eu_project_data=None,
|
eu_project_data=None,
|
||||||
error=f"Internal server error: {e!s}"
|
error=f"Internal server error: {e!s}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -623,7 +675,9 @@ async def get_institution_bund_projects_funding_over_time(
|
|||||||
] = None,
|
] = None,
|
||||||
fuzzy: Annotated[
|
fuzzy: Annotated[
|
||||||
bool,
|
bool,
|
||||||
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
Query(
|
||||||
|
description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."
|
||||||
|
),
|
||||||
] = False,
|
] = False,
|
||||||
) -> InstitutionFunderSummary:
|
) -> InstitutionFunderSummary:
|
||||||
return await projects_service.get_institution_bund_projects_funding_over_time(
|
return await projects_service.get_institution_bund_projects_funding_over_time(
|
||||||
@@ -674,15 +728,21 @@ async def get_institution_cordis_eu_projects_funding_over_time(
|
|||||||
] = None,
|
] = None,
|
||||||
author_ids: Annotated[
|
author_ids: Annotated[
|
||||||
list[str] | None,
|
list[str] | None,
|
||||||
Query(description="Additional OpenAlex author IDs to filter by. All selected authors must match."),
|
Query(
|
||||||
|
description="Additional OpenAlex author IDs to filter by. All selected authors must match."
|
||||||
|
),
|
||||||
] = None,
|
] = None,
|
||||||
organization_ids: Annotated[
|
organization_ids: Annotated[
|
||||||
list[str] | None,
|
list[str] | None,
|
||||||
Query(description="CORDIS organisation IDs. All selected organizations must match."),
|
Query(
|
||||||
|
description="CORDIS organisation IDs. All selected organizations must match."
|
||||||
|
),
|
||||||
] = None,
|
] = None,
|
||||||
organization_names: Annotated[
|
organization_names: Annotated[
|
||||||
list[str] | None,
|
list[str] | None,
|
||||||
Query(description="CORDIS organization names. All selected organizations must match."),
|
Query(
|
||||||
|
description="CORDIS organization names. All selected organizations must match."
|
||||||
|
),
|
||||||
] = None,
|
] = None,
|
||||||
project_types: Annotated[
|
project_types: Annotated[
|
||||||
list[EuCordisProjectType] | None,
|
list[EuCordisProjectType] | None,
|
||||||
@@ -730,7 +790,9 @@ async def get_institution_cordis_eu_projects_funding_over_time(
|
|||||||
] = None,
|
] = None,
|
||||||
fuzzy: Annotated[
|
fuzzy: Annotated[
|
||||||
bool,
|
bool,
|
||||||
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
Query(
|
||||||
|
description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."
|
||||||
|
),
|
||||||
] = False,
|
] = False,
|
||||||
) -> InstitutionFunderSummary:
|
) -> InstitutionFunderSummary:
|
||||||
return await projects_service.get_institution_cordis_eu_projects_funding_over_time(
|
return await projects_service.get_institution_cordis_eu_projects_funding_over_time(
|
||||||
@@ -777,9 +839,7 @@ async def search_projects(
|
|||||||
description="The set of project types to filter by (e.g., 'bund', 'eu', 'dfg'). If not provided, projects of all types will be included."
|
description="The set of project types to filter by (e.g., 'bund', 'eu', 'dfg'). If not provided, projects of all types will be included."
|
||||||
),
|
),
|
||||||
] = None,
|
] = None,
|
||||||
title: Annotated[
|
title: Annotated[str | None, Query(description="The title to filter by.")] = None,
|
||||||
str | None, Query(description="The title to filter by.")
|
|
||||||
] = None,
|
|
||||||
sort_by: Annotated[
|
sort_by: Annotated[
|
||||||
ProjectsSortBy, Query(description="The field to sort by.")
|
ProjectsSortBy, Query(description="The field to sort by.")
|
||||||
] = ProjectsSortBy.TITLE,
|
] = ProjectsSortBy.TITLE,
|
||||||
@@ -794,4 +854,4 @@ async def search_projects(
|
|||||||
title=title,
|
title=title,
|
||||||
sort_by=sort_by,
|
sort_by=sort_by,
|
||||||
sort_direction=sort_direction,
|
sort_direction=sort_direction,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -184,10 +184,13 @@ async def get_dfg_projects(
|
|||||||
funding_end_years: list[str] | None,
|
funding_end_years: list[str] | None,
|
||||||
page: int,
|
page: int,
|
||||||
size: int,
|
size: int,
|
||||||
sort_by: str = "topic",
|
sort_by: str = "",
|
||||||
sort_direction: str = "asc",
|
sort_direction: str = "asc",
|
||||||
fuzzy: bool = False,
|
fuzzy: bool = False,
|
||||||
skip_enrichment: bool = False,
|
skip_enrichment: bool = False,
|
||||||
|
active_from_year: int | None = None,
|
||||||
|
active_to_year: int | None = None,
|
||||||
|
institution_aliases: list[str] | None = None,
|
||||||
) -> DfgProjectPage:
|
) -> DfgProjectPage:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Fetching DFG projects for author_id=%s, author_filter_ids=%s, "
|
"Fetching DFG projects for author_id=%s, author_filter_ids=%s, "
|
||||||
@@ -249,18 +252,18 @@ async def get_dfg_projects(
|
|||||||
"No author names found for author_filter_ids=%s",
|
"No author names found for author_filter_ids=%s",
|
||||||
author_filter_ids_int,
|
author_filter_ids_int,
|
||||||
)
|
)
|
||||||
institution_aliases = []
|
resolved_institution_aliases = list(institution_aliases or [])
|
||||||
if raw_oa_institution_id:
|
if raw_oa_institution_id:
|
||||||
if institutions_search_client is None:
|
if institutions_search_client is None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"institutions_search_client must be provided when raw_oa_institution_id is set"
|
"institutions_search_client must be provided when raw_oa_institution_id is set"
|
||||||
)
|
)
|
||||||
institution_aliases = (
|
resolved_institution_aliases.extend(
|
||||||
await institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
await institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
||||||
raw_oa_institution_id
|
raw_oa_institution_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if not institution_aliases:
|
if not resolved_institution_aliases:
|
||||||
return DfgProjectPage(
|
return DfgProjectPage(
|
||||||
elements=[],
|
elements=[],
|
||||||
page=page,
|
page=page,
|
||||||
@@ -270,7 +273,7 @@ async def get_dfg_projects(
|
|||||||
return await projects_search_client.search_dfg_projects(
|
return await projects_search_client.search_dfg_projects(
|
||||||
page=page,
|
page=page,
|
||||||
size=size,
|
size=size,
|
||||||
institution_aliases=institution_aliases,
|
institution_aliases=resolved_institution_aliases,
|
||||||
project_ids=author_project_ids,
|
project_ids=author_project_ids,
|
||||||
names=filter_names or [],
|
names=filter_names or [],
|
||||||
institution_ids=institution_ids_int,
|
institution_ids=institution_ids_int,
|
||||||
@@ -284,6 +287,8 @@ async def get_dfg_projects(
|
|||||||
sort_direction=sort_direction,
|
sort_direction=sort_direction,
|
||||||
fuzzy=fuzzy,
|
fuzzy=fuzzy,
|
||||||
skip_enrichment=skip_enrichment,
|
skip_enrichment=skip_enrichment,
|
||||||
|
active_from_year=active_from_year,
|
||||||
|
active_to_year=active_to_year,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def get_institution_cordis_eu_projects_funding_over_time(
|
async def get_institution_cordis_eu_projects_funding_over_time(
|
||||||
@@ -456,11 +461,14 @@ async def search_bund_projects_with_filters(
|
|||||||
countries: list[str] | None,
|
countries: list[str] | None,
|
||||||
page: int,
|
page: int,
|
||||||
size: int,
|
size: int,
|
||||||
sort_by: str = "title",
|
sort_by: str = "",
|
||||||
sort_direction: str = "asc",
|
sort_direction: str = "asc",
|
||||||
fuzzy: bool = False,
|
fuzzy: bool = False,
|
||||||
|
active_from_year: int | None = None,
|
||||||
|
active_to_year: int | None = None,
|
||||||
|
oa_institution_aliases: list[str] | None = None,
|
||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
institution_aliases = []
|
institution_aliases = list(oa_institution_aliases or [])
|
||||||
if raw_oa_institution_id:
|
if raw_oa_institution_id:
|
||||||
if institutions_search_client is None:
|
if institutions_search_client is None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
@@ -494,7 +502,9 @@ async def search_bund_projects_with_filters(
|
|||||||
size=size,
|
size=size,
|
||||||
sort_by=sort_by,
|
sort_by=sort_by,
|
||||||
sort_direction=sort_direction,
|
sort_direction=sort_direction,
|
||||||
fuzzy=fuzzy
|
fuzzy=fuzzy,
|
||||||
|
active_from_year=active_from_year,
|
||||||
|
active_to_year=active_to_year,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _calculate_funding_over_time(
|
def _calculate_funding_over_time(
|
||||||
@@ -656,11 +666,13 @@ async def search_eu_cordis_projects(
|
|||||||
title: str | None = None,
|
title: str | None = None,
|
||||||
funding_start_years: list[str] | None = None,
|
funding_start_years: list[str] | None = None,
|
||||||
funding_end_years: list[str] | None = None,
|
funding_end_years: list[str] | None = None,
|
||||||
|
active_from_year: int | None = None,
|
||||||
|
active_to_year: int | None = None,
|
||||||
countries: list[str] | None = None,
|
countries: list[str] | None = None,
|
||||||
framework_programmes: list[str] | None = None,
|
framework_programmes: list[str] | None = None,
|
||||||
funding_schemes: list[str] | None = None,
|
funding_schemes: list[str] | None = None,
|
||||||
statuses: list[str] | None = None,
|
statuses: list[str] | None = None,
|
||||||
sort_by: str = "title",
|
sort_by: str = "",
|
||||||
sort_direction: str = "asc",
|
sort_direction: str = "asc",
|
||||||
fuzzy: bool = False,
|
fuzzy: bool = False,
|
||||||
skip_enrichment: bool = False,
|
skip_enrichment: bool = False,
|
||||||
@@ -716,6 +728,8 @@ async def search_eu_cordis_projects(
|
|||||||
title=title,
|
title=title,
|
||||||
funding_start_years=funding_start_years,
|
funding_start_years=funding_start_years,
|
||||||
funding_end_years=funding_end_years,
|
funding_end_years=funding_end_years,
|
||||||
|
active_from_year=active_from_year,
|
||||||
|
active_to_year=active_to_year,
|
||||||
countries=countries,
|
countries=countries,
|
||||||
framework_programmes=framework_programmes,
|
framework_programmes=framework_programmes,
|
||||||
funding_schemes=funding_schemes,
|
funding_schemes=funding_schemes,
|
||||||
|
|||||||
@@ -2,6 +2,21 @@ import pytest
|
|||||||
from inse.projects import eu_cordis_projects_client as eu_cordis_search_client
|
from inse.projects import eu_cordis_projects_client as eu_cordis_search_client
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_active_period_filter_matches_projects_overlapping_interval():
|
||||||
|
query, _, _ = await eu_cordis_search_client._build_eu_cordis_search_query(
|
||||||
|
active_from_year=2022,
|
||||||
|
active_to_year=2026,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert {"range": {"startDate": {"lte": "2026-12-31"}}} in query["bool"][
|
||||||
|
"must"
|
||||||
|
]
|
||||||
|
assert {"range": {"endDate": {"gte": "2022-01-01"}}} in query["bool"][
|
||||||
|
"must"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_search_eu_cordis_projects_by_title():
|
async def test_search_eu_cordis_projects_by_title():
|
||||||
"""Test searching EU CORDIS projects by title."""
|
"""Test searching EU CORDIS projects by title."""
|
||||||
@@ -362,4 +377,4 @@ async def test_search_eu_cordis_projects_with_fuzzy_topic_search():
|
|||||||
# Note: This may return 0 results if the topic ID doesn't exist
|
# Note: This may return 0 results if the topic ID doesn't exist
|
||||||
# The important thing is that it doesn't crash
|
# The important thing is that it doesn't crash
|
||||||
assert isinstance(res.total, int)
|
assert isinstance(res.total, int)
|
||||||
assert isinstance(res.elements, list)
|
assert isinstance(res.elements, list)
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
|
from unittest.mock import AsyncMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from inse.projects import projects_search_client
|
from inse.projects import projects_search_client
|
||||||
|
|
||||||
|
|
||||||
@@ -20,6 +23,33 @@ async def test_search_dfg_projects():
|
|||||||
for name in element.names
|
for name in element.names
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_search_dfg_projects_returns_empty_page_without_enrichment_crash():
|
||||||
|
response = {
|
||||||
|
"hits": {
|
||||||
|
"total": {"value": 0},
|
||||||
|
"hits": [],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
with patch(
|
||||||
|
"inse.projects.projects_search_client.elasticsearch.search",
|
||||||
|
new=AsyncMock(return_value=response),
|
||||||
|
) as mocked_search:
|
||||||
|
result = await projects_search_client.search_dfg_projects(
|
||||||
|
page=0,
|
||||||
|
size=1,
|
||||||
|
funding_start_years=["2022"],
|
||||||
|
funding_end_years=["2026"],
|
||||||
|
)
|
||||||
|
|
||||||
|
assert result.total == 0
|
||||||
|
assert result.elements == []
|
||||||
|
query = mocked_search.await_args.kwargs["body"]["query"]
|
||||||
|
assert {"terms": {"funding_start": ["2022"]}} in query["bool"]["must"]
|
||||||
|
assert {"terms": {"funding_end": ["2026"]}} in query["bool"]["must"]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.anyio
|
@pytest.mark.anyio
|
||||||
async def test_get_dfg_project_by_id():
|
async def test_get_dfg_project_by_id():
|
||||||
# Get by ID of the project we found or a known one
|
# Get by ID of the project we found or a known one
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from dataclasses import dataclass
|
|
||||||
from math import floor
|
from math import floor
|
||||||
from time import time
|
from time import time
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -21,13 +20,16 @@ from .model import (
|
|||||||
AuthorTopicStats,
|
AuthorTopicStats,
|
||||||
CareerStage,
|
CareerStage,
|
||||||
CompanyStatusFilter,
|
CompanyStatusFilter,
|
||||||
FilterType,
|
|
||||||
KeywordOperator,
|
KeywordOperator,
|
||||||
PublicationType,
|
PublicationType,
|
||||||
|
PublicationTypeCount,
|
||||||
RankedAuthor,
|
RankedAuthor,
|
||||||
RankingWeights,
|
RankingWeights,
|
||||||
SubfieldShare,
|
SubfieldShare,
|
||||||
Timespan,
|
Timespan,
|
||||||
|
FieldNode,
|
||||||
|
SubfieldNode,
|
||||||
|
TopicNode,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -65,59 +67,88 @@ async def _get_author_ids_from_institution(institution_id: str) -> list[str]:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
def _topics_nested_clause(should_clauses: list[dict]) -> dict:
|
||||||
class MatchConfig:
|
"""Wraps should-clauses on the nested topics of a work."""
|
||||||
"""Where a topic filter matches on a work: keyword display names or topic ids."""
|
|
||||||
|
|
||||||
path: str
|
|
||||||
match_field: str
|
|
||||||
score_field: str
|
|
||||||
|
|
||||||
|
|
||||||
_KEYWORD_MATCH = MatchConfig(
|
|
||||||
path="keywords",
|
|
||||||
match_field="keywords.display_name.keyword",
|
|
||||||
score_field="keywords.score",
|
|
||||||
)
|
|
||||||
_TOPIC_MATCH = MatchConfig(
|
|
||||||
path="topics",
|
|
||||||
match_field="topics.display_name.keyword",
|
|
||||||
score_field="topics.score",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _match_config(filter_type: FilterType) -> MatchConfig:
|
|
||||||
"""Resolves the request's filter_type into the single set of fields to match on."""
|
|
||||||
if filter_type == FilterType.TOPIC:
|
|
||||||
return _TOPIC_MATCH
|
|
||||||
return _KEYWORD_MATCH
|
|
||||||
|
|
||||||
|
|
||||||
def _keyword_clause(value: str, config: MatchConfig = _KEYWORD_MATCH) -> dict:
|
|
||||||
"""A single nested clause that matches one keyword/topic value on a work."""
|
|
||||||
return {
|
return {
|
||||||
"nested": {
|
"nested": {
|
||||||
"path": config.path,
|
"path": "topics",
|
||||||
"query": {
|
"query": {
|
||||||
"term": {config.match_field: value},
|
"bool": {
|
||||||
|
"should": should_clauses,
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _topic_id_clause(topic_id: str) -> dict:
|
||||||
|
"""Matches one OpenAlex topic id against a work (fuzzy mode).
|
||||||
|
|
||||||
|
A work matches when the topic is either its primary topic or one of its
|
||||||
|
other topics.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
_topics_nested_clause([{"term": {"topics.id": topic_id}}]),
|
||||||
|
{"term": {"primary_topic.id": topic_id}},
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _keyword_clause(keyword: str) -> dict:
|
||||||
|
"""Matches one raw keyword as a phrase against a work (non-fuzzy mode).
|
||||||
|
|
||||||
|
The keyword has to occur as a phrase in at least one of the work's own text
|
||||||
|
fields or in one of the names of its topic hierarchy.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{
|
||||||
|
"nested": {
|
||||||
|
"path": "keywords",
|
||||||
|
"query": {
|
||||||
|
"match_phrase": {"keywords.display_name": keyword},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{"match_phrase": {"primary_topic.display_name": keyword}},
|
||||||
|
{"match_phrase": {"title": keyword}},
|
||||||
|
{"match_phrase": {"abstract": keyword}},
|
||||||
|
_topics_nested_clause(
|
||||||
|
[
|
||||||
|
{"match_phrase": {"topics.display_name": keyword}},
|
||||||
|
{"match_phrase": {"topics.field.display_name": keyword}},
|
||||||
|
{"match_phrase": {"topics.subfield.display_name": keyword}},
|
||||||
|
{"match_phrase": {"topics.domain.display_name": keyword}},
|
||||||
|
]
|
||||||
|
),
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _build_keyword_query(
|
def _build_keyword_query(
|
||||||
keywords: list[str],
|
keywords: list[str],
|
||||||
operator: KeywordOperator,
|
operator: KeywordOperator,
|
||||||
config: MatchConfig = _KEYWORD_MATCH,
|
fuzzy: bool = False,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""Combines the keyword/topic clauses according to the operator.
|
"""Combines the keyword/topic clauses according to the operator.
|
||||||
|
|
||||||
AND: a work must carry all values (every clause is required).
|
AND: a work must match all values (every clause is required).
|
||||||
OR: a work must carry at least one of the values.
|
OR: a work must match at least one of the values.
|
||||||
"""
|
"""
|
||||||
clauses = []
|
clauses = []
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
clauses.append(_keyword_clause(keyword, config))
|
if fuzzy:
|
||||||
|
clauses.append(_topic_id_clause(keyword))
|
||||||
|
else:
|
||||||
|
clauses.append(_keyword_clause(keyword))
|
||||||
|
|
||||||
if operator == KeywordOperator.OR:
|
if operator == KeywordOperator.OR:
|
||||||
return {
|
return {
|
||||||
@@ -152,12 +183,12 @@ def _topic_stats_query(
|
|||||||
operator: KeywordOperator,
|
operator: KeywordOperator,
|
||||||
publication_types: list[PublicationType],
|
publication_types: list[PublicationType],
|
||||||
timespan: Timespan | None,
|
timespan: Timespan | None,
|
||||||
config: MatchConfig = _KEYWORD_MATCH,
|
fuzzy: bool = False,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""Builds a single query with all stats for Section 1"""
|
"""Builds a single query with all stats for Section 1"""
|
||||||
|
|
||||||
filters = [
|
filters = [
|
||||||
_build_keyword_query(keywords, operator, config),
|
_build_keyword_query(keywords, operator, fuzzy),
|
||||||
_author_filter(author_ids),
|
_author_filter(author_ids),
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -279,38 +310,6 @@ def _topic_stats_query(
|
|||||||
"_source": {"includes": ["cited_by_count"]},
|
"_source": {"includes": ["cited_by_count"]},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
# works whose matched keyword/topic scores above 0.8
|
|
||||||
"relevance_above_80": {
|
|
||||||
"filter": {
|
|
||||||
"nested": {
|
|
||||||
"path": config.path,
|
|
||||||
"query": {
|
|
||||||
"bool": {
|
|
||||||
"filter": [
|
|
||||||
{"terms": {config.match_field: keywords}},
|
|
||||||
{"range": {config.score_field: {"gt": 0.8}}},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
# average matched relevance score over the works
|
|
||||||
"matched_keywords": {
|
|
||||||
"nested": {"path": config.path},
|
|
||||||
"aggs": {
|
|
||||||
"only_searched": {
|
|
||||||
"filter": {
|
|
||||||
"terms": {config.match_field: keywords},
|
|
||||||
},
|
|
||||||
"aggs": {
|
|
||||||
"avg_score": {
|
|
||||||
"avg": {"field": config.score_field},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -343,17 +342,16 @@ async def topic_stats_for_authors(
|
|||||||
operator: KeywordOperator,
|
operator: KeywordOperator,
|
||||||
publication_types: list[PublicationType],
|
publication_types: list[PublicationType],
|
||||||
timespan: Timespan | None,
|
timespan: Timespan | None,
|
||||||
filter_type: FilterType = FilterType.KEYWORD,
|
fuzzy: bool = False,
|
||||||
) -> list[AuthorTopicStats]:
|
) -> list[AuthorTopicStats]:
|
||||||
|
|
||||||
if not author_ids:
|
if not author_ids:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
match_cfg = _match_config(filter_type)
|
|
||||||
response: dict[str, Any] = await elasticsearch.search(
|
response: dict[str, Any] = await elasticsearch.search(
|
||||||
index=config.settings.openalex_works_search_index,
|
index=config.settings.openalex_works_search_index,
|
||||||
body=_topic_stats_query(
|
body=_topic_stats_query(
|
||||||
author_ids, keywords, operator, publication_types, timespan, match_cfg
|
author_ids, keywords, operator, publication_types, timespan, fuzzy
|
||||||
),
|
),
|
||||||
cluster=ESCluster.NES,
|
cluster=ESCluster.NES,
|
||||||
)
|
)
|
||||||
@@ -371,12 +369,6 @@ async def topic_stats_for_authors(
|
|||||||
for author_bucket in author_buckets:
|
for author_bucket in author_buckets:
|
||||||
to_work = author_bucket.get("to_work", {})
|
to_work = author_bucket.get("to_work", {})
|
||||||
avg_value = to_work.get("avg_percentile", {}).get("value")
|
avg_value = to_work.get("avg_percentile", {}).get("value")
|
||||||
avg_rel = (
|
|
||||||
to_work.get("matched_keywords", {})
|
|
||||||
.get("only_searched", {})
|
|
||||||
.get("avg_score", {})
|
|
||||||
.get("value")
|
|
||||||
)
|
|
||||||
positions = {
|
positions = {
|
||||||
bucket.get("key", ""): bucket.get("doc_count", 0)
|
bucket.get("key", ""): bucket.get("doc_count", 0)
|
||||||
for bucket in author_bucket.get("positions", {}).get("buckets", [])
|
for bucket in author_bucket.get("positions", {}).get("buckets", [])
|
||||||
@@ -409,8 +401,6 @@ async def topic_stats_for_authors(
|
|||||||
industry_works_count=to_work.get("industry_collab", {}).get("doc_count", 0),
|
industry_works_count=to_work.get("industry_collab", {}).get("doc_count", 0),
|
||||||
first_year=int(first_year) if first_year is not None else None,
|
first_year=int(first_year) if first_year is not None else None,
|
||||||
last_year=int(last_year) if last_year is not None else None,
|
last_year=int(last_year) if last_year is not None else None,
|
||||||
relevance_above_80_count=to_work.get("relevance_above_80", {}).get("doc_count", 0),
|
|
||||||
avg_relevance=float(avg_rel) if avg_rel is not None else 0.0,
|
|
||||||
first_author_count=positions.get("first", 0),
|
first_author_count=positions.get("first", 0),
|
||||||
middle_author_count=positions.get("middle", 0),
|
middle_author_count=positions.get("middle", 0),
|
||||||
last_author_count=positions.get("last", 0),
|
last_author_count=positions.get("last", 0),
|
||||||
@@ -420,13 +410,29 @@ async def topic_stats_for_authors(
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def _primary_topic_match(keywords: list[str], fuzzy: bool) -> dict:
|
||||||
|
"""Matches works whose primary topic is one of the searched topics/keywords."""
|
||||||
|
if fuzzy:
|
||||||
|
return {"terms": {"primary_topic.id": keywords}}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"bool": {
|
||||||
|
"should": [
|
||||||
|
{"match_phrase": {"primary_topic.display_name": keyword}}
|
||||||
|
for keyword in keywords
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def _topic_profile_query(
|
def _topic_profile_query(
|
||||||
author_ids: list[str],
|
author_ids: list[str],
|
||||||
keywords: list[str],
|
keywords: list[str],
|
||||||
operator: KeywordOperator,
|
operator: KeywordOperator,
|
||||||
publication_types: list[PublicationType],
|
publication_types: list[PublicationType],
|
||||||
timespan: Timespan | None,
|
timespan: Timespan | None,
|
||||||
config: MatchConfig = _KEYWORD_MATCH,
|
fuzzy: bool = False,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""Builds the Section 3 query"""
|
"""Builds the Section 3 query"""
|
||||||
|
|
||||||
@@ -470,14 +476,10 @@ def _topic_profile_query(
|
|||||||
"reverse_nested": {},
|
"reverse_nested": {},
|
||||||
"aggs": {
|
"aggs": {
|
||||||
"matched": {
|
"matched": {
|
||||||
"filter": _build_keyword_query(keywords, operator, config),
|
"filter": _build_keyword_query(keywords, operator, fuzzy),
|
||||||
"aggs": {
|
"aggs": {
|
||||||
"primary_match": {
|
"primary_match": {
|
||||||
"filter": {
|
"filter": _primary_topic_match(keywords, fuzzy),
|
||||||
"terms": {
|
|
||||||
"primary_topic.display_name.keyword": keywords,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -487,6 +489,49 @@ def _topic_profile_query(
|
|||||||
"size": 10,
|
"size": 10,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
# topic treemap
|
||||||
|
"by_field": {
|
||||||
|
"terms": {
|
||||||
|
"field": "primary_topic.field.id",
|
||||||
|
"size": 30,
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"field_name": {
|
||||||
|
"terms": {
|
||||||
|
"field": "primary_topic.field.display_name.keyword",
|
||||||
|
"size": 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"by_subfield": {
|
||||||
|
"terms": {
|
||||||
|
"field": "primary_topic.subfield.id",
|
||||||
|
"size": 30,
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"subfield_name": {
|
||||||
|
"terms": {
|
||||||
|
"field": "primary_topic.subfield.display_name.keyword",
|
||||||
|
"size": 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"by_topic": {
|
||||||
|
"terms": {
|
||||||
|
"field": "primary_topic.id",
|
||||||
|
"size": 30,
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"topic_name": {
|
||||||
|
"terms": {
|
||||||
|
"field": "primary_topic.display_name.keyword",
|
||||||
|
"size": 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
"distinct_topics": {
|
"distinct_topics": {
|
||||||
"cardinality": {"field": "primary_topic.id"},
|
"cardinality": {"field": "primary_topic.id"},
|
||||||
},
|
},
|
||||||
@@ -514,17 +559,16 @@ async def topic_profile_for_authors(
|
|||||||
operator: KeywordOperator,
|
operator: KeywordOperator,
|
||||||
publication_types: list[PublicationType],
|
publication_types: list[PublicationType],
|
||||||
timespan: Timespan | None,
|
timespan: Timespan | None,
|
||||||
filter_type: FilterType = FilterType.KEYWORD,
|
fuzzy: bool = False,
|
||||||
) -> list[AuthorTopicProfile]:
|
) -> list[AuthorTopicProfile]:
|
||||||
|
|
||||||
if not author_ids:
|
if not author_ids:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
match_cfg = _match_config(filter_type)
|
|
||||||
response: dict[str, Any] = await elasticsearch.search(
|
response: dict[str, Any] = await elasticsearch.search(
|
||||||
index=config.settings.openalex_works_search_index,
|
index=config.settings.openalex_works_search_index,
|
||||||
body=_topic_profile_query(
|
body=_topic_profile_query(
|
||||||
author_ids, keywords, operator, publication_types, timespan, match_cfg
|
author_ids, keywords, operator, publication_types, timespan, fuzzy
|
||||||
),
|
),
|
||||||
cluster=ESCluster.NES,
|
cluster=ESCluster.NES,
|
||||||
)
|
)
|
||||||
@@ -549,6 +593,30 @@ async def topic_profile_for_authors(
|
|||||||
)
|
)
|
||||||
for bucket in to_work.get("by_subfield", {}).get("buckets", [])
|
for bucket in to_work.get("by_subfield", {}).get("buckets", [])
|
||||||
]
|
]
|
||||||
|
field_tree = [
|
||||||
|
FieldNode(
|
||||||
|
id=field_bucket.get("key", ""),
|
||||||
|
name=_bucket_name(field_bucket, "field_name", field_bucket.get("key", "")),
|
||||||
|
count=field_bucket.get("doc_count", 0),
|
||||||
|
subfields=[
|
||||||
|
SubfieldNode(
|
||||||
|
id=subfield_bucket.get("key", ""),
|
||||||
|
name=_bucket_name(subfield_bucket, "subfield_name", subfield_bucket.get("key", "")),
|
||||||
|
count=subfield_bucket.get("doc_count", 0),
|
||||||
|
topics=[
|
||||||
|
TopicNode(
|
||||||
|
id=topic_bucket.get("key", ""),
|
||||||
|
name=_bucket_name(topic_bucket, "topic_name", topic_bucket.get("key", "")),
|
||||||
|
count=topic_bucket.get("doc_count", 0),
|
||||||
|
)
|
||||||
|
for topic_bucket in subfield_bucket.get("by_topic", {}).get("buckets", [])
|
||||||
|
],
|
||||||
|
)
|
||||||
|
for subfield_bucket in field_bucket.get("by_subfield", {}).get("buckets", [])
|
||||||
|
],
|
||||||
|
)
|
||||||
|
for field_bucket in to_work.get("by_field", {}).get("buckets", [])
|
||||||
|
]
|
||||||
results.append(
|
results.append(
|
||||||
AuthorTopicProfile(
|
AuthorTopicProfile(
|
||||||
author_id=author_bucket.get("key", ""),
|
author_id=author_bucket.get("key", ""),
|
||||||
@@ -560,6 +628,7 @@ async def topic_profile_for_authors(
|
|||||||
distinct_subfields=to_work.get("distinct_subfields", {}).get("value", 0),
|
distinct_subfields=to_work.get("distinct_subfields", {}).get("value", 0),
|
||||||
distinct_fields=to_work.get("distinct_fields", {}).get("value", 0),
|
distinct_fields=to_work.get("distinct_fields", {}).get("value", 0),
|
||||||
subfields=subfields,
|
subfields=subfields,
|
||||||
|
field_tree=field_tree,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -655,11 +724,11 @@ def _build_query(
|
|||||||
author_ids: list[str],
|
author_ids: list[str],
|
||||||
publication_types: list[PublicationType],
|
publication_types: list[PublicationType],
|
||||||
timespan: Timespan | None,
|
timespan: Timespan | None,
|
||||||
config: MatchConfig = _KEYWORD_MATCH,
|
fuzzy: bool = False,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
"""Builds the Elasticsearch query that returns the raw stats per author."""
|
"""Builds the Elasticsearch query that returns the raw stats per author."""
|
||||||
work_filters = [
|
work_filters = [
|
||||||
_build_keyword_query(keywords, operator, config),
|
_build_keyword_query(keywords, operator, fuzzy),
|
||||||
_author_filter(author_ids),
|
_author_filter(author_ids),
|
||||||
]
|
]
|
||||||
if publication_types:
|
if publication_types:
|
||||||
@@ -717,6 +786,84 @@ def _build_query(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _build_publication_type_counts_query(
|
||||||
|
keywords: list[str],
|
||||||
|
operator: KeywordOperator,
|
||||||
|
author_ids: list[str],
|
||||||
|
timespan: Timespan | None,
|
||||||
|
fuzzy: bool = False,
|
||||||
|
) -> dict:
|
||||||
|
"""Builds the query that counts matching works per publication type.
|
||||||
|
|
||||||
|
Mirrors _build_query's work filters but leaves out the publication_types
|
||||||
|
filter itself, since it aggregates over all types instead of one score.
|
||||||
|
"""
|
||||||
|
work_filters = [
|
||||||
|
_build_keyword_query(keywords, operator, fuzzy),
|
||||||
|
_author_filter(author_ids),
|
||||||
|
]
|
||||||
|
if timespan is not None:
|
||||||
|
work_filters.append(_timespan_filter(timespan))
|
||||||
|
|
||||||
|
return {
|
||||||
|
"size": 0,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": work_filters,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"by_type": {
|
||||||
|
"terms": {
|
||||||
|
"field": "type",
|
||||||
|
"size": len(PublicationType),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def publication_type_counts_for_keywords(
|
||||||
|
keywords: list[str],
|
||||||
|
operator: KeywordOperator,
|
||||||
|
institution_id: str,
|
||||||
|
career_stages: list[CareerStage],
|
||||||
|
timespan: Timespan | None,
|
||||||
|
fuzzy: bool = False,
|
||||||
|
) -> list[PublicationTypeCount]:
|
||||||
|
"""Counts the university's matching works per publication type, largest first."""
|
||||||
|
author_ids = await _get_author_ids_from_institution(institution_id)
|
||||||
|
|
||||||
|
if not author_ids:
|
||||||
|
return []
|
||||||
|
|
||||||
|
if career_stages:
|
||||||
|
author_ids = await _filter_author_ids_by_career_stage(author_ids, career_stages)
|
||||||
|
|
||||||
|
query_body = _build_publication_type_counts_query(
|
||||||
|
keywords, operator, author_ids, timespan, fuzzy,
|
||||||
|
)
|
||||||
|
|
||||||
|
response: dict[str, Any] = await elasticsearch.search(
|
||||||
|
index=config.settings.openalex_works_search_index,
|
||||||
|
body=query_body,
|
||||||
|
cluster=ESCluster.NES,
|
||||||
|
)
|
||||||
|
|
||||||
|
type_buckets = response.get("aggregations", {}).get("by_type", {}).get("buckets", [])
|
||||||
|
|
||||||
|
counts = []
|
||||||
|
for bucket in type_buckets:
|
||||||
|
try:
|
||||||
|
publication_type = PublicationType(bucket["key"])
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
counts.append(PublicationTypeCount(type=publication_type, count=bucket["doc_count"]))
|
||||||
|
|
||||||
|
counts.sort(key=lambda c: c.count, reverse=True)
|
||||||
|
return counts
|
||||||
|
|
||||||
|
|
||||||
def _display_name_from_bucket(author_bucket: dict) -> str:
|
def _display_name_from_bucket(author_bucket: dict) -> str:
|
||||||
"""Reads the authors display name out of the name sub-aggregation."""
|
"""Reads the authors display name out of the name sub-aggregation."""
|
||||||
name_buckets = author_bucket.get("author_name", {}).get("buckets", [])
|
name_buckets = author_bucket.get("author_name", {}).get("buckets", [])
|
||||||
@@ -725,6 +872,14 @@ def _display_name_from_bucket(author_bucket: dict) -> str:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def _bucket_name(bucket: dict, name_agg_key: str, fallback: str) -> str:
|
||||||
|
"""Reads a display name out of a bucket's name sub-aggregation, falling back to its id."""
|
||||||
|
name_buckets = bucket.get(name_agg_key, {}).get("buckets", [])
|
||||||
|
if name_buckets and name_buckets[0].get("key"):
|
||||||
|
return str(name_buckets[0]["key"])
|
||||||
|
return fallback
|
||||||
|
|
||||||
|
|
||||||
def _citations_from_bucket(author_bucket: dict) -> int:
|
def _citations_from_bucket(author_bucket: dict) -> int:
|
||||||
"""Reads the summed citations out of the reverse_nested sub-aggregation."""
|
"""Reads the summed citations out of the reverse_nested sub-aggregation."""
|
||||||
citations_value = (
|
citations_value = (
|
||||||
@@ -1017,7 +1172,7 @@ async def rank_authors_by_keywords(
|
|||||||
publication_types: list[PublicationType],
|
publication_types: list[PublicationType],
|
||||||
timespan: Timespan | None,
|
timespan: Timespan | None,
|
||||||
company_status: CompanyStatusFilter = CompanyStatusFilter.ALL,
|
company_status: CompanyStatusFilter = CompanyStatusFilter.ALL,
|
||||||
filter_type: FilterType = FilterType.KEYWORD,
|
fuzzy: bool = False,
|
||||||
) -> list[RankedAuthor]:
|
) -> list[RankedAuthor]:
|
||||||
"""Ranks the university's authors by a weighted score over works and citations.
|
"""Ranks the university's authors by a weighted score over works and citations.
|
||||||
|
|
||||||
@@ -1035,8 +1190,7 @@ async def rank_authors_by_keywords(
|
|||||||
author_ids = await _filter_author_ids_by_career_stage(author_ids, career_stages)
|
author_ids = await _filter_author_ids_by_career_stage(author_ids, career_stages)
|
||||||
|
|
||||||
query_body = _build_query(
|
query_body = _build_query(
|
||||||
keywords, operator, author_ids, publication_types, timespan,
|
keywords, operator, author_ids, publication_types, timespan, fuzzy,
|
||||||
_match_config(filter_type),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
response: dict[str, Any] = await elasticsearch.search(
|
response: dict[str, Any] = await elasticsearch.search(
|
||||||
|
|||||||
@@ -12,11 +12,6 @@ class KeywordOperator(StrEnum):
|
|||||||
OR = "or"
|
OR = "or"
|
||||||
|
|
||||||
|
|
||||||
class FilterType(StrEnum):
|
|
||||||
KEYWORD = "keyword"
|
|
||||||
TOPIC = "topic"
|
|
||||||
|
|
||||||
|
|
||||||
class CompanyStatusFilter(StrEnum):
|
class CompanyStatusFilter(StrEnum):
|
||||||
ALL = "all"
|
ALL = "all"
|
||||||
ACTIVE = "active"
|
ACTIVE = "active"
|
||||||
@@ -107,10 +102,12 @@ class KeywordToAuthorRequest(BaseModel):
|
|||||||
default=KeywordOperator.AND,
|
default=KeywordOperator.AND,
|
||||||
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
||||||
)
|
)
|
||||||
filter_type: FilterType = Field(
|
fuzzy: bool = Field(
|
||||||
default=FilterType.KEYWORD,
|
default=False,
|
||||||
description="What the 'keywords' values match against: 'keyword' (OpenAlex "
|
description="How the 'keywords' values are matched: True means they are "
|
||||||
"keyword display names) or 'topic' (OpenAlex topic display names). Defaults to 'keyword'.",
|
"OpenAlex topic ids matched against the work's topics, False means they are "
|
||||||
|
"raw keywords matched as phrases in the work's title, abstract, keywords and "
|
||||||
|
"topic names. Defaults to False.",
|
||||||
)
|
)
|
||||||
weights: RankingWeights = Field(
|
weights: RankingWeights = Field(
|
||||||
description="Weights for the ranking metrics. Required.",
|
description="Weights for the ranking metrics. Required.",
|
||||||
@@ -133,7 +130,7 @@ class KeywordToAuthorRequest(BaseModel):
|
|||||||
"'all', only 'active' (non-deleted), or only 'deleted'.",
|
"'all', only 'active' (non-deleted), or only 'deleted'.",
|
||||||
)
|
)
|
||||||
|
|
||||||
@field_validator("operator", "filter_type", mode="before")
|
@field_validator("operator", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def operator_case_insensitive(cls, value):
|
def operator_case_insensitive(cls, value):
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
@@ -154,10 +151,12 @@ class SelectedAuthorsRequest(BaseModel):
|
|||||||
default=KeywordOperator.AND,
|
default=KeywordOperator.AND,
|
||||||
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
||||||
)
|
)
|
||||||
filter_type: FilterType = Field(
|
fuzzy: bool = Field(
|
||||||
default=FilterType.KEYWORD,
|
default=False,
|
||||||
description="What the 'keywords' values match against: 'keyword' (OpenAlex "
|
description="How the 'keywords' values are matched: True means they are "
|
||||||
"keyword display names) or 'topic' (OpenAlex topic ids). Defaults to 'keyword'.",
|
"OpenAlex topic ids matched against the work's topics, False means they are "
|
||||||
|
"raw keywords matched as phrases in the work's title, abstract, keywords and "
|
||||||
|
"topic names. Defaults to False.",
|
||||||
)
|
)
|
||||||
publication_types: list[PublicationType] = Field(
|
publication_types: list[PublicationType] = Field(
|
||||||
default_factory=list,
|
default_factory=list,
|
||||||
@@ -175,13 +174,6 @@ class SelectedAuthorsRequest(BaseModel):
|
|||||||
return value.lower()
|
return value.lower()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@field_validator("filter_type", mode="before")
|
|
||||||
@classmethod
|
|
||||||
def filter_type_case_insensitive(cls, value):
|
|
||||||
if isinstance(value, str):
|
|
||||||
return value.lower()
|
|
||||||
return value
|
|
||||||
|
|
||||||
|
|
||||||
class AuthorMetricsRequest(BaseModel):
|
class AuthorMetricsRequest(BaseModel):
|
||||||
author_ids: list[str] = Field(
|
author_ids: list[str] = Field(
|
||||||
@@ -195,6 +187,44 @@ class AuthorMetricsRequest(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class PublicationTypeCountsRequest(BaseModel):
|
||||||
|
keywords: list[str] = Field(
|
||||||
|
min_length=1,
|
||||||
|
description="One or more keywords to match works against.",
|
||||||
|
)
|
||||||
|
operator: KeywordOperator = Field(
|
||||||
|
default=KeywordOperator.AND,
|
||||||
|
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
||||||
|
)
|
||||||
|
fuzzy: bool = Field(
|
||||||
|
default=False,
|
||||||
|
description="How the 'keywords' values are matched: True means they are "
|
||||||
|
"OpenAlex topic ids matched against the work's topics, False means they are "
|
||||||
|
"raw keywords matched as phrases in the work's title, abstract, keywords and "
|
||||||
|
"topic names. Defaults to False.",
|
||||||
|
)
|
||||||
|
career_stages: list[CareerStage] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="Optional filter: only count works of authors in one of these career stages. Empty = no filter.",
|
||||||
|
)
|
||||||
|
timespan: Timespan | None = Field(
|
||||||
|
default=None,
|
||||||
|
description="Optional filter: only count works whose publication_year is within [from, to].",
|
||||||
|
)
|
||||||
|
|
||||||
|
@field_validator("operator", mode="before")
|
||||||
|
@classmethod
|
||||||
|
def operator_case_insensitive(cls, value):
|
||||||
|
if isinstance(value, str):
|
||||||
|
return value.lower()
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
class PublicationTypeCount(BaseModel):
|
||||||
|
type: PublicationType = Field(description="The OpenAlex work type.")
|
||||||
|
count: int = Field(description="Number of matching works of this type.")
|
||||||
|
|
||||||
|
|
||||||
class AuthorTopicStats(BaseModel):
|
class AuthorTopicStats(BaseModel):
|
||||||
"""Section 1: combined stats over an author's works that match the topic filter."""
|
"""Section 1: combined stats over an author's works that match the topic filter."""
|
||||||
|
|
||||||
@@ -254,15 +284,6 @@ class AuthorTopicStats(BaseModel):
|
|||||||
default=None,
|
default=None,
|
||||||
description="Latest publication year among the author's topic works.",
|
description="Latest publication year among the author's topic works.",
|
||||||
)
|
)
|
||||||
relevance_above_80_count: int = Field(
|
|
||||||
default=0,
|
|
||||||
description="Number of the author's topic works where the matched keyword's "
|
|
||||||
"relevance score is above 0.8.",
|
|
||||||
)
|
|
||||||
avg_relevance: float = Field(
|
|
||||||
default=0.0,
|
|
||||||
description="Average matched-keyword relevance score (0-1) over the author's topic works.",
|
|
||||||
)
|
|
||||||
first_author_count: int = Field(
|
first_author_count: int = Field(
|
||||||
default=0,
|
default=0,
|
||||||
description="Number of the author's topic works where they are the first author.",
|
description="Number of the author's topic works where they are the first author.",
|
||||||
@@ -282,6 +303,32 @@ class SubfieldShare(BaseModel):
|
|||||||
count: int = Field(description="Number of works whose primary topic belongs to this subfield.")
|
count: int = Field(description="Number of works whose primary topic belongs to this subfield.")
|
||||||
|
|
||||||
|
|
||||||
|
class TopicNode(BaseModel):
|
||||||
|
id: str = Field(description="The OpenAlex ID of the primary topic.")
|
||||||
|
name: str = Field(description="The primary-topic display name.")
|
||||||
|
count: int = Field(description="Number of works whose primary topic is this topic.")
|
||||||
|
|
||||||
|
|
||||||
|
class SubfieldNode(BaseModel):
|
||||||
|
id: str = Field(description="The OpenAlex ID of the subfield.")
|
||||||
|
name: str = Field(description="The subfield display name.")
|
||||||
|
count: int = Field(description="Number of works whose primary topic belongs to this subfield.")
|
||||||
|
topics: list[TopicNode] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="Primary topics within this subfield, largest first.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class FieldNode(BaseModel):
|
||||||
|
id: str = Field(description="The OpenAlex ID of the field.")
|
||||||
|
name: str = Field(description="The field display name.")
|
||||||
|
count: int = Field(description="Number of works whose primary topic belongs to this field.")
|
||||||
|
subfields: list[SubfieldNode] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="Subfields within this field, largest first.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AuthorTopicProfile(BaseModel):
|
class AuthorTopicProfile(BaseModel):
|
||||||
author_id: str = Field(description="The OpenAlex ID of the author.")
|
author_id: str = Field(description="The OpenAlex ID of the author.")
|
||||||
display_name: str = Field(description="The name of the author.")
|
display_name: str = Field(description="The name of the author.")
|
||||||
@@ -293,7 +340,7 @@ class AuthorTopicProfile(BaseModel):
|
|||||||
)
|
)
|
||||||
primary_topic_matches: int = Field(
|
primary_topic_matches: int = Field(
|
||||||
description="Matched works where one of the searched topics is the work's "
|
description="Matched works where one of the searched topics is the work's "
|
||||||
"primary topic (only meaningful for filter_type 'topic').",
|
"primary topic.",
|
||||||
)
|
)
|
||||||
distinct_topics: int = Field(
|
distinct_topics: int = Field(
|
||||||
description="Number of distinct primary topics across all works.",
|
description="Number of distinct primary topics across all works.",
|
||||||
@@ -308,6 +355,11 @@ class AuthorTopicProfile(BaseModel):
|
|||||||
default_factory=list,
|
default_factory=list,
|
||||||
description="Top subfields over all works, by primary topic, largest first.",
|
description="Top subfields over all works, by primary topic, largest first.",
|
||||||
)
|
)
|
||||||
|
field_tree: list[FieldNode] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="Field -> subfield -> topic hierarchy over all works, by primary "
|
||||||
|
"topic, each level largest first. Drives the interactive topic treemap.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AuthorStaticStats(BaseModel):
|
class AuthorStaticStats(BaseModel):
|
||||||
|
|||||||
@@ -116,6 +116,16 @@ Content-Type: application/json
|
|||||||
"timespan": { "from": 2018, "to": 2025 }
|
"timespan": { "from": 2018, "to": 2025 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
POST http://localhost:8000/api/rank/topic-profile
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"author_ids": ["https://openalex.org/A504035360", "https://openalex.org/A5019137844"],
|
||||||
|
"keywords": ["Augmented Reality Applications"],
|
||||||
|
"operator": "or"
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
GET https://project.nes.uni-due.de/elastic/_aliases
|
GET https://project.nes.uni-due.de/elastic/_aliases
|
||||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ from .model import (
|
|||||||
AuthorTopicProfile,
|
AuthorTopicProfile,
|
||||||
AuthorTopicStats,
|
AuthorTopicStats,
|
||||||
KeywordToAuthorRequest,
|
KeywordToAuthorRequest,
|
||||||
|
PublicationTypeCount,
|
||||||
|
PublicationTypeCountsRequest,
|
||||||
RankedAuthor,
|
RankedAuthor,
|
||||||
SelectedAuthorsRequest,
|
SelectedAuthorsRequest,
|
||||||
)
|
)
|
||||||
@@ -46,11 +48,11 @@ async def rank_author(
|
|||||||
)
|
)
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"rank-author keywords=%s operator=%s filter_type=%s institution_id=%s career_stages=%s "
|
"rank-author keywords=%s operator=%s fuzzy=%s institution_id=%s career_stages=%s "
|
||||||
"publication_types=%s timespan=%s",
|
"publication_types=%s timespan=%s",
|
||||||
request.keywords,
|
request.keywords,
|
||||||
request.operator,
|
request.operator,
|
||||||
request.filter_type,
|
request.fuzzy,
|
||||||
institution_id,
|
institution_id,
|
||||||
request.career_stages,
|
request.career_stages,
|
||||||
request.publication_types,
|
request.publication_types,
|
||||||
@@ -65,18 +67,52 @@ async def rank_author(
|
|||||||
publication_types=request.publication_types,
|
publication_types=request.publication_types,
|
||||||
timespan=request.timespan,
|
timespan=request.timespan,
|
||||||
company_status=request.company_status,
|
company_status=request.company_status,
|
||||||
filter_type=request.filter_type,
|
fuzzy=request.fuzzy,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Publication-type facet counts for the "Art der Work" filter
|
||||||
|
@router.post("/publication-type-counts", response_model=list[PublicationTypeCount])
|
||||||
|
async def publication_type_counts(
|
||||||
|
request: PublicationTypeCountsRequest,
|
||||||
|
access_token_metadata: Annotated[
|
||||||
|
AccessTokenMetadata, CurrentUserAccessTokenPayloadDep
|
||||||
|
],
|
||||||
|
):
|
||||||
|
institution_id = access_token_metadata.effective_institution_id
|
||||||
|
if not institution_id:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_403_FORBIDDEN,
|
||||||
|
detail="No OpenAlex institution is assigned to the current organization.",
|
||||||
|
)
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
"publication-type-counts keywords=%s operator=%s fuzzy=%s institution_id=%s "
|
||||||
|
"career_stages=%s timespan=%s",
|
||||||
|
request.keywords,
|
||||||
|
request.operator,
|
||||||
|
request.fuzzy,
|
||||||
|
institution_id,
|
||||||
|
request.career_stages,
|
||||||
|
request.timespan,
|
||||||
|
)
|
||||||
|
return await logic.publication_type_counts_for_keywords(
|
||||||
|
keywords=request.keywords,
|
||||||
|
operator=request.operator,
|
||||||
|
institution_id=institution_id,
|
||||||
|
career_stages=request.career_stages,
|
||||||
|
timespan=request.timespan,
|
||||||
|
fuzzy=request.fuzzy,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Compare authors table 1 (topic stats)
|
# Compare authors table 1 (topic stats)
|
||||||
@router.post("/topic-stats", response_model=list[AuthorTopicStats])
|
@router.post("/topic-stats", response_model=list[AuthorTopicStats])
|
||||||
async def topic_stats(request: SelectedAuthorsRequest):
|
async def topic_stats(request: SelectedAuthorsRequest):
|
||||||
logger.info(
|
logger.info(
|
||||||
"topic-stats author_ids=%s keywords=%s operator=%s filter_type=%s publication_types=%s timespan=%s",
|
"topic-stats author_ids=%s keywords=%s operator=%s fuzzy=%s publication_types=%s timespan=%s",
|
||||||
request.author_ids,
|
request.author_ids,
|
||||||
request.keywords,
|
request.keywords,
|
||||||
request.operator,
|
request.operator,
|
||||||
request.filter_type,
|
request.fuzzy,
|
||||||
request.publication_types,
|
request.publication_types,
|
||||||
request.timespan,
|
request.timespan,
|
||||||
)
|
)
|
||||||
@@ -86,19 +122,19 @@ async def topic_stats(request: SelectedAuthorsRequest):
|
|||||||
request.operator,
|
request.operator,
|
||||||
request.publication_types,
|
request.publication_types,
|
||||||
request.timespan,
|
request.timespan,
|
||||||
request.filter_type,
|
request.fuzzy,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Compare authors section 3 (topic profile over ALL works of each author)
|
# Compare authors section 3 (topic profile over ALL works of each author)
|
||||||
@router.post("/topic-profile", response_model=list[AuthorTopicProfile])
|
@router.post("/topic-profile", response_model=list[AuthorTopicProfile])
|
||||||
async def topic_profile(request: SelectedAuthorsRequest):
|
async def topic_profile(request: SelectedAuthorsRequest):
|
||||||
logger.info(
|
logger.info(
|
||||||
"topic-profile author_ids=%s keywords=%s operator=%s filter_type=%s "
|
"topic-profile author_ids=%s keywords=%s operator=%s fuzzy=%s "
|
||||||
"publication_types=%s timespan=%s",
|
"publication_types=%s timespan=%s",
|
||||||
request.author_ids,
|
request.author_ids,
|
||||||
request.keywords,
|
request.keywords,
|
||||||
request.operator,
|
request.operator,
|
||||||
request.filter_type,
|
request.fuzzy,
|
||||||
request.publication_types,
|
request.publication_types,
|
||||||
request.timespan,
|
request.timespan,
|
||||||
)
|
)
|
||||||
@@ -108,7 +144,7 @@ async def topic_profile(request: SelectedAuthorsRequest):
|
|||||||
request.operator,
|
request.operator,
|
||||||
request.publication_types,
|
request.publication_types,
|
||||||
request.timespan,
|
request.timespan,
|
||||||
request.filter_type,
|
request.fuzzy,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Compare authors table 2 (author-level stats, keyword/time-independent)
|
# Compare authors table 2 (author-level stats, keyword/time-independent)
|
||||||
|
|||||||
@@ -1,84 +0,0 @@
|
|||||||
|
|
||||||
"""
|
|
||||||
This module contains the rest api of the
|
|
||||||
service.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from typing import Annotated
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Query
|
|
||||||
|
|
||||||
from inse.config import get_settings
|
|
||||||
|
|
||||||
from . import logic
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
### startup
|
|
||||||
|
|
||||||
settings = get_settings()
|
|
||||||
|
|
||||||
router = APIRouter(
|
|
||||||
prefix="/api/inse-service",
|
|
||||||
tags=["INSE Service"],
|
|
||||||
responses={404: {"description": "Not found"}},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
### topics
|
|
||||||
# hierarchy cache (temporaray => should be called by a scheduled job, with new openalex data indexing)
|
|
||||||
@router.get(
|
|
||||||
"/topics/cache",
|
|
||||||
operation_id="buildTopicCache",
|
|
||||||
response_model=dict,
|
|
||||||
summary="Builds the topic hierarchy cache.",
|
|
||||||
tags=["Topics"],
|
|
||||||
)
|
|
||||||
def build_topic_cache(
|
|
||||||
page_size: Annotated[
|
|
||||||
int, Query(description="Page size for each search page.", ge=1, le=1000)
|
|
||||||
] = 200,
|
|
||||||
save_json: Annotated[
|
|
||||||
bool, Query(description="Persist cache JSON to data folder.")
|
|
||||||
] = True,
|
|
||||||
):
|
|
||||||
return logic.build_topic_cache(page_size=page_size, save_json=save_json)
|
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
|
||||||
"/topics/count",
|
|
||||||
operation_id="countTopicHierarchy",
|
|
||||||
response_model=dict,
|
|
||||||
summary="Counts topic hierarchy occurrences from cache.",
|
|
||||||
tags=["Topics"],
|
|
||||||
)
|
|
||||||
def count_topic_hierarchy(
|
|
||||||
topic_names: Annotated[
|
|
||||||
list[str],
|
|
||||||
Query(
|
|
||||||
alias="topic",
|
|
||||||
description="Topic names (repeat parameter).",
|
|
||||||
example=[
|
|
||||||
"Big Data and Business Intelligence",
|
|
||||||
"Big Data and Business Intelligence",
|
|
||||||
"Topic Modeling",
|
|
||||||
"Entrepreneurship Studies and Influences",
|
|
||||||
"Complex Network Analysis Techniques",
|
|
||||||
"Semantic Web and Ontologies",
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
):
|
|
||||||
return logic.count_topic_hierarchy(topic_names)
|
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
|
||||||
"/topics/hierarchy",
|
|
||||||
operation_id="getTopicHierarchy",
|
|
||||||
response_model=dict,
|
|
||||||
summary="Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).",
|
|
||||||
tags=["Topics"],
|
|
||||||
)
|
|
||||||
def get_topic_hierarchy():
|
|
||||||
return logic.get_topic_hierarchy()
|
|
||||||
@@ -1,111 +1,10 @@
|
|||||||
|
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
from inse.main import app
|
from inse.main import app
|
||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
URL_SERVICE_PREFIX="/inse-service"
|
|
||||||
|
|
||||||
def test_redirect_root():
|
def test_redirect_root():
|
||||||
response = client.get("/", follow_redirects=False)
|
response = client.get("/", follow_redirects=False)
|
||||||
assert response.status_code == 307
|
assert response.status_code == 307
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# def test_get_person_by_id_success():
|
|
||||||
|
|
||||||
# mock_person = model.Person(
|
|
||||||
# id="A5093075883",
|
|
||||||
# name="Arman Arzani",
|
|
||||||
# works_count=6,
|
|
||||||
# cited_by_count=4,
|
|
||||||
# affiliations=[],
|
|
||||||
# topics=[]
|
|
||||||
# )
|
|
||||||
|
|
||||||
# with patch("inse.logic.get_person_by_id", return_value=mock_person):
|
|
||||||
|
|
||||||
# response = client.get(
|
|
||||||
# URL_SERVICE_PREFIX + "/persons/id",
|
|
||||||
# params={"author_id": "A5093075883"}
|
|
||||||
# )
|
|
||||||
|
|
||||||
# assert response.status_code == 200
|
|
||||||
|
|
||||||
# data = response.json()
|
|
||||||
|
|
||||||
# assert data["id"] == "A5093075883"
|
|
||||||
# assert data["name"] == "Arman Arzani"
|
|
||||||
# assert data["works_count"] == 6
|
|
||||||
# assert data["cited_by_count"] == 4
|
|
||||||
|
|
||||||
# def test_get_person_by_id_not_found():
|
|
||||||
# invalid_id = "INVALID"
|
|
||||||
# with patch(
|
|
||||||
# "inse.logic.get_person_by_id",
|
|
||||||
# side_effect=HTTPException(
|
|
||||||
# status_code=404,
|
|
||||||
# detail="Person with id INVALID not found"
|
|
||||||
# )
|
|
||||||
# ):
|
|
||||||
|
|
||||||
# response = client.get(
|
|
||||||
# URL_SERVICE_PREFIX + "/persons/id",
|
|
||||||
# params={"author_id": invalid_id}
|
|
||||||
# )
|
|
||||||
# assert response.status_code == 404
|
|
||||||
|
|
||||||
# def test_get_person_by_id_missing_query_param():
|
|
||||||
|
|
||||||
# response = client.get(URL_SERVICE_PREFIX + "/persons/id")
|
|
||||||
|
|
||||||
# assert response.status_code == 422
|
|
||||||
|
|
||||||
# def test_search_persons_by_name_success():
|
|
||||||
|
|
||||||
# mock_result = model.PersonSearchResult(
|
|
||||||
# persons=[
|
|
||||||
# model.Person(
|
|
||||||
# id="A5047117780",
|
|
||||||
# name="Pedro José Marrón",
|
|
||||||
# works_count=285,
|
|
||||||
# cited_by_count=2638,
|
|
||||||
# )
|
|
||||||
# ]
|
|
||||||
# )
|
|
||||||
|
|
||||||
# with patch(
|
|
||||||
# "inse.logic.search_persons_by_name",
|
|
||||||
# return_value=mock_result
|
|
||||||
# ):
|
|
||||||
|
|
||||||
# response = client.get(
|
|
||||||
# URL_SERVICE_PREFIX + "/persons/searchByName",
|
|
||||||
# params={"author_name": "Pedro José Marrón"}
|
|
||||||
# )
|
|
||||||
|
|
||||||
# assert response.status_code == 200
|
|
||||||
|
|
||||||
# data = response.json()
|
|
||||||
|
|
||||||
# assert "persons" in data
|
|
||||||
# assert data["persons"][0]["name"] == "Pedro José Marrón"
|
|
||||||
|
|
||||||
# def test_search_persons_by_name_empty_result():
|
|
||||||
|
|
||||||
# response = client.get(
|
|
||||||
# URL_SERVICE_PREFIX + "/persons/searchByName",
|
|
||||||
# params={"author_name": "zzzz_nonexistent_name_123"}
|
|
||||||
# )
|
|
||||||
|
|
||||||
# assert response.status_code == 200
|
|
||||||
|
|
||||||
# data = response.json()
|
|
||||||
|
|
||||||
# assert data["persons"] == []
|
|
||||||
|
|
||||||
# def test_search_persons_by_name_missing_query_param():
|
|
||||||
|
|
||||||
# response = client.get(URL_SERVICE_PREFIX + "/persons/searchByName")
|
|
||||||
|
|
||||||
# assert response.status_code == 422
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
from enum import StrEnum
|
from enum import StrEnum
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from inse.model import Page
|
from inse.model import Page
|
||||||
from inse.models.openalex.topic import Topic
|
from inse.models.openalex.topic import Topic
|
||||||
@@ -12,3 +13,25 @@ class TopicSortBy(StrEnum):
|
|||||||
|
|
||||||
class TopicPageV2(Page[Topic]):
|
class TopicPageV2(Page[Topic]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class TopicHierarchySubfield(BaseModel):
|
||||||
|
id: str | None = None
|
||||||
|
name: str
|
||||||
|
topics: list[Topic] = []
|
||||||
|
|
||||||
|
|
||||||
|
class TopicHierarchyField(BaseModel):
|
||||||
|
id: str | None = None
|
||||||
|
name: str
|
||||||
|
subfields: list[TopicHierarchySubfield] = []
|
||||||
|
|
||||||
|
|
||||||
|
class TopicHierarchyDomain(BaseModel):
|
||||||
|
id: str | None = None
|
||||||
|
name: str
|
||||||
|
fields: list[TopicHierarchyField] = []
|
||||||
|
|
||||||
|
|
||||||
|
class TopicHierarchyResponse(BaseModel):
|
||||||
|
domains: list[TopicHierarchyDomain] = []
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ from inse.models.openalex.subfield import Subfield
|
|||||||
from inse.models.openalex.topic import Topic
|
from inse.models.openalex.topic import Topic
|
||||||
from inse.router_prefixes import RouterPrefixes
|
from inse.router_prefixes import RouterPrefixes
|
||||||
from inse.tags import Tags
|
from inse.tags import Tags
|
||||||
from inse.topics.v2.model import TopicPageV2, TopicSortBy
|
from inse.topics.v2.model import (
|
||||||
|
TopicHierarchyResponse,
|
||||||
|
TopicPageV2,
|
||||||
|
TopicSortBy,
|
||||||
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -18,6 +22,15 @@ logger = logging.getLogger(__name__)
|
|||||||
router = APIRouter(prefix=RouterPrefixes.TOPICS_V2, tags=[Tags.TOPICS_V2])
|
router = APIRouter(prefix=RouterPrefixes.TOPICS_V2, tags=[Tags.TOPICS_V2])
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/hierarchy",
|
||||||
|
operation_id="getTopicHierarchy",
|
||||||
|
summary="Returns the full topic hierarchy tree (Domain -> Field -> Subfield -> Topics).",
|
||||||
|
)
|
||||||
|
async def get_topic_hierarchy() -> TopicHierarchyResponse:
|
||||||
|
return await topics_service.get_topic_hierarchy()
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/search",
|
"/search",
|
||||||
operation_id="searchTopics",
|
operation_id="searchTopics",
|
||||||
|
|||||||
@@ -5,7 +5,14 @@ from inse.models.openalex.domain import Domain
|
|||||||
from inse.models.openalex.model_field import ModelField
|
from inse.models.openalex.model_field import ModelField
|
||||||
from inse.models.openalex.subfield import Subfield
|
from inse.models.openalex.subfield import Subfield
|
||||||
from inse.models.openalex.topic import Topic
|
from inse.models.openalex.topic import Topic
|
||||||
from inse.topics.v2.model import TopicPageV2, TopicSortBy
|
from inse.topics.v2.model import (
|
||||||
|
TopicHierarchyDomain,
|
||||||
|
TopicHierarchyField,
|
||||||
|
TopicHierarchyResponse,
|
||||||
|
TopicHierarchySubfield,
|
||||||
|
TopicPageV2,
|
||||||
|
TopicSortBy,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def _search_topics(
|
async def _search_topics(
|
||||||
@@ -322,3 +329,118 @@ async def get_topics_by_ids(topic_ids: list[str]) -> TopicPageV2:
|
|||||||
"domain",
|
"domain",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
_cached_hierarchy: TopicHierarchyResponse | None = None #cache is small, data is static => reduces database calls
|
||||||
|
|
||||||
|
|
||||||
|
def clear_topic_hierarchy_cache() -> None:
|
||||||
|
global _cached_hierarchy
|
||||||
|
_cached_hierarchy = None
|
||||||
|
|
||||||
|
|
||||||
|
async def get_topic_hierarchy() -> TopicHierarchyResponse:
|
||||||
|
"""Builds and returns a hierarchical tree structure of topics:
|
||||||
|
Domains -> Fields -> Subfields -> Topics
|
||||||
|
Data is dynamically streamed from Elasticsearch openalex-topics using PIT+search_after scan and cached in-memory.
|
||||||
|
"""
|
||||||
|
global _cached_hierarchy
|
||||||
|
if _cached_hierarchy is not None:
|
||||||
|
return _cached_hierarchy
|
||||||
|
|
||||||
|
domains_map: dict[str, dict] = {}
|
||||||
|
|
||||||
|
async for hit in elasticsearch.scan(
|
||||||
|
index=ESIndex.OPENALEX_TOPICS,
|
||||||
|
query={"match_all": {}},
|
||||||
|
source=[
|
||||||
|
"id",
|
||||||
|
"display_name",
|
||||||
|
"description",
|
||||||
|
"subfield",
|
||||||
|
"field",
|
||||||
|
"domain",
|
||||||
|
"works_count",
|
||||||
|
"cited_by_count",
|
||||||
|
],
|
||||||
|
page_size=2000,
|
||||||
|
):
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
topic_name = source.get("display_name")
|
||||||
|
topic_id = source.get("id") or hit.get("_id")
|
||||||
|
if not topic_name or not topic_id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
domain_info = source.get("domain") or {}
|
||||||
|
field_info = source.get("field") or {}
|
||||||
|
subfield_info = source.get("subfield") or {}
|
||||||
|
|
||||||
|
domain_name = domain_info.get("display_name") or "Unbekannter Bereich"
|
||||||
|
domain_id = domain_info.get("id")
|
||||||
|
field_name = field_info.get("display_name") or "Unbekanntes Feld"
|
||||||
|
field_id = field_info.get("id")
|
||||||
|
subfield_name = subfield_info.get("display_name") or "Unbekanntes Teilfeld"
|
||||||
|
subfield_id = subfield_info.get("id")
|
||||||
|
|
||||||
|
if domain_name not in domains_map:
|
||||||
|
domains_map[domain_name] = {
|
||||||
|
"id": domain_id,
|
||||||
|
"name": domain_name,
|
||||||
|
"fields": {},
|
||||||
|
}
|
||||||
|
fields_map = domains_map[domain_name]["fields"]
|
||||||
|
|
||||||
|
if field_name not in fields_map:
|
||||||
|
fields_map[field_name] = {
|
||||||
|
"id": field_id,
|
||||||
|
"name": field_name,
|
||||||
|
"subfields": {},
|
||||||
|
}
|
||||||
|
subfields_map = fields_map[field_name]["subfields"]
|
||||||
|
|
||||||
|
if subfield_name not in subfields_map:
|
||||||
|
subfields_map[subfield_name] = {
|
||||||
|
"id": subfield_id,
|
||||||
|
"name": subfield_name,
|
||||||
|
"topics": [],
|
||||||
|
}
|
||||||
|
|
||||||
|
topic_obj = Topic.from_dict(source) if hasattr(Topic, "from_dict") else Topic(**source)
|
||||||
|
subfields_map[subfield_name]["topics"].append(topic_obj)
|
||||||
|
|
||||||
|
formatted_domains: list[TopicHierarchyDomain] = []
|
||||||
|
for d_name, d_val in sorted(domains_map.items(), key=lambda x: x[0]):
|
||||||
|
formatted_fields: list[TopicHierarchyField] = []
|
||||||
|
for f_name, f_val in sorted(d_val["fields"].items(), key=lambda x: x[0]):
|
||||||
|
formatted_subfields: list[TopicHierarchySubfield] = []
|
||||||
|
for sf_name, sf_val in sorted(
|
||||||
|
f_val["subfields"].items(), key=lambda x: x[0]
|
||||||
|
):
|
||||||
|
sf_val["topics"].sort(
|
||||||
|
key=lambda t: t.display_name or ""
|
||||||
|
)
|
||||||
|
formatted_subfields.append(
|
||||||
|
TopicHierarchySubfield(
|
||||||
|
id=sf_val["id"],
|
||||||
|
name=sf_name,
|
||||||
|
topics=sf_val["topics"],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
formatted_fields.append(
|
||||||
|
TopicHierarchyField(
|
||||||
|
id=f_val["id"],
|
||||||
|
name=f_name,
|
||||||
|
subfields=formatted_subfields,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
formatted_domains.append(
|
||||||
|
TopicHierarchyDomain(
|
||||||
|
id=d_val["id"],
|
||||||
|
name=d_name,
|
||||||
|
fields=formatted_fields,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
result = TopicHierarchyResponse(domains=formatted_domains)
|
||||||
|
_cached_hierarchy = result
|
||||||
|
return result
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ from inse.models.openalex.topics_by_time import TopicsByTime
|
|||||||
from inse.models.openalex.topics_by_year import TopicsByYear
|
from inse.models.openalex.topics_by_year import TopicsByYear
|
||||||
from inse.models.openalex.work import Work
|
from inse.models.openalex.work import Work
|
||||||
from inse.models.openalex.work_page import WorkPage
|
from inse.models.openalex.work_page import WorkPage
|
||||||
|
from inse.models.openalex.work_topic import WorkTopic
|
||||||
|
from inse.models.openalex.work_topic_domain import WorkTopicDomain
|
||||||
|
from inse.models.openalex.work_topic_field import WorkTopicField
|
||||||
|
from inse.models.openalex.work_topic_subfield import WorkTopicSubfield
|
||||||
from inse.models.openalex.works_list_response import WorksListResponse
|
from inse.models.openalex.works_list_response import WorksListResponse
|
||||||
|
|
||||||
from .search_client import OpenAlexWorksSearchClient
|
from .search_client import OpenAlexWorksSearchClient
|
||||||
@@ -235,26 +239,39 @@ async def get_work(
|
|||||||
return elements[0]
|
return elements[0]
|
||||||
|
|
||||||
|
|
||||||
async def enrich_topic_descriptions(topics: list) -> None:
|
async def enrich_topic_descriptions(topics: list[WorkTopic]) -> None:
|
||||||
"""Batch-fill missing descriptions on dehydrated topics.
|
"""Batch-fill missing hierarchy metadata and descriptions on dehydrated topics.
|
||||||
|
|
||||||
OpenAlex work and author documents carry dehydrated topics without a
|
OpenAlex work and author documents carry dehydrated topics without a
|
||||||
description, so we batch-load the details from the openalex-topics index.
|
description, subfield, field, or domain, so we batch-load the details from
|
||||||
|
the openalex-topics index.
|
||||||
"""
|
"""
|
||||||
pending = [topic for topic in topics if topic.id and not topic.description]
|
pending = [
|
||||||
|
topic
|
||||||
|
for topic in topics
|
||||||
|
if topic.id and (not topic.description or not topic.var_field or not topic.domain)
|
||||||
|
]
|
||||||
|
|
||||||
if not pending:
|
if not pending:
|
||||||
return
|
return
|
||||||
|
|
||||||
details = await _get_topic_details(list({topic.id for topic in pending}))
|
details = await _get_topic_details(list({topic.id for topic in pending}))
|
||||||
|
|
||||||
if not details:
|
if not details:
|
||||||
return
|
return
|
||||||
|
|
||||||
for topic in pending:
|
for topic in pending:
|
||||||
info = details.get(topic.id)
|
info = details.get(topic.id)
|
||||||
if info:
|
if not info:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not topic.description:
|
||||||
topic.description = info.get("description")
|
topic.description = info.get("description")
|
||||||
|
if not topic.subfield and info.get("subfield"):
|
||||||
|
topic.subfield = WorkTopicSubfield.from_dict(info["subfield"])
|
||||||
|
if not topic.var_field and info.get("field"):
|
||||||
|
topic.var_field = WorkTopicField.from_dict(info["field"])
|
||||||
|
if not topic.domain and info.get("domain"):
|
||||||
|
topic.domain = WorkTopicDomain.from_dict(info["domain"])
|
||||||
|
|
||||||
|
|
||||||
async def _enrich_work_topic_descriptions(works: list[Work]) -> None:
|
async def _enrich_work_topic_descriptions(works: list[Work]) -> None:
|
||||||
|
|||||||
Generated
+88
@@ -712,6 +712,53 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/df/b2/87e62e8c3e2f4b32e5fe99e0b86d576da1312593b39f47d8ceef365e95ed/packaging-26.2-py3-none-any.whl", hash = "sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e", size = 100195, upload-time = "2026-04-24T20:15:22.081Z" },
|
{ url = "https://files.pythonhosted.org/packages/df/b2/87e62e8c3e2f4b32e5fe99e0b86d576da1312593b39f47d8ceef365e95ed/packaging-26.2-py3-none-any.whl", hash = "sha256:5fc45236b9446107ff2415ce77c807cee2862cb6fac22b8a73826d0693b0980e", size = 100195, upload-time = "2026-04-24T20:15:22.081Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pandas"
|
||||||
|
version = "2.3.3"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "numpy" },
|
||||||
|
{ name = "python-dateutil" },
|
||||||
|
{ name = "pytz" },
|
||||||
|
{ name = "tzdata" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/33/01/d40b85317f86cf08d853a4f495195c73815fdf205eef3993821720274518/pandas-2.3.3.tar.gz", hash = "sha256:e05e1af93b977f7eafa636d043f9f94c7ee3ac81af99c13508215942e64c993b", size = 4495223, upload-time = "2025-09-29T23:34:51.853Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/9c/fb/231d89e8637c808b997d172b18e9d4a4bc7bf31296196c260526055d1ea0/pandas-2.3.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6d21f6d74eb1725c2efaa71a2bfc661a0689579b58e9c0ca58a739ff0b002b53", size = 11597846, upload-time = "2025-09-29T23:19:48.856Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/5c/bd/bf8064d9cfa214294356c2d6702b716d3cf3bb24be59287a6a21e24cae6b/pandas-2.3.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3fd2f887589c7aa868e02632612ba39acb0b8948faf5cc58f0850e165bd46f35", size = 10729618, upload-time = "2025-09-29T23:39:08.659Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/57/56/cf2dbe1a3f5271370669475ead12ce77c61726ffd19a35546e31aa8edf4e/pandas-2.3.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ecaf1e12bdc03c86ad4a7ea848d66c685cb6851d807a26aa245ca3d2017a1908", size = 11737212, upload-time = "2025-09-29T23:19:59.765Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e5/63/cd7d615331b328e287d8233ba9fdf191a9c2d11b6af0c7a59cfcec23de68/pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b3d11d2fda7eb164ef27ffc14b4fcab16a80e1ce67e9f57e19ec0afaf715ba89", size = 12362693, upload-time = "2025-09-29T23:20:14.098Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a6/de/8b1895b107277d52f2b42d3a6806e69cfef0d5cf1d0ba343470b9d8e0a04/pandas-2.3.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a68e15f780eddf2b07d242e17a04aa187a7ee12b40b930bfdd78070556550e98", size = 12771002, upload-time = "2025-09-29T23:20:26.76Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/87/21/84072af3187a677c5893b170ba2c8fbe450a6ff911234916da889b698220/pandas-2.3.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:371a4ab48e950033bcf52b6527eccb564f52dc826c02afd9a1bc0ab731bba084", size = 13450971, upload-time = "2025-09-29T23:20:41.344Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/86/41/585a168330ff063014880a80d744219dbf1dd7a1c706e75ab3425a987384/pandas-2.3.3-cp312-cp312-win_amd64.whl", hash = "sha256:a16dcec078a01eeef8ee61bf64074b4e524a2a3f4b3be9326420cabe59c4778b", size = 10992722, upload-time = "2025-09-29T23:20:54.139Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/cd/4b/18b035ee18f97c1040d94debd8f2e737000ad70ccc8f5513f4eefad75f4b/pandas-2.3.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:56851a737e3470de7fa88e6131f41281ed440d29a9268dcbf0002da5ac366713", size = 11544671, upload-time = "2025-09-29T23:21:05.024Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/31/94/72fac03573102779920099bcac1c3b05975c2cb5f01eac609faf34bed1ca/pandas-2.3.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:bdcd9d1167f4885211e401b3036c0c8d9e274eee67ea8d0758a256d60704cfe8", size = 10680807, upload-time = "2025-09-29T23:21:15.979Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/16/87/9472cf4a487d848476865321de18cc8c920b8cab98453ab79dbbc98db63a/pandas-2.3.3-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e32e7cc9af0f1cc15548288a51a3b681cc2a219faa838e995f7dc53dbab1062d", size = 11709872, upload-time = "2025-09-29T23:21:27.165Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/15/07/284f757f63f8a8d69ed4472bfd85122bd086e637bf4ed09de572d575a693/pandas-2.3.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:318d77e0e42a628c04dc56bcef4b40de67918f7041c2b061af1da41dcff670ac", size = 12306371, upload-time = "2025-09-29T23:21:40.532Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/33/81/a3afc88fca4aa925804a27d2676d22dcd2031c2ebe08aabd0ae55b9ff282/pandas-2.3.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4e0a175408804d566144e170d0476b15d78458795bb18f1304fb94160cabf40c", size = 12765333, upload-time = "2025-09-29T23:21:55.77Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/8d/0f/b4d4ae743a83742f1153464cf1a8ecfafc3ac59722a0b5c8602310cb7158/pandas-2.3.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:93c2d9ab0fc11822b5eece72ec9587e172f63cff87c00b062f6e37448ced4493", size = 13418120, upload-time = "2025-09-29T23:22:10.109Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/4f/c7/e54682c96a895d0c808453269e0b5928a07a127a15704fedb643e9b0a4c8/pandas-2.3.3-cp313-cp313-win_amd64.whl", hash = "sha256:f8bfc0e12dc78f777f323f55c58649591b2cd0c43534e8355c51d3fede5f4dee", size = 10993991, upload-time = "2025-09-29T23:25:04.889Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f9/ca/3f8d4f49740799189e1395812f3bf23b5e8fc7c190827d55a610da72ce55/pandas-2.3.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:75ea25f9529fdec2d2e93a42c523962261e567d250b0013b16210e1d40d7c2e5", size = 12048227, upload-time = "2025-09-29T23:22:24.343Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0e/5a/f43efec3e8c0cc92c4663ccad372dbdff72b60bdb56b2749f04aa1d07d7e/pandas-2.3.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:74ecdf1d301e812db96a465a525952f4dde225fdb6d8e5a521d47e1f42041e21", size = 11411056, upload-time = "2025-09-29T23:22:37.762Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/46/b1/85331edfc591208c9d1a63a06baa67b21d332e63b7a591a5ba42a10bb507/pandas-2.3.3-cp313-cp313t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6435cb949cb34ec11cc9860246ccb2fdc9ecd742c12d3304989017d53f039a78", size = 11645189, upload-time = "2025-09-29T23:22:51.688Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/44/23/78d645adc35d94d1ac4f2a3c4112ab6f5b8999f4898b8cdf01252f8df4a9/pandas-2.3.3-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:900f47d8f20860de523a1ac881c4c36d65efcb2eb850e6948140fa781736e110", size = 12121912, upload-time = "2025-09-29T23:23:05.042Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/53/da/d10013df5e6aaef6b425aa0c32e1fc1f3e431e4bcabd420517dceadce354/pandas-2.3.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:a45c765238e2ed7d7c608fc5bc4a6f88b642f2f01e70c0c23d2224dd21829d86", size = 12712160, upload-time = "2025-09-29T23:23:28.57Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/bd/17/e756653095a083d8a37cbd816cb87148debcfcd920129b25f99dd8d04271/pandas-2.3.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c4fc4c21971a1a9f4bdb4c73978c7f7256caa3e62b323f70d6cb80db583350bc", size = 13199233, upload-time = "2025-09-29T23:24:24.876Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/04/fd/74903979833db8390b73b3a8a7d30d146d710bd32703724dd9083950386f/pandas-2.3.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:ee15f284898e7b246df8087fc82b87b01686f98ee67d85a17b7ab44143a3a9a0", size = 11540635, upload-time = "2025-09-29T23:25:52.486Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/21/00/266d6b357ad5e6d3ad55093a7e8efc7dd245f5a842b584db9f30b0f0a287/pandas-2.3.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1611aedd912e1ff81ff41c745822980c49ce4a7907537be8692c8dbc31924593", size = 10759079, upload-time = "2025-09-29T23:26:33.204Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ca/05/d01ef80a7a3a12b2f8bbf16daba1e17c98a2f039cbc8e2f77a2c5a63d382/pandas-2.3.3-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6d2cefc361461662ac48810cb14365a365ce864afe85ef1f447ff5a1e99ea81c", size = 11814049, upload-time = "2025-09-29T23:27:15.384Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/15/b2/0e62f78c0c5ba7e3d2c5945a82456f4fac76c480940f805e0b97fcbc2f65/pandas-2.3.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ee67acbbf05014ea6c763beb097e03cd629961c8a632075eeb34247120abcb4b", size = 12332638, upload-time = "2025-09-29T23:27:51.625Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/c5/33/dd70400631b62b9b29c3c93d2feee1d0964dc2bae2e5ad7a6c73a7f25325/pandas-2.3.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c46467899aaa4da076d5abc11084634e2d197e9460643dd455ac3db5856b24d6", size = 12886834, upload-time = "2025-09-29T23:28:21.289Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d3/18/b5d48f55821228d0d2692b34fd5034bb185e854bdb592e9c640f6290e012/pandas-2.3.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:6253c72c6a1d990a410bc7de641d34053364ef8bcd3126f7e7450125887dffe3", size = 13409925, upload-time = "2025-09-29T23:28:58.261Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a6/3d/124ac75fcd0ecc09b8fdccb0246ef65e35b012030defb0e0eba2cbbbe948/pandas-2.3.3-cp314-cp314-win_amd64.whl", hash = "sha256:1b07204a219b3b7350abaae088f451860223a52cfb8a6c53358e7948735158e5", size = 11109071, upload-time = "2025-09-29T23:32:27.484Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/89/9c/0e21c895c38a157e0faa1fb64587a9226d6dd46452cac4532d80c3c4a244/pandas-2.3.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:2462b1a365b6109d275250baaae7b760fd25c726aaca0054649286bcfbb3e8ec", size = 12048504, upload-time = "2025-09-29T23:29:31.47Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/d7/82/b69a1c95df796858777b68fbe6a81d37443a33319761d7c652ce77797475/pandas-2.3.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0242fe9a49aa8b4d78a4fa03acb397a58833ef6199e9aa40a95f027bb3a1b6e7", size = 11410702, upload-time = "2025-09-29T23:29:54.591Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f9/88/702bde3ba0a94b8c73a0181e05144b10f13f29ebfc2150c3a79062a8195d/pandas-2.3.3-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a21d830e78df0a515db2b3d2f5570610f5e6bd2e27749770e8bb7b524b89b450", size = 11634535, upload-time = "2025-09-29T23:30:21.003Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/a4/1e/1bac1a839d12e6a82ec6cb40cda2edde64a2013a66963293696bbf31fbbb/pandas-2.3.3-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2e3ebdb170b5ef78f19bfb71b0dc5dc58775032361fa188e814959b74d726dd5", size = 12121582, upload-time = "2025-09-29T23:30:43.391Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/44/91/483de934193e12a3b1d6ae7c8645d083ff88dec75f46e827562f1e4b4da6/pandas-2.3.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:d051c0e065b94b7a3cea50eb1ec32e912cd96dba41647eb24104b6c6c14c5788", size = 12699963, upload-time = "2025-09-29T23:31:10.009Z" },
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/70/44/5191d2e4026f86a2a109053e194d3ba7a31a2d10a9c2348368c63ed4e85a/pandas-2.3.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:3869faf4bd07b3b66a9f462417d0ca3a9df29a9f6abd5d0d0dbab15dac7abe87", size = 13202175, upload-time = "2025-09-29T23:31:59.173Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pluggy"
|
name = "pluggy"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
@@ -823,6 +870,18 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/f0/d7/a812a0bd0f5160823e647524488cc9734f93782f2c273b8f77e8afc60a37/pytest-8.1.2-py3-none-any.whl", hash = "sha256:6c06dc309ff46a05721e6fd48e492a775ed8165d2ecdf57f156a80c7e95bb142", size = 337456, upload-time = "2024-04-26T18:05:15.452Z" },
|
{ url = "https://files.pythonhosted.org/packages/f0/d7/a812a0bd0f5160823e647524488cc9734f93782f2c273b8f77e8afc60a37/pytest-8.1.2-py3-none-any.whl", hash = "sha256:6c06dc309ff46a05721e6fd48e492a775ed8165d2ecdf57f156a80c7e95bb142", size = 337456, upload-time = "2024-04-26T18:05:15.452Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "python-dateutil"
|
||||||
|
version = "2.9.0.post0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "six" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432, upload-time = "2024-03-01T18:36:20.211Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892, upload-time = "2024-03-01T18:36:18.57Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "python-dotenv"
|
name = "python-dotenv"
|
||||||
version = "1.2.2"
|
version = "1.2.2"
|
||||||
@@ -841,6 +900,15 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/8f/cb/769cfc37177252872a45a71f3fbdde9d51b471a3f3c14bfe95dde3407386/python_multipart-0.0.29-py3-none-any.whl", hash = "sha256:2ddcc971cef266225f54f552d8fa10bcfbb1f14446caec199060daac59ff2d69", size = 29640, upload-time = "2026-05-17T17:29:45.69Z" },
|
{ url = "https://files.pythonhosted.org/packages/8f/cb/769cfc37177252872a45a71f3fbdde9d51b471a3f3c14bfe95dde3407386/python_multipart-0.0.29-py3-none-any.whl", hash = "sha256:2ddcc971cef266225f54f552d8fa10bcfbb1f14446caec199060daac59ff2d69", size = 29640, upload-time = "2026-05-17T17:29:45.69Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pytz"
|
||||||
|
version = "2026.3.post1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/fb/48/fb042503b6ca6cd271261dc559fd6432f7d8c713153e9ec5c591af4dfc1c/pytz-2026.3.post1.tar.gz", hash = "sha256:2211d3fcf9a797d3405cac96ac7f61d80e6a644f72a3309607282fe8a2010c5d", size = 319745, upload-time = "2026-07-25T15:12:07.385Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/0f/7b/39c34ca613b0b198cb866466651b26b045e2009864c5183c979a3b83f383/pytz-2026.3.post1-py2.py3-none-any.whl", hash = "sha256:dd95840dd199baea12d9cc096a1d452caa6596a1c1e4b5f3dbd1541855d5e815", size = 508283, upload-time = "2026-07-25T15:12:05.782Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyyaml"
|
name = "pyyaml"
|
||||||
version = "6.0.3"
|
version = "6.0.3"
|
||||||
@@ -1143,6 +1211,7 @@ dependencies = [
|
|||||||
{ name = "fastapi" },
|
{ name = "fastapi" },
|
||||||
{ name = "httpx" },
|
{ name = "httpx" },
|
||||||
{ name = "openai" },
|
{ name = "openai" },
|
||||||
|
{ name = "pandas" },
|
||||||
{ name = "pydantic" },
|
{ name = "pydantic" },
|
||||||
{ name = "pydantic-settings" },
|
{ name = "pydantic-settings" },
|
||||||
{ name = "pyjwt" },
|
{ name = "pyjwt" },
|
||||||
@@ -1165,6 +1234,7 @@ requires-dist = [
|
|||||||
{ name = "fastapi", specifier = "~=0.115.0" },
|
{ name = "fastapi", specifier = "~=0.115.0" },
|
||||||
{ name = "httpx", specifier = "~=0.27.0" },
|
{ name = "httpx", specifier = "~=0.27.0" },
|
||||||
{ name = "openai", specifier = "~=2.41.0" },
|
{ name = "openai", specifier = "~=2.41.0" },
|
||||||
|
{ name = "pandas", specifier = "~=2.3.3" },
|
||||||
{ name = "pydantic", specifier = "~=2.7.1" },
|
{ name = "pydantic", specifier = "~=2.7.1" },
|
||||||
{ name = "pydantic-settings", specifier = "~=2.2.1" },
|
{ name = "pydantic-settings", specifier = "~=2.2.1" },
|
||||||
{ name = "pyjwt", specifier = "~=2.8.0" },
|
{ name = "pyjwt", specifier = "~=2.8.0" },
|
||||||
@@ -1196,6 +1266,15 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" },
|
{ url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755, upload-time = "2023-10-24T04:13:38.866Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "six"
|
||||||
|
version = "1.17.0"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031, upload-time = "2024-12-04T17:35:28.174Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sniffio"
|
name = "sniffio"
|
||||||
version = "1.3.1"
|
version = "1.3.1"
|
||||||
@@ -1441,6 +1520,15 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" },
|
{ url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614, upload-time = "2025-08-25T13:49:24.86Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tzdata"
|
||||||
|
version = "2026.3"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/92/ff/5a28bdfd8c3ebec42564ac7d0e54ca3db65044a9314a97f9564fa7a1e926/tzdata-2026.3.tar.gz", hash = "sha256:4a1518b8993086a7982523e071643f3c0e5f213e75b21318e78bcabfff9d1415", size = 198674, upload-time = "2026-07-10T08:50:37.887Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/e5/6d/b53b99a9f2766d095985947a5782f1702cabb129a34f7a802d7197af832f/tzdata-2026.3-py2.py3-none-any.whl", hash = "sha256:dc096730c87af6cab1b171c9d532be840741ff5d459015e7f6947bd7d7e54931", size = 348168, upload-time = "2026-07-10T08:50:36.46Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uvicorn"
|
name = "uvicorn"
|
||||||
version = "0.29.0"
|
version = "0.29.0"
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ api/dFGInstitutions.service.ts
|
|||||||
api/dFGPersons.service.ts
|
api/dFGPersons.service.ts
|
||||||
api/dashboard.service.ts
|
api/dashboard.service.ts
|
||||||
api/funding.service.ts
|
api/funding.service.ts
|
||||||
api/iNSEService.service.ts
|
|
||||||
api/institutions.service.ts
|
api/institutions.service.ts
|
||||||
api/institutionsV2.service.ts
|
api/institutionsV2.service.ts
|
||||||
api/keywords.service.ts
|
api/keywords.service.ts
|
||||||
@@ -73,8 +72,10 @@ model/bodyResetPassword.ts
|
|||||||
model/bundInstitutionSummary.ts
|
model/bundInstitutionSummary.ts
|
||||||
model/bundInstitutionSummaryPage.ts
|
model/bundInstitutionSummaryPage.ts
|
||||||
model/bundProjectDetails.ts
|
model/bundProjectDetails.ts
|
||||||
|
model/bundProjectHighlight.ts
|
||||||
model/bundProjectPage.ts
|
model/bundProjectPage.ts
|
||||||
model/bundProjectSummary.ts
|
model/bundProjectSummary.ts
|
||||||
|
model/bundProjectTopics.ts
|
||||||
model/careerMetrics.ts
|
model/careerMetrics.ts
|
||||||
model/careerStage.ts
|
model/careerStage.ts
|
||||||
model/collaborationGraph.ts
|
model/collaborationGraph.ts
|
||||||
@@ -102,6 +103,7 @@ model/dfgInstitutionSummaryPage.ts
|
|||||||
model/dfgPersonSummary.ts
|
model/dfgPersonSummary.ts
|
||||||
model/dfgPersonSummaryPage.ts
|
model/dfgPersonSummaryPage.ts
|
||||||
model/dfgProjectDetails.ts
|
model/dfgProjectDetails.ts
|
||||||
|
model/dfgProjectHighlight.ts
|
||||||
model/dfgProjectInstitutionRole.ts
|
model/dfgProjectInstitutionRole.ts
|
||||||
model/dfgProjectKeyword.ts
|
model/dfgProjectKeyword.ts
|
||||||
model/dfgProjectPage.ts
|
model/dfgProjectPage.ts
|
||||||
@@ -112,12 +114,17 @@ model/dfgProjectSubprojectSummary.ts
|
|||||||
model/dfgProjectSummary.ts
|
model/dfgProjectSummary.ts
|
||||||
model/dfgProjectTopic.ts
|
model/dfgProjectTopic.ts
|
||||||
model/dfgProjectTopics.ts
|
model/dfgProjectTopics.ts
|
||||||
|
model/dfgSubjectClassificationHighlight.ts
|
||||||
model/dockerHealth.ts
|
model/dockerHealth.ts
|
||||||
|
model/domain.ts
|
||||||
|
model/domainFieldsInner.ts
|
||||||
|
model/domainIds.ts
|
||||||
model/edge.ts
|
model/edge.ts
|
||||||
model/euCordisEurosciVocSummary.ts
|
model/euCordisEurosciVocSummary.ts
|
||||||
model/euCordisOrganizationSelectorPage.ts
|
model/euCordisOrganizationSelectorPage.ts
|
||||||
model/euCordisOrganizationSelectorSummary.ts
|
model/euCordisOrganizationSelectorSummary.ts
|
||||||
model/euCordisOrganizationSummary.ts
|
model/euCordisOrganizationSummary.ts
|
||||||
|
model/euCordisProjectHighlight.ts
|
||||||
model/euCordisProjectResponse.ts
|
model/euCordisProjectResponse.ts
|
||||||
model/euCordisProjectSearchPage.ts
|
model/euCordisProjectSearchPage.ts
|
||||||
model/euCordisProjectSummary.ts
|
model/euCordisProjectSummary.ts
|
||||||
@@ -125,11 +132,12 @@ model/euCordisProjectType.ts
|
|||||||
model/euCordisTopicSummary.ts
|
model/euCordisTopicSummary.ts
|
||||||
model/euProjectData.ts
|
model/euProjectData.ts
|
||||||
model/euProjectStatusStatistics.ts
|
model/euProjectStatusStatistics.ts
|
||||||
|
model/euProjectTopics.ts
|
||||||
model/extractedKeywords.ts
|
model/extractedKeywords.ts
|
||||||
model/extractedKeywordsLLM.ts
|
model/extractedKeywordsLLM.ts
|
||||||
model/extractedKeywordsResponse.ts
|
model/extractedKeywordsResponse.ts
|
||||||
|
model/fieldNode.ts
|
||||||
model/fileUpload.ts
|
model/fileUpload.ts
|
||||||
model/filterType.ts
|
|
||||||
model/fp7EurosciVoc.ts
|
model/fp7EurosciVoc.ts
|
||||||
model/fp7LegalBasis.ts
|
model/fp7LegalBasis.ts
|
||||||
model/fp7Organization.ts
|
model/fp7Organization.ts
|
||||||
@@ -169,6 +177,8 @@ model/idTokenMetadata.ts
|
|||||||
model/inseAccountManagementModelOrganizationProfile.ts
|
model/inseAccountManagementModelOrganizationProfile.ts
|
||||||
model/inseOrganizationManagementModelOrganizationProfile.ts
|
model/inseOrganizationManagementModelOrganizationProfile.ts
|
||||||
model/institution.ts
|
model/institution.ts
|
||||||
|
model/institutionAssociation.ts
|
||||||
|
model/institutionAssociationsResponse.ts
|
||||||
model/institutionFunderSummary.ts
|
model/institutionFunderSummary.ts
|
||||||
model/institutionGeo.ts
|
model/institutionGeo.ts
|
||||||
model/institutionIds.ts
|
model/institutionIds.ts
|
||||||
@@ -207,6 +217,7 @@ model/matchedTopic.ts
|
|||||||
model/mentionedPerson.ts
|
model/mentionedPerson.ts
|
||||||
model/meta.ts
|
model/meta.ts
|
||||||
model/model2YrMeanCitedness.ts
|
model/model2YrMeanCitedness.ts
|
||||||
|
model/modelField.ts
|
||||||
model/models.ts
|
model/models.ts
|
||||||
model/newsArticle.ts
|
model/newsArticle.ts
|
||||||
model/newsArticleDetail.ts
|
model/newsArticleDetail.ts
|
||||||
@@ -232,6 +243,8 @@ model/projectsSortBy.ts
|
|||||||
model/publicationDetailByFunder.ts
|
model/publicationDetailByFunder.ts
|
||||||
model/publicationIdsByAuthorPosition.ts
|
model/publicationIdsByAuthorPosition.ts
|
||||||
model/publicationType.ts
|
model/publicationType.ts
|
||||||
|
model/publicationTypeCount.ts
|
||||||
|
model/publicationTypeCountsRequest.ts
|
||||||
model/publicationsByAuthorResponse.ts
|
model/publicationsByAuthorResponse.ts
|
||||||
model/rankedAuthor.ts
|
model/rankedAuthor.ts
|
||||||
model/rankingResponse.ts
|
model/rankingResponse.ts
|
||||||
@@ -242,10 +255,15 @@ model/score.ts
|
|||||||
model/selectedAuthorsRequest.ts
|
model/selectedAuthorsRequest.ts
|
||||||
model/sortDirection.ts
|
model/sortDirection.ts
|
||||||
model/startCollaborationGraphResponse.ts
|
model/startCollaborationGraphResponse.ts
|
||||||
|
model/subfield.ts
|
||||||
|
model/subfieldDomain.ts
|
||||||
|
model/subfieldField.ts
|
||||||
|
model/subfieldNode.ts
|
||||||
model/subfieldShare.ts
|
model/subfieldShare.ts
|
||||||
model/timespan.ts
|
model/timespan.ts
|
||||||
model/tokenType.ts
|
model/tokenType.ts
|
||||||
model/topAuthor.ts
|
model/topAuthor.ts
|
||||||
|
model/topAuthorAnalysis.ts
|
||||||
model/topAuthorStatistics.ts
|
model/topAuthorStatistics.ts
|
||||||
model/topInstitutionItem.ts
|
model/topInstitutionItem.ts
|
||||||
model/topTopicItem.ts
|
model/topTopicItem.ts
|
||||||
@@ -259,7 +277,12 @@ model/topicHeatmapField.ts
|
|||||||
model/topicHeatmapSubfield.ts
|
model/topicHeatmapSubfield.ts
|
||||||
model/topicHeatmapTopic.ts
|
model/topicHeatmapTopic.ts
|
||||||
model/topicHeatmapValue.ts
|
model/topicHeatmapValue.ts
|
||||||
|
model/topicHierarchyDomain.ts
|
||||||
|
model/topicHierarchyField.ts
|
||||||
|
model/topicHierarchyResponse.ts
|
||||||
|
model/topicHierarchySubfield.ts
|
||||||
model/topicIds.ts
|
model/topicIds.ts
|
||||||
|
model/topicNode.ts
|
||||||
model/topicPageV2.ts
|
model/topicPageV2.ts
|
||||||
model/topicSortBy.ts
|
model/topicSortBy.ts
|
||||||
model/topicSubfield.ts
|
model/topicSubfield.ts
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ export * from './dashboard.service';
|
|||||||
import { DashboardService } from './dashboard.service';
|
import { DashboardService } from './dashboard.service';
|
||||||
export * from './funding.service';
|
export * from './funding.service';
|
||||||
import { FundingService } from './funding.service';
|
import { FundingService } from './funding.service';
|
||||||
export * from './iNSEService.service';
|
|
||||||
import { INSEServiceService } from './iNSEService.service';
|
|
||||||
export * from './institutions.service';
|
export * from './institutions.service';
|
||||||
import { InstitutionsService } from './institutions.service';
|
import { InstitutionsService } from './institutions.service';
|
||||||
export * from './institutionsV2.service';
|
export * from './institutionsV2.service';
|
||||||
@@ -48,4 +46,29 @@ export * from './works.service';
|
|||||||
import { WorksService } from './works.service';
|
import { WorksService } from './works.service';
|
||||||
export * from './worksV2.service';
|
export * from './worksV2.service';
|
||||||
import { WorksV2Service } from './worksV2.service';
|
import { WorksV2Service } from './worksV2.service';
|
||||||
export const APIS = [AuthService, AuthorsV2Service, BUNDInstitutionsService, BackgroundJobsService, BookmarksService, CompanyConnectionsService, DFGInstitutionsService, DFGPersonsService, DashboardService, FundingService, INSEServiceService, InstitutionsService, InstitutionsV2Service, KeywordsService, NewsService, OrganizationService, PatentsService, PersonsService, ProjectsService, RankingService, TopicsService, TopicsV2Service, UniversityRankingsService, WorksService, WorksV2Service];
|
export const APIS = [
|
||||||
|
AuthService,
|
||||||
|
AuthorsV2Service,
|
||||||
|
BUNDInstitutionsService,
|
||||||
|
BackgroundJobsService,
|
||||||
|
BookmarksService,
|
||||||
|
CompanyConnectionsService,
|
||||||
|
DFGInstitutionsService,
|
||||||
|
DFGPersonsService,
|
||||||
|
DashboardService,
|
||||||
|
FundingService,
|
||||||
|
InstitutionsService,
|
||||||
|
InstitutionsV2Service,
|
||||||
|
KeywordsService,
|
||||||
|
NewsService,
|
||||||
|
OrganizationService,
|
||||||
|
PatentsService,
|
||||||
|
PersonsService,
|
||||||
|
ProjectsService,
|
||||||
|
RankingService,
|
||||||
|
TopicsService,
|
||||||
|
TopicsV2Service,
|
||||||
|
UniversityRankingsService,
|
||||||
|
WorksService,
|
||||||
|
WorksV2Service,
|
||||||
|
];
|
||||||
|
|||||||
+1825
-971
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Author } from '../model/author';
|
import { Author } from '../model/author';
|
||||||
@@ -28,333 +34,613 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
|||||||
import { StartCollaborationGraphResponse } from '../model/startCollaborationGraphResponse';
|
import { StartCollaborationGraphResponse } from '../model/startCollaborationGraphResponse';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class AuthorsV2Service extends BaseService {
|
export class AuthorsV2Service extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Returns a paginated list of authors for a given search term based on their display name.
|
||||||
|
* @endpoint get /api/authors/v2/autocomplete/selector
|
||||||
|
* @param query A search term to filter authors by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public autocompleteAuthorsForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<AuthorPage>;
|
||||||
|
public autocompleteAuthorsForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<AuthorPage>>;
|
||||||
|
public autocompleteAuthorsForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<AuthorPage>>;
|
||||||
|
public autocompleteAuthorsForSelector(
|
||||||
|
query?: 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>query,
|
||||||
|
'query',
|
||||||
|
);
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Returns a paginated list of authors for a given search term based on their display name.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/authors/v2/autocomplete/selector
|
|
||||||
* @param query A search term to filter authors by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public autocompleteAuthorsForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorPage>;
|
|
||||||
public autocompleteAuthorsForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorPage>>;
|
|
||||||
public autocompleteAuthorsForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorPage>>;
|
|
||||||
public autocompleteAuthorsForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>query, 'query');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let localVarPath = `/api/authors/v2/autocomplete/selector`;
|
||||||
'application/json'
|
const { basePath, withCredentials } = this.configuration;
|
||||||
]);
|
return this.httpClient.request<AuthorPage>(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'get',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
`${basePath}${localVarPath}`,
|
||||||
}
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
/**
|
||||||
|
* Returns an author for a given author ID.
|
||||||
|
* @endpoint get /api/authors/v2/{raw_oa_author_id}
|
||||||
|
* @param rawOaAuthorId The ID of the author to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getAuthorById(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<Author>;
|
||||||
|
public getAuthorById(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<Author>>;
|
||||||
|
public getAuthorById(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<Author>>;
|
||||||
|
public getAuthorById(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter rawOaAuthorId was null or undefined when calling getAuthorById.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
const localVarHttpContext: HttpContext =
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
options?.context ?? new HttpContext();
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/autocomplete/selector`;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<AuthorPage>('get', `${basePath}${localVarPath}`,
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
{
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
context: localVarHttpContext,
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
params: localVarQueryParameters,
|
responseType_ = 'text';
|
||||||
responseType: <any>responseType_,
|
} else if (
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
headers: localVarHeaders,
|
) {
|
||||||
observe: observe,
|
responseType_ = 'json';
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
} else {
|
||||||
reportProgress: reportProgress
|
responseType_ = 'blob';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/authors/v2/${this.configuration.encodeParam({ name: 'rawOaAuthorId', value: rawOaAuthorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Author>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a paginated list of authors for a given list of author IDs.
|
||||||
|
* @endpoint get /api/authors/v2/authors/id
|
||||||
|
* @param authorIds A list of author IDs to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getAuthorsByIds(
|
||||||
|
authorIds?: Array<string>,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<AuthorPage>;
|
||||||
|
public getAuthorsByIds(
|
||||||
|
authorIds?: Array<string>,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<AuthorPage>>;
|
||||||
|
public getAuthorsByIds(
|
||||||
|
authorIds?: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<AuthorPage>>;
|
||||||
|
public getAuthorsByIds(
|
||||||
|
authorIds?: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (authorIds) {
|
||||||
|
authorIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'author_ids',
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Returns an author for a given author ID.
|
|
||||||
* @endpoint get /api/authors/v2/{raw_oa_author_id}
|
|
||||||
* @param rawOaAuthorId The ID of the author to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getAuthorById(rawOaAuthorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Author>;
|
|
||||||
public getAuthorById(rawOaAuthorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Author>>;
|
|
||||||
public getAuthorById(rawOaAuthorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Author>>;
|
|
||||||
public getAuthorById(rawOaAuthorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
|
||||||
throw new Error('Required parameter rawOaAuthorId was null or undefined when calling getAuthorById.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
const localVarHttpContext: HttpContext =
|
||||||
'application/json'
|
options?.context ?? new HttpContext();
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/authors/v2/authors/id`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<AuthorPage>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
/**
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
* Returns the status of a collaboration graph generation task.
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
* @endpoint get /api/authors/v2/collaboration-graph/{graph_id}/status
|
||||||
responseType_ = 'text';
|
* @param graphId The ID of the collaboration graph generation task.
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
responseType_ = 'json';
|
* @param reportProgress flag to report request and response progress.
|
||||||
} else {
|
*/
|
||||||
responseType_ = 'blob';
|
public getCollaborationGraphStatus(
|
||||||
}
|
graphId: string,
|
||||||
}
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<CollaborationGraphStatusResponse>;
|
||||||
|
public getCollaborationGraphStatus(
|
||||||
|
graphId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<CollaborationGraphStatusResponse>>;
|
||||||
|
public getCollaborationGraphStatus(
|
||||||
|
graphId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<CollaborationGraphStatusResponse>>;
|
||||||
|
public getCollaborationGraphStatus(
|
||||||
|
graphId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (graphId === null || graphId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter graphId was null or undefined when calling getCollaborationGraphStatus.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/${this.configuration.encodeParam({name: "rawOaAuthorId", value: rawOaAuthorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Author>('get', `${basePath}${localVarPath}`,
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
{
|
options?.httpHeaderAccept ??
|
||||||
context: localVarHttpContext,
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
responseType: <any>responseType_,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
localVarHeaders = localVarHeaders.set(
|
||||||
headers: localVarHeaders,
|
'Accept',
|
||||||
observe: observe,
|
localVarHttpHeaderAcceptSelected,
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
);
|
||||||
reportProgress: reportProgress
|
}
|
||||||
}
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/authors/v2/collaboration-graph/${this.configuration.encodeParam({ name: 'graphId', value: graphId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/status`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CollaborationGraphStatusResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a collaboration graph for a given author ID.
|
||||||
|
* @endpoint post /api/authors/v2/collaboration-graph
|
||||||
|
* @param rawOaAuthorId The raw OpenAlex author ID for which to retrieve the collaboration graph.
|
||||||
|
* @param yearFrom The starting year to filter the works by (optional).
|
||||||
|
* @param yearTo The ending year to filter the works by (optional).
|
||||||
|
* @param minCollaborators The minimum number of collaborators to filter the works by (optional).
|
||||||
|
* @param maxCollaborators The maximum number of collaborators to filter the works by (optional).
|
||||||
|
* @param topicIds A list of topic IDs to filter the works by (optional).
|
||||||
|
* @param institutionIds A list of institution IDs to filter the works by (optional).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public startCollaborationGraph(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
yearFrom?: number,
|
||||||
|
yearTo?: number,
|
||||||
|
minCollaborators?: number,
|
||||||
|
maxCollaborators?: number,
|
||||||
|
topicIds?: Array<string>,
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<StartCollaborationGraphResponse>;
|
||||||
|
public startCollaborationGraph(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
yearFrom?: number,
|
||||||
|
yearTo?: number,
|
||||||
|
minCollaborators?: number,
|
||||||
|
maxCollaborators?: number,
|
||||||
|
topicIds?: Array<string>,
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<StartCollaborationGraphResponse>>;
|
||||||
|
public startCollaborationGraph(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
yearFrom?: number,
|
||||||
|
yearTo?: number,
|
||||||
|
minCollaborators?: number,
|
||||||
|
maxCollaborators?: number,
|
||||||
|
topicIds?: Array<string>,
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<StartCollaborationGraphResponse>>;
|
||||||
|
public startCollaborationGraph(
|
||||||
|
rawOaAuthorId: string,
|
||||||
|
yearFrom?: number,
|
||||||
|
yearTo?: number,
|
||||||
|
minCollaborators?: number,
|
||||||
|
maxCollaborators?: number,
|
||||||
|
topicIds?: Array<string>,
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter rawOaAuthorId was null or undefined when calling startCollaborationGraph.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>rawOaAuthorId,
|
||||||
|
'raw_oa_author_id',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>yearFrom,
|
||||||
|
'year_from',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>yearTo,
|
||||||
|
'year_to',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>minCollaborators,
|
||||||
|
'min_collaborators',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>maxCollaborators,
|
||||||
|
'max_collaborators',
|
||||||
|
);
|
||||||
|
if (topicIds) {
|
||||||
|
topicIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'topic_ids',
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
if (institutionIds) {
|
||||||
/**
|
institutionIds.forEach((element) => {
|
||||||
* Returns a paginated list of authors for a given list of author IDs.
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
* @endpoint get /api/authors/v2/authors/id
|
localVarQueryParameters,
|
||||||
* @param authorIds A list of author IDs to retrieve.
|
<any>element,
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
'institution_ids',
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getAuthorsByIds(authorIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorPage>;
|
|
||||||
public getAuthorsByIds(authorIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorPage>>;
|
|
||||||
public getAuthorsByIds(authorIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorPage>>;
|
|
||||||
public getAuthorsByIds(authorIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
|
||||||
if (authorIds) {
|
|
||||||
authorIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>element, 'author_ids');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'application/json'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/authors/id`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<AuthorPage>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Returns the status of a collaboration graph generation task.
|
|
||||||
* @endpoint get /api/authors/v2/collaboration-graph/{graph_id}/status
|
|
||||||
* @param graphId The ID of the collaboration graph generation task.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getCollaborationGraphStatus(graphId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CollaborationGraphStatusResponse>;
|
|
||||||
public getCollaborationGraphStatus(graphId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CollaborationGraphStatusResponse>>;
|
|
||||||
public getCollaborationGraphStatus(graphId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CollaborationGraphStatusResponse>>;
|
|
||||||
public getCollaborationGraphStatus(graphId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (graphId === null || graphId === undefined) {
|
|
||||||
throw new Error('Required parameter graphId was null or undefined when calling getCollaborationGraphStatus.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHttpHeaderAcceptSelected,
|
||||||
}
|
);
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/collaboration-graph/${this.configuration.encodeParam({name: "graphId", value: graphId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/status`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<CollaborationGraphStatusResponse>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Returns a collaboration graph for a given author ID.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint post /api/authors/v2/collaboration-graph
|
|
||||||
* @param rawOaAuthorId The raw OpenAlex author ID for which to retrieve the collaboration graph.
|
|
||||||
* @param yearFrom The starting year to filter the works by (optional).
|
|
||||||
* @param yearTo The ending year to filter the works by (optional).
|
|
||||||
* @param minCollaborators The minimum number of collaborators to filter the works by (optional).
|
|
||||||
* @param maxCollaborators The maximum number of collaborators to filter the works by (optional).
|
|
||||||
* @param topicIds A list of topic IDs to filter the works by (optional).
|
|
||||||
* @param institutionIds A list of institution IDs to filter the works by (optional).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<StartCollaborationGraphResponse>;
|
|
||||||
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<StartCollaborationGraphResponse>>;
|
|
||||||
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<StartCollaborationGraphResponse>>;
|
|
||||||
public startCollaborationGraph(rawOaAuthorId: string, yearFrom?: number, yearTo?: number, minCollaborators?: number, maxCollaborators?: number, topicIds?: Array<string>, institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
|
||||||
throw new Error('Required parameter rawOaAuthorId was null or undefined when calling startCollaborationGraph.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>rawOaAuthorId, 'raw_oa_author_id');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>yearFrom, 'year_from');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>yearTo, 'year_to');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>minCollaborators, 'min_collaborators');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>maxCollaborators, 'max_collaborators');
|
|
||||||
if (topicIds) {
|
|
||||||
topicIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>element, 'topic_ids');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (institutionIds) {
|
|
||||||
institutionIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>element, 'institution_ids');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
'application/json'
|
responseType_ = 'text';
|
||||||
]);
|
} else if (
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
) {
|
||||||
}
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/authors/v2/collaboration-graph`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<StartCollaborationGraphResponse>('post', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/authors/v2/collaboration-graph`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<StartCollaborationGraphResponse>(
|
||||||
|
'post',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BundInstitutionSummaryPage } from '../model/bundInstitutionSummaryPage';
|
import { BundInstitutionSummaryPage } from '../model/bundInstitutionSummaryPage';
|
||||||
@@ -22,137 +28,231 @@ import { BundInstitutionSummaryPage } from '../model/bundInstitutionSummaryPage'
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class BUNDInstitutionsService extends BaseService {
|
export class BUNDInstitutionsService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Returns a list of institutions based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/bund/institutions/autocomplete/selector
|
||||||
|
* @param query A search term to filter institutions by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getBundInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<BundInstitutionSummaryPage>;
|
||||||
|
public getBundInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
||||||
|
public getBundInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
||||||
|
public getBundInstitutionAutocompleteForSelector(
|
||||||
|
query?: 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>query,
|
||||||
|
'query',
|
||||||
|
);
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Returns a list of institutions based on a search term for autocomplete functionality.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/bund/institutions/autocomplete/selector
|
|
||||||
* @param query A search term to filter institutions by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getBundInstitutionAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<BundInstitutionSummaryPage>;
|
|
||||||
public getBundInstitutionAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
|
||||||
public getBundInstitutionAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
|
||||||
public getBundInstitutionAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>query, 'query');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let localVarPath = `/api/bund/institutions/autocomplete/selector`;
|
||||||
'application/json'
|
const { basePath, withCredentials } = this.configuration;
|
||||||
]);
|
return this.httpClient.request<BundInstitutionSummaryPage>(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'get',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
`${basePath}${localVarPath}`,
|
||||||
}
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
/**
|
||||||
|
* Returns a list of institutions based on their names.
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
* @endpoint get /api/bund/institutions/names
|
||||||
|
* @param institutionNames A list of institution names to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
* @param reportProgress flag to report request and response progress.
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
*/
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
public getBundInstitutionsByName(
|
||||||
responseType_ = 'text';
|
institutionNames?: Array<string>,
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
observe?: 'body',
|
||||||
responseType_ = 'json';
|
reportProgress?: boolean,
|
||||||
} else {
|
options?: {
|
||||||
responseType_ = 'blob';
|
httpHeaderAccept?: 'application/json';
|
||||||
}
|
context?: HttpContext;
|
||||||
}
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
let localVarPath = `/api/bund/institutions/autocomplete/selector`;
|
): Observable<BundInstitutionSummaryPage>;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
public getBundInstitutionsByName(
|
||||||
return this.httpClient.request<BundInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
institutionNames?: Array<string>,
|
||||||
{
|
observe?: 'response',
|
||||||
context: localVarHttpContext,
|
reportProgress?: boolean,
|
||||||
params: localVarQueryParameters,
|
options?: {
|
||||||
responseType: <any>responseType_,
|
httpHeaderAccept?: 'application/json';
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
context?: HttpContext;
|
||||||
headers: localVarHeaders,
|
transferCache?: boolean;
|
||||||
observe: observe,
|
},
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
||||||
reportProgress: reportProgress
|
public getBundInstitutionsByName(
|
||||||
}
|
institutionNames?: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
||||||
|
public getBundInstitutionsByName(
|
||||||
|
institutionNames?: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (institutionNames) {
|
||||||
|
institutionNames.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'institution_names',
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Returns a list of institutions based on their names.
|
|
||||||
* @endpoint get /api/bund/institutions/names
|
|
||||||
* @param institutionNames A list of institution names to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getBundInstitutionsByName(institutionNames?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<BundInstitutionSummaryPage>;
|
|
||||||
public getBundInstitutionsByName(institutionNames?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<BundInstitutionSummaryPage>>;
|
|
||||||
public getBundInstitutionsByName(institutionNames?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<BundInstitutionSummaryPage>>;
|
|
||||||
public getBundInstitutionsByName(institutionNames?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
if (institutionNames) {
|
options?.httpHeaderAccept ??
|
||||||
institutionNames.forEach((element) => {
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
<any>element, 'institution_names');
|
localVarHeaders = localVarHeaders.set(
|
||||||
})
|
'Accept',
|
||||||
}
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'application/json'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/bund/institutions/names`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<BundInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bund/institutions/names`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<BundInstitutionSummaryPage>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CreatePersonBookmark } from '../model/createPersonBookmark';
|
import { CreatePersonBookmark } from '../model/createPersonBookmark';
|
||||||
@@ -24,206 +30,375 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
|||||||
import { PersonBookmarkResponse } from '../model/personBookmarkResponse';
|
import { PersonBookmarkResponse } from '../model/personBookmarkResponse';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class BookmarksService extends BaseService {
|
export class BookmarksService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Bookmark Person
|
||||||
|
* @endpoint put /api/bookmarks/persons/{person_id}
|
||||||
|
* @param personId
|
||||||
|
* @param createPersonBookmark
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public bookmarkPerson(
|
||||||
|
personId: string,
|
||||||
|
createPersonBookmark: CreatePersonBookmark,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<PersonBookmarkResponse>;
|
||||||
|
public bookmarkPerson(
|
||||||
|
personId: string,
|
||||||
|
createPersonBookmark: CreatePersonBookmark,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<PersonBookmarkResponse>>;
|
||||||
|
public bookmarkPerson(
|
||||||
|
personId: string,
|
||||||
|
createPersonBookmark: CreatePersonBookmark,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<PersonBookmarkResponse>>;
|
||||||
|
public bookmarkPerson(
|
||||||
|
personId: string,
|
||||||
|
createPersonBookmark: CreatePersonBookmark,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (personId === null || personId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter personId was null or undefined when calling bookmarkPerson.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (createPersonBookmark === null || createPersonBookmark === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter createPersonBookmark was null or undefined when calling bookmarkPerson.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Bookmark Person
|
|
||||||
* @endpoint put /api/bookmarks/persons/{person_id}
|
|
||||||
* @param personId
|
|
||||||
* @param createPersonBookmark
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PersonBookmarkResponse>;
|
|
||||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonBookmarkResponse>>;
|
|
||||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonBookmarkResponse>>;
|
|
||||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (personId === null || personId === undefined) {
|
|
||||||
throw new Error('Required parameter personId was null or undefined when calling bookmarkPerson.');
|
|
||||||
}
|
|
||||||
if (createPersonBookmark === null || createPersonBookmark === undefined) {
|
|
||||||
throw new Error('Required parameter createPersonBookmark was null or undefined when calling bookmarkPerson.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
'application/json'
|
localVarHeaders = localVarHeaders.set(
|
||||||
]);
|
'Accept',
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
localVarHttpHeaderAcceptSelected,
|
||||||
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/bookmarks/persons/${this.configuration.encodeParam({name: "personId", value: personId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<PersonBookmarkResponse>('put', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
body: createPersonBookmark,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* List Person Bookmarks
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/bookmarks/persons
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<PersonBookmarkResponse>>;
|
|
||||||
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<PersonBookmarkResponse>>>;
|
|
||||||
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<PersonBookmarkResponse>>>;
|
|
||||||
public listPersonBookmarks(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
// to determine the Content-Type header
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
const consumes: string[] = ['application/json'];
|
||||||
|
const httpContentTypeSelected: string | undefined =
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderContentType(consumes);
|
||||||
'application/json'
|
if (httpContentTypeSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Content-Type',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
httpContentTypeSelected,
|
||||||
}
|
);
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/bookmarks/persons`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Array<PersonBookmarkResponse>>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
* Remove Person Bookmark
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
* @endpoint delete /api/bookmarks/persons/{person_id}
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
* @param personId
|
responseType_ = 'text';
|
||||||
* @param secureFgpAcc
|
} else if (
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
* @param reportProgress flag to report request and response progress.
|
) {
|
||||||
*/
|
responseType_ = 'json';
|
||||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
} else {
|
||||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
responseType_ = 'blob';
|
||||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
}
|
||||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (personId === null || personId === undefined) {
|
|
||||||
throw new Error('Required parameter personId was null or undefined when calling removePersonBookmark.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'application/json'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({name: "personId", value: personId, in: "path", style: "simple", explode: false, dataType: "string", 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
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({ name: 'personId', value: personId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<PersonBookmarkResponse>(
|
||||||
|
'put',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: createPersonBookmark,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List Person Bookmarks
|
||||||
|
* @endpoint get /api/bookmarks/persons
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public listPersonBookmarks(
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<Array<PersonBookmarkResponse>>;
|
||||||
|
public listPersonBookmarks(
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<Array<PersonBookmarkResponse>>>;
|
||||||
|
public listPersonBookmarks(
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<Array<PersonBookmarkResponse>>>;
|
||||||
|
public listPersonBookmarks(
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bookmarks/persons`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Array<PersonBookmarkResponse>>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove Person Bookmark
|
||||||
|
* @endpoint delete /api/bookmarks/persons/{person_id}
|
||||||
|
* @param personId
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public removePersonBookmark(
|
||||||
|
personId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any>;
|
||||||
|
public removePersonBookmark(
|
||||||
|
personId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<any>>;
|
||||||
|
public removePersonBookmark(
|
||||||
|
personId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<any>>;
|
||||||
|
public removePersonBookmark(
|
||||||
|
personId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (personId === null || personId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter personId was null or undefined when calling removePersonBookmark.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({ name: 'personId', value: personId, in: 'path', style: 'simple', explode: false, dataType: 'string', 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,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CompanyConnectionsAvailability } from '../model/companyConnectionsAvailability';
|
import { CompanyConnectionsAvailability } from '../model/companyConnectionsAvailability';
|
||||||
@@ -24,137 +30,249 @@ import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse'
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class CompanyConnectionsService extends BaseService {
|
export class CompanyConnectionsService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Check whether company connections are available for an author.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/company-connections/availability
|
||||||
|
* @param authorId
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getCompanyConnectionsAvailability(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<CompanyConnectionsAvailability>;
|
||||||
|
public getCompanyConnectionsAvailability(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<CompanyConnectionsAvailability>>;
|
||||||
|
public getCompanyConnectionsAvailability(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<CompanyConnectionsAvailability>>;
|
||||||
|
public getCompanyConnectionsAvailability(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: 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 getCompanyConnectionsAvailability.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Check whether company connections are available for an author.
|
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/company-connections/availability
|
|
||||||
* @param authorId
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CompanyConnectionsAvailability>;
|
|
||||||
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CompanyConnectionsAvailability>>;
|
|
||||||
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CompanyConnectionsAvailability>>;
|
|
||||||
public getCompanyConnectionsAvailability(authorId: string, secureFgpAcc?: 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 getCompanyConnectionsAvailability.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
'application/json'
|
localVarHeaders = localVarHeaders.set(
|
||||||
]);
|
'Accept',
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
localVarHttpHeaderAcceptSelected,
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/company-connections/availability`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<CompanyConnectionsAvailability>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Get possible company connections by OpenAlex author ID.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
|
|
||||||
* @param authorId
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CompanyConnectionsResponse>;
|
|
||||||
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CompanyConnectionsResponse>>;
|
|
||||||
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CompanyConnectionsResponse>>;
|
|
||||||
public getCompanyConnectionsByAuthor(authorId: string, secureFgpAcc?: 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 getCompanyConnectionsByAuthor.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
responseType_ = 'text';
|
||||||
'application/json'
|
} else if (
|
||||||
]);
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
) {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
responseType_ = 'json';
|
||||||
}
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/company-connections`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<CompanyConnectionsResponse>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/company-connections/availability`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CompanyConnectionsAvailability>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get possible company connections by OpenAlex author ID.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
|
||||||
|
* @param authorId
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getCompanyConnectionsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<CompanyConnectionsResponse>;
|
||||||
|
public getCompanyConnectionsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
secureFgpAcc?: 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 getCompanyConnectionsByAuthor.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/company-connections`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CompanyConnectionsResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { DfgInstitutionSummaryPage } from '../model/dfgInstitutionSummaryPage';
|
import { DfgInstitutionSummaryPage } from '../model/dfgInstitutionSummaryPage';
|
||||||
@@ -22,137 +28,231 @@ import { DfgInstitutionSummaryPage } from '../model/dfgInstitutionSummaryPage';
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class DFGInstitutionsService extends BaseService {
|
export class DFGInstitutionsService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Returns a list of institutions based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/dfg/institutions/autocomplete/selector
|
||||||
|
* @param query A search term to filter institutions by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<DfgInstitutionSummaryPage>;
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
||||||
|
public getDfgInstitutionAutocompleteForSelector(
|
||||||
|
query?: 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>query,
|
||||||
|
'query',
|
||||||
|
);
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Returns a list of institutions based on a search term for autocomplete functionality.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/dfg/institutions/autocomplete/selector
|
|
||||||
* @param query A search term to filter institutions by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgInstitutionSummaryPage>;
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
|
||||||
public getDfgInstitutionAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>query, 'query');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let localVarPath = `/api/dfg/institutions/autocomplete/selector`;
|
||||||
'application/json'
|
const { basePath, withCredentials } = this.configuration;
|
||||||
]);
|
return this.httpClient.request<DfgInstitutionSummaryPage>(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'get',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
`${basePath}${localVarPath}`,
|
||||||
}
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
/**
|
||||||
|
* Returns a list of institutions based on their IDs.
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
* @endpoint get /api/dfg/institutions/ids
|
||||||
|
* @param institutionIds A list of institution IDs to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
* @param reportProgress flag to report request and response progress.
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
*/
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
public getDfgInstitutionsByIds(
|
||||||
responseType_ = 'text';
|
institutionIds?: Array<string>,
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
observe?: 'body',
|
||||||
responseType_ = 'json';
|
reportProgress?: boolean,
|
||||||
} else {
|
options?: {
|
||||||
responseType_ = 'blob';
|
httpHeaderAccept?: 'application/json';
|
||||||
}
|
context?: HttpContext;
|
||||||
}
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
let localVarPath = `/api/dfg/institutions/autocomplete/selector`;
|
): Observable<DfgInstitutionSummaryPage>;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
public getDfgInstitutionsByIds(
|
||||||
return this.httpClient.request<DfgInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
institutionIds?: Array<string>,
|
||||||
{
|
observe?: 'response',
|
||||||
context: localVarHttpContext,
|
reportProgress?: boolean,
|
||||||
params: localVarQueryParameters,
|
options?: {
|
||||||
responseType: <any>responseType_,
|
httpHeaderAccept?: 'application/json';
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
context?: HttpContext;
|
||||||
headers: localVarHeaders,
|
transferCache?: boolean;
|
||||||
observe: observe,
|
},
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
||||||
reportProgress: reportProgress
|
public getDfgInstitutionsByIds(
|
||||||
}
|
institutionIds?: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
||||||
|
public getDfgInstitutionsByIds(
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (institutionIds) {
|
||||||
|
institutionIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'institution_ids',
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Returns a list of institutions based on their IDs.
|
|
||||||
* @endpoint get /api/dfg/institutions/ids
|
|
||||||
* @param institutionIds A list of institution IDs to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgInstitutionSummaryPage>;
|
|
||||||
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgInstitutionSummaryPage>>;
|
|
||||||
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgInstitutionSummaryPage>>;
|
|
||||||
public getDfgInstitutionsByIds(institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
if (institutionIds) {
|
options?.httpHeaderAccept ??
|
||||||
institutionIds.forEach((element) => {
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
<any>element, 'institution_ids');
|
localVarHeaders = localVarHeaders.set(
|
||||||
})
|
'Accept',
|
||||||
}
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'application/json'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/dfg/institutions/ids`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<DfgInstitutionSummaryPage>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/dfg/institutions/ids`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<DfgInstitutionSummaryPage>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { DfgPersonSummaryPage } from '../model/dfgPersonSummaryPage';
|
import { DfgPersonSummaryPage } from '../model/dfgPersonSummaryPage';
|
||||||
@@ -22,137 +28,231 @@ import { DfgPersonSummaryPage } from '../model/dfgPersonSummaryPage';
|
|||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class DFGPersonsService extends BaseService {
|
export class DFGPersonsService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Returns a list of persons based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/dfg/persons/autocomplete/selector
|
||||||
|
* @param query A search term to filter persons by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getDfgPersonAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<DfgPersonSummaryPage>;
|
||||||
|
public getDfgPersonAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
||||||
|
public getDfgPersonAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
||||||
|
public getDfgPersonAutocompleteForSelector(
|
||||||
|
query?: 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>query,
|
||||||
|
'query',
|
||||||
|
);
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Returns a list of persons based on a search term for autocomplete functionality.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/dfg/persons/autocomplete/selector
|
|
||||||
* @param query A search term to filter persons by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgPersonSummaryPage>;
|
|
||||||
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
|
||||||
public getDfgPersonAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
|
||||||
public getDfgPersonAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>query, 'query');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let localVarPath = `/api/dfg/persons/autocomplete/selector`;
|
||||||
'application/json'
|
const { basePath, withCredentials } = this.configuration;
|
||||||
]);
|
return this.httpClient.request<DfgPersonSummaryPage>(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'get',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
`${basePath}${localVarPath}`,
|
||||||
}
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
/**
|
||||||
|
* Returns a list of persons based on their IDs.
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
* @endpoint get /api/dfg/persons/ids
|
||||||
|
* @param personIds A list of person IDs to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
* @param reportProgress flag to report request and response progress.
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
*/
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
public getDfgPersonsByIds(
|
||||||
responseType_ = 'text';
|
personIds?: Array<string>,
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
observe?: 'body',
|
||||||
responseType_ = 'json';
|
reportProgress?: boolean,
|
||||||
} else {
|
options?: {
|
||||||
responseType_ = 'blob';
|
httpHeaderAccept?: 'application/json';
|
||||||
}
|
context?: HttpContext;
|
||||||
}
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
let localVarPath = `/api/dfg/persons/autocomplete/selector`;
|
): Observable<DfgPersonSummaryPage>;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
public getDfgPersonsByIds(
|
||||||
return this.httpClient.request<DfgPersonSummaryPage>('get', `${basePath}${localVarPath}`,
|
personIds?: Array<string>,
|
||||||
{
|
observe?: 'response',
|
||||||
context: localVarHttpContext,
|
reportProgress?: boolean,
|
||||||
params: localVarQueryParameters,
|
options?: {
|
||||||
responseType: <any>responseType_,
|
httpHeaderAccept?: 'application/json';
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
context?: HttpContext;
|
||||||
headers: localVarHeaders,
|
transferCache?: boolean;
|
||||||
observe: observe,
|
},
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
||||||
reportProgress: reportProgress
|
public getDfgPersonsByIds(
|
||||||
}
|
personIds?: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
||||||
|
public getDfgPersonsByIds(
|
||||||
|
personIds?: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (personIds) {
|
||||||
|
personIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'person_ids',
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Returns a list of persons based on their IDs.
|
|
||||||
* @endpoint get /api/dfg/persons/ids
|
|
||||||
* @param personIds A list of person IDs to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgPersonSummaryPage>;
|
|
||||||
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgPersonSummaryPage>>;
|
|
||||||
public getDfgPersonsByIds(personIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgPersonSummaryPage>>;
|
|
||||||
public getDfgPersonsByIds(personIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
if (personIds) {
|
options?.httpHeaderAccept ??
|
||||||
personIds.forEach((element) => {
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
<any>element, 'person_ids');
|
localVarHeaders = localVarHeaders.set(
|
||||||
})
|
'Accept',
|
||||||
}
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
let localVarHeaders = this.defaultHeaders;
|
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
|
||||||
'application/json'
|
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/dfg/persons/ids`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<DfgPersonSummaryPage>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/dfg/persons/ids`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<DfgPersonSummaryPage>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,213 +0,0 @@
|
|||||||
/**
|
|
||||||
* Innovation Search Engine API
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
|
||||||
} from '@angular/common/http';
|
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
||||||
import { Configuration } from '../configuration';
|
|
||||||
import { BaseService } from '../api.base.service';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root'
|
|
||||||
})
|
|
||||||
export class INSEServiceService extends BaseService {
|
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
||||||
super(basePath, configuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds the topic hierarchy cache.
|
|
||||||
* @endpoint get /api/inse-service/topics/cache
|
|
||||||
* @param pageSize Page size for each search page.
|
|
||||||
* @param saveJson Persist cache JSON to data folder.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<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
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
@@ -24,192 +30,333 @@ import { Institution } from '../model/institution';
|
|||||||
import { InstitutionPageV2 } from '../model/institutionPageV2';
|
import { InstitutionPageV2 } from '../model/institutionPageV2';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class InstitutionsV2Service extends BaseService {
|
export class InstitutionsV2Service extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Returns a list of institutions based on a search term for autocomplete functionality.
|
||||||
|
* @endpoint get /api/institutions/v2/autocomplete/selector
|
||||||
|
* @param query A search term to filter institutions by (partial matches allowed).
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<InstitutionPageV2>;
|
||||||
|
public getInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<InstitutionPageV2>>;
|
||||||
|
public getInstitutionAutocompleteForSelector(
|
||||||
|
query?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<InstitutionPageV2>>;
|
||||||
|
public getInstitutionAutocompleteForSelector(
|
||||||
|
query?: 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>query,
|
||||||
|
'query',
|
||||||
|
);
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Returns a list of institutions based on a search term for autocomplete functionality.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/institutions/v2/autocomplete/selector
|
|
||||||
* @param query A search term to filter institutions by (partial matches allowed).
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getInstitutionAutocompleteForSelector(query?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionPageV2>;
|
|
||||||
public getInstitutionAutocompleteForSelector(query?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionPageV2>>;
|
|
||||||
public getInstitutionAutocompleteForSelector(query?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionPageV2>>;
|
|
||||||
public getInstitutionAutocompleteForSelector(query?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>query, 'query');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
let localVarPath = `/api/institutions/v2/autocomplete/selector`;
|
||||||
'application/json'
|
const { basePath, withCredentials } = this.configuration;
|
||||||
]);
|
return this.httpClient.request<InstitutionPageV2>(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'get',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
`${basePath}${localVarPath}`,
|
||||||
}
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
/**
|
||||||
|
* Returns an institution based on its ID.
|
||||||
|
* @endpoint get /api/institutions/v2/single/{institution_id}
|
||||||
|
* @param institutionId The ID of the institution to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getInstitutionById2(
|
||||||
|
institutionId: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<Institution>;
|
||||||
|
public getInstitutionById2(
|
||||||
|
institutionId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<Institution>>;
|
||||||
|
public getInstitutionById2(
|
||||||
|
institutionId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<Institution>>;
|
||||||
|
public getInstitutionById2(
|
||||||
|
institutionId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (institutionId === null || institutionId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter institutionId was null or undefined when calling getInstitutionById2.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
const localVarHttpContext: HttpContext =
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
options?.context ?? new HttpContext();
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/institutions/v2/autocomplete/selector`;
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<InstitutionPageV2>('get', `${basePath}${localVarPath}`,
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
{
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
context: localVarHttpContext,
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
params: localVarQueryParameters,
|
responseType_ = 'text';
|
||||||
responseType: <any>responseType_,
|
} else if (
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
headers: localVarHeaders,
|
) {
|
||||||
observe: observe,
|
responseType_ = 'json';
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
} else {
|
||||||
reportProgress: reportProgress
|
responseType_ = 'blob';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/institutions/v2/single/${this.configuration.encodeParam({ name: 'institutionId', value: institutionId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<Institution>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of institutions based on their IDs.
|
||||||
|
* @endpoint get /api/institutions/v2/multiple/ids
|
||||||
|
* @param institutionIds A list of institution IDs to retrieve.
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getInstitutionsByIds(
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<InstitutionPageV2>;
|
||||||
|
public getInstitutionsByIds(
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<InstitutionPageV2>>;
|
||||||
|
public getInstitutionsByIds(
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<InstitutionPageV2>>;
|
||||||
|
public getInstitutionsByIds(
|
||||||
|
institutionIds?: Array<string>,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (institutionIds) {
|
||||||
|
institutionIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'institution_ids',
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Returns an institution based on its ID.
|
|
||||||
* @endpoint get /api/institutions/v2/single/{institution_id}
|
|
||||||
* @param institutionId The ID of the institution to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getInstitutionById2(institutionId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Institution>;
|
|
||||||
public getInstitutionById2(institutionId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Institution>>;
|
|
||||||
public getInstitutionById2(institutionId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Institution>>;
|
|
||||||
public getInstitutionById2(institutionId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (institutionId === null || institutionId === undefined) {
|
|
||||||
throw new Error('Required parameter institutionId was null or undefined when calling getInstitutionById2.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
'application/json'
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
]);
|
localVarHeaders = localVarHeaders.set(
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
'Accept',
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
localVarHttpHeaderAcceptSelected,
|
||||||
}
|
);
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | '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/v2/single/${this.configuration.encodeParam({name: "institutionId", value: institutionId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<Institution>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Returns a list of institutions based on their IDs.
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/institutions/v2/multiple/ids
|
|
||||||
* @param institutionIds A list of institution IDs to retrieve.
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InstitutionPageV2>;
|
|
||||||
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InstitutionPageV2>>;
|
|
||||||
public getInstitutionsByIds(institutionIds?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InstitutionPageV2>>;
|
|
||||||
public getInstitutionsByIds(institutionIds?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
if (institutionIds) {
|
|
||||||
institutionIds.forEach((element) => {
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>element, 'institution_ids');
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
'application/json'
|
responseType_ = 'text';
|
||||||
]);
|
} else if (
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
) {
|
||||||
}
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | '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/v2/multiple/ids`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<InstitutionPageV2>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/institutions/v2/multiple/ids`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<InstitutionPageV2>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,12 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
/* tslint:disable:no-unused-variable member-ordering */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
import { Inject, Injectable, Optional } from '@angular/core';
|
import { Inject, Injectable, Optional } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders, HttpParams,
|
import {
|
||||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
HttpClient,
|
||||||
} from '@angular/common/http';
|
HttpHeaders,
|
||||||
import { CustomHttpParameterCodec } from '../encoder';
|
HttpParams,
|
||||||
import { Observable } from 'rxjs';
|
HttpResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpParameterCodec,
|
||||||
|
HttpContext,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { CreateOrganizationRequest } from '../model/createOrganizationRequest';
|
import { CreateOrganizationRequest } from '../model/createOrganizationRequest';
|
||||||
@@ -23,292 +29,679 @@ import { HTTPValidationError } from '../model/hTTPValidationError';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { InseOrganizationManagementModelOrganizationProfile } from '../model/inseOrganizationManagementModelOrganizationProfile';
|
import { InseOrganizationManagementModelOrganizationProfile } from '../model/inseOrganizationManagementModelOrganizationProfile';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { InstitutionAssociationsResponse } from '../model/institutionAssociationsResponse';
|
||||||
|
// @ts-ignore
|
||||||
import { OrganizationPage } from '../model/organizationPage';
|
import { OrganizationPage } from '../model/organizationPage';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest';
|
import { UpdateOrganizationRequest } from '../model/updateOrganizationRequest';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
export class OrganizationService extends BaseService {
|
export class OrganizationService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
/**
|
||||||
super(basePath, configuration);
|
* Create Organization
|
||||||
|
* @endpoint post /api/organizations
|
||||||
|
* @param createOrganizationRequest
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||||
|
public createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<
|
||||||
|
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||||
|
>;
|
||||||
|
public createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||||
|
public createOrganisation(
|
||||||
|
createOrganizationRequest: CreateOrganizationRequest,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (
|
||||||
|
createOrganizationRequest === null ||
|
||||||
|
createOrganizationRequest === undefined
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Create Organization
|
|
||||||
* @endpoint post /api/organizations
|
|
||||||
* @param createOrganizationRequest
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
|
||||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InseOrganizationManagementModelOrganizationProfile>>;
|
|
||||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
|
||||||
public createOrganisation(createOrganizationRequest: CreateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (createOrganizationRequest === null || createOrganizationRequest === undefined) {
|
|
||||||
throw new Error('Required parameter createOrganizationRequest was null or undefined when calling createOrganisation.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
const localVarHttpContext: HttpContext =
|
||||||
'application/json'
|
options?.context ?? new HttpContext();
|
||||||
]);
|
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
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';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// to determine the Content-Type header
|
let localVarPath = `/api/organizations`;
|
||||||
const consumes: string[] = [
|
const { basePath, withCredentials } = this.configuration;
|
||||||
'application/json'
|
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||||
];
|
'post',
|
||||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
`${basePath}${localVarPath}`,
|
||||||
if (httpContentTypeSelected !== undefined) {
|
{
|
||||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
context: localVarHttpContext,
|
||||||
}
|
body: createOrganizationRequest,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
/**
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
* Delete Organization
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
* @endpoint delete /api/organizations/{organization_id}
|
||||||
responseType_ = 'text';
|
* @param organizationId
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
* @param secureFgpAcc
|
||||||
responseType_ = 'json';
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
} else {
|
* @param reportProgress flag to report request and response progress.
|
||||||
responseType_ = 'blob';
|
*/
|
||||||
}
|
public deleteOrganisation(
|
||||||
}
|
organizationId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any>;
|
||||||
|
public deleteOrganisation(
|
||||||
|
organizationId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<any>>;
|
||||||
|
public deleteOrganisation(
|
||||||
|
organizationId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<any>>;
|
||||||
|
public deleteOrganisation(
|
||||||
|
organizationId: string,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (organizationId === null || organizationId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter organizationId was null or undefined when calling deleteOrganisation.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/organizations`;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>('post', `${basePath}${localVarPath}`,
|
// authentication (HTTPBearer) required
|
||||||
{
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
context: localVarHttpContext,
|
'HTTPBearer',
|
||||||
body: createOrganizationRequest,
|
'Authorization',
|
||||||
responseType: <any>responseType_,
|
localVarHeaders,
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
'Bearer ',
|
||||||
headers: localVarHeaders,
|
);
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
reportProgress: reportProgress
|
options?.httpHeaderAccept ??
|
||||||
}
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<any>(
|
||||||
|
'delete',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Organizations
|
||||||
|
* @endpoint get /api/organizations
|
||||||
|
* @param page
|
||||||
|
* @param pageSize
|
||||||
|
* @param offset
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: number,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<OrganizationPage>;
|
||||||
|
public getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: number,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<OrganizationPage>>;
|
||||||
|
public getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: number,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<OrganizationPage>>;
|
||||||
|
public getOrganisations(
|
||||||
|
page?: number,
|
||||||
|
pageSize?: number,
|
||||||
|
offset?: number,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>page,
|
||||||
|
'page',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>pageSize,
|
||||||
|
'page_size',
|
||||||
|
);
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>offset,
|
||||||
|
'offset',
|
||||||
|
);
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/organizations`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<OrganizationPage>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
params: localVarQueryParameters,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Organization Institution Associations
|
||||||
|
* @endpoint get /api/organizations/institutions/associations
|
||||||
|
* @param institutionIds
|
||||||
|
* @param secureFgpAcc
|
||||||
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
|
* @param reportProgress flag to report request and response progress.
|
||||||
|
*/
|
||||||
|
public getOrganizationInstitutionAssociations(
|
||||||
|
institutionIds: Array<string>,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<Array<InstitutionAssociationsResponse>>;
|
||||||
|
public getOrganizationInstitutionAssociations(
|
||||||
|
institutionIds: Array<string>,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<Array<InstitutionAssociationsResponse>>>;
|
||||||
|
public getOrganizationInstitutionAssociations(
|
||||||
|
institutionIds: Array<string>,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<Array<InstitutionAssociationsResponse>>>;
|
||||||
|
public getOrganizationInstitutionAssociations(
|
||||||
|
institutionIds: Array<string>,
|
||||||
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (institutionIds === null || institutionIds === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter institutionIds was null or undefined when calling getOrganizationInstitutionAssociations.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||||
|
if (institutionIds) {
|
||||||
|
institutionIds.forEach((element) => {
|
||||||
|
localVarQueryParameters = this.addToHttpParams(
|
||||||
|
localVarQueryParameters,
|
||||||
|
<any>element,
|
||||||
|
'institution_ids',
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarHeaders = this.defaultHeaders;
|
||||||
* Delete Organization
|
|
||||||
* @endpoint delete /api/organizations/{organization_id}
|
|
||||||
* @param organizationId
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
|
||||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
|
||||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
|
||||||
public deleteOrganisation(organizationId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
if (organizationId === null || organizationId === undefined) {
|
|
||||||
throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganisation.');
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
// authentication (HTTPBearer) required
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
'application/json'
|
localVarHeaders = localVarHeaders.set(
|
||||||
]);
|
'Accept',
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
localVarHttpHeaderAcceptSelected,
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<any>('delete', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const localVarHttpContext: HttpContext =
|
||||||
* Get Organizations
|
options?.context ?? new HttpContext();
|
||||||
* @endpoint get /api/organizations
|
|
||||||
* @param page
|
|
||||||
* @param pageSize
|
|
||||||
* @param offset
|
|
||||||
* @param secureFgpAcc
|
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|
||||||
* @param reportProgress flag to report request and response progress.
|
|
||||||
*/
|
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<OrganizationPage>;
|
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<OrganizationPage>>;
|
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<OrganizationPage>>;
|
|
||||||
public getOrganisations(page?: number, pageSize?: number, offset?: number, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>page, 'page');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>pageSize, 'page_size');
|
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
||||||
<any>offset, 'offset');
|
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
// authentication (HTTPBearer) required
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
'application/json'
|
) {
|
||||||
]);
|
responseType_ = 'json';
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
} else {
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
responseType_ = 'blob';
|
||||||
}
|
}
|
||||||
|
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
|
||||||
|
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
||||||
|
|
||||||
|
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
|
||||||
responseType_ = 'text';
|
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
|
||||||
responseType_ = 'json';
|
|
||||||
} else {
|
|
||||||
responseType_ = 'blob';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let localVarPath = `/api/organizations`;
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
|
||||||
return this.httpClient.request<OrganizationPage>('get', `${basePath}${localVarPath}`,
|
|
||||||
{
|
|
||||||
context: localVarHttpContext,
|
|
||||||
params: localVarQueryParameters,
|
|
||||||
responseType: <any>responseType_,
|
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
|
||||||
headers: localVarHeaders,
|
|
||||||
observe: observe,
|
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
||||||
reportProgress: reportProgress
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
let localVarPath = `/api/organizations/institutions/associations`;
|
||||||
* Update Organization
|
const { basePath, withCredentials } = this.configuration;
|
||||||
* @endpoint put /api/organizations/{organization_id}
|
return this.httpClient.request<Array<InstitutionAssociationsResponse>>(
|
||||||
* @param organizationId
|
'get',
|
||||||
* @param updateOrganizationRequest
|
`${basePath}${localVarPath}`,
|
||||||
* @param secureFgpAcc
|
{
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
context: localVarHttpContext,
|
||||||
* @param reportProgress flag to report request and response progress.
|
params: localVarQueryParameters,
|
||||||
*/
|
responseType: <any>responseType_,
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<InseOrganizationManagementModelOrganizationProfile>>;
|
headers: localVarHeaders,
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
observe: observe,
|
||||||
public updateOrganisation(organizationId: string, updateOrganizationRequest: UpdateOrganizationRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
...(localVarTransferCache !== undefined
|
||||||
if (organizationId === null || organizationId === undefined) {
|
? { transferCache: localVarTransferCache }
|
||||||
throw new Error('Required parameter organizationId was null or undefined when calling updateOrganisation.');
|
: {}),
|
||||||
}
|
reportProgress: reportProgress,
|
||||||
if (updateOrganizationRequest === null || updateOrganizationRequest === undefined) {
|
},
|
||||||
throw new Error('Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.');
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
/**
|
||||||
|
* Update Organization
|
||||||
// authentication (HTTPBearer) required
|
* @endpoint put /api/organizations/{organization_id}
|
||||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
* @param organizationId
|
||||||
|
* @param updateOrganizationRequest
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
* @param secureFgpAcc
|
||||||
'application/json'
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
]);
|
* @param reportProgress flag to report request and response progress.
|
||||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
*/
|
||||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
public updateOrganisation(
|
||||||
}
|
organizationId: string,
|
||||||
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'body',
|
||||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
// to determine the Content-Type header
|
context?: HttpContext;
|
||||||
const consumes: string[] = [
|
transferCache?: boolean;
|
||||||
'application/json'
|
},
|
||||||
];
|
): Observable<InseOrganizationManagementModelOrganizationProfile>;
|
||||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
public updateOrganisation(
|
||||||
if (httpContentTypeSelected !== undefined) {
|
organizationId: string,
|
||||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
}
|
secureFgpAcc?: string,
|
||||||
|
observe?: 'response',
|
||||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
reportProgress?: boolean,
|
||||||
if (localVarHttpHeaderAcceptSelected) {
|
options?: {
|
||||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
httpHeaderAccept?: 'application/json';
|
||||||
responseType_ = 'text';
|
context?: HttpContext;
|
||||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
transferCache?: boolean;
|
||||||
responseType_ = 'json';
|
},
|
||||||
} else {
|
): Observable<
|
||||||
responseType_ = 'blob';
|
HttpResponse<InseOrganizationManagementModelOrganizationProfile>
|
||||||
}
|
>;
|
||||||
}
|
public updateOrganisation(
|
||||||
|
organizationId: string,
|
||||||
let localVarPath = `/api/organizations/${this.configuration.encodeParam({name: "organizationId", value: organizationId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: "uuid"})}`;
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
const { basePath, withCredentials } = this.configuration;
|
secureFgpAcc?: string,
|
||||||
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>('put', `${basePath}${localVarPath}`,
|
observe?: 'events',
|
||||||
{
|
reportProgress?: boolean,
|
||||||
context: localVarHttpContext,
|
options?: {
|
||||||
body: updateOrganizationRequest,
|
httpHeaderAccept?: 'application/json';
|
||||||
responseType: <any>responseType_,
|
context?: HttpContext;
|
||||||
...(withCredentials ? { withCredentials } : {}),
|
transferCache?: boolean;
|
||||||
headers: localVarHeaders,
|
},
|
||||||
observe: observe,
|
): Observable<HttpEvent<InseOrganizationManagementModelOrganizationProfile>>;
|
||||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
public updateOrganisation(
|
||||||
reportProgress: reportProgress
|
organizationId: string,
|
||||||
}
|
updateOrganizationRequest: UpdateOrganizationRequest,
|
||||||
);
|
secureFgpAcc?: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<any> {
|
||||||
|
if (organizationId === null || organizationId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter organizationId was null or undefined when calling updateOrganisation.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
updateOrganizationRequest === null ||
|
||||||
|
updateOrganizationRequest === undefined
|
||||||
|
) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter updateOrganizationRequest was null or undefined when calling updateOrganisation.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||||
|
'HTTPBearer',
|
||||||
|
'Authorization',
|
||||||
|
localVarHeaders,
|
||||||
|
'Bearer ',
|
||||||
|
);
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
const consumes: string[] = ['application/json'];
|
||||||
|
const httpContentTypeSelected: string | undefined =
|
||||||
|
this.configuration.selectHeaderContentType(consumes);
|
||||||
|
if (httpContentTypeSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Content-Type',
|
||||||
|
httpContentTypeSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/organizations/${this.configuration.encodeParam({ name: 'organizationId', value: organizationId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: 'uuid' })}`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<InseOrganizationManagementModelOrganizationProfile>(
|
||||||
|
'put',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
body: updateOrganizationRequest,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2300
-1131
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,8 @@ import { Subfield } from '../model/subfield';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { Topic } from '../model/topic';
|
import { Topic } from '../model/topic';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
import { TopicHierarchyResponse } from '../model/topicHierarchyResponse';
|
||||||
|
// @ts-ignore
|
||||||
import { TopicPageV2 } from '../model/topicPageV2';
|
import { TopicPageV2 } from '../model/topicPageV2';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { TopicSortBy } from '../model/topicSortBy';
|
import { TopicSortBy } from '../model/topicSortBy';
|
||||||
@@ -564,6 +566,97 @@ export class TopicsV2Service extends BaseService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the full topic hierarchy tree (Domain -> Field -> Subfield -> Topics).
|
||||||
|
* @endpoint get /api/topics/v2/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<TopicHierarchyResponse>;
|
||||||
|
public getTopicHierarchy(
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpResponse<TopicHierarchyResponse>>;
|
||||||
|
public getTopicHierarchy(
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
|
): Observable<HttpEvent<TopicHierarchyResponse>>;
|
||||||
|
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/topics/v2/hierarchy`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<TopicHierarchyResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a paginated list of topics for a given list of topic IDs.
|
* Returns a paginated list of topics for a given list of topic IDs.
|
||||||
* @endpoint get /api/topics/v2/topics/id
|
* @endpoint get /api/topics/v2/topics/id
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -10,51 +10,47 @@
|
|||||||
import { TokenType } from './tokenType';
|
import { TokenType } from './tokenType';
|
||||||
import { UserRole } from './userRole';
|
import { UserRole } from './userRole';
|
||||||
|
|
||||||
|
export interface AccessToken {
|
||||||
export interface AccessToken {
|
/**
|
||||||
/**
|
* The unique identifier of the real account associated with this token.
|
||||||
* The unique identifier of the real account associated with this token.
|
*/
|
||||||
*/
|
real_account_id: string;
|
||||||
real_account_id: string;
|
/**
|
||||||
/**
|
* The timestamp indicating when the token will expire.
|
||||||
* The timestamp indicating when the token will expire.
|
*/
|
||||||
*/
|
expires_at: string;
|
||||||
expires_at: string;
|
/**
|
||||||
/**
|
* The epoch value for the token. Used for versioning of tokens.
|
||||||
* The epoch value for the token. Used for versioning of tokens.
|
*/
|
||||||
*/
|
epoch?: number;
|
||||||
epoch?: number;
|
/**
|
||||||
/**
|
* The type of the token, which is always ACCESS_TOKEN for this class.
|
||||||
* The type of the token, which is always ACCESS_TOKEN for this class.
|
*/
|
||||||
*/
|
token_type?: TokenType;
|
||||||
token_type?: TokenType;
|
/**
|
||||||
/**
|
* A unique fingerprint of the user, used for additional security checks.
|
||||||
* A unique fingerprint of the user, used for additional security checks.
|
*/
|
||||||
*/
|
user_fingerprint_hash: string;
|
||||||
user_fingerprint_hash: string;
|
/**
|
||||||
/**
|
* The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.
|
||||||
* The unique identifier of the effective account associated with this access token. This may differ from the real account ID due to account impersonation.
|
*/
|
||||||
*/
|
effective_account_id: string;
|
||||||
effective_account_id: string;
|
/**
|
||||||
/**
|
* The specific role this access token grants within its organization.
|
||||||
* The specific role this access token grants within its organization.
|
*/
|
||||||
*/
|
effective_role?: UserRole;
|
||||||
effective_role?: UserRole;
|
/**
|
||||||
/**
|
* The roles this access token grants within its organization.
|
||||||
* The roles this access token grants within its organization.
|
*/
|
||||||
*/
|
effective_roles?: Array<UserRole>;
|
||||||
effective_roles?: Array<UserRole>;
|
/**
|
||||||
/**
|
* The unique identifier of the organization associated with this access token.
|
||||||
* The unique identifier of the organization associated with this access token.
|
*/
|
||||||
*/
|
effective_organization_id: string;
|
||||||
effective_organization_id: string;
|
effective_institution_id?: string | null;
|
||||||
effective_institution_id?: string | null;
|
/**
|
||||||
/**
|
* The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes.
|
||||||
* The raw string representation of the access token. This is the actual token that can be used for authentication and authorization purposes.
|
*/
|
||||||
*/
|
raw_token: string;
|
||||||
raw_token: string;
|
|
||||||
}
|
}
|
||||||
export namespace AccessToken {
|
export namespace AccessToken {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,16 @@
|
|||||||
*/
|
*/
|
||||||
import { UserRole } from './userRole';
|
import { UserRole } from './userRole';
|
||||||
|
|
||||||
|
export interface AccountProfile {
|
||||||
export interface AccountProfile {
|
id: string;
|
||||||
id: string;
|
email: string;
|
||||||
email: string;
|
name: string;
|
||||||
name: string;
|
roles: Array<UserRole>;
|
||||||
roles: Array<UserRole>;
|
organization_id: string;
|
||||||
organization_id: string;
|
organization_name: string;
|
||||||
organization_name: string;
|
deleted: boolean;
|
||||||
deleted: boolean;
|
activated: boolean;
|
||||||
activated: boolean;
|
is_current?: boolean;
|
||||||
is_current?: boolean;
|
is_real_account?: boolean;
|
||||||
is_real_account?: boolean;
|
is_impersonating?: boolean;
|
||||||
is_impersonating?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,18 +9,14 @@
|
|||||||
*/
|
*/
|
||||||
import { CompanyStatusFilter } from './companyStatusFilter';
|
import { CompanyStatusFilter } from './companyStatusFilter';
|
||||||
|
|
||||||
|
export interface AuthorMetricsRequest {
|
||||||
export interface AuthorMetricsRequest {
|
/**
|
||||||
/**
|
* OpenAlex IDs of the authors.
|
||||||
* OpenAlex IDs of the authors.
|
*/
|
||||||
*/
|
author_ids: Array<string>;
|
||||||
author_ids: Array<string>;
|
/**
|
||||||
/**
|
* Which companies to count for the company-foundations metric: \'all\', only \'active\' (non-deleted), or only \'deleted\'.
|
||||||
* Which companies to count for the company-foundations metric: \'all\', only \'active\' (non-deleted), or only \'deleted\'.
|
*/
|
||||||
*/
|
company_status?: CompanyStatusFilter;
|
||||||
company_status?: CompanyStatusFilter;
|
|
||||||
}
|
}
|
||||||
export namespace AuthorMetricsRequest {
|
export namespace AuthorMetricsRequest {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,24 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export interface AuthorNode {
|
||||||
export interface AuthorNode {
|
/**
|
||||||
/**
|
* The ID of the author.
|
||||||
* The ID of the author.
|
*/
|
||||||
*/
|
id: string;
|
||||||
id: string;
|
/**
|
||||||
/**
|
* The display name of the author.
|
||||||
* The display name of the author.
|
*/
|
||||||
*/
|
display_name: string;
|
||||||
display_name: string;
|
/**
|
||||||
/**
|
* IDs of institutions this author is affiliated with.
|
||||||
* IDs of institutions this author is affiliated with.
|
*/
|
||||||
*/
|
institution_ids?: Array<string>;
|
||||||
institution_ids?: Array<string>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,22 +9,18 @@
|
|||||||
*/
|
*/
|
||||||
import { AuthorOrientationProfileStatus } from './authorOrientationProfileStatus';
|
import { AuthorOrientationProfileStatus } from './authorOrientationProfileStatus';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aggregated research-orientation result for one selected author.
|
* Aggregated research-orientation result for one selected author.
|
||||||
*/
|
*/
|
||||||
export interface AuthorOrientationProfile {
|
export interface AuthorOrientationProfile {
|
||||||
/**
|
/**
|
||||||
* The full OpenAlex author ID.
|
* The full OpenAlex author ID.
|
||||||
*/
|
*/
|
||||||
author_id: string;
|
author_id: string;
|
||||||
status: AuthorOrientationProfileStatus;
|
status: AuthorOrientationProfileStatus;
|
||||||
orientation_score?: number | null;
|
orientation_score?: number | null;
|
||||||
primary_category_counts?: { [key: string]: number; } | null;
|
primary_category_counts?: { [key: string]: number } | null;
|
||||||
classified_work_count?: number | null;
|
classified_work_count?: number | null;
|
||||||
scored_work_count?: number | null;
|
scored_work_count?: number | null;
|
||||||
}
|
}
|
||||||
export namespace AuthorOrientationProfile {
|
export namespace AuthorOrientationProfile {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
export const AuthorOrientationProfileStatus = {
|
export const AuthorOrientationProfileStatus = {
|
||||||
Available: 'available',
|
Available: 'available',
|
||||||
InsufficientScoredPublications: 'insufficient_scored_publications',
|
InsufficientScoredPublications: 'insufficient_scored_publications',
|
||||||
NoClassifiedPublications: 'no_classified_publications',
|
NoClassifiedPublications: 'no_classified_publications',
|
||||||
NoOrientationScore: 'no_orientation_score',
|
NoOrientationScore: 'no_orientation_score',
|
||||||
Restricted: 'restricted'
|
Restricted: 'restricted',
|
||||||
} as const;
|
} as const;
|
||||||
export type AuthorOrientationProfileStatus = typeof AuthorOrientationProfileStatus[keyof typeof AuthorOrientationProfileStatus];
|
export type AuthorOrientationProfileStatus =
|
||||||
|
(typeof AuthorOrientationProfileStatus)[keyof typeof AuthorOrientationProfileStatus];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -10,19 +10,17 @@
|
|||||||
import { Timespan } from './timespan';
|
import { Timespan } from './timespan';
|
||||||
import { PublicationType } from './publicationType';
|
import { PublicationType } from './publicationType';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters used to compare the research orientation of selected authors.
|
* Filters used to compare the research orientation of selected authors.
|
||||||
*/
|
*/
|
||||||
export interface AuthorOrientationProfilesRequest {
|
export interface AuthorOrientationProfilesRequest {
|
||||||
/**
|
/**
|
||||||
* One to four unique OpenAlex author IDs.
|
* One to four unique OpenAlex author IDs.
|
||||||
*/
|
*/
|
||||||
author_ids: Array<string>;
|
author_ids: Array<string>;
|
||||||
/**
|
/**
|
||||||
* Optional publication-type filter. Empty means all types.
|
* Optional publication-type filter. Empty means all types.
|
||||||
*/
|
*/
|
||||||
publication_types?: Array<PublicationType>;
|
publication_types?: Array<PublicationType>;
|
||||||
timespan?: Timespan | null;
|
timespan?: Timespan | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,26 +9,24 @@
|
|||||||
*/
|
*/
|
||||||
import { Author } from './author';
|
import { Author } from './author';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A paginated response containing a list of authors.
|
* A paginated response containing a list of authors.
|
||||||
*/
|
*/
|
||||||
export interface AuthorPage {
|
export interface AuthorPage {
|
||||||
/**
|
/**
|
||||||
* The elements of the page.
|
* The elements of the page.
|
||||||
*/
|
*/
|
||||||
elements?: Array<Author>;
|
elements?: Array<Author>;
|
||||||
/**
|
/**
|
||||||
* The page number. (0-based)
|
* The page number. (0-based)
|
||||||
*/
|
*/
|
||||||
page?: number;
|
page?: number;
|
||||||
/**
|
/**
|
||||||
* The page size in elements.
|
* The page size in elements.
|
||||||
*/
|
*/
|
||||||
size?: number;
|
size?: number;
|
||||||
/**
|
/**
|
||||||
* The total number of elements.
|
* The total number of elements.
|
||||||
*/
|
*/
|
||||||
total?: number;
|
total?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,35 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section 2: author-level stats independent of any keyword/topic/time filter.
|
* Section 2: author-level stats independent of any keyword/topic/time filter.
|
||||||
*/
|
*/
|
||||||
export interface AuthorStaticStats {
|
export interface AuthorStaticStats {
|
||||||
/**
|
/**
|
||||||
* The OpenAlex ID of the author.
|
* The OpenAlex ID of the author.
|
||||||
*/
|
*/
|
||||||
author_id: string;
|
author_id: string;
|
||||||
/**
|
/**
|
||||||
* The name of the author.
|
* The name of the author.
|
||||||
*/
|
*/
|
||||||
display_name: string;
|
display_name: string;
|
||||||
/**
|
/**
|
||||||
* Number of Handelsregister company connections matched by the author\'s name.
|
* Number of Handelsregister company connections matched by the author\'s name.
|
||||||
*/
|
*/
|
||||||
companies_count: number;
|
companies_count: number;
|
||||||
/**
|
/**
|
||||||
* Number of news articles that mention the author by exact name.
|
* Number of news articles that mention the author by exact name.
|
||||||
*/
|
*/
|
||||||
news_count: number;
|
news_count: number;
|
||||||
/**
|
/**
|
||||||
* Number of patents matched to the author (from the org_patents index).
|
* Number of patents matched to the author (from the org_patents index).
|
||||||
*/
|
*/
|
||||||
patents_count: number;
|
patents_count: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,51 +1,54 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
import { FieldNode } from './fieldNode';
|
||||||
import { SubfieldShare } from './subfieldShare';
|
import { SubfieldShare } from './subfieldShare';
|
||||||
|
|
||||||
|
export interface AuthorTopicProfile {
|
||||||
export interface AuthorTopicProfile {
|
/**
|
||||||
/**
|
* The OpenAlex ID of the author.
|
||||||
* The OpenAlex ID of the author.
|
*/
|
||||||
*/
|
author_id: string;
|
||||||
author_id: string;
|
/**
|
||||||
/**
|
* The name of the author.
|
||||||
* The name of the author.
|
*/
|
||||||
*/
|
display_name: string;
|
||||||
display_name: string;
|
/**
|
||||||
/**
|
* All works of the author in the timespan, regardless of the topic filter.
|
||||||
* All works of the author in the timespan, regardless of the topic filter.
|
*/
|
||||||
*/
|
works_total: number;
|
||||||
works_total: number;
|
/**
|
||||||
/**
|
* Works matching the topic filter (same subset as Section 1).
|
||||||
* Works matching the topic filter (same subset as Section 1).
|
*/
|
||||||
*/
|
matched_works: number;
|
||||||
matched_works: number;
|
/**
|
||||||
/**
|
* Matched works where one of the searched topics is the work\'s primary topic.
|
||||||
* Matched works where one of the searched topics is the work\'s primary topic (only meaningful for filter_type \'topic\').
|
*/
|
||||||
*/
|
primary_topic_matches: number;
|
||||||
primary_topic_matches: number;
|
/**
|
||||||
/**
|
* Number of distinct primary topics across all works.
|
||||||
* Number of distinct primary topics across all works.
|
*/
|
||||||
*/
|
distinct_topics: number;
|
||||||
distinct_topics: number;
|
/**
|
||||||
/**
|
* Number of distinct primary-topic subfields across all works.
|
||||||
* Number of distinct primary-topic subfields across all works.
|
*/
|
||||||
*/
|
distinct_subfields: number;
|
||||||
distinct_subfields: number;
|
/**
|
||||||
/**
|
* Number of distinct primary-topic fields across all works.
|
||||||
* Number of distinct primary-topic fields across all works.
|
*/
|
||||||
*/
|
distinct_fields: number;
|
||||||
distinct_fields: number;
|
/**
|
||||||
/**
|
* Top subfields over all works, by primary topic, largest first.
|
||||||
* Top subfields over all works, by primary topic, largest first.
|
*/
|
||||||
*/
|
subfields?: Array<SubfieldShare>;
|
||||||
subfields?: Array<SubfieldShare>;
|
/**
|
||||||
|
* Field -> subfield -> topic hierarchy over all works, by primary topic, each level largest first. Drives the interactive topic treemap.
|
||||||
|
*/
|
||||||
|
field_tree?: Array<FieldNode>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,95 +1,85 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section 1: combined stats over an author\'s works that match the topic filter.
|
* Section 1: combined stats over an author\'s works that match the topic filter.
|
||||||
*/
|
*/
|
||||||
export interface AuthorTopicStats {
|
export interface AuthorTopicStats {
|
||||||
/**
|
/**
|
||||||
* The OpenAlex ID of the author.
|
* The OpenAlex ID of the author.
|
||||||
*/
|
*/
|
||||||
author_id: string;
|
author_id: string;
|
||||||
/**
|
/**
|
||||||
* The name of the author.
|
* The name of the author.
|
||||||
*/
|
*/
|
||||||
display_name: string;
|
display_name: string;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s works matching the topic filter.
|
* Number of the author\'s works matching the topic filter.
|
||||||
*/
|
*/
|
||||||
works_total: number;
|
works_total: number;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s topic works where they are the corresponding author.
|
* Number of the author\'s topic works where they are the corresponding author.
|
||||||
*/
|
*/
|
||||||
corresponding_count: number;
|
corresponding_count: number;
|
||||||
/**
|
/**
|
||||||
* Average field-normalized citation percentile (0-1) over the author\'s topic works.
|
* Average field-normalized citation percentile (0-1) over the author\'s topic works.
|
||||||
*/
|
*/
|
||||||
avg_percentile: number;
|
avg_percentile: number;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s topic works in the top 1% most-cited.
|
* Number of the author\'s topic works in the top 1% most-cited.
|
||||||
*/
|
*/
|
||||||
top1_count: number;
|
top1_count: number;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s topic works in the top 10% most-cited.
|
* Number of the author\'s topic works in the top 10% most-cited.
|
||||||
*/
|
*/
|
||||||
top10_count: number;
|
top10_count: number;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s topic works with a field-weighted citation impact (FWCI) above 1 (cited more than the field/year/type average).
|
* Number of the author\'s topic works with a field-weighted citation impact (FWCI) above 1 (cited more than the field/year/type average).
|
||||||
*/
|
*/
|
||||||
fwci_above_one_count?: number;
|
fwci_above_one_count?: number;
|
||||||
/**
|
/**
|
||||||
* Total citations across the author\'s topic works.
|
* Total citations across the author\'s topic works.
|
||||||
*/
|
*/
|
||||||
citations_total?: number;
|
citations_total?: number;
|
||||||
/**
|
/**
|
||||||
* Average citations per topic work.
|
* Average citations per topic work.
|
||||||
*/
|
*/
|
||||||
avg_citations?: number;
|
avg_citations?: number;
|
||||||
/**
|
/**
|
||||||
* Citations of the author\'s most-cited topic work.
|
* Citations of the author\'s most-cited topic work.
|
||||||
*/
|
*/
|
||||||
max_citations?: number;
|
max_citations?: number;
|
||||||
/**
|
/**
|
||||||
* h-index over the author\'s topic works (capped at 100).
|
* h-index over the author\'s topic works (capped at 100).
|
||||||
*/
|
*/
|
||||||
h_index?: number;
|
h_index?: number;
|
||||||
/**
|
/**
|
||||||
* Average field-weighted citation impact (FWCI) over the author\'s topic works; works without an FWCI value are excluded.
|
* Average field-weighted citation impact (FWCI) over the author\'s topic works; works without an FWCI value are excluded.
|
||||||
*/
|
*/
|
||||||
avg_fwci?: number;
|
avg_fwci?: number;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s topic works with at least one co-author institution of type \'company\'.
|
* Number of the author\'s topic works with at least one co-author institution of type \'company\'.
|
||||||
*/
|
*/
|
||||||
industry_works_count?: number;
|
industry_works_count?: number;
|
||||||
first_year?: number | null;
|
first_year?: number | null;
|
||||||
last_year?: number | null;
|
last_year?: number | null;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s topic works where the matched keyword\'s relevance score is above 0.8.
|
* Number of the author\'s topic works where they are the first author.
|
||||||
*/
|
*/
|
||||||
relevance_above_80_count?: number;
|
first_author_count?: number;
|
||||||
/**
|
/**
|
||||||
* Average matched-keyword relevance score (0-1) over the author\'s topic works.
|
* Number of the author\'s topic works where they are a middle author.
|
||||||
*/
|
*/
|
||||||
avg_relevance?: number;
|
middle_author_count?: number;
|
||||||
/**
|
/**
|
||||||
* Number of the author\'s topic works where they are the first author.
|
* Number of the author\'s topic works where they are the last author.
|
||||||
*/
|
*/
|
||||||
first_author_count?: number;
|
last_author_count?: number;
|
||||||
/**
|
|
||||||
* Number of the author\'s topic works where they are a middle author.
|
|
||||||
*/
|
|
||||||
middle_author_count?: number;
|
|
||||||
/**
|
|
||||||
* Number of the author\'s topic works where they are the last author.
|
|
||||||
*/
|
|
||||||
last_author_count?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export interface AvailableImages {
|
||||||
export interface AvailableImages {
|
images: Array<string>;
|
||||||
images: Array<string>;
|
detail?: string;
|
||||||
detail?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,19 +9,17 @@
|
|||||||
*/
|
*/
|
||||||
import { JobRun } from './jobRun';
|
import { JobRun } from './jobRun';
|
||||||
|
|
||||||
|
export interface BackgroundJobTask {
|
||||||
export interface BackgroundJobTask {
|
id: number;
|
||||||
id: number;
|
name: string;
|
||||||
name: string;
|
description: string;
|
||||||
description: string;
|
target_index: string;
|
||||||
target_index: string;
|
image: string | null;
|
||||||
image: string | null;
|
command: string | null;
|
||||||
command: string | null;
|
env: { [key: string]: string };
|
||||||
env: { [key: string]: string; };
|
schedule: string | null;
|
||||||
schedule: string | null;
|
enabled: boolean;
|
||||||
enabled: boolean;
|
next_run_at: string | null;
|
||||||
next_run_at: string | null;
|
last_run: JobRun | null;
|
||||||
last_run: JobRun | null;
|
status: string;
|
||||||
status: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
export interface BmbfProjectStatusStatistics {
|
||||||
export interface BmbfProjectStatusStatistics {
|
institution_id: string;
|
||||||
institution_id: string;
|
organization_name: string;
|
||||||
organization_name: string;
|
ongoing: number;
|
||||||
ongoing: number;
|
upcoming: number;
|
||||||
upcoming: number;
|
completed: number;
|
||||||
completed: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,23 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A single institution entry derived from a BUND project record. Note: this index has no dedicated institution entity — each entry is reconstructed from the agency/recipient fields on a single project hit, so the same institution may appear multiple times (once per project).
|
* A single institution entry derived from a BUND project record. Note: this index has no dedicated institution entity — each entry is reconstructed from the agency/recipient fields on a single project hit, so the same institution may appear multiple times (once per project).
|
||||||
*/
|
*/
|
||||||
export interface BundInstitutionSummary {
|
export interface BundInstitutionSummary {
|
||||||
department?: string | null;
|
department?: string | null;
|
||||||
department_fullname?: string | null;
|
department_fullname?: string | null;
|
||||||
name?: string | null;
|
name?: string | null;
|
||||||
recepient?: string | null;
|
recepient?: string | null;
|
||||||
municipality?: string | null;
|
municipality?: string | null;
|
||||||
place?: string | null;
|
place?: string | null;
|
||||||
state?: string | null;
|
state?: string | null;
|
||||||
country?: string | null;
|
country?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,26 +9,24 @@
|
|||||||
*/
|
*/
|
||||||
import { BundInstitutionSummary } from './bundInstitutionSummary';
|
import { BundInstitutionSummary } from './bundInstitutionSummary';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A paginated response containing a list of institutions.
|
* A paginated response containing a list of institutions.
|
||||||
*/
|
*/
|
||||||
export interface BundInstitutionSummaryPage {
|
export interface BundInstitutionSummaryPage {
|
||||||
/**
|
/**
|
||||||
* The elements of the page.
|
* The elements of the page.
|
||||||
*/
|
*/
|
||||||
elements?: Array<BundInstitutionSummary>;
|
elements?: Array<BundInstitutionSummary>;
|
||||||
/**
|
/**
|
||||||
* The page number. (0-based)
|
* The page number. (0-based)
|
||||||
*/
|
*/
|
||||||
page?: number;
|
page?: number;
|
||||||
/**
|
/**
|
||||||
* The page size in elements.
|
* The page size in elements.
|
||||||
*/
|
*/
|
||||||
size?: number;
|
size?: number;
|
||||||
/**
|
/**
|
||||||
* The total number of elements.
|
* The total number of elements.
|
||||||
*/
|
*/
|
||||||
total?: number;
|
total?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -9,51 +9,49 @@
|
|||||||
*/
|
*/
|
||||||
import { Topic } from './topic';
|
import { Topic } from './topic';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types.
|
* Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types.
|
||||||
*/
|
*/
|
||||||
export interface BundProjectDetails {
|
export interface BundProjectDetails {
|
||||||
/**
|
/**
|
||||||
* The ID of the Bund project
|
* The ID of the Bund project
|
||||||
*/
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
funding_reference?: string | null;
|
funding_reference?: string | null;
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
description?: string | null;
|
description?: string | null;
|
||||||
joint_project?: string | null;
|
joint_project?: string | null;
|
||||||
funding_type?: string | null;
|
funding_type?: string | null;
|
||||||
funding_profile?: string | null;
|
funding_profile?: string | null;
|
||||||
funding_amount?: number | null;
|
funding_amount?: number | null;
|
||||||
funding_start_date?: string | null;
|
funding_start_date?: string | null;
|
||||||
funding_end_date?: string | null;
|
funding_end_date?: string | null;
|
||||||
duration?: string | null;
|
duration?: string | null;
|
||||||
performance_plan_code?: string | null;
|
performance_plan_code?: string | null;
|
||||||
performance_plan_fullname?: string | null;
|
performance_plan_fullname?: string | null;
|
||||||
executing_agency?: string | null;
|
executing_agency?: string | null;
|
||||||
funding_recipient?: string | null;
|
funding_recipient?: string | null;
|
||||||
project_agency?: string | null;
|
project_agency?: string | null;
|
||||||
project_agency_fullname?: string | null;
|
project_agency_fullname?: string | null;
|
||||||
department?: string | null;
|
department?: string | null;
|
||||||
department_fullname?: string | null;
|
department_fullname?: string | null;
|
||||||
division?: string | null;
|
division?: string | null;
|
||||||
location?: string | null;
|
location?: string | null;
|
||||||
municipality?: string | null;
|
municipality?: string | null;
|
||||||
state?: string | null;
|
state?: string | null;
|
||||||
country?: string | null;
|
country?: string | null;
|
||||||
municipality_code?: string | null;
|
municipality_code?: string | null;
|
||||||
publication_date?: string | null;
|
publication_date?: string | null;
|
||||||
is_new?: boolean | null;
|
is_new?: boolean | null;
|
||||||
record_date?: string | null;
|
record_date?: string | null;
|
||||||
unix_timestamp?: number | null;
|
unix_timestamp?: number | null;
|
||||||
/**
|
/**
|
||||||
* All persons associated with the Bund project (from nested Arb object)
|
* All persons associated with the Bund project (from nested Arb object)
|
||||||
*/
|
*/
|
||||||
associated_persons?: Array<string>;
|
associated_persons?: Array<string>;
|
||||||
/**
|
/**
|
||||||
* All institutions associated with the Bund project
|
* All institutions associated with the Bund project
|
||||||
*/
|
*/
|
||||||
institutions?: Array<string>;
|
institutions?: Array<string>;
|
||||||
oa_topics?: Array<Topic> | null;
|
oa_topics?: Array<Topic> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Highlighted matching fragments from a BUND project search.
|
||||||
|
*/
|
||||||
|
export interface BundProjectHighlight {
|
||||||
|
/**
|
||||||
|
* Highlights from the Elasticsearch field \"Verbundprojekt\".
|
||||||
|
*/
|
||||||
|
joint_project?: Array<string>;
|
||||||
|
/**
|
||||||
|
* Highlights from the Elasticsearch field \"Thema\".
|
||||||
|
*/
|
||||||
|
topic?: Array<string>;
|
||||||
|
/**
|
||||||
|
* Highlights from the Elasticsearch field \"Zuwendungsempfänger\".
|
||||||
|
*/
|
||||||
|
recipient?: Array<string>;
|
||||||
|
/**
|
||||||
|
* Highlights from the Elasticsearch field \"Ausführende Stelle\".
|
||||||
|
*/
|
||||||
|
executing_agency?: Array<string>;
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user