Compare commits
72
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e4742206f | ||
|
|
a28ecc9d02 | ||
|
|
53397f844e | ||
|
|
818398ccda | ||
|
|
a6c7068ca6 | ||
|
|
4785bb4d40 | ||
|
|
1a9f9496fd | ||
|
|
78f35daa58 | ||
|
|
b2e70c2bb3 | ||
|
|
3d8ceeb5b6 | ||
|
|
0b8540d70b | ||
|
|
e9ccfe6796 | ||
|
|
e20f2732b3 | ||
|
|
4da4ea1bff | ||
|
|
93ba39f9b0 | ||
|
|
0642a3704d | ||
|
|
57e1bafa8b | ||
|
|
3d5eb524aa | ||
|
|
c15afed0aa | ||
|
|
b133ce80c9 | ||
|
|
ae8332dc3d | ||
|
|
026a35dd90 | ||
|
|
5fdc1cdce3 | ||
|
|
02bb8b8fb8 | ||
|
|
6af1747477 | ||
|
|
401b82c226 | ||
|
|
9d128e18b6 | ||
|
|
a6a78bb556 | ||
|
|
bc59c3f563 | ||
|
|
8b7ac08192 | ||
|
|
4fe78c2b88 | ||
|
|
2e8dd00aa6 | ||
|
|
127eed5c49 | ||
|
|
7a84fc2b12 | ||
|
|
96e0925054 | ||
|
|
730ee7f89a | ||
|
|
e62d1ca458 | ||
|
|
6bca5643ee | ||
|
|
db20b23ff3 | ||
|
|
66f34668a9 | ||
|
|
ceadc26741 | ||
|
|
3a74dc9b7b | ||
|
|
4a47d752cb | ||
|
|
1bca6648bd | ||
|
|
af00bc4635 | ||
|
|
def210b4b9 | ||
|
|
89bdab0a26 | ||
|
|
448922d907 | ||
|
|
3ef8c28191 | ||
|
|
46aee46ea3 | ||
|
|
e57875d2a5 | ||
|
|
28726cf4c7 | ||
|
|
b0e4ad639e | ||
|
|
1810918e43 | ||
|
|
a736539851 | ||
|
|
591233e255 | ||
|
|
c2a2a31fb9 | ||
|
|
d4a4bfa2c7 | ||
|
|
3a127450e3 | ||
|
|
c2f9a6381a | ||
|
|
7adf12912f | ||
|
|
0b2b05ae85 | ||
|
|
127c32dce7 | ||
|
|
652ff8db15 | ||
|
|
3a78519655 | ||
|
|
c6de85d4a0 | ||
|
|
f25c5cd222 | ||
|
|
0b5c6bed37 | ||
|
|
2d485263d1 | ||
|
|
3d78ec900e | ||
|
|
fc134dad8e | ||
|
|
59a1f765d0 |
@@ -12,6 +12,11 @@ ELASTICSEARCH_API_KEY=am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ
|
||||
ELASTICSEARCH_INSE_URL=https://inse.nes.uni-due.de/elastic
|
||||
ELASTICSEARCH_INSE_API_KEY=bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||
|
||||
# Debugging: Log every outgoing Elasticsearch query (index + payload)
|
||||
PRINT_ES_QUERIES=false
|
||||
# Debugging: Log the duration of every Elasticsearch request
|
||||
PRINT_ES_TIMINGS=true
|
||||
|
||||
# Sentence Transformers Configuration
|
||||
SENTENCE_TRANSFORMERS_MODEL_NAME=intfloat/multilingual-e5-base
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from inse.authors.v2.model import (
|
||||
StartCollaborationGraphResponse,
|
||||
)
|
||||
from inse.database import SessionDep
|
||||
from inse.models.openalex.author import Author
|
||||
from inse.router_prefixes import RouterPrefixes
|
||||
from inse.tags import Tags
|
||||
|
||||
@@ -18,6 +19,22 @@ logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix=RouterPrefixes.AUTHORS_V2, tags=[Tags.AUTHORS_V2])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/{raw_oa_author_id}",
|
||||
operation_id="getAuthorById",
|
||||
summary="Returns an author for a given author ID.",
|
||||
)
|
||||
async def get_author_by_id(
|
||||
raw_oa_author_id: Annotated[
|
||||
str,
|
||||
Path(description="The ID of the author to retrieve."),
|
||||
],
|
||||
) -> Author:
|
||||
return await authors_service.get_author_by_id_strict_or_raise(
|
||||
raw_oa_author_id=raw_oa_author_id
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/authors/id",
|
||||
operation_id="getAuthorsByIds",
|
||||
|
||||
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
@@ -18,6 +18,7 @@ from inse.authors.v2.model import (
|
||||
StartCollaborationGraphResponse,
|
||||
WorkNode,
|
||||
)
|
||||
from inse.exceptions import NotFoundException
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESIndex
|
||||
from inse.models.openalex.author import Author
|
||||
@@ -68,21 +69,41 @@ async def search_authors(
|
||||
return AuthorPage(elements=authors, total=len(authors), page=page, size=size)
|
||||
|
||||
|
||||
async def get_author_by_id(author_id: str) -> Author | None:
|
||||
async def get_author_by_id(raw_oa_author_id: str) -> Author | None:
|
||||
"""Retrieves an author from the OpenAlex Elasticsearch index based on the provided author ID.
|
||||
|
||||
Args:
|
||||
author_id (str): The ID of the author to retrieve.
|
||||
raw_oa_author_id (str): The raw OpenAlex author ID of the author to retrieve.
|
||||
|
||||
Returns:
|
||||
Optional[Author]: The retrieved author, or None if not found.
|
||||
"""
|
||||
response = await elasticsearch.get(index=ESIndex.OPENALEX_AUTHORS, doc_id=author_id)
|
||||
response = await elasticsearch.get(
|
||||
index=ESIndex.OPENALEX_AUTHORS, doc_id=raw_oa_author_id
|
||||
)
|
||||
if not response.get("found"):
|
||||
return None
|
||||
return Author.from_dict(response.get("_source", {})) # type: ignore
|
||||
|
||||
|
||||
async def get_author_by_id_strict_or_raise(raw_oa_author_id: str) -> Author:
|
||||
"""Retrieves an author from the OpenAlex Elasticsearch index based on the provided author ID.
|
||||
|
||||
Args:
|
||||
raw_oa_author_id (str): The raw OpenAlex author ID of the author to retrieve.
|
||||
|
||||
Returns:
|
||||
Author: The retrieved author.
|
||||
|
||||
Raises:
|
||||
ValueError: If the author is not found.
|
||||
"""
|
||||
author = await get_author_by_id(raw_oa_author_id=raw_oa_author_id)
|
||||
if not author:
|
||||
raise NotFoundException(f"Author with ID {raw_oa_author_id} not found.")
|
||||
return author
|
||||
|
||||
|
||||
async def autocomplete_authors_for_selector(query: str) -> AuthorPage:
|
||||
"""Autocompletes authors based on a search term for use in a selector component.
|
||||
|
||||
@@ -367,7 +388,7 @@ async def _build_collaboration_graph(
|
||||
f"Searching works for collaboration graph of author {raw_oa_author_id} with query: {query}"
|
||||
)
|
||||
|
||||
work_page: WorkPageV2 = await works_service.search_works(
|
||||
work_page: WorkPageV2 = await works_service._search_works(
|
||||
query=query,
|
||||
source=COLLABORATION_GRAPH_SOURCE_FIELDS,
|
||||
page=0,
|
||||
|
||||
@@ -69,6 +69,8 @@ class Settings(BaseSettings):
|
||||
elasticsearch_api_key: Optional[str] = None
|
||||
elasticsearch_inse_url: Optional[str] = None
|
||||
elasticsearch_inse_api_key: Optional[str] = None
|
||||
print_es_queries: bool = False
|
||||
print_es_timings: bool = False
|
||||
|
||||
model_config = SettingsConfigDict(env_file=str(ENV_FILE))
|
||||
|
||||
|
||||
@@ -34,6 +34,14 @@ class BmbfProjectStatusStatistics(BaseModel):
|
||||
completed: int
|
||||
|
||||
|
||||
class DfgProjectStatusStatistics(BaseModel):
|
||||
institution_id: str
|
||||
organization_name: str
|
||||
ongoing: int
|
||||
upcoming: int
|
||||
completed: int
|
||||
|
||||
|
||||
class DfgProjectTopic(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
@@ -60,6 +68,7 @@ class TopAuthor(BaseModel):
|
||||
class TopAuthorStatistics(BaseModel):
|
||||
institution_id: str
|
||||
works: list[TopAuthor]
|
||||
projects: list[TopAuthor]
|
||||
eu_projects: list[TopAuthor]
|
||||
patents: list[TopAuthor]
|
||||
news: list[TopAuthor]
|
||||
|
||||
@@ -12,6 +12,7 @@ from .model import (
|
||||
BmbfProjectStatusStatistics,
|
||||
DashboardStatisticValue,
|
||||
DashboardStatistics,
|
||||
DfgProjectStatusStatistics,
|
||||
DfgProjectTopics,
|
||||
EuProjectStatusStatistics,
|
||||
TopAuthorStatistics,
|
||||
@@ -22,6 +23,7 @@ from .service import (
|
||||
get_dashboard_bmbf_project_statuses,
|
||||
get_dashboard_bmbf_projects,
|
||||
get_dashboard_dfg_projects,
|
||||
get_dashboard_dfg_project_statuses,
|
||||
get_dashboard_dfg_topics,
|
||||
get_dashboard_eu_projects,
|
||||
get_dashboard_eu_project_statuses,
|
||||
@@ -60,6 +62,8 @@ async def dashboard_statistics(
|
||||
response_model=DashboardStatisticValue,
|
||||
)
|
||||
async def dashboard_publications(
|
||||
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,
|
||||
) -> DashboardStatisticValue:
|
||||
@@ -67,6 +71,8 @@ async def dashboard_publications(
|
||||
return await get_dashboard_publications(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -92,6 +98,8 @@ async def dashboard_persons(
|
||||
response_model=DashboardStatisticValue,
|
||||
)
|
||||
async def dashboard_patents(
|
||||
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,
|
||||
) -> DashboardStatisticValue:
|
||||
@@ -99,6 +107,8 @@ async def dashboard_patents(
|
||||
return await get_dashboard_patents(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -108,6 +118,8 @@ async def dashboard_patents(
|
||||
response_model=DashboardStatisticValue,
|
||||
)
|
||||
async def dashboard_eu_projects(
|
||||
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,
|
||||
) -> DashboardStatisticValue:
|
||||
@@ -115,6 +127,8 @@ async def dashboard_eu_projects(
|
||||
return await get_dashboard_eu_projects(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -124,6 +138,8 @@ async def dashboard_eu_projects(
|
||||
response_model=EuProjectStatusStatistics,
|
||||
)
|
||||
async def dashboard_eu_project_statuses(
|
||||
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,
|
||||
) -> EuProjectStatusStatistics:
|
||||
@@ -131,6 +147,8 @@ async def dashboard_eu_project_statuses(
|
||||
return await get_dashboard_eu_project_statuses(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -140,6 +158,8 @@ async def dashboard_eu_project_statuses(
|
||||
response_model=DashboardStatisticValue,
|
||||
)
|
||||
async def dashboard_bmbf_projects(
|
||||
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,
|
||||
) -> DashboardStatisticValue:
|
||||
@@ -147,6 +167,8 @@ async def dashboard_bmbf_projects(
|
||||
return await get_dashboard_bmbf_projects(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -156,6 +178,8 @@ async def dashboard_bmbf_projects(
|
||||
response_model=BmbfProjectStatusStatistics,
|
||||
)
|
||||
async def dashboard_bmbf_project_statuses(
|
||||
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,
|
||||
) -> BmbfProjectStatusStatistics:
|
||||
@@ -163,6 +187,8 @@ async def dashboard_bmbf_project_statuses(
|
||||
return await get_dashboard_bmbf_project_statuses(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -172,6 +198,8 @@ async def dashboard_bmbf_project_statuses(
|
||||
response_model=DashboardStatisticValue,
|
||||
)
|
||||
async def dashboard_dfg_projects(
|
||||
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,
|
||||
) -> DashboardStatisticValue:
|
||||
@@ -179,6 +207,28 @@ async def dashboard_dfg_projects(
|
||||
return await get_dashboard_dfg_projects(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/projects/dfg/status",
|
||||
operation_id="getDashboardDfgProjectStatuses",
|
||||
response_model=DfgProjectStatusStatistics,
|
||||
)
|
||||
async def dashboard_dfg_project_statuses(
|
||||
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,
|
||||
) -> DfgProjectStatusStatistics:
|
||||
organization = get_dashboard_organization(session, access_token)
|
||||
return await get_dashboard_dfg_project_statuses(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -188,6 +238,8 @@ async def dashboard_dfg_projects(
|
||||
response_model=DfgProjectTopics,
|
||||
)
|
||||
async def dashboard_dfg_project_topics(
|
||||
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,
|
||||
) -> DfgProjectTopics:
|
||||
@@ -195,6 +247,8 @@ async def dashboard_dfg_project_topics(
|
||||
return await get_dashboard_dfg_topics(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
@@ -208,6 +262,8 @@ async def dashboard_top_authors(
|
||||
default="all_time",
|
||||
pattern="^(all_time|last_5_years)$",
|
||||
),
|
||||
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,
|
||||
) -> TopAuthorStatistics:
|
||||
@@ -216,6 +272,8 @@ async def dashboard_top_authors(
|
||||
organization.openalex_institution_id,
|
||||
organization.name,
|
||||
works_period=works_period,
|
||||
from_year=from_year,
|
||||
to_year=to_year,
|
||||
)
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock, patch
|
||||
from datetime import datetime
|
||||
|
||||
@@ -7,12 +8,17 @@ from sqlmodel import Session, SQLModel, create_engine
|
||||
|
||||
from inse import config
|
||||
from inse.auth.model import AccessToken, Organization, UserRole
|
||||
from inse.authors.institution_membership_query import (
|
||||
build_active_institution_membership_query,
|
||||
)
|
||||
from inse.dashboard.service import (
|
||||
get_dashboard_bmbf_project_statuses,
|
||||
get_dashboard_organization,
|
||||
get_dashboard_dfg_project_statuses,
|
||||
get_dashboard_dfg_topics,
|
||||
get_dashboard_eu_project_statuses,
|
||||
get_dashboard_patents,
|
||||
get_dashboard_publications,
|
||||
get_dashboard_statistics,
|
||||
get_top_authors,
|
||||
get_topic_heatmap,
|
||||
@@ -42,7 +48,36 @@ async def test_dashboard_patents_uses_org_patent_total():
|
||||
"organization_name": "Example Org",
|
||||
"value": 42,
|
||||
}
|
||||
search.assert_awaited_once_with(ORG_INSTITUTION_ID, page=0, size=0)
|
||||
search.assert_awaited_once_with(
|
||||
ORG_INSTITUTION_ID,
|
||||
page=0,
|
||||
size=0,
|
||||
from_year=None,
|
||||
to_year=None,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_dashboard_publications_filters_by_publication_year_period():
|
||||
with patch(
|
||||
"inse.dashboard.service.elasticsearch.search",
|
||||
new=AsyncMock(return_value={"hits": {"total": {"value": 7}}}),
|
||||
) as search:
|
||||
result = await get_dashboard_publications(
|
||||
ORG_INSTITUTION_ID,
|
||||
"Example Org",
|
||||
from_year=2020,
|
||||
to_year=2024,
|
||||
)
|
||||
|
||||
assert result.value == 7
|
||||
query = search.await_args.kwargs["query"]
|
||||
assert query["bool"]["must"][0]["nested"]["query"]["term"] == {
|
||||
"authorships.institutions.id": ORG_INSTITUTION_ID
|
||||
}
|
||||
assert query["bool"]["filter"] == [
|
||||
{"range": {"publication_year": {"gte": 2020, "lte": 2024}}}
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
@@ -103,6 +138,51 @@ async def test_dashboard_eu_project_statuses_deduplicates_projects():
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_dashboard_eu_project_statuses_restricts_project_set_by_period():
|
||||
async def scan(**kwargs):
|
||||
yield {"_source": {"projectID": "P2"}}
|
||||
yield {"_source": {"projectID": "P1"}}
|
||||
|
||||
with patch(
|
||||
"inse.dashboard.service.InstitutionsSearchClient.get_institution_aliases_by_oa_institution_id",
|
||||
new=AsyncMock(return_value=["Example University"]),
|
||||
), patch("inse.dashboard.service.elasticsearch.scan", new=scan), patch(
|
||||
"inse.dashboard.service.elasticsearch.search",
|
||||
new=AsyncMock(
|
||||
return_value={
|
||||
"aggregations": {
|
||||
"ongoing": {"projects": {"value": 1}},
|
||||
"upcoming": {"projects": {"value": 0}},
|
||||
"completed": {"projects": {"value": 1}},
|
||||
}
|
||||
}
|
||||
),
|
||||
) as search:
|
||||
await get_dashboard_eu_project_statuses(
|
||||
ORG_INSTITUTION_ID,
|
||||
"Example Org",
|
||||
from_year=2020,
|
||||
to_year=2024,
|
||||
)
|
||||
|
||||
assert search.await_args.kwargs["body"]["query"] == {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{"terms": {"id": ["P1", "P2"]}},
|
||||
{
|
||||
"bool": {
|
||||
"filter": [
|
||||
{"range": {"startDate": {"lte": "2024-12-31"}}},
|
||||
{"range": {"endDate": {"gte": "2020-01-01"}}},
|
||||
]
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_dashboard_bmbf_project_statuses_uses_funding_dates():
|
||||
response = {
|
||||
@@ -148,6 +228,102 @@ async def test_dashboard_bmbf_project_statuses_uses_funding_dates():
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_dashboard_dfg_project_statuses_uses_nested_status_de():
|
||||
with patch(
|
||||
"inse.dashboard.service._get_dfg_project_ids_for_institution",
|
||||
new=AsyncMock(return_value=["123", "456"]),
|
||||
) as project_ids, patch(
|
||||
"inse.dashboard.service.elasticsearch.search",
|
||||
new=AsyncMock(
|
||||
return_value={
|
||||
"aggregations": {
|
||||
"projects_nested": {
|
||||
"selected_projects": {
|
||||
"ongoing": {"projects": {"value": 1}},
|
||||
"completed": {"projects": {"value": 1}},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
) as search:
|
||||
result = await get_dashboard_dfg_project_statuses(
|
||||
ORG_INSTITUTION_ID,
|
||||
"Example Org",
|
||||
from_year=2020,
|
||||
to_year=2024,
|
||||
)
|
||||
|
||||
project_ids.assert_awaited_once_with(
|
||||
ORG_INSTITUTION_ID,
|
||||
)
|
||||
assert result.model_dump() == {
|
||||
"institution_id": ORG_INSTITUTION_ID,
|
||||
"organization_name": "Example Org",
|
||||
"ongoing": 1,
|
||||
"upcoming": 0,
|
||||
"completed": 1,
|
||||
}
|
||||
call = search.await_args
|
||||
assert call.kwargs["index"] == ESIndex.DFG_INSTITUTES_V2
|
||||
selected = call.kwargs["body"]["aggs"]["projects_nested"]["aggs"][
|
||||
"selected_projects"
|
||||
]
|
||||
assert selected["filter"] == {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{"terms": {"projects.project_id": [123, 456]}},
|
||||
{
|
||||
"bool": {
|
||||
"filter": [
|
||||
{
|
||||
"range": {
|
||||
"projects.funding_start": {"lte": 2024}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"range": {
|
||||
"projects.funding_end": {
|
||||
"gte": 2020
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"must_not": {
|
||||
"exists": {
|
||||
"field": "projects.funding_end"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
assert selected["aggs"]["ongoing"]["filter"] == {
|
||||
"match_phrase": {"projects.status_de": "laufend"}
|
||||
}
|
||||
assert selected["aggs"]["completed"]["filter"] == {
|
||||
"match_phrase": {"projects.status_de": "abgeschlossen"}
|
||||
}
|
||||
assert all(
|
||||
selected["aggs"][status]["aggs"]["projects"]["cardinality"]["field"]
|
||||
== "projects.project_id"
|
||||
for status in ("ongoing", "completed")
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_dashboard_statistics_counts_organization_data_and_all_projects():
|
||||
async def search(**kwargs):
|
||||
@@ -231,11 +407,9 @@ async def test_dashboard_statistics_counts_organization_data_and_all_projects():
|
||||
assert works_call.kwargs["query"]["nested"]["query"]["term"] == {
|
||||
"authorships.institutions.id": ORG_INSTITUTION_ID
|
||||
}
|
||||
assert authors_call.kwargs["query"]["bool"]["should"][0]["bool"]["filter"][
|
||||
0
|
||||
]["nested"]["query"]["match_phrase"] == {
|
||||
"last_known_institutions.id": ORG_INSTITUTION_ID
|
||||
}
|
||||
assert authors_call.kwargs["query"] == build_active_institution_membership_query(
|
||||
ORG_INSTITUTION_ID
|
||||
)
|
||||
assert all(
|
||||
call.kwargs["cluster"] == ESCluster.INSE
|
||||
for call in [eu_call, bmbf_call, *dfg_calls]
|
||||
@@ -383,7 +557,7 @@ async def test_dashboard_dfg_topics_returns_deduplicated_topics():
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_top_authors_maps_works_patents_and_news_without_project_queries():
|
||||
async def test_top_authors_maps_works_patents_eu_dfg_and_news():
|
||||
async def search(**kwargs):
|
||||
if kwargs["index"] == ESIndex.OPENALEX_AUTHORS:
|
||||
return {
|
||||
@@ -427,6 +601,37 @@ async def test_top_authors_maps_works_patents_and_news_without_project_queries()
|
||||
}
|
||||
}
|
||||
}
|
||||
if kwargs["index"] == ESIndex.DFG_PROJECTS:
|
||||
return {
|
||||
"hits": {
|
||||
"total": {"value": 2},
|
||||
"hits": [
|
||||
{
|
||||
"_source": {
|
||||
"id": "P1",
|
||||
"persons": [
|
||||
{"person_id": 2, "full_name": "Grace Example"},
|
||||
{
|
||||
"person_id": 99,
|
||||
"full_name": "Outside Collaborator",
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
{
|
||||
"_source": {
|
||||
"id": "P2",
|
||||
"persons": [
|
||||
{"person_id": 2, "full_name": "Grace Example"},
|
||||
{"person_id": 2, "full_name": "Grace Example"},
|
||||
],
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
if kwargs["index"] == ESIndex.DFG_PERSONS:
|
||||
return {"hits": {"hits": []}}
|
||||
return {"aggregations": {"people": {"buckets": []}}}
|
||||
|
||||
with patch(
|
||||
@@ -439,6 +644,12 @@ async def test_top_authors_maps_works_patents_and_news_without_project_queries()
|
||||
{"id": "A1", "name": "Ada Example", "count": 4},
|
||||
]
|
||||
),
|
||||
), patch(
|
||||
"inse.dashboard.service.autocomplete_institutions_for_selector",
|
||||
new=AsyncMock(return_value=SimpleNamespace(elements=[SimpleNamespace(id=101)])),
|
||||
), patch(
|
||||
"inse.dashboard.service.get_person_ids_by_institution_ids",
|
||||
new=AsyncMock(return_value=[2]),
|
||||
):
|
||||
result = await get_top_authors(ORG_INSTITUTION_ID, "Example Org")
|
||||
|
||||
@@ -456,6 +667,11 @@ async def test_top_authors_maps_works_patents_and_news_without_project_queries()
|
||||
{"id": None, "name": "Grace Example", "count": 8},
|
||||
{"id": None, "name": "Ada Example", "count": 5},
|
||||
]
|
||||
assert result.projects[0].model_dump() == {
|
||||
"id": "A2",
|
||||
"name": "Grace Example",
|
||||
"count": 2,
|
||||
}
|
||||
assert result.news[0].model_dump() == {
|
||||
"id": "A1",
|
||||
"name": "Ada Example",
|
||||
@@ -464,10 +680,15 @@ async def test_top_authors_maps_works_patents_and_news_without_project_queries()
|
||||
project_calls = [
|
||||
call
|
||||
for call in mocked_search.await_args_list
|
||||
if call.kwargs["index"]
|
||||
in {ESIndex.DFG_PROJECTS_V2, ESIndex.PROJECTS_BUND_V1}
|
||||
if call.kwargs["index"] == ESIndex.DFG_PROJECTS
|
||||
]
|
||||
assert project_calls == []
|
||||
assert len(project_calls) == 1
|
||||
assert project_calls[0].kwargs["body"]["query"] == {
|
||||
"nested": {
|
||||
"path": "persons",
|
||||
"query": {"terms": {"persons.person_id": [2]}},
|
||||
},
|
||||
}
|
||||
eu_calls = [
|
||||
call
|
||||
for call in mocked_search.await_args_list
|
||||
@@ -505,10 +726,14 @@ async def test_top_authors_returns_partial_response_when_one_source_fails():
|
||||
), patch(
|
||||
"inse.dashboard.service.OrgPatentsSearchClient.top_authors_by_institution",
|
||||
new=AsyncMock(return_value=[]),
|
||||
), patch(
|
||||
"inse.dashboard.service.autocomplete_institutions_for_selector",
|
||||
new=AsyncMock(return_value=SimpleNamespace(elements=[])),
|
||||
):
|
||||
result = await get_top_authors(ORG_INSTITUTION_ID, "Example Org")
|
||||
|
||||
assert result.works[0].name == "Ada Example"
|
||||
assert result.projects == []
|
||||
assert result.eu_projects == []
|
||||
assert result.patents == []
|
||||
assert result.news == []
|
||||
@@ -559,6 +784,9 @@ async def test_top_authors_can_rank_works_by_last_five_years():
|
||||
), patch(
|
||||
"inse.dashboard.service.OrgPatentsSearchClient.top_authors_by_institution",
|
||||
new=AsyncMock(return_value=[]),
|
||||
), patch(
|
||||
"inse.dashboard.service.autocomplete_institutions_for_selector",
|
||||
new=AsyncMock(return_value=SimpleNamespace(elements=[])),
|
||||
):
|
||||
result = await get_top_authors(
|
||||
ORG_INSTITUTION_ID,
|
||||
@@ -734,7 +962,7 @@ async def test_topic_heatmap_maps_field_year_counts_and_shares():
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_topic_heatmap_defaults_to_last_five_years():
|
||||
async def test_topic_heatmap_defaults_to_all_time():
|
||||
async def search(**kwargs):
|
||||
if kwargs["index"] == config.settings.openalex_works_search_index:
|
||||
return {
|
||||
@@ -754,13 +982,9 @@ async def test_topic_heatmap_defaults_to_last_five_years():
|
||||
organization_name="Example Org",
|
||||
)
|
||||
|
||||
current_year = datetime.now().year
|
||||
assert result.years == list(range(current_year - 4, current_year + 1))
|
||||
assert result.years == []
|
||||
body = mocked_search.await_args_list[0].kwargs["body"]
|
||||
assert body["query"]["bool"]["filter"][0]["range"]["publication_year"] == {
|
||||
"gte": current_year - 4,
|
||||
"lte": current_year,
|
||||
}
|
||||
assert body["query"]["bool"]["filter"] == []
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import logging
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Query
|
||||
import inse.institutions.v2.service as institutions_service
|
||||
from fastapi import APIRouter, Path, Query
|
||||
from inse.institutions.v2.model import InstitutionPageV2
|
||||
from inse.models.openalex.institution import Institution
|
||||
from inse.router_prefixes import RouterPrefixes
|
||||
from inse.tags import Tags
|
||||
|
||||
@@ -13,7 +15,32 @@ router = APIRouter(prefix=RouterPrefixes.INSTITUTIONS_V2, tags=[Tags.INSTITUTION
|
||||
|
||||
|
||||
@router.get(
|
||||
"/ids",
|
||||
"/single/{institution_id}",
|
||||
operation_id="getInstitutionById2",
|
||||
summary="Returns an institution based on its ID.",
|
||||
)
|
||||
async def get_institution_by_id(
|
||||
institution_id: Annotated[
|
||||
str,
|
||||
Path(description="The ID of the institution to retrieve."),
|
||||
],
|
||||
) -> Institution:
|
||||
return await institutions_service.get_institution_by_id_or_raise(
|
||||
raw_oa_institution_id=institution_id,
|
||||
source=[
|
||||
"id",
|
||||
"display_name",
|
||||
"display_name_alternatives",
|
||||
"works_count",
|
||||
"cited_by_count",
|
||||
"geo",
|
||||
"summary_stats",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/multiple/ids",
|
||||
operation_id="getInstitutionsByIds",
|
||||
summary="Returns a list of institutions based on their IDs.",
|
||||
)
|
||||
@@ -23,9 +50,9 @@ async def get_institutions_by_ids(
|
||||
Query(description="A list of institution IDs to retrieve."),
|
||||
] = None,
|
||||
) -> InstitutionPageV2:
|
||||
from inse.institutions.v2.service import get_institutions_by_ids
|
||||
|
||||
return await get_institutions_by_ids(institution_ids=institution_ids or [])
|
||||
return await institutions_service.get_institutions_by_ids(
|
||||
institution_ids=institution_ids or []
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
@@ -41,6 +68,6 @@ async def get_institution_autocomplete(
|
||||
),
|
||||
] = "",
|
||||
) -> InstitutionPageV2:
|
||||
from inse.institutions.v2.service import autocomplete_institutions_for_selector
|
||||
|
||||
return await autocomplete_institutions_for_selector(query=query)
|
||||
return await institutions_service.autocomplete_institutions_for_selector(
|
||||
query=query
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
|
||||
from inse.exceptions import NotFoundException
|
||||
from inse.institutions.v2.model import InstitutionPageV2
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESIndex
|
||||
@@ -8,6 +9,51 @@ from inse.models.openalex.institution import Institution
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def get_institution_by_id(
|
||||
raw_oa_institution_id: str, source: list[str] | None = None
|
||||
) -> Institution | None:
|
||||
"""Retrieves an institution by its ID from the OpenAlex Elasticsearch index.
|
||||
|
||||
Args:
|
||||
raw_oa_institution_id (str): The raw OpenAlex ID of the institution to retrieve.
|
||||
source (Optional[List[str]], optional): A list of fields to include in the response. Defaults to None.
|
||||
|
||||
Returns:
|
||||
Institution | None: The institution object if found, otherwise None.
|
||||
"""
|
||||
response = await elasticsearch.get(
|
||||
index=ESIndex.OPENALEX_INSTITUTIONS, doc_id=raw_oa_institution_id, source=source
|
||||
)
|
||||
if not response.get("found"):
|
||||
return None
|
||||
return Institution.from_dict(response.get("_source", {})) # type: ignore
|
||||
|
||||
|
||||
async def get_institution_by_id_or_raise(
|
||||
raw_oa_institution_id: str, source: list[str] | None = None
|
||||
) -> Institution:
|
||||
"""Retrieves an institution by its ID from the OpenAlex Elasticsearch index, raising an exception if not found.
|
||||
|
||||
Args:
|
||||
raw_oa_institution_id (str): The raw OpenAlex ID of the institution to retrieve.
|
||||
source (Optional[List[str]], optional): A list of fields to include in the response. Defaults to None.
|
||||
|
||||
Raises:
|
||||
NotFoundException: If the institution is not found.
|
||||
|
||||
Returns:
|
||||
Institution: The institution object if found.
|
||||
"""
|
||||
institution = await get_institution_by_id(
|
||||
raw_oa_institution_id=raw_oa_institution_id, source=source
|
||||
)
|
||||
if institution is None:
|
||||
raise NotFoundException(
|
||||
f"Institution with ID {raw_oa_institution_id} not found."
|
||||
)
|
||||
return institution
|
||||
|
||||
|
||||
async def search_institutions(
|
||||
page: int = 0,
|
||||
size: int = 10,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from typing import Any, Dict, AsyncIterator, List, Optional, Tuple
|
||||
|
||||
import httpx
|
||||
@@ -110,6 +111,10 @@ def _index_to_cluster(index: ESIndex) -> Optional[ESCluster]:
|
||||
return None
|
||||
|
||||
|
||||
def _headers(api_key: str, content_type: str = "application/json") -> Dict[str, str]:
|
||||
return {"Authorization": f"ApiKey {api_key}", "Content-Type": content_type}
|
||||
|
||||
|
||||
def _wrap_exception(e: Exception) -> Exception:
|
||||
logger.exception(f"Elasticsearch raised an exception: {e}")
|
||||
if isinstance(e, httpx.HTTPStatusError):
|
||||
@@ -125,6 +130,63 @@ def _wrap_exception(e: Exception) -> Exception:
|
||||
return ElasticsearchException(f"Unexpected Elasticsearch error: {e}")
|
||||
|
||||
|
||||
async def _request(
|
||||
method: str,
|
||||
cluster: ESCluster,
|
||||
path: str,
|
||||
*,
|
||||
json_body: Optional[Any] = None,
|
||||
params: Optional[Dict[str, Any]] = None,
|
||||
content: Optional[bytes] = None,
|
||||
content_type: str = "application/json",
|
||||
) -> httpx.Response:
|
||||
"""Sends an authenticated request to cluster and returns the raw response.
|
||||
|
||||
Args:
|
||||
method: The HTTP method (e.g. "GET", "POST", "PUT", "DELETE").
|
||||
cluster: The Elasticsearch cluster to send the request to.
|
||||
path: The path appended to the cluster URL (without leading slash).
|
||||
json_body: Optional JSON-serialisable request body.
|
||||
params: Optional query parameters.
|
||||
content: Optional raw request body (e.g. ndjson); mutually exclusive with json_body.
|
||||
content_type: The Content-Type header value.
|
||||
|
||||
Returns:
|
||||
httpx.Response: The successful response (status already checked).
|
||||
"""
|
||||
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
client = get_client()
|
||||
|
||||
start = time.perf_counter()
|
||||
try:
|
||||
response = await client.request(
|
||||
method,
|
||||
f"{elasticsearch_url}/{path}",
|
||||
json=json_body,
|
||||
params=params,
|
||||
content=content,
|
||||
headers=_headers(api_key, content_type=content_type),
|
||||
)
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
if config.settings.print_es_timings:
|
||||
elapsed_ms = (time.perf_counter() - start) * 1000
|
||||
logger.debug(
|
||||
f"Elasticsearch request {method} {path} on cluster '{cluster}' took {elapsed_ms:.1f} ms"
|
||||
)
|
||||
|
||||
return response
|
||||
except Exception as exc:
|
||||
if config.settings.print_es_timings:
|
||||
elapsed_ms = (time.perf_counter() - start) * 1000
|
||||
logger.debug(
|
||||
f"Elasticsearch request {method} {path} on cluster '{cluster}' failed after {elapsed_ms:.1f} ms"
|
||||
)
|
||||
raise _wrap_exception(exc) from exc
|
||||
|
||||
|
||||
async def search(
|
||||
index: ESIndex | List[ESIndex] | str | List[str],
|
||||
query: Optional[Dict] = None,
|
||||
@@ -175,10 +237,6 @@ async def search(
|
||||
elif len(clusters) == 1:
|
||||
cluster = clusters.pop()
|
||||
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
|
||||
payload: Dict[str, Any] = {}
|
||||
|
||||
if body is not None:
|
||||
@@ -210,61 +268,34 @@ async def search(
|
||||
"At least one of 'query', 'body', 'source', 'size', 'offset', 'sort', 'aggs' must be provided"
|
||||
)
|
||||
|
||||
client = get_client()
|
||||
logger.debug(
|
||||
f"Sending search request to Elasticsearch cluster '{cluster}' at {elasticsearch_url} for {index} with payload: {json.dumps(payload)}"
|
||||
)
|
||||
if config.settings.print_es_queries:
|
||||
logger.debug(
|
||||
f"Sending search request to Elasticsearch cluster '{cluster}' for {index} with payload: {json.dumps(payload)}"
|
||||
)
|
||||
|
||||
if isinstance(index, list):
|
||||
index_str = ",".join(str(idx) for idx in index)
|
||||
else:
|
||||
index_str = str(index)
|
||||
|
||||
try:
|
||||
response = await client.post(
|
||||
f"{elasticsearch_url}/{index_str}/_search", json=payload, headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
response = await _request("POST", cluster, f"{index_str}/_search", json_body=payload)
|
||||
|
||||
return response.json()
|
||||
|
||||
|
||||
async def open_point_in_time(
|
||||
index: str, keep_alive: str = "1m", cluster: str = "nes"
|
||||
) -> str:
|
||||
"""Opens a point-in-time on the given index and returns its id."""
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
response = await _request("POST", cluster, f"{index}/_pit", params={"keep_alive": keep_alive})
|
||||
|
||||
client = get_client()
|
||||
try:
|
||||
response = await client.post(
|
||||
f"{elasticsearch_url}/{index}/_pit",
|
||||
params={"keep_alive": keep_alive},
|
||||
headers=headers,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()["id"]
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
return response.json()["id"]
|
||||
|
||||
|
||||
async def close_point_in_time(pit_id: str, cluster: str = "nes") -> None:
|
||||
"""Closes a previously opened point-in-time."""
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
|
||||
client = get_client()
|
||||
try:
|
||||
response = await client.request(
|
||||
"DELETE",
|
||||
f"{elasticsearch_url}/_pit",
|
||||
json={"id": pit_id},
|
||||
headers=headers,
|
||||
)
|
||||
response.raise_for_status()
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
await _request("DELETE", cluster, "_pit", json_body={"id": pit_id})
|
||||
|
||||
|
||||
async def scan(
|
||||
@@ -280,13 +311,9 @@ async def scan(
|
||||
Unlike ``from``/``size`` pagination, this is not bounded by
|
||||
``index.max_result_window``, so it can stream result sets larger than 10k.
|
||||
"""
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
|
||||
pit_id = await open_point_in_time(index, keep_alive=keep_alive, cluster=cluster)
|
||||
search_after: Optional[List] = None
|
||||
try:
|
||||
client = get_client()
|
||||
while True:
|
||||
payload: Dict[str, Any] = {
|
||||
"size": page_size,
|
||||
@@ -299,14 +326,7 @@ async def scan(
|
||||
if search_after is not None:
|
||||
payload["search_after"] = search_after
|
||||
|
||||
try:
|
||||
response = await client.post(
|
||||
f"{elasticsearch_url}/_search", json=payload, headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
|
||||
response = await _request("POST", cluster, "_search", json_body=payload)
|
||||
result = response.json()
|
||||
|
||||
hits = result.get("hits", {}).get("hits", [])
|
||||
@@ -338,23 +358,13 @@ async def get(
|
||||
if isinstance(index, ESIndex):
|
||||
cluster = _index_to_cluster(index) or cluster
|
||||
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
|
||||
params = {}
|
||||
if source is not None:
|
||||
params["_source_includes"] = ",".join(source)
|
||||
|
||||
client = get_client()
|
||||
try:
|
||||
response = await client.get(
|
||||
f"{elasticsearch_url}/{index}/_doc/{doc_id}", params=params, headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
response = await _request("GET", cluster, f"{index}/_doc/{doc_id}", params=params)
|
||||
|
||||
return response.json()
|
||||
|
||||
|
||||
async def update(
|
||||
@@ -363,20 +373,11 @@ async def update(
|
||||
doc: Dict[str, Any],
|
||||
cluster: ESCluster = ESCluster.NES,
|
||||
) -> Dict[str, Any]:
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
response = await _request(
|
||||
"POST", cluster, f"{index}/_update/{doc_id}", json_body={"doc": doc}
|
||||
)
|
||||
|
||||
client = get_client()
|
||||
try:
|
||||
response = await client.post(
|
||||
f"{elasticsearch_url}/{index}/_update/{doc_id}",
|
||||
json={"doc": doc},
|
||||
headers=headers,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
return response.json()
|
||||
|
||||
|
||||
async def index_doc(
|
||||
@@ -385,20 +386,11 @@ async def index_doc(
|
||||
document: Dict[str, Any],
|
||||
cluster: ESCluster = ESCluster.NES,
|
||||
) -> Dict[str, Any]:
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
response = await _request(
|
||||
"PUT", cluster, f"{index}/_doc/{doc_id}", json_body=document
|
||||
)
|
||||
|
||||
client = get_client()
|
||||
try:
|
||||
response = await client.put(
|
||||
f"{elasticsearch_url}/{index}/_doc/{doc_id}",
|
||||
json=document,
|
||||
headers=headers,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
return response.json()
|
||||
|
||||
|
||||
async def count(
|
||||
@@ -431,24 +423,15 @@ async def count(
|
||||
if len(clusters) == 1:
|
||||
cluster = clusters.pop()
|
||||
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||
|
||||
if isinstance(index, list):
|
||||
index_str = ",".join(str(idx) for idx in index)
|
||||
else:
|
||||
index_str = str(index)
|
||||
|
||||
payload = {"query": query} if query else {}
|
||||
client = get_client()
|
||||
try:
|
||||
response = await client.post(
|
||||
f"{elasticsearch_url}/{index_str}/_count", json=payload, headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json().get("count", 0)
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
response = await _request("POST", cluster, f"{index_str}/_count", json_body=payload)
|
||||
|
||||
return response.json().get("count", 0)
|
||||
|
||||
|
||||
async def msearch(
|
||||
@@ -473,9 +456,6 @@ async def msearch(
|
||||
if c is not None:
|
||||
cluster = c
|
||||
|
||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/x-ndjson"}
|
||||
|
||||
lines = []
|
||||
for idx, body in searches:
|
||||
if isinstance(idx, list):
|
||||
@@ -488,16 +468,13 @@ async def msearch(
|
||||
|
||||
ndjson_payload = "\n".join(lines) + "\n"
|
||||
|
||||
client = get_client()
|
||||
try:
|
||||
response = await client.post(
|
||||
f"{elasticsearch_url}/_msearch",
|
||||
content=ndjson_payload.encode("utf-8"),
|
||||
headers=headers,
|
||||
)
|
||||
response.raise_for_status()
|
||||
res_json = response.json()
|
||||
return res_json.get("responses", [])
|
||||
except Exception as exc:
|
||||
raise _wrap_exception(exc) from exc
|
||||
response = await _request(
|
||||
"POST",
|
||||
cluster,
|
||||
"_msearch",
|
||||
content=ndjson_payload.encode("utf-8"),
|
||||
content_type="application/x-ndjson",
|
||||
)
|
||||
|
||||
return response.json().get("responses", [])
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ from inse.patents.service import (
|
||||
)
|
||||
from inse.persons.service import router as persons_service_router
|
||||
from inse.projects.dfg_institutions.router import router as dfg_institutions_router
|
||||
from inse.projects.bund_institutions.router import router as bund_institutions_router
|
||||
from inse.projects.dfg_persons.router import router as dfg_persons_router
|
||||
from inse.projects.eu_organizations.router import router as eu_organizations_router
|
||||
from inse.projects.router import router as projects_router
|
||||
@@ -103,6 +104,7 @@ app = FastAPI(
|
||||
app.include_router(institution_patents_router)
|
||||
app.include_router(org_patents_router)
|
||||
app.include_router(institutions_router)
|
||||
app.include_router(bund_institutions_router)
|
||||
app.include_router(topics_service_router)
|
||||
app.include_router(works_service_router)
|
||||
app.include_router(persons_service_router)
|
||||
@@ -137,7 +139,7 @@ app.include_router(background_jobs_router)
|
||||
app.include_router(eu_organizations_router)
|
||||
app.add_middleware(
|
||||
ETagCacheMiddleware,
|
||||
ttl=120, # 2 minutes expiration time
|
||||
ttl=600, # 10 minutes expiration time
|
||||
)
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
|
||||
@@ -16,10 +16,11 @@ NO_STORE_PATH_PREFIXES = (
|
||||
"/api/background-jobs",
|
||||
"/api/bookmarks",
|
||||
"/api/organizations",
|
||||
"/api/dashboard",
|
||||
"/api/rank/rank-author",
|
||||
"/api/works/v2/classification/",
|
||||
)
|
||||
"/api/dashboard",
|
||||
"/api/rank/rank-author",
|
||||
"/api/rank/orientation-profiles",
|
||||
"/api/works/v2/classification/",
|
||||
)
|
||||
|
||||
NO_STORE_PATH_FRAGMENTS = (
|
||||
"/company-connections",
|
||||
|
||||
@@ -68,6 +68,7 @@ class ESIndex(StrEnum):
|
||||
|
||||
AKTUELLES = "aktuell"
|
||||
AKTUELLES_POSTPROC = "aktuell_postproc"
|
||||
AKTUELLES_OPENALEX_TOPICS = "aktuell_openalex_topics"
|
||||
|
||||
|
||||
CORDIS_EU_ORGANIZATIONS_WILDCARD = "cordis_eu_*_organizations"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
"""
|
||||
|
||||
from datetime import date, datetime
|
||||
from typing import Optional, List, Set, Any
|
||||
|
||||
from typing import Optional, List, Set, Any, Dict
|
||||
from inse.models.openalex.topic import Topic, TopicDomain, TopicField, TopicSubfield
|
||||
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||
|
||||
|
||||
@@ -189,6 +189,10 @@ class BundProjectDetails(BaseModel):
|
||||
default_factory=list,
|
||||
description="All institutions associated with the Bund project",
|
||||
)
|
||||
oa_topics: Optional[List[Topic]] = Field(
|
||||
default_factory=list,
|
||||
description="OpenAlex topics associated with the Bund project",
|
||||
)
|
||||
|
||||
# --- Validators for type coercion ---
|
||||
|
||||
@@ -301,7 +305,17 @@ class BundProjectDetails(BaseModel):
|
||||
|
||||
if source.get("PT_fullname"):
|
||||
institutions.add(source["PT_fullname"].strip())
|
||||
topics_raw = source.get("oa_topics") or []
|
||||
if not isinstance(source, dict):
|
||||
return cls.model_validate(source)
|
||||
oa_topics = None
|
||||
if isinstance(topics_raw, list) and topics_raw:
|
||||
|
||||
sorted_topics_raw = sorted(
|
||||
(t for t in topics_raw if isinstance(t, dict)),
|
||||
key=lambda t: t.get("rank") if t.get("rank") is not None else float("inf"),
|
||||
)
|
||||
oa_topics = [cls._topic_from_match(t) for t in sorted_topics_raw]
|
||||
return cls(
|
||||
id=hit["_id"],
|
||||
funding_reference=source.get("Förderkennzeichen"),
|
||||
@@ -334,4 +348,24 @@ class BundProjectDetails(BaseModel):
|
||||
unix_timestamp=source.get("unix_timestamp"),
|
||||
associated_persons=sorted(persons),
|
||||
institutions=sorted(institutions),
|
||||
oa_topics=oa_topics
|
||||
)
|
||||
@staticmethod
|
||||
def _topic_from_match(match: Dict[str, Any]) -> Topic:
|
||||
"""Builds a Topic model from a flattened topic_match dict.
|
||||
"""
|
||||
domain_name = match.get("domain")
|
||||
field_name = match.get("field")
|
||||
subfield_name = match.get("subfield")
|
||||
|
||||
domain = TopicDomain(display_name=domain_name) if domain_name else None
|
||||
field = TopicField(display_name=field_name) if field_name else None
|
||||
subfield = TopicSubfield(display_name=subfield_name) if subfield_name else None
|
||||
|
||||
return Topic(
|
||||
id=match.get("topic_id"),
|
||||
display_name=match.get("topic_display_name"),
|
||||
domain=domain,
|
||||
field=field,
|
||||
subfield=subfield,
|
||||
)
|
||||
@@ -1,293 +1,435 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
DFG Project Clean Model
|
||||
DFG Project Clean Model (v2)
|
||||
|
||||
Summary model that consolidates all scattered person and institution fields
|
||||
from the raw projects_dfg_all index into clean, unified lists.
|
||||
Enriched, consolidated model built on top of the structured
|
||||
projects_dfg_v2 API models (DFGProject / DFGPerson / DFGInstitute),
|
||||
rather than the old flat projects_dfg_all Elasticsearch index.
|
||||
"""
|
||||
|
||||
from typing import Optional, List, Set
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from inse.models.projects_dfg_v2.project.dfg_project import DFGProject
|
||||
from inse.models.projects_dfg_v2.project.dfg_project_persons_inner import (
|
||||
DFGProjectPersonsInner,
|
||||
)
|
||||
from inse.models.projects_dfg_v2.project.dfg_project_institutions_inner import (
|
||||
DFGProjectInstitutionsInner,
|
||||
)
|
||||
from inse.models.projects_dfg_v2.project.dfg_project_subprojects_inner import (
|
||||
DFGProjectSubprojectsInner,
|
||||
)
|
||||
from inse.models.projects_dfg_v2.project.dfg_project_publications_inner import (
|
||||
DFGProjectPublicationsInner,
|
||||
)
|
||||
from inse.models.projects_dfg_v2.project.dfg_project_fachgebiete_inner import (
|
||||
DFGProjectFachgebieteInner,
|
||||
)
|
||||
from inse.topics.model import Topic
|
||||
|
||||
|
||||
class DfgProjectPersonRole(BaseModel):
|
||||
"""A person associated with the project, together with their role."""
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
person_id: Optional[int] = Field(default=None, description="DFG person ID")
|
||||
full_name: Optional[str] = Field(default=None, description="Full name of the person")
|
||||
orcid_id: Optional[str] = Field(
|
||||
default=None,
|
||||
description=(
|
||||
"ORCID iD, if known. Not present on the project's embedded person "
|
||||
"record (DFGProjectPersonsInner) -- only populated if the caller "
|
||||
"cross-references the full DFGPerson record via person_id and "
|
||||
"calls DfgProjectDetails.enrich_orcids afterwards."
|
||||
),
|
||||
)
|
||||
role_key: Optional[str] = Field(
|
||||
default=None, description="Machine-readable role key (e.g. 'antragsteller')"
|
||||
)
|
||||
role_label_de: Optional[str] = Field(default=None, description="Role label (German)")
|
||||
role_label_en: Optional[str] = Field(default=None, description="Role label (English)")
|
||||
affiliation_de: Optional[str] = Field(
|
||||
default=None, description="Person's affiliation at time of project (German)"
|
||||
)
|
||||
affiliation_en: Optional[str] = Field(
|
||||
default=None, description="Person's affiliation at time of project (English)"
|
||||
)
|
||||
is_deceased: Optional[bool] = Field(default=None, description="Whether the person is deceased")
|
||||
is_head: Optional[bool] = Field(
|
||||
default=None, description="Whether this person is highlighted as the project head"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_inner(cls, p: DFGProjectPersonsInner) -> "DfgProjectPersonRole":
|
||||
return cls(
|
||||
person_id=p.person_id,
|
||||
full_name=p.full_name,
|
||||
role_key=p.role_key,
|
||||
role_label_de=p.role_label_de,
|
||||
role_label_en=p.role_label_en,
|
||||
affiliation_de=p.affiliation_de,
|
||||
affiliation_en=p.affiliation_en,
|
||||
is_deceased=p.is_deceased,
|
||||
is_head=p.is_head_display,
|
||||
)
|
||||
|
||||
|
||||
class DfgProjectInstitutionRole(BaseModel):
|
||||
"""An institution associated with the project, together with its role."""
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
institute_id: Optional[int] = Field(default=None, description="DFG institute ID")
|
||||
name_de: Optional[str] = Field(default=None, description="Institution name (German)")
|
||||
name_en: Optional[str] = Field(default=None, description="Institution name (English)")
|
||||
role_key: Optional[str] = Field(default=None, description="Machine-readable role key")
|
||||
role_label_de: Optional[str] = Field(default=None, description="Role label (German)")
|
||||
role_label_en: Optional[str] = Field(default=None, description="Role label (English)")
|
||||
is_dissolved: Optional[bool] = Field(
|
||||
default=None, description="Whether the institution has since been dissolved"
|
||||
)
|
||||
is_head: Optional[bool] = Field(
|
||||
default=None, description="Whether this institution is highlighted as the lead institution"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_inner(cls, i: DFGProjectInstitutionsInner) -> "DfgProjectInstitutionRole":
|
||||
return cls(
|
||||
institute_id=i.institute_id,
|
||||
name_de=i.institute_name_de,
|
||||
name_en=i.institute_name_en,
|
||||
role_key=i.role_key,
|
||||
role_label_de=i.role_label_de,
|
||||
role_label_en=i.role_label_en,
|
||||
is_dissolved=i.is_dissolved,
|
||||
is_head=i.is_head_display,
|
||||
)
|
||||
|
||||
|
||||
class DfgProjectSubprojectSummary(BaseModel):
|
||||
"""A lightweight reference to a sub-project of this project."""
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
subproject_id: Optional[int] = None
|
||||
title_de: Optional[str] = None
|
||||
title_en: Optional[str] = None
|
||||
short_title: Optional[str] = None
|
||||
role_label_de: Optional[str] = Field(
|
||||
default=None, description="Role of the sub-project lead within the sub-project"
|
||||
)
|
||||
person_full_name: Optional[str] = Field(
|
||||
default=None, description="Sub-project lead, derived from first/last name fields"
|
||||
)
|
||||
status_de: Optional[str] = None
|
||||
funding_start: Optional[int] = None
|
||||
funding_end: Optional[int] = None
|
||||
|
||||
@classmethod
|
||||
def from_inner(cls, s: DFGProjectSubprojectsInner) -> "DfgProjectSubprojectSummary":
|
||||
person_full_name = None
|
||||
if s.person_first_names or s.person_last_name:
|
||||
person_full_name = " ".join(
|
||||
part for part in [s.person_first_names, s.person_last_name] if part
|
||||
).strip() or None
|
||||
|
||||
return cls(
|
||||
subproject_id=s.subproject_id,
|
||||
title_de=s.title_de,
|
||||
title_en=s.title_en,
|
||||
short_title=s.short_title,
|
||||
role_label_de=s.role_label_de,
|
||||
person_full_name=person_full_name,
|
||||
status_de=s.status_de,
|
||||
funding_start=s.funding_start,
|
||||
funding_end=s.funding_end,
|
||||
)
|
||||
|
||||
|
||||
class DfgProjectPublicationSummary(BaseModel):
|
||||
"""A lightweight reference to a publication resulting from the project."""
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
publication_id: Optional[int] = None
|
||||
title: Optional[str] = None
|
||||
authors_editors: Optional[str] = None
|
||||
doi: Optional[str] = None
|
||||
publication_year: Optional[int] = None
|
||||
|
||||
@classmethod
|
||||
def from_inner(cls, p: DFGProjectPublicationsInner) -> "DfgProjectPublicationSummary":
|
||||
return cls(
|
||||
publication_id=p.publication_id,
|
||||
title=p.title,
|
||||
authors_editors=p.authors_editors,
|
||||
doi=p.doi,
|
||||
publication_year=p.publication_year,
|
||||
)
|
||||
|
||||
|
||||
class DfgProjectSubjectArea(BaseModel):
|
||||
"""A single subject-area classification entry (DFG 'Fachsystematik')."""
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
fach: Optional[str] = None
|
||||
fachgebiet: Optional[str] = None
|
||||
fachkollegium: Optional[str] = None
|
||||
wissenschaftsbereich: Optional[str] = None
|
||||
|
||||
@classmethod
|
||||
def from_inner(cls, f: DFGProjectFachgebieteInner) -> "DfgProjectSubjectArea":
|
||||
return cls(
|
||||
fach=f.fach,
|
||||
fachgebiet=f.fachgebiet,
|
||||
fachkollegium=f.fachkollegium,
|
||||
wissenschaftsbereich=f.wissenschaftsbereich,
|
||||
)
|
||||
|
||||
|
||||
class DfgProjectDetails(BaseModel):
|
||||
"""
|
||||
Clean summary model for a DFG project, consolidating all person roles
|
||||
and institution references into unified lists.
|
||||
Clean, enriched summary model for a DFG project.
|
||||
"""
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True, validate_assignment=True)
|
||||
|
||||
id: Optional[int] = Field(default=None, description="The DFG project ID")
|
||||
link: Optional[str] = Field(default=None, description="Canonical DFG link to the project")
|
||||
page_url: Optional[str] = Field(default=None, description="DFG GEPRIS page URL")
|
||||
external_link: Optional[str] = Field(
|
||||
default=None, description="External project website/link, if provided"
|
||||
)
|
||||
|
||||
id: str = Field(description="The ID of the DFG project")
|
||||
link: Optional[str] = Field(default=None, description="The link to the DFG project")
|
||||
title: Optional[str] = Field(
|
||||
default=None, description="The title of the DFG project"
|
||||
title_de: Optional[str] = Field(default=None, description="Project title (German)")
|
||||
title_en: Optional[str] = Field(default=None, description="Project title (English)")
|
||||
description_de: Optional[str] = Field(default=None, description="Project abstract (German)")
|
||||
description_en: Optional[str] = Field(default=None, description="Project abstract (English)")
|
||||
final_report_abstract_de: Optional[str] = Field(
|
||||
default=None, description="Final report abstract (German), if the project has concluded"
|
||||
)
|
||||
description: Optional[str] = Field(
|
||||
default=None, description="The description of the DFG project"
|
||||
final_report_abstract_en: Optional[str] = Field(
|
||||
default=None, description="Final report abstract (English), if the project has concluded"
|
||||
)
|
||||
|
||||
project_identifier: Optional[str] = Field(
|
||||
default=None,
|
||||
description="The project identifier of the DFG project",
|
||||
)
|
||||
project_identifier_de: Optional[str] = Field(default=None, description="DFG project identifier (German)")
|
||||
project_identifier_en: Optional[str] = Field(default=None, description="DFG project identifier (English)")
|
||||
|
||||
funding_start_date: Optional[str] = Field(
|
||||
default=None, description="The funding start date of the DFG project"
|
||||
)
|
||||
funding_end_date: Optional[str] = Field(
|
||||
default=None, description="The funding end date of the DFG project"
|
||||
)
|
||||
funding_start: Optional[int] = Field(default=None, description="Funding start year")
|
||||
funding_end: Optional[int] = Field(default=None, description="Funding end year")
|
||||
funding_period_de: Optional[str] = Field(default=None, description="Human-readable funding period (German)")
|
||||
funding_period_en: Optional[str] = Field(default=None, description="Human-readable funding period (English)")
|
||||
|
||||
funding_type_de: Optional[str] = Field(default=None, description="Funding type / programme (German)")
|
||||
funding_type_en: Optional[str] = Field(default=None, description="Funding type / programme (English)")
|
||||
funding_type_key: Optional[str] = Field(default=None, description="Machine-readable funding type key")
|
||||
|
||||
dfg_procedure: Optional[str] = Field(
|
||||
default=None, description="The DFG procedure"
|
||||
)
|
||||
subject_area: Optional[str] = Field(
|
||||
default=None,
|
||||
description="The subject area classification",
|
||||
)
|
||||
funding_type: Optional[str] = Field(
|
||||
default=None, description="The type of funding"
|
||||
)
|
||||
international_reference: Optional[str] = Field(
|
||||
default=None,
|
||||
|
||||
description="International reference",
|
||||
default=None, description="DFG procedure / template type (e.g. Sachbeihilfe, SFB, GRK)"
|
||||
)
|
||||
|
||||
website: Optional[str] = Field(
|
||||
default=None, description="The project website"
|
||||
is_transfer_project: Optional[bool] = Field(
|
||||
default=None, description="Whether this is a transfer project"
|
||||
)
|
||||
|
||||
# Unified person list: all person names from any role
|
||||
website_html_de: Optional[str] = Field(
|
||||
default=None, description="Raw project website HTML content (German), as served by DFG"
|
||||
)
|
||||
website_html_en: Optional[str] = Field(
|
||||
default=None, description="Raw project website HTML content (English), as served by DFG"
|
||||
)
|
||||
|
||||
equipment_group: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Large-equipment (Großgerät) group, for equipment-funding projects",
|
||||
)
|
||||
equipment_name: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Large-equipment (Großgerät) name, for equipment-funding projects",
|
||||
)
|
||||
|
||||
subject_area_de: Optional[str] = Field(default=None, description="Subject area, summary text (German)")
|
||||
subject_area_en: Optional[str] = Field(default=None, description="Subject area, summary text (English)")
|
||||
subject_classifications: List[DfgProjectSubjectArea] = Field(
|
||||
default_factory=list,
|
||||
description="Detailed DFG subject-area classification entries (Fachsystematik)",
|
||||
)
|
||||
|
||||
international_relation_de: Optional[str] = Field(
|
||||
default=None, description="International reference/cooperation (German)"
|
||||
)
|
||||
international_relation_en: Optional[str] = Field(
|
||||
default=None, description="International reference/cooperation (English)"
|
||||
)
|
||||
|
||||
# Structured, role-aware person and institution lists
|
||||
persons: List[DfgProjectPersonRole] = Field(
|
||||
default_factory=list,
|
||||
description="All persons associated with the project, each with their role",
|
||||
)
|
||||
institutions: List[DfgProjectInstitutionRole] = Field(
|
||||
default_factory=list,
|
||||
description="All institutions associated with the project, each with their role",
|
||||
)
|
||||
|
||||
# Convenience flat views, derived from the structured lists above
|
||||
associated_persons: List[str] = Field(
|
||||
default_factory=list,
|
||||
description="All persons associated with the DFG project (any role)",
|
||||
description="Flat, de-duplicated list of all person full names (convenience view)",
|
||||
)
|
||||
|
||||
# Unified institution list: all institutions involved
|
||||
institutions: List[str] = Field(
|
||||
associated_institutions: List[str] = Field(
|
||||
default_factory=list,
|
||||
description="All institutions associated with the DFG project",
|
||||
description="Flat, de-duplicated list of all institution names (convenience view)",
|
||||
)
|
||||
|
||||
# Sub-project reference
|
||||
subproject_of: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Parent project this is a sub-project of",
|
||||
# Parent / sub-project structure
|
||||
parent_project_id: Optional[int] = Field(default=None, description="Parent project ID, if this is a sub-project")
|
||||
parent_title_de: Optional[str] = Field(default=None, description="Parent project title (German)")
|
||||
parent_title_en: Optional[str] = Field(default=None, description="Parent project title (English)")
|
||||
subprojects: List[DfgProjectSubprojectSummary] = Field(
|
||||
default_factory=list, description="Sub-projects of this project, if any"
|
||||
)
|
||||
|
||||
publications: List[DfgProjectPublicationSummary] = Field(
|
||||
default_factory=list, description="Publications resulting from the project"
|
||||
)
|
||||
|
||||
topics: Optional[List[Topic]] = Field(
|
||||
default_factory=list, description="OpenAlex topics associated with the project ID"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_dfg_project(cls, project: DFGProject) -> "DfgProjectDetails":
|
||||
"""
|
||||
Build a DfgProjectDetails from a fully-typed DFGProject instance
|
||||
(e.g. as returned by the projects_dfg_v2 API client).
|
||||
"""
|
||||
|
||||
persons = [DfgProjectPersonRole.from_inner(p) for p in (project.persons or [])]
|
||||
institutions = [
|
||||
DfgProjectInstitutionRole.from_inner(i) for i in (project.institutions or [])
|
||||
]
|
||||
subprojects = [
|
||||
DfgProjectSubprojectSummary.from_inner(s) for s in (project.subprojects or [])
|
||||
]
|
||||
publications = [
|
||||
DfgProjectPublicationSummary.from_inner(p) for p in (project.publications or [])
|
||||
]
|
||||
subject_classifications = [
|
||||
DfgProjectSubjectArea.from_inner(f) for f in (project.fachgebiete or [])
|
||||
]
|
||||
|
||||
# De-duplicated flat views, order-preserving
|
||||
seen_persons = set()
|
||||
associated_persons = []
|
||||
for p in persons:
|
||||
if p.full_name and p.full_name not in seen_persons:
|
||||
seen_persons.add(p.full_name)
|
||||
associated_persons.append(p.full_name)
|
||||
|
||||
seen_institutions = set()
|
||||
associated_institutions = []
|
||||
for i in institutions:
|
||||
name = i.name_de or i.name_en
|
||||
if name and name not in seen_institutions:
|
||||
seen_institutions.add(name)
|
||||
associated_institutions.append(name)
|
||||
|
||||
return cls(
|
||||
id=project.id or project.project_id,
|
||||
link=project.link,
|
||||
page_url=project.page_url,
|
||||
external_link=project.external_link,
|
||||
title_de=project.title_de,
|
||||
title_en=project.title_en,
|
||||
description_de=project.abstract_de,
|
||||
description_en=project.abstract_en,
|
||||
final_report_abstract_de=project.final_report_abstract_de,
|
||||
final_report_abstract_en=project.final_report_abstract_en,
|
||||
project_identifier_de=project.project_identifier_de,
|
||||
project_identifier_en=project.project_identifier_en,
|
||||
funding_start=project.funding_start,
|
||||
funding_end=project.funding_end,
|
||||
funding_period_de=project.funding_period_de,
|
||||
funding_period_en=project.funding_period_en,
|
||||
funding_type_de=project.funding_type_de,
|
||||
funding_type_en=project.funding_type_en,
|
||||
funding_type_key=project.funding_type_key,
|
||||
dfg_procedure=project.template_type,
|
||||
is_transfer_project=project.is_transfer_project,
|
||||
website_html_de=project.website_html_de,
|
||||
website_html_en=project.website_html_en,
|
||||
equipment_group=project.equipment_group,
|
||||
equipment_name=project.equipment_name,
|
||||
subject_area_de=project.subject_area_de,
|
||||
subject_area_en=project.subject_area_en,
|
||||
subject_classifications=subject_classifications,
|
||||
international_relation_de=project.international_relation_de,
|
||||
international_relation_en=project.international_relation_en,
|
||||
persons=persons,
|
||||
institutions=institutions,
|
||||
associated_persons=associated_persons,
|
||||
associated_institutions=associated_institutions,
|
||||
parent_project_id=project.parent_project_id,
|
||||
parent_title_de=project.parent_title_de,
|
||||
parent_title_en=project.parent_title_en,
|
||||
subprojects=subprojects,
|
||||
publications=publications,
|
||||
topics=project.topics,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> "DfgProjectDetails":
|
||||
"""Convenience constructor from a raw dict (e.g. a JSON API response body)."""
|
||||
obj = cls._sanitize_raw_project_dict(obj)
|
||||
return cls.from_dfg_project(DFGProject.from_dict(obj))
|
||||
|
||||
@staticmethod
|
||||
def _sanitize_raw_project_dict(obj: dict) -> dict:
|
||||
"""
|
||||
Work around known mismatches between the generated DFGProject model
|
||||
and the actual shape of API/index data, before handing off to
|
||||
DFGProject.from_dict (which would otherwise raise a ValidationError
|
||||
and abort the whole parse).
|
||||
"""
|
||||
if isinstance(obj.get("subject_classifications"), list):
|
||||
obj = dict(obj)
|
||||
obj.pop("subject_classifications", None)
|
||||
return obj
|
||||
|
||||
@classmethod
|
||||
def from_elastic_hit(cls, hit: dict) -> "DfgProjectDetails":
|
||||
"""
|
||||
Create a DfgProject from an Elasticsearch hit, consolidating all
|
||||
person and institution fields into unified lists.
|
||||
Compatibility constructor for callers still reading from an
|
||||
Elasticsearch hit (e.g. `{"_id": ..., "_source": {...}}`), matching
|
||||
the old model's from_elastic_hit signature.
|
||||
"""
|
||||
source = dict(hit.get("_source", {}))
|
||||
|
||||
source = hit.get("_source", {})
|
||||
if source.get("id") is None and source.get("project_id") is None:
|
||||
raw_id = hit.get("_id")
|
||||
if raw_id is not None:
|
||||
try:
|
||||
source["id"] = int(raw_id)
|
||||
except (TypeError, ValueError):
|
||||
# Non-numeric _id (e.g. a composite/legacy key) - leave
|
||||
# id unset rather than fail the whole parse.
|
||||
pass
|
||||
|
||||
associated_persons: Set[str] = set()
|
||||
institutions: Set[str] = set()
|
||||
return cls.from_dict(source)
|
||||
|
||||
# --- Collect all persons and institutions from nested persons array ---
|
||||
persons_list = source.get("persons", [])
|
||||
if isinstance(persons_list, list):
|
||||
for p in persons_list:
|
||||
if isinstance(p, dict):
|
||||
full_name = p.get("full_name")
|
||||
if full_name:
|
||||
associated_persons.add(full_name.strip())
|
||||
|
||||
aff_de = p.get("affiliation_de")
|
||||
if aff_de:
|
||||
institutions.add(aff_de.strip())
|
||||
|
||||
aff_en = p.get("affiliation_en")
|
||||
if aff_en:
|
||||
institutions.add(aff_en.strip())
|
||||
|
||||
# --- Collect all persons from every person-related field ---
|
||||
|
||||
# Applicant fields
|
||||
_add_persons(source, associated_persons, "Antragsteller") # semicolon-separated
|
||||
_add_person(source, associated_persons, "Antragstellerin")
|
||||
_add_persons(
|
||||
source, associated_persons, "Antragstellerinnen"
|
||||
) # semicolon-separated
|
||||
_add_persons(
|
||||
source, associated_persons, "Antragstellerinnen / Antragsteller"
|
||||
) # semicolon-separated
|
||||
|
||||
# Co-applicant fields
|
||||
_add_persons(source, associated_persons, "Mitantragsteller")
|
||||
_add_person(source, associated_persons, "Mitantragstellerin")
|
||||
_add_persons(source, associated_persons, "Mitantragstellerinnen")
|
||||
_add_persons(
|
||||
source, associated_persons, "Mitantragstellerinnen / Mitantragsteller"
|
||||
)
|
||||
|
||||
# Former applicant fields
|
||||
_add_persons(source, associated_persons, "Ehemalige Antragsteller")
|
||||
_add_person(source, associated_persons, "Ehemalige Antragstellerin")
|
||||
_add_persons(source, associated_persons, "Ehemalige Antragstellerinnen")
|
||||
_add_persons(
|
||||
source,
|
||||
associated_persons,
|
||||
"Ehemalige Antragstellerinnen / Ehemalige Antragsteller",
|
||||
)
|
||||
_add_person(source, associated_persons, "Ehemaliger Antragsteller")
|
||||
|
||||
# Speaker / coordinator fields
|
||||
_add_person(source, associated_persons, "Sprecher")
|
||||
_add_person(source, associated_persons, "Sprecherin")
|
||||
_add_persons(source, associated_persons, "Sprecherinnen")
|
||||
_add_persons(source, associated_persons, "Sprecherinnen / Sprecher")
|
||||
_add_person(source, associated_persons, "Co-Sprecher")
|
||||
_add_persons(source, associated_persons, "Co-Sprecherinnen / Co-Sprecher")
|
||||
|
||||
# IGK partner speaker fields
|
||||
_add_person(source, associated_persons, "Sprecher (IGK-Partner)")
|
||||
_add_person(source, associated_persons, "Sprecherin (IGK-Partner)")
|
||||
_add_persons(
|
||||
source,
|
||||
associated_persons,
|
||||
"Sprecherinnen (IGK-Partner) / Sprecher (IGK-Partner)",
|
||||
)
|
||||
|
||||
# Leader fields
|
||||
_add_person(source, associated_persons, "Leiter")
|
||||
_add_person(source, associated_persons, "Leiterin")
|
||||
_add_persons(source, associated_persons, "Leiterinnen")
|
||||
_add_persons(source, associated_persons, "Leiterinnen / Leiter")
|
||||
|
||||
# Sub-project leader fields
|
||||
_add_persons(source, associated_persons, "Teilprojektleiter")
|
||||
_add_person(source, associated_persons, "Teilprojektleiterin")
|
||||
_add_persons(source, associated_persons, "Teilprojektleiterinnen")
|
||||
_add_persons(
|
||||
source, associated_persons, "Teilprojektleiterinnen / Teilprojektleiter"
|
||||
)
|
||||
|
||||
# Participating scientist fields
|
||||
_add_persons(source, associated_persons, "beteiligte Wissenschaftler")
|
||||
_add_person(source, associated_persons, "beteiligte Wissenschaftlerin")
|
||||
_add_persons(source, associated_persons, "beteiligte Wissenschaftlerinnen")
|
||||
_add_persons(
|
||||
source,
|
||||
associated_persons,
|
||||
"beteiligte Wissenschaftlerinnen / beteiligte Wissenschaftler",
|
||||
)
|
||||
_add_person(source, associated_persons, "beteiligter Wissenschaftler")
|
||||
|
||||
# Participating person fields
|
||||
_add_person(source, associated_persons, "Beteiligte Person")
|
||||
_add_persons(source, associated_persons, "Beteiligte Personen")
|
||||
|
||||
# Host fields (for guest researchers)
|
||||
_add_person(source, associated_persons, "Gastgeber")
|
||||
_add_person(source, associated_persons, "Gastgeberin")
|
||||
_add_persons(source, associated_persons, "Gastgeberinnen")
|
||||
_add_persons(source, associated_persons, "Gastgeberinnen / Gastgeber")
|
||||
|
||||
# Cooperation partner fields
|
||||
_add_person(source, associated_persons, "Kooperationspartner")
|
||||
_add_person(source, associated_persons, "Kooperationspartnerin")
|
||||
_add_persons(source, associated_persons, "Kooperationspartnerinnen")
|
||||
_add_persons(
|
||||
source, associated_persons, "Kooperationspartnerinnen / Kooperationspartner"
|
||||
)
|
||||
|
||||
# Co-responsible fields
|
||||
_add_person(source, associated_persons, "Mitverantwortlich")
|
||||
_add_person(source, associated_persons, "Mitverantwortlich(e)")
|
||||
_add_persons(source, associated_persons, "Mitverantwortliche")
|
||||
|
||||
# Application partner
|
||||
_add_person(source, associated_persons, "Anwendungspartner")
|
||||
|
||||
# Foreign co-applicant fields
|
||||
_add_persons(source, associated_persons, "ausländische Mitantragsteller")
|
||||
_add_person(source, associated_persons, "ausländischer Mitantragsteller")
|
||||
|
||||
# Person creator (from nested fields)
|
||||
if "person_creater_name" in source and source["person_creater_name"]:
|
||||
associated_persons.add(source["person_creater_name"].strip())
|
||||
|
||||
# Deputy (stellvertr) - nested object
|
||||
stellvertr = source.get("stellvertr")
|
||||
if stellvertr and isinstance(stellvertr, dict):
|
||||
for field in ["stellvertreter", "stellvertreterin"]:
|
||||
if field in stellvertr and stellvertr[field]:
|
||||
associated_persons.add(stellvertr[field].strip())
|
||||
|
||||
# --- Collect all institutions ---
|
||||
|
||||
_add_institution(source, institutions, "Antragstellende Institution")
|
||||
_add_institution(source, institutions, "Mitantragstellende Institution")
|
||||
_add_institution(source, institutions, "Beteiligte Einrichtung")
|
||||
_add_institution(source, institutions, "Beteiligte Hochschule")
|
||||
_add_institution(source, institutions, "Beteiligte Institution")
|
||||
_add_institution(source, institutions, "IGK-Partnerinstitution")
|
||||
_add_institution(source, institutions, "Partnerorganisation")
|
||||
_add_institution(source, institutions, "Unternehmen")
|
||||
|
||||
# Foreign institution (nested object)
|
||||
auslaend = source.get("ausländ")
|
||||
if auslaend and isinstance(auslaend, dict):
|
||||
for field in [
|
||||
"auslaendischeInstitution",
|
||||
"auslaendischeInstitution2",
|
||||
"auslaendischesUnternehmen",
|
||||
"auslaendischesUnternehmen2",
|
||||
]:
|
||||
if field in auslaend and auslaend[field]:
|
||||
institutions.add(auslaend[field].strip())
|
||||
|
||||
return cls(
|
||||
id=hit["_id"],
|
||||
link=source.get("link") or source.get("page_url"),
|
||||
title=source.get("title") or source.get("title_de") or source.get("title_en"),
|
||||
description=source.get("description") or source.get("abstract_de") or source.get("abstract_en"),
|
||||
project_identifier=source.get("Projektkennung") or source.get("project_identifier_de") or source.get("project_identifier_en"),
|
||||
funding_start_date=str(source.get("funding_start")) if source.get("funding_start") is not None else None,
|
||||
funding_end_date=str(source.get("funding_end")) if source.get("funding_end") is not None else None,
|
||||
dfg_procedure=source.get("DFG-Verfahren") or source.get("template_type"),
|
||||
subject_area=source.get("Fachliche Zuordnung") or source.get("subject_area_de") or source.get("subject_area_en"),
|
||||
funding_type=source.get("Förderung") or source.get("funding_type_sort"),
|
||||
international_reference=source.get("Internationaler Bezug") or source.get("international_relation_de") or source.get("international_relation_en"),
|
||||
website=source.get("Webseite"),
|
||||
associated_persons=sorted(associated_persons), # sorted for consistency
|
||||
institutions=sorted(institutions),
|
||||
subproject_of=source.get("Teilprojekt zu") or source.get("parent_project_id"),
|
||||
)
|
||||
|
||||
|
||||
# --- Helper functions for parsing source fields ---
|
||||
|
||||
def _add_person(source: dict, persons: Set[str], field: str) -> None:
|
||||
"""Add a single person value from a field."""
|
||||
if field in source and source[field]:
|
||||
value = source[field].strip()
|
||||
if value:
|
||||
persons.add(value)
|
||||
|
||||
|
||||
def _add_persons(source: dict, persons: Set[str], field: str) -> None:
|
||||
"""Add persons from a semicolon-separated field."""
|
||||
if field in source and source[field]:
|
||||
for person in source[field].split(";"):
|
||||
cleaned = person.strip()
|
||||
if cleaned:
|
||||
persons.add(cleaned)
|
||||
|
||||
|
||||
def _add_institution(source: dict, institutions: Set[str], field: str) -> None:
|
||||
"""Add a single institution value from a field."""
|
||||
if field in source and source[field]:
|
||||
value = source[field].strip()
|
||||
if value:
|
||||
institutions.add(value)
|
||||
def enrich_orcids(self, persons_by_id: dict) -> None:
|
||||
"""
|
||||
Fill in orcid_id on each entry in `self.persons`, given a mapping of
|
||||
person_id -> DFGPersonPerson (or DFGPerson) for the persons involved
|
||||
in this project
|
||||
"""
|
||||
for person in self.persons:
|
||||
record = persons_by_id.get(person.person_id)
|
||||
if record is not None:
|
||||
person.orcid_id = getattr(record, "orcid_id", None)
|
||||
@@ -29,6 +29,7 @@ from inse.models.projects_dfg_v2.project.dfg_project_subprojects_inner import DF
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
from pydantic_core import to_jsonable_python
|
||||
from inse.models.openalex.topic import Topic, TopicDomain, TopicField, TopicSubfield
|
||||
|
||||
class DFGProject(BaseModel):
|
||||
"""
|
||||
@@ -52,7 +53,7 @@ class DFGProject(BaseModel):
|
||||
funding_type_key: Optional[StrictStr] = None
|
||||
funding_type_sort: Optional[StrictStr] = None
|
||||
id: Optional[StrictInt] = None
|
||||
institution_roles_order: Optional[StrictStr] = None
|
||||
institution_roles_order: Optional[list[StrictStr]] = None
|
||||
institutions: Optional[List[DFGProjectInstitutionsInner]] = None
|
||||
international_relation_de: Optional[StrictStr] = None
|
||||
international_relation_en: Optional[StrictStr] = None
|
||||
@@ -62,7 +63,7 @@ class DFGProject(BaseModel):
|
||||
parent_project_id: Optional[StrictInt] = None
|
||||
parent_title_de: Optional[StrictStr] = None
|
||||
parent_title_en: Optional[StrictStr] = None
|
||||
person_roles_order: Optional[StrictStr] = None
|
||||
person_roles_order: Optional[list[StrictStr]] = None
|
||||
persons: Optional[List[DFGProjectPersonsInner]] = None
|
||||
project: Optional[DFGProjectProject] = None
|
||||
project_id: Optional[StrictInt] = None
|
||||
@@ -72,13 +73,14 @@ class DFGProject(BaseModel):
|
||||
subject_area_de: Optional[StrictStr] = None
|
||||
subject_area_en: Optional[StrictStr] = None
|
||||
subject_classifications: Optional[DFGProjectFachgebieteInner] = None
|
||||
subproject_order: Optional[StrictStr] = None
|
||||
subproject_order: Optional[list[StrictStr]] = None
|
||||
subprojects: Optional[List[DFGProjectSubprojectsInner]] = None
|
||||
template_type: Optional[StrictStr] = None
|
||||
title_de: Optional[StrictStr] = None
|
||||
title_en: Optional[StrictStr] = None
|
||||
website_html_de: Optional[StrictStr] = None
|
||||
website_html_en: Optional[StrictStr] = None
|
||||
topics: Optional[List[Topic]] = None
|
||||
__properties: ClassVar[List[str]] = ["abstract_de", "abstract_en", "equipment_group", "equipment_name", "external_link", "fachgebiete", "fetched_at", "final_report_abstract_de", "final_report_abstract_en", "funding_end", "funding_period_de", "funding_period_en", "funding_start", "funding_type_de", "funding_type_en", "funding_type_key", "funding_type_sort", "id", "institution_roles_order", "institutions", "international_relation_de", "international_relation_en", "is_transfer_project", "link", "page_url", "parent_project_id", "parent_title_de", "parent_title_en", "person_roles_order", "persons", "project", "project_id", "project_identifier_de", "project_identifier_en", "publications", "subject_area_de", "subject_area_en", "subject_classifications", "subproject_order", "subprojects", "template_type", "title_de", "title_en", "website_html_de", "website_html_en"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
@@ -168,9 +170,18 @@ class DFGProject(BaseModel):
|
||||
"""Create an instance of DFGProject from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
|
||||
topics_raw = obj.get("topics") or []
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
topics = None
|
||||
if isinstance(topics_raw, list) and topics_raw:
|
||||
|
||||
sorted_topics_raw = sorted(
|
||||
(t for t in topics_raw if isinstance(t, dict)),
|
||||
key=lambda t: t.get("rank") if t.get("rank") is not None else float("inf"),
|
||||
)
|
||||
topics = [cls._topic_from_match(t) for t in sorted_topics_raw]
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"abstract_de": obj.get("abstract_de"),
|
||||
@@ -217,8 +228,29 @@ class DFGProject(BaseModel):
|
||||
"title_de": obj.get("title_de"),
|
||||
"title_en": obj.get("title_en"),
|
||||
"website_html_de": obj.get("website_html_de"),
|
||||
"website_html_en": obj.get("website_html_en")
|
||||
"website_html_en": obj.get("website_html_en"),
|
||||
"topics": topics,
|
||||
})
|
||||
return _obj
|
||||
|
||||
@staticmethod
|
||||
def _topic_from_match(match: Dict[str, Any]) -> Topic:
|
||||
"""Builds a Topic model from a flattened topic_match dict.
|
||||
"""
|
||||
domain_name = match.get("domain")
|
||||
field_name = match.get("field")
|
||||
subfield_name = match.get("subfield")
|
||||
|
||||
domain = TopicDomain(display_name=domain_name) if domain_name else None
|
||||
field = TopicField(display_name=field_name) if field_name else None
|
||||
subfield = TopicSubfield(display_name=subfield_name) if subfield_name else None
|
||||
|
||||
return Topic(
|
||||
id=match.get("topic_id"),
|
||||
display_name=match.get("topic_display_name"),
|
||||
domain=domain,
|
||||
field=field,
|
||||
subfield=subfield,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ from inse.models.projects_eu_cordis.fp7.fp7_topic import Fp7Topic
|
||||
from inse.models.projects_eu_cordis.fp7.fp7_web_link import Fp7WebLink
|
||||
from inse.models.projects_eu_cordis.fp7.fp7_eurosci_voc import Fp7EurosciVoc
|
||||
from inse.models.projects_eu_cordis.fp7.fp7_legal_basis import Fp7LegalBasis
|
||||
|
||||
from inse.authors.v2.model import AuthorPage
|
||||
from inse.models.openalex.topic import Topic
|
||||
|
||||
class Fp7ProjectDetails(BaseModel):
|
||||
"""
|
||||
@@ -70,6 +71,9 @@ class Fp7ProjectDetails(BaseModel):
|
||||
organization_count: Optional[int] = Field(default=None, alias="organizationCount")
|
||||
publication_count: Optional[int] = Field(default=None, alias="publicationCount")
|
||||
ipr_count: Optional[int] = Field(default=None, alias="iprCount")
|
||||
# OpenAlex related fields
|
||||
oa_topics: Optional[List[Topic]] = Field(default=None, alias="oaTopics", description="OpenAlex topics associated with the project")
|
||||
oa_authors: Optional[AuthorPage] = Field(default=None, alias="oaAuthors", description="OpenAlex authors associated with the project")
|
||||
|
||||
__properties: ClassVar[List[str]] = [
|
||||
"acronym", "contentUpdateDate", "ecMaxContribution", "ecSignatureDate",
|
||||
@@ -79,7 +83,7 @@ class Fp7ProjectDetails(BaseModel):
|
||||
"title", "topics", "totalCost",
|
||||
"organizations", "publications", "iprs", "reportSummaries",
|
||||
"topicsList", "webLinks", "eurosciVoc", "legalBasisList",
|
||||
"organizationCount", "publicationCount", "iprCount"
|
||||
"organizationCount", "publicationCount", "iprCount","oaTopics", "oaAuthors"
|
||||
]
|
||||
|
||||
model_config = ConfigDict(
|
||||
@@ -163,6 +167,10 @@ class Fp7ProjectDetails(BaseModel):
|
||||
"organizationCount": len(obj.get("organizations", [])) if obj.get("organizations") else 0,
|
||||
"publicationCount": len(obj.get("publications", [])) if obj.get("publications") else 0,
|
||||
"iprCount": len(obj.get("iprs", [])) if obj.get("iprs") else 0,
|
||||
|
||||
# # OpenAlex related fields
|
||||
# "oaTopics": [Topic.from_dict(topic) for topic in obj.get("oaTopics", [])] if obj.get("oaTopics") else None,
|
||||
# "oaAuthors": AuthorPage.from_dict(obj.get("oaAuthors")) if obj.get("oaAuthors") else None,
|
||||
})
|
||||
return _obj
|
||||
|
||||
@@ -178,6 +186,8 @@ class Fp7ProjectDetails(BaseModel):
|
||||
web_links: Optional[List[Fp7WebLink]] = None,
|
||||
eurosci_voc: Optional[List[Fp7EurosciVoc]] = None,
|
||||
legal_basis_list: Optional[List[Fp7LegalBasis]] = None,
|
||||
oa_topics: Optional[List[Topic]] = None,
|
||||
oa_authors: Optional[AuthorPage] = None,
|
||||
) -> Self:
|
||||
"""
|
||||
Factory method to create a detailed project from a base project and its relations.
|
||||
@@ -211,4 +221,6 @@ class Fp7ProjectDetails(BaseModel):
|
||||
organizationCount=len(organizations) if organizations else 0,
|
||||
publicationCount=len(publications) if publications else 0,
|
||||
iprCount=len(iprs) if iprs else 0,
|
||||
oa_authors=oa_authors,
|
||||
oa_topics=oa_topics or [],
|
||||
)
|
||||
+11
-2
@@ -26,7 +26,8 @@ from inse.models.projects_eu_cordis.horizon2020.h2020_web_link import H2020WebLi
|
||||
from inse.models.projects_eu_cordis.horizon2020.h2020_eurosci_voc import H2020EurosciVoc
|
||||
from inse.models.projects_eu_cordis.horizon2020.h2020_legal_basis import H2020LegalBasis
|
||||
from inse.models.projects_eu_cordis.horizon2020.h2020_erc_pi import H2020ErcPI
|
||||
|
||||
from inse.authors.v2.model import AuthorPage
|
||||
from inse.models.openalex.topic import Topic
|
||||
|
||||
class H2020ProjectDetails(BaseModel):
|
||||
"""
|
||||
@@ -73,7 +74,10 @@ class H2020ProjectDetails(BaseModel):
|
||||
publication_count: Optional[int] = Field(default=None, alias="publicationCount")
|
||||
deliverable_count: Optional[int] = Field(default=None, alias="deliverableCount")
|
||||
erc_pi_count: Optional[int] = Field(default=None, alias="ercPiCount")
|
||||
|
||||
# OpenAlex related fields
|
||||
oa_topics: Optional[List[Topic]] = Field(default=None, alias="oaTopics", description="OpenAlex topics associated with the project")
|
||||
oa_authors: Optional[AuthorPage] = Field(default=None, alias="oaAuthors", description="OpenAlex authors associated with the project")
|
||||
|
||||
__properties: ClassVar[List[str]] = [
|
||||
"acronym", "contentUpdateDate", "ecMaxContribution", "ecSignatureDate",
|
||||
"endDate", "frameworkProgramme", "fundingScheme", "grantDoi",
|
||||
@@ -84,6 +88,7 @@ class H2020ProjectDetails(BaseModel):
|
||||
"topicsList", "webLinks", "eurosciVoc", "legalBasisList",
|
||||
"ercPrincipalInvestigators",
|
||||
"organizationCount", "publicationCount", "deliverableCount", "ercPiCount"
|
||||
,"oaTopics", "oaAuthors"
|
||||
]
|
||||
|
||||
model_config = ConfigDict(
|
||||
@@ -185,6 +190,8 @@ class H2020ProjectDetails(BaseModel):
|
||||
eurosci_voc: Optional[List[H2020EurosciVoc]] = None,
|
||||
legal_basis_list: Optional[List[H2020LegalBasis]] = None,
|
||||
erc_principal_investigators: Optional[List[H2020ErcPI]] = None,
|
||||
oa_topics: Optional[List[Topic]] = None,
|
||||
oa_authors: Optional[AuthorPage] = None,
|
||||
) -> Self:
|
||||
"""
|
||||
Factory method to create a detailed project from a base project and its relations.
|
||||
@@ -221,4 +228,6 @@ class H2020ProjectDetails(BaseModel):
|
||||
publicationCount=len(publications) if publications else 0,
|
||||
deliverableCount=len(deliverables) if deliverables else 0,
|
||||
ercPiCount=len(erc_principal_investigators) if erc_principal_investigators else 0,
|
||||
oa_authors=oa_authors,
|
||||
oa_topics=oa_topics or [],
|
||||
)
|
||||
+10
-3
@@ -25,7 +25,8 @@ from inse.models.projects_eu_cordis.horizon_europe.heu_topic import HEUTopic
|
||||
from inse.models.projects_eu_cordis.horizon_europe.heu_web_link import HEUWebLink
|
||||
from inse.models.projects_eu_cordis.horizon_europe.heu_eurosci_voc import HEUEurosciVoc
|
||||
from inse.models.projects_eu_cordis.horizon_europe.heu_legal_basis import HEULegalBasis
|
||||
|
||||
from inse.authors.v2.model import AuthorPage
|
||||
from inse.models.openalex.topic import Topic
|
||||
|
||||
class HEUProjectDetails(BaseModel):
|
||||
"""
|
||||
@@ -70,7 +71,9 @@ class HEUProjectDetails(BaseModel):
|
||||
organization_count: Optional[int] = Field(default=None, alias="organizationCount")
|
||||
publication_count: Optional[int] = Field(default=None, alias="publicationCount")
|
||||
deliverable_count: Optional[int] = Field(default=None, alias="deliverableCount")
|
||||
|
||||
# OpenAlex related fields
|
||||
oa_topics: Optional[List[Topic]] = Field(default=None, alias="oaTopics", description="OpenAlex topics associated with the project")
|
||||
oa_authors: Optional[AuthorPage] = Field(default=None, alias="oaAuthors", description="OpenAlex authors associated with the project")
|
||||
__properties: ClassVar[List[str]] = [
|
||||
"acronym", "contentUpdateDate", "ecMaxContribution", "ecSignatureDate",
|
||||
"endDate", "frameworkProgramme", "fundingScheme", "grantDoi",
|
||||
@@ -79,7 +82,7 @@ class HEUProjectDetails(BaseModel):
|
||||
"title", "topics", "totalCost",
|
||||
"organizations", "publications", "deliverables", "reportSummaries",
|
||||
"topicsList", "webLinks", "eurosciVoc", "legalBasisList",
|
||||
"organizationCount", "publicationCount", "deliverableCount"
|
||||
"organizationCount", "publicationCount", "deliverableCount","oaTopics", "oaAuthors"
|
||||
]
|
||||
|
||||
model_config = ConfigDict(
|
||||
@@ -178,6 +181,8 @@ class HEUProjectDetails(BaseModel):
|
||||
web_links: Optional[List[HEUWebLink]] = None,
|
||||
eurosci_voc: Optional[List[HEUEurosciVoc]] = None,
|
||||
legal_basis_list: Optional[List[HEULegalBasis]] = None,
|
||||
oa_topics: Optional[List[Topic]] = None,
|
||||
oa_authors: Optional[AuthorPage] = None,
|
||||
) -> Self:
|
||||
"""
|
||||
Factory method to create a detailed project from a base project and its relations.
|
||||
@@ -211,4 +216,6 @@ class HEUProjectDetails(BaseModel):
|
||||
organizationCount=len(organizations) if organizations else 0,
|
||||
publicationCount=len(publications) if publications else 0,
|
||||
deliverableCount=len(deliverables) if deliverables else 0,
|
||||
oa_authors=oa_authors,
|
||||
oa_topics=oa_topics or [],
|
||||
)
|
||||
@@ -256,6 +256,8 @@ class OrgPatentsSearchClient:
|
||||
page: int = 0,
|
||||
size: int = DEFAULT_PAGE_SIZE,
|
||||
source: str | None = None,
|
||||
from_year: int | None = None,
|
||||
to_year: int | None = None,
|
||||
) -> tuple[list[OrgPatentEntry], int]:
|
||||
short_id = institution_id.replace("https://openalex.org/", "").upper()
|
||||
filters: list[dict[str, Any]] = [{"term": {"institution_id": short_id}}]
|
||||
@@ -270,6 +272,14 @@ class OrgPatentsSearchClient:
|
||||
if source in ("EPO", "USPTO"):
|
||||
filters.append({"term": {"source": source}})
|
||||
|
||||
year_range: dict[str, int] = {}
|
||||
if from_year is not None:
|
||||
year_range["gte"] = from_year
|
||||
if to_year is not None:
|
||||
year_range["lte"] = to_year
|
||||
if year_range:
|
||||
filters.append({"range": {"publication_year": year_range}})
|
||||
|
||||
payload = {
|
||||
"from": page * size,
|
||||
"size": size,
|
||||
@@ -304,11 +314,27 @@ class OrgPatentsSearchClient:
|
||||
self,
|
||||
institution_id: str,
|
||||
size: int = 10,
|
||||
from_year: int | None = None,
|
||||
to_year: int | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
short_id = institution_id.replace("https://openalex.org/", "").upper()
|
||||
filters: list[dict[str, Any]] = [{"term": {"institution_id": short_id}}]
|
||||
year_range: dict[str, int] = {}
|
||||
if from_year is not None:
|
||||
year_range["gte"] = from_year
|
||||
if to_year is not None:
|
||||
year_range["lte"] = to_year
|
||||
if year_range:
|
||||
filters.append({"range": {"publication_year": year_range}})
|
||||
|
||||
query = (
|
||||
{"term": {"institution_id": short_id}}
|
||||
if len(filters) == 1
|
||||
else {"bool": {"filter": filters}}
|
||||
)
|
||||
payload = {
|
||||
"size": 0,
|
||||
"query": {"term": {"institution_id": short_id}},
|
||||
"query": query,
|
||||
"aggs": {
|
||||
"matched_authors_nested": {
|
||||
"nested": {"path": "matched_authors"},
|
||||
|
||||
@@ -53,3 +53,43 @@ async def test_top_authors_by_institution_aggregates_matched_authors():
|
||||
payload["aggs"]["matched_authors_nested"]["nested"]["path"]
|
||||
== "matched_authors"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_top_authors_by_institution_filters_by_publication_year():
|
||||
requests: list[httpx.Request] = []
|
||||
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
requests.append(request)
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"aggregations": {
|
||||
"matched_authors_nested": {
|
||||
"authors": {"buckets": []}
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
client = OrgPatentsSearchClient(
|
||||
base_url="https://example.test",
|
||||
api_key="key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
await client.top_authors_by_institution(
|
||||
"https://openalex.org/I123",
|
||||
from_year=2020,
|
||||
to_year=2024,
|
||||
)
|
||||
|
||||
payload = json.loads(requests[0].content)
|
||||
assert payload["query"] == {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{"term": {"institution_id": "I123"}},
|
||||
{"range": {"publication_year": {"gte": 2020, "lte": 2024}}},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
from typing import Optional
|
||||
|
||||
from inse.model import Page
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class BundInstitutionSummary(BaseModel):
|
||||
"""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).
|
||||
"""
|
||||
|
||||
department: Optional[str] = None
|
||||
department_fullname: Optional[str] = None
|
||||
name: Optional[str] = None
|
||||
recepient: Optional[str] = None
|
||||
municipality: Optional[str] = None
|
||||
place: Optional[str] = None
|
||||
state: Optional[str] = None
|
||||
country: Optional[str] = None
|
||||
|
||||
@classmethod
|
||||
def from_source(cls, source: dict) -> "BundInstitutionSummary":
|
||||
"""Build a BundInstitutionSummary from a raw Elasticsearch _source dict."""
|
||||
return cls(
|
||||
department=source.get("Ressort"),
|
||||
department_fullname=source.get("Ressort_fullname"),
|
||||
name=source.get("Ausführende Stelle"),
|
||||
recepient=source.get("Zuwendungsempfänger"),
|
||||
municipality=source.get("Stadt/Gemeinde"),
|
||||
place=source.get("Ort"),
|
||||
state=source.get("Bundesland"),
|
||||
country=source.get("Staat"),
|
||||
)
|
||||
|
||||
|
||||
class BundInstitutionSummaryPage(Page[BundInstitutionSummary]):
|
||||
"""A paginated response containing a list of institutions."""
|
||||
|
||||
pass
|
||||
@@ -0,0 +1,47 @@
|
||||
import logging
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import APIRouter, Query
|
||||
|
||||
from inse.projects.bund_institutions.model import BundInstitutionSummaryPage
|
||||
from inse.tags import Tags
|
||||
from inse.projects.bund_institutions.service import autocomplete_institutions_for_selector, get_institutions_by_names
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
INSTITUTIONS_BUND_PREFIX = "/api/bund/institutions"
|
||||
|
||||
router = APIRouter(prefix=INSTITUTIONS_BUND_PREFIX, tags=[Tags.BUND_INSTITUTIONS])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/names",
|
||||
operation_id="getBundInstitutionsByName",
|
||||
summary="Returns a list of institutions based on their names.",
|
||||
)
|
||||
async def get_bund_institutions(
|
||||
institution_names: Annotated[
|
||||
list[str],
|
||||
Query(description="A list of institution names to retrieve."),
|
||||
] = [],
|
||||
) -> BundInstitutionSummaryPage:
|
||||
|
||||
return await get_institutions_by_names(institution_names=institution_names or [])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/autocomplete/selector",
|
||||
operation_id="getBundInstitutionAutocompleteForSelector",
|
||||
summary="Returns a list of institutions based on a search term for autocomplete functionality.",
|
||||
)
|
||||
async def get_bund_institution_autocomplete(
|
||||
query: Annotated[
|
||||
str,
|
||||
Query(
|
||||
description="A search term to filter institutions by (partial matches allowed)."
|
||||
),
|
||||
] = "",
|
||||
) -> BundInstitutionSummaryPage:
|
||||
|
||||
return await autocomplete_institutions_for_selector(query=query)
|
||||
@@ -0,0 +1,169 @@
|
||||
import logging
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESIndex, ESCluster
|
||||
|
||||
from inse.projects.bund_institutions.model import BundInstitutionSummary
|
||||
from inse.projects.bund_institutions.model import BundInstitutionSummaryPage
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Fields on the BUND project index that describe the institution/agency involved,
|
||||
# used consistently across all lookup functions below.
|
||||
_INSTITUTION_SOURCE_FIELDS = [
|
||||
"Ressort",
|
||||
"Ressort_fullname",
|
||||
"Ausführende Stelle",
|
||||
"Zuwendungsempfänger",
|
||||
"Stadt/Gemeinde",
|
||||
"Ort",
|
||||
"Bundesland",
|
||||
"Staat",
|
||||
]
|
||||
|
||||
|
||||
async def search_institutions(
|
||||
page: int = 0,
|
||||
size: int = 10,
|
||||
query: Optional[Dict] = None,
|
||||
source: Optional[List[str]] = None,
|
||||
sort: Optional[List[Dict]] = None,
|
||||
body: Optional[Dict] = None,
|
||||
) -> BundInstitutionSummaryPage:
|
||||
"""Searches for institutions in the BUND Projects Elasticsearch index based on the provided parameters.
|
||||
|
||||
Note: PROJECTS_BUND_V1 indexes projects, not institutions directly, so each
|
||||
matching project hit is reshaped into a BundInstitutionSummary. The same
|
||||
institution may therefore appear multiple times if it's tied to multiple projects.
|
||||
|
||||
Args:
|
||||
page (int, optional): The page number to retrieve. Defaults to 0.
|
||||
size (int, optional): The number of institutions to retrieve per page. Defaults to 10.
|
||||
query (Optional[Dict], optional): The search query to filter institutions by. Defaults to None.
|
||||
source (Optional[List[str]], optional): A list of fields to include in the response. Defaults to None.
|
||||
sort (Optional[List[Dict]], optional): A list of sorting criteria. Defaults to None.
|
||||
body (Optional[Dict], optional): The request body for the Elasticsearch search query. Defaults to None.
|
||||
|
||||
Returns:
|
||||
BundInstitutionSummaryPage: A page of institutions matching the search criteria.
|
||||
"""
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_BUND_V1,
|
||||
cluster=ESCluster.INSE,
|
||||
query=query,
|
||||
source=source or _INSTITUTION_SOURCE_FIELDS,
|
||||
size=size,
|
||||
offset=size * page,
|
||||
sort=sort,
|
||||
body=body,
|
||||
)
|
||||
|
||||
hits_block = response.get("hits", {})
|
||||
hits = hits_block.get("hits", [])
|
||||
institutions: List[BundInstitutionSummary] = [
|
||||
BundInstitutionSummary.from_source(hit.get("_source", {})) for hit in hits
|
||||
]
|
||||
|
||||
return BundInstitutionSummaryPage(
|
||||
elements=institutions,
|
||||
total=hits_block.get("total", {}).get("value", len(institutions)),
|
||||
page=page,
|
||||
size=size,
|
||||
)
|
||||
|
||||
|
||||
async def get_institutions_by_names(institution_names: List[str]) -> BundInstitutionSummaryPage:
|
||||
"""Retrieves institutions based on a list of institution (Ausführende Stelle) names.
|
||||
|
||||
Args:
|
||||
institution_names (List[str]): A list of institution names to retrieve.
|
||||
|
||||
Returns:
|
||||
BundInstitutionSummaryPage: A page of institutions matching the provided names.
|
||||
"""
|
||||
logger.debug(f"Fetching institutions for names: {institution_names}")
|
||||
if not institution_names:
|
||||
return BundInstitutionSummaryPage(elements=[], total=0, page=0, size=0)
|
||||
|
||||
return await search_institutions(
|
||||
page=0,
|
||||
size=len(institution_names),
|
||||
query={
|
||||
"terms": {
|
||||
"Ausführende Stelle.keyword": institution_names,
|
||||
}
|
||||
},
|
||||
source=_INSTITUTION_SOURCE_FIELDS,
|
||||
)
|
||||
|
||||
|
||||
async def autocomplete_institutions(
|
||||
query: str, page: int = 0, size: int = 10, source: Optional[List[str]] = None
|
||||
) -> BundInstitutionSummaryPage:
|
||||
"""Autocompletes institutions based on a search term, matching against both the
|
||||
executing agency (Ausführende Stelle) and recipient (Zuwendungsempfänger) fields.
|
||||
|
||||
Args:
|
||||
query (str): The search term to autocomplete institutions with.
|
||||
page (int, optional): The page number to retrieve. Defaults to 0.
|
||||
size (int, optional): The number of institutions to retrieve per page. Defaults to 10.
|
||||
source (Optional[List[str]], optional): A list of fields to include in the response. Defaults to None.
|
||||
|
||||
Returns:
|
||||
BundInstitutionSummaryPage: A page of institutions matching the autocomplete criteria.
|
||||
"""
|
||||
logger.debug(f"Autocomplete institutions for query: {query}")
|
||||
if not query:
|
||||
return BundInstitutionSummaryPage(elements=[], total=0, page=0, size=0)
|
||||
|
||||
return await search_institutions(
|
||||
page=page,
|
||||
size=size,
|
||||
query={
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match_phrase_prefix": {
|
||||
"Ausführende Stelle": {
|
||||
"query": query,
|
||||
"max_expansions": 50,
|
||||
"boost": 2,
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"match_phrase_prefix": {
|
||||
"Zuwendungsempfänger": {
|
||||
"query": query,
|
||||
"max_expansions": 50,
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
},
|
||||
source=source or _INSTITUTION_SOURCE_FIELDS,
|
||||
)
|
||||
|
||||
|
||||
async def autocomplete_institutions_for_selector(
|
||||
query: str, page: int = 0, size: int = 10
|
||||
) -> BundInstitutionSummaryPage:
|
||||
"""Autocompletes institutions based on a search term for use in a selector component.
|
||||
|
||||
Args:
|
||||
query (str): The search term to filter institutions by (partial matches allowed).
|
||||
page (int, optional): The page number to retrieve. Defaults to 0.
|
||||
size (int, optional): The number of institutions to retrieve per page. Defaults to 10.
|
||||
|
||||
Returns:
|
||||
BundInstitutionSummaryPage: A page of institutions matching the autocomplete criteria.
|
||||
"""
|
||||
return await autocomplete_institutions(
|
||||
query=query,
|
||||
page=page,
|
||||
size=size,
|
||||
source=_INSTITUTION_SOURCE_FIELDS,
|
||||
)
|
||||
@@ -46,7 +46,7 @@ from inse.models.projects_eu_cordis.horizon_europe.heu_web_link import HEUWebLin
|
||||
from inse.models.projects_eu_cordis.horizon_europe.heu_eurosci_voc import HEUEurosciVoc
|
||||
from inse.models.projects_eu_cordis.horizon_europe.heu_legal_basis import HEULegalBasis
|
||||
from inse.models.projects_eu_cordis.horizon_europe.heu_project_details import HEUProjectDetails
|
||||
|
||||
from inse.projects.model import EuCordisProjectType, EuCordisProjectSummary
|
||||
from inse.projects.model import (
|
||||
EuCordisProjectType,
|
||||
EuCordisProjectSearchPage,
|
||||
@@ -56,7 +56,7 @@ from inse.projects.model import (
|
||||
EuCordisEurosciVocSummary,
|
||||
)
|
||||
from inse.projects.logic import get_eu_project_ids_by_openalex_topic_ids, get_openalex_topics_for_eu_projects
|
||||
|
||||
from inse.models.openalex.topic import Topic
|
||||
|
||||
settings = get_settings()
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -96,24 +96,13 @@ _HEU_ENTITY_CONFIGS = [
|
||||
{"key": "eurosci_voc", "index_pattern": ESIndex.CORDIS_EU_HORIZON_EUROPE_EUROSCIVOC, "model_class": HEUEurosciVoc},
|
||||
{"key": "legal_basis_list", "index_pattern": ESIndex.CORDIS_EU_HORIZON_EUROPE_LEGAL_BASIS, "model_class": HEULegalBasis},
|
||||
]
|
||||
|
||||
async def get_enriched_cordis_project_by_id(
|
||||
project_id: str,
|
||||
) -> Optional[Union[Fp7ProjectDetails, H2020ProjectDetails, HEUProjectDetails]]:
|
||||
"""
|
||||
Fetches and enriches a single Cordis EU project by its ID across all programme types.
|
||||
|
||||
Args:
|
||||
project_id: The project ID to fetch.
|
||||
|
||||
Returns:
|
||||
The enriched detailed project model, or None if not found.
|
||||
"""
|
||||
if not project_id:
|
||||
return None
|
||||
|
||||
query = {"bool": {"filter": [{"term": {"id": project_id}}]}}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
query=query,
|
||||
index=ESIndex.CORDIS_EU_PROJECTS_WILDCARD,
|
||||
@@ -130,33 +119,46 @@ async def get_enriched_cordis_project_by_id(
|
||||
index = hit.get("_index", "")
|
||||
source = hit.get("_source", {})
|
||||
|
||||
program_type = _determine_program_type_from_index(index)
|
||||
project_type = EuCordisProjectType.from_index_name(index)
|
||||
|
||||
enrichers = {
|
||||
"fp7": _enrich_fp7_project,
|
||||
"h2020": _enrich_h2020_project,
|
||||
"heu": _enrich_heu_project,
|
||||
EuCordisProjectType.FP7: _enrich_fp7_project,
|
||||
EuCordisProjectType.H2020: _enrich_h2020_project,
|
||||
EuCordisProjectType.HEU: _enrich_heu_project,
|
||||
}
|
||||
|
||||
enricher = enrichers.get(program_type)
|
||||
enricher = enrichers.get(project_type)
|
||||
if enricher is None:
|
||||
logger.warning(f"Unknown programme type for index: {index}")
|
||||
return CordisEuProject.model_validate(source)
|
||||
|
||||
return await enricher(project_id, source)
|
||||
return await enricher(project_id, source, project_type)
|
||||
|
||||
# helpers
|
||||
def _determine_program_type_from_index(index: str) -> str:
|
||||
"""Determines the programme type from the Elasticsearch index name."""
|
||||
index_lower = index.lower()
|
||||
if "fp7" in index_lower:
|
||||
return "fp7"
|
||||
if "horizon_2020" in index_lower:
|
||||
return "h2020"
|
||||
if "heu" in index_lower or "horizon_europe" in index_lower:
|
||||
return "heu"
|
||||
return "unknown"
|
||||
|
||||
async def _fetch_authors_and_topics_for_project(
|
||||
project_id: str,
|
||||
project_type: EuCordisProjectType,
|
||||
) -> Tuple[Optional[AuthorPage], List[Topic]]:
|
||||
"""Fetches OpenAlex authors and mapped topics for a single project."""
|
||||
authors_lookup, topics_lookup = await asyncio.gather(
|
||||
get_openalex_authors_for_projects_ids({project_type: [project_id]}),
|
||||
get_openalex_topics_for_eu_projects({project_type: [project_id]}),
|
||||
)
|
||||
|
||||
author_page = authors_lookup.get((project_type, project_id))
|
||||
|
||||
raw_topic_matches = sorted(
|
||||
topics_lookup.get((project_type, project_id), []),
|
||||
key=lambda t: t.get("rank") if t.get("rank") is not None else float("inf"),
|
||||
)
|
||||
topics = [
|
||||
EuCordisProjectSummary.topic_from_match(match)
|
||||
for match in raw_topic_matches
|
||||
if isinstance(match, dict)
|
||||
]
|
||||
|
||||
return author_page, topics
|
||||
|
||||
async def _fetch_related_entities_parallel(
|
||||
project_id: str,
|
||||
@@ -244,10 +246,10 @@ async def _fetch_related_entities(
|
||||
|
||||
return grouped
|
||||
|
||||
|
||||
async def _enrich_fp7_project(
|
||||
project_id: str,
|
||||
project_source: Dict[str, Any],
|
||||
project_type: EuCordisProjectType,
|
||||
) -> Optional[Fp7ProjectDetails]:
|
||||
"""Enriches a single FP7 project with all related data."""
|
||||
try:
|
||||
@@ -256,41 +258,97 @@ async def _enrich_fp7_project(
|
||||
logger.error(f"Failed to validate FP7 project {project_id}: {e}")
|
||||
return None
|
||||
|
||||
related = await _fetch_related_entities_parallel(project_id, _FP7_ENTITY_CONFIGS)
|
||||
related, (authors, topics) = await asyncio.gather(
|
||||
_fetch_related_entities_parallel(project_id, _FP7_ENTITY_CONFIGS),
|
||||
_fetch_authors_and_topics_for_project(project_id, project_type),
|
||||
)
|
||||
|
||||
return Fp7ProjectDetails.from_project_with_relations(project=project, **related)
|
||||
return Fp7ProjectDetails.from_project_with_relations(
|
||||
project=project, oa_authors=authors, oa_topics=topics, **related
|
||||
)
|
||||
|
||||
|
||||
async def _enrich_h2020_project(
|
||||
project_id: str,
|
||||
project_source: Dict[str, Any],
|
||||
project_type: EuCordisProjectType,
|
||||
) -> Optional[H2020ProjectDetails]:
|
||||
"""Enriches a single H2020 project with all related data."""
|
||||
try:
|
||||
project = H2020Project.model_validate(project_source)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to validate H2020 project {project_id}: {e}")
|
||||
return None
|
||||
|
||||
related = await _fetch_related_entities_parallel(project_id, _H2020_ENTITY_CONFIGS)
|
||||
related, (authors, topics) = await asyncio.gather(
|
||||
_fetch_related_entities_parallel(project_id, _H2020_ENTITY_CONFIGS),
|
||||
_fetch_authors_and_topics_for_project(project_id, project_type),
|
||||
)
|
||||
|
||||
return H2020ProjectDetails.from_project_with_relations(project=project, **related)
|
||||
return H2020ProjectDetails.from_project_with_relations(
|
||||
project=project, oa_authors=authors, oa_topics=topics, **related
|
||||
)
|
||||
|
||||
|
||||
async def _enrich_heu_project(
|
||||
project_id: str,
|
||||
project_source: Dict[str, Any],
|
||||
project_type: EuCordisProjectType,
|
||||
) -> Optional[HEUProjectDetails]:
|
||||
"""Enriches a single Horizon Europe project with all related data."""
|
||||
try:
|
||||
project = HEUProject.model_validate(project_source)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to validate Horizon Europe project {project_id}: {e}")
|
||||
return None
|
||||
|
||||
related = await _fetch_related_entities_parallel(project_id, _HEU_ENTITY_CONFIGS)
|
||||
related, (authors, topics) = await asyncio.gather(
|
||||
_fetch_related_entities_parallel(project_id, _HEU_ENTITY_CONFIGS),
|
||||
_fetch_authors_and_topics_for_project(project_id, project_type),
|
||||
)
|
||||
|
||||
return HEUProjectDetails.from_project_with_relations(project=project, **related)
|
||||
return HEUProjectDetails.from_project_with_relations(
|
||||
project=project, oa_authors=authors, oa_topics=topics, **related
|
||||
)
|
||||
|
||||
async def _enrich_h2020_project(
|
||||
project_id: str,
|
||||
project_source: Dict[str, Any],
|
||||
project_type: EuCordisProjectType,
|
||||
) -> Optional[H2020ProjectDetails]:
|
||||
try:
|
||||
project = H2020Project.model_validate(project_source)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to validate H2020 project {project_id}: {e}")
|
||||
return None
|
||||
|
||||
related, (authors, topics) = await asyncio.gather(
|
||||
_fetch_related_entities_parallel(project_id, _H2020_ENTITY_CONFIGS),
|
||||
_fetch_authors_and_topics_for_project(project_id, project_type),
|
||||
)
|
||||
|
||||
return H2020ProjectDetails.from_project_with_relations(
|
||||
project=project, oa_authors=authors, oa_topics=topics, **related
|
||||
)
|
||||
|
||||
|
||||
async def _enrich_heu_project(
|
||||
project_id: str,
|
||||
project_source: Dict[str, Any],
|
||||
project_type: EuCordisProjectType,
|
||||
) -> Optional[HEUProjectDetails]:
|
||||
try:
|
||||
project = HEUProject.model_validate(project_source)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to validate Horizon Europe project {project_id}: {e}")
|
||||
return None
|
||||
|
||||
related, (authors, topics) = await asyncio.gather(
|
||||
_fetch_related_entities_parallel(project_id, _HEU_ENTITY_CONFIGS),
|
||||
_fetch_authors_and_topics_for_project(project_id, project_type),
|
||||
)
|
||||
|
||||
return HEUProjectDetails.from_project_with_relations(
|
||||
project=project, oa_authors=authors, oa_topics=topics, **related
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -74,6 +74,73 @@ async def get_person_ids_by_institution_ids(
|
||||
if hit.get("_source", {}).get("person_id") is not None
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
async def get_bund_project_ids_by_topic_ids(topic_ids: List[str]) -> List[str]:
|
||||
"""
|
||||
Query the `projects_bund_openalex_topics` index to find BUND project IDs
|
||||
that match any of the given OpenAlex topic IDs.
|
||||
"""
|
||||
if not topic_ids:
|
||||
return []
|
||||
|
||||
required_topics = set(topic_ids)
|
||||
|
||||
project_topics: dict[str, Set[str]] = defaultdict(set)
|
||||
|
||||
page_size = 1000
|
||||
from_ = 0
|
||||
|
||||
while True:
|
||||
body = {
|
||||
"size": page_size,
|
||||
"from": from_,
|
||||
"_source": ["project_id", "topic_matches"],
|
||||
"query": {
|
||||
"terms": {
|
||||
"topic_matches.topic_id.keyword": topic_ids
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_BUND_TOPICS,
|
||||
cluster=ESCluster.INSE,
|
||||
body=body,
|
||||
)
|
||||
print(f"Response from Elasticsearch: {json.dumps(response, indent=2)}") # Debugging line
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
if not hits:
|
||||
break
|
||||
|
||||
for hit in hits:
|
||||
source = hit["_source"]
|
||||
|
||||
project_id = source.get("project_id")
|
||||
if not project_id:
|
||||
continue
|
||||
|
||||
topic_matches = source.get("topic_matches") or []
|
||||
|
||||
if isinstance(topic_matches, dict):
|
||||
topic_matches = [topic_matches]
|
||||
|
||||
for match in topic_matches:
|
||||
topic_id = match.get("topic_id")
|
||||
if topic_id in required_topics:
|
||||
project_topics[project_id].add(topic_id)
|
||||
|
||||
if len(hits) < page_size:
|
||||
break
|
||||
|
||||
from_ += page_size
|
||||
|
||||
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]:
|
||||
"""Fetches project IDs whose topic_matches contain EVERY given topic ID,
|
||||
even if the topics are distributed across multiple documents for the same project.
|
||||
@@ -137,63 +204,73 @@ async def get_dfg_project_ids_by_topic_ids(topic_ids: List[str]) -> List[str]:
|
||||
for project_id, found_topics in project_topics.items()
|
||||
if required_topics.issubset(found_topics)
|
||||
]
|
||||
async def get_openalex_topics_for_dfg_projects(
|
||||
project_ids: List[str],
|
||||
) -> Dict[int, List[Dict[str, Any]]]:
|
||||
"""Fetches OpenAlex topic matches for the given DFG project IDs.
|
||||
|
||||
|
||||
Args:
|
||||
project_ids (List[str]): The DFG project IDs to fetch topics for.
|
||||
|
||||
Returns:
|
||||
Dict[int, List[Dict[str, Any]]]: Mapping of project_id -> list of topic match dicts,
|
||||
each containing topic_id, topic_display_name, domain, field, subfield, rank.
|
||||
async def get_openalex_topics_for_bund_projects(project_ids: List[str]) -> Dict[str, List[Dict]]:
|
||||
"""
|
||||
Retrieve OpenAlex topic details for a list of BUND project IDs.
|
||||
Returns a dict mapping `project_id` -> list of topic_match objects.
|
||||
"""
|
||||
if not project_ids:
|
||||
return {}
|
||||
|
||||
topic_lookup: Dict[int, List[Dict[str, Any]]] = {}
|
||||
body: Dict[str, Any] = {
|
||||
"size": 10000,
|
||||
"query": {
|
||||
"terms": {
|
||||
"project_id.keyword": project_ids
|
||||
}
|
||||
},
|
||||
"_source": ["project_id", "topic_matches"]
|
||||
}
|
||||
|
||||
page_size = 1000
|
||||
from_ = 0
|
||||
# print(f"Fetching topics for {len(project_ids)} DFG projects in batches of {page_size}...{project_ids}")
|
||||
while True:
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_DFG_TOPICS,
|
||||
cluster=ESCluster.INSE,
|
||||
body={
|
||||
"size": page_size,
|
||||
"from": from_,
|
||||
"query": {
|
||||
"terms": {
|
||||
"project_id.keyword": project_ids
|
||||
}
|
||||
},
|
||||
},
|
||||
)
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_BUND_TOPICS,
|
||||
body=body,
|
||||
cluster=ESCluster.INSE
|
||||
)
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
if not hits:
|
||||
break
|
||||
lookup: Dict[str, List[Dict]] = {}
|
||||
for hit in response.get("hits", {}).get("hits", []):
|
||||
src = hit["_source"]
|
||||
pid = src.get("project_id")
|
||||
if pid:
|
||||
lookup[pid] = src.get("topic_matches", [])
|
||||
return lookup
|
||||
async def get_openalex_topics_for_dfg_projects(
|
||||
project_ids: List[str],
|
||||
) -> Dict[str, List[Dict]]:
|
||||
"""
|
||||
Retrieve OpenAlex topic details for a list of DFG project IDs.
|
||||
Returns a dict mapping `project_id` -> list of topic_match objects.
|
||||
"""
|
||||
if not project_ids:
|
||||
return {}
|
||||
|
||||
for hit in hits:
|
||||
source = hit["_source"]
|
||||
project_id = int(source.get("project_id"))
|
||||
if project_id is None:
|
||||
continue
|
||||
body: Dict[str, Any] = {
|
||||
"size": 10000,
|
||||
"query": {
|
||||
"terms": {
|
||||
"project_id.keyword": project_ids
|
||||
}
|
||||
},
|
||||
"_source": ["project_id", "topic_matches"]
|
||||
}
|
||||
|
||||
topic_matches = source.get("topic_matches") or []
|
||||
if isinstance(topic_matches, dict):
|
||||
topic_matches = [topic_matches]
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_DFG_TOPICS,
|
||||
body=body,
|
||||
cluster=ESCluster.INSE
|
||||
)
|
||||
|
||||
topic_lookup.setdefault(project_id, []).extend(topic_matches)
|
||||
lookup: Dict[str, List[Dict]] = {}
|
||||
for hit in response.get("hits", {}).get("hits", []):
|
||||
src = hit["_source"]
|
||||
pid = src.get("project_id")
|
||||
if pid:
|
||||
lookup[str(pid)] = src.get("topic_matches", [])
|
||||
|
||||
if len(hits) < page_size:
|
||||
break
|
||||
|
||||
from_ += page_size
|
||||
#logger.info(f"Fetched topics for {len(topic_lookup)} DFG projects.")
|
||||
return topic_lookup
|
||||
return lookup
|
||||
|
||||
async def get_person_institutes(
|
||||
person_ids: list[int],
|
||||
|
||||
@@ -14,6 +14,7 @@ from inse.models.projects_eu_cordis.fp7.fp7_project_details import Fp7ProjectDet
|
||||
from inse.models.projects_dfg_v2.project.dfg_project_fachgebiete_inner import DFGProjectFachgebieteInner
|
||||
from inse.models.openalex.topic import Topic, TopicDomain, TopicField, TopicSubfield
|
||||
from inse.authors.v2.model import AuthorPage
|
||||
from inse.projects.bund_institutions.model import BundInstitutionSummary
|
||||
from typing import Union
|
||||
|
||||
class ProjectType(StrEnum):
|
||||
@@ -75,6 +76,11 @@ class BundProjectSummary(BundProject):
|
||||
description="The OpenAlex topics of the project",
|
||||
examples=[["Artificial Intelligence", "Machine Learning"]],
|
||||
)
|
||||
institution: Optional[BundInstitutionSummary] = Field(
|
||||
default=None,
|
||||
description="The executing agency / recipient institution for this project, "
|
||||
"derived from the project's own agency fields.",
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def from_hit(cls, hit: dict) -> "BundProjectSummary":
|
||||
@@ -91,7 +97,6 @@ class BundProjectSummary(BundProject):
|
||||
key=lambda t: t.get("rank") if t.get("rank") is not None else float("inf"),
|
||||
)
|
||||
oa_topics = [cls._topic_from_match(t) for t in sorted_topics_raw]
|
||||
print(f"oa_topics: {oa_topics}")
|
||||
return cls(
|
||||
funding_code=source.get("Förderkennzeichen"),
|
||||
department=source.get("Ressort"),
|
||||
@@ -110,8 +115,8 @@ class BundProjectSummary(BundProject):
|
||||
topic=source.get("Thema"),
|
||||
performance_plan_system=source.get("Leistungsplansystematik"),
|
||||
performance_plan_system_text=source.get("Klartext Leistungsplansystematik"),
|
||||
funding_start=source.get("Förderbeginn"),
|
||||
funding_end=source.get("Förderende"),
|
||||
funding_start=source.get("funding_start"),
|
||||
funding_end=source.get("funding_end"),
|
||||
grant_amount=source.get("Fördersumme"),
|
||||
funding_profile=source.get("Förderprofil"),
|
||||
joint_project=source.get("Verbundprojekt"),
|
||||
@@ -122,6 +127,7 @@ class BundProjectSummary(BundProject):
|
||||
new=source.get("neu"),
|
||||
duration=source.get("Laufzeit"),
|
||||
oa_topics=oa_topics,
|
||||
institution=BundInstitutionSummary.from_source(source),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -21,7 +21,7 @@ from inse.models.dfg_project_details import DfgProjectDetails
|
||||
from inse.models.bund_project_details import BundProjectDetails
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESCluster, ESIndex
|
||||
from inse.projects.logic import get_person_ids_by_institution_ids, get_dfg_project_ids_by_topic_ids, get_openalex_topics_for_dfg_projects, get_person_institutes
|
||||
from inse.projects.logic import get_person_ids_by_institution_ids, get_dfg_project_ids_by_topic_ids,get_bund_project_ids_by_topic_ids, get_openalex_topics_for_dfg_projects, get_person_institutes, get_openalex_topics_for_bund_projects
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
@@ -29,66 +29,6 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
logger.setLevel(settings.logging_level)
|
||||
|
||||
DFG_PERSON_FIELDS: List[str] = [
|
||||
"Antragsteller",
|
||||
"Antragstellerin",
|
||||
"Antragstellerinnen",
|
||||
"Antragstellerinnen / Antragsteller",
|
||||
"Beteiligte Person",
|
||||
"Beteiligte Personen",
|
||||
"Co-Sprecher",
|
||||
"Co-Sprecherinnen / Co-Sprecher",
|
||||
"Ehemalige Antragsteller",
|
||||
"Ehemalige Antragstellerin",
|
||||
"Ehemalige Antragstellerinnen",
|
||||
"Ehemalige Antragstellerinnen / Ehemalige Antragsteller",
|
||||
"Ehemaliger Antragsteller",
|
||||
"Gastgeber",
|
||||
"Gastgeberin",
|
||||
"Gastgeberinnen",
|
||||
"Gastgeberinnen / Gastgeber",
|
||||
"Kooperationspartner",
|
||||
"Kooperationspartnerin",
|
||||
"Kooperationspartnerinnen",
|
||||
"Kooperationspartnerinnen / Kooperationspartner",
|
||||
"Leiter",
|
||||
"Leiterin",
|
||||
"Leiterinnen",
|
||||
"Leiterinnen / Leiter",
|
||||
"Mitantragsteller",
|
||||
"Mitantragstellerin",
|
||||
"Mitantragstellerinnen",
|
||||
"Mitantragstellerinnen / Mitantragsteller",
|
||||
"Mitverantwortlich",
|
||||
"Mitverantwortlich(e)",
|
||||
"Mitverantwortliche",
|
||||
"Sprecher",
|
||||
"Sprecher (IGK-Partner)",
|
||||
"Sprecherin",
|
||||
"Sprecherin (IGK-Partner)",
|
||||
"Sprecherinnen",
|
||||
"Sprecherinnen (IGK-Partner) / Sprecher (IGK-Partner)",
|
||||
"Sprecherinnen / Sprecher",
|
||||
"Teilprojektleiter",
|
||||
"Teilprojektleiterin",
|
||||
"Teilprojektleiterinnen",
|
||||
"Teilprojektleiterinnen / Teilprojektleiter",
|
||||
"ausländ. Mitantragstellerin",
|
||||
"ausländ. Mitantragstellerinnen",
|
||||
"ausländ. Mitantragstellerinnen / ausländische Mitantragsteller",
|
||||
"ausländische Mitantragsteller",
|
||||
"ausländischer Mitantragsteller",
|
||||
"beteiligte Wissenschaftler",
|
||||
"beteiligte Wissenschaftlerin",
|
||||
"beteiligte Wissenschaftlerinnen",
|
||||
"beteiligte Wissenschaftlerinnen / beteiligte Wissenschaftler",
|
||||
"beteiligter Wissenschaftler",
|
||||
"person_creater_name",
|
||||
"stellvertr. Sprecher",
|
||||
"stellvertr. Sprecherin",
|
||||
"stellvertr. Sprecherinnen / stellvertr. Sprecher",
|
||||
]
|
||||
|
||||
# BUND
|
||||
|
||||
|
||||
@@ -204,10 +144,13 @@ async def get_bund_project_by_id(project_id: str) -> Optional[BundProjectDetails
|
||||
query=query,
|
||||
size=1,
|
||||
)
|
||||
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
if hits:
|
||||
hit = hits[0]
|
||||
elastic_id = hit["_id"]
|
||||
topic_lookup = await get_openalex_topics_for_bund_projects(project_ids=[elastic_id])
|
||||
hit["_source"]["oa_topics"] = topic_lookup.get(elastic_id, [])
|
||||
details = BundProjectDetails.from_elastic_hit(hit=hit)
|
||||
return details
|
||||
return None
|
||||
@@ -679,6 +622,7 @@ async def get_dfg_project_by_id(project_id: str) -> Optional[DfgProjectDetails]:
|
||||
Returns:
|
||||
Optional[DfgProjectDetails]: The project details or None if not found.
|
||||
"""
|
||||
topic_lookup = await get_openalex_topics_for_dfg_projects(project_ids=[project_id])
|
||||
query = {"ids": {"values": [project_id]}}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
@@ -690,79 +634,42 @@ async def get_dfg_project_by_id(project_id: str) -> Optional[DfgProjectDetails]:
|
||||
|
||||
if hits:
|
||||
hit = hits[0]
|
||||
hit["_source"]["topics"] = topic_lookup.get(project_id, [])
|
||||
details = DfgProjectDetails.from_elastic_hit(hit=hit)
|
||||
return details
|
||||
return None
|
||||
|
||||
#BUND
|
||||
|
||||
async def get_bund_project_ids_by_topic_ids(topic_ids: List[str]) -> List[str]:
|
||||
"""
|
||||
Query the `projects_bund_openalex_topics` index to find BUND project IDs
|
||||
that match any of the given OpenAlex topic IDs.
|
||||
"""
|
||||
body: Dict[str, Any] = {
|
||||
"size": 0,
|
||||
"query": {
|
||||
"terms": {
|
||||
"topic_matches.topic_id": topic_ids
|
||||
}
|
||||
},
|
||||
"aggs": {
|
||||
"project_ids": {
|
||||
"terms": {
|
||||
"field": "project_id.keyword",
|
||||
"size": 10000
|
||||
def _bund_year_filters(field: str, years: List[str]) -> Dict[str, Any]:
|
||||
should = []
|
||||
|
||||
for year in years:
|
||||
year = str(year).strip()
|
||||
if not year:
|
||||
continue
|
||||
|
||||
should.append(
|
||||
{
|
||||
"range": {
|
||||
field: {
|
||||
"gte": f"01.01.{year}",
|
||||
"lte": f"31.12.{year}",
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
"bool": {
|
||||
"should": should,
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_BUND_TOPICS,
|
||||
body=body,
|
||||
cluster=ESCluster.INSE
|
||||
)
|
||||
print(f"Received response for topic_ids {topic_ids}: {json.dumps(response, indent=2)}")
|
||||
buckets = response.get("aggregations", {}).get("project_ids", {}).get("buckets", [])
|
||||
return [bucket["key"] for bucket in buckets]
|
||||
|
||||
|
||||
async def get_openalex_topics_for_bund_projects(project_ids: List[str]) -> Dict[str, List[Dict]]:
|
||||
"""
|
||||
Retrieve OpenAlex topic details for a list of BUND project IDs.
|
||||
Returns a dict mapping `project_id` -> list of topic_match objects.
|
||||
"""
|
||||
if not project_ids:
|
||||
return {}
|
||||
|
||||
body: Dict[str, Any] = {
|
||||
"size": 10000,
|
||||
"query": {
|
||||
"terms": {
|
||||
"project_id.keyword": project_ids
|
||||
}
|
||||
},
|
||||
"_source": ["project_id", "topic_matches"]
|
||||
}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_BUND_TOPICS,
|
||||
body=body,
|
||||
cluster=ESCluster.INSE
|
||||
)
|
||||
|
||||
lookup: Dict[str, List[Dict]] = {}
|
||||
for hit in response.get("hits", {}).get("hits", []):
|
||||
src = hit["_source"]
|
||||
pid = src.get("project_id")
|
||||
if pid:
|
||||
lookup[pid] = src.get("topic_matches", [])
|
||||
return lookup
|
||||
|
||||
|
||||
async def search_bund_projects_with_filters(
|
||||
executing_agency: Optional[List[str]] = None,
|
||||
institution_ids: Optional[List[int]] = None,
|
||||
institution_ids: Optional[List[str]] = None,
|
||||
funding_arts: Optional[List[str]] = None, # actually EuCordisProjectType, but treated as strings
|
||||
title: Optional[str] = None,
|
||||
keywords: Optional[List[str]] = None,
|
||||
@@ -781,7 +688,7 @@ async def search_bund_projects_with_filters(
|
||||
Main search function for BUND projects, analogous to the DFG search.
|
||||
"""
|
||||
from_ = page * size
|
||||
|
||||
#institution_ids = ["I62318514"]
|
||||
# Fields we need to build BundProject objects (validation aliases match these exact names)
|
||||
source_fields = [
|
||||
"Förderkennzeichen",
|
||||
@@ -812,7 +719,6 @@ async def search_bund_projects_with_filters(
|
||||
"datum",
|
||||
"neu",
|
||||
"Laufzeit",
|
||||
# Also include funding_start/end for sorting and filtering (they may also be needed)
|
||||
"funding_start",
|
||||
"funding_end",
|
||||
]
|
||||
@@ -825,13 +731,12 @@ async def search_bund_projects_with_filters(
|
||||
}
|
||||
|
||||
must_clauses: List[Dict[str, Any]] = []
|
||||
|
||||
# === Primary search clause: fuzzy(topic_ids) vs keyword phrase search ===
|
||||
if fuzzy and topic_ids:
|
||||
matching_project_ids = await get_bund_project_ids_by_topic_ids(topic_ids=topic_ids)
|
||||
if not matching_project_ids:
|
||||
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
||||
must_clauses.append({"terms": {"Förderkennzeichen.keyword": matching_project_ids}})
|
||||
must_clauses.append({"terms": {"_id": matching_project_ids}})
|
||||
|
||||
elif keywords:
|
||||
keyword_clauses = []
|
||||
@@ -841,7 +746,7 @@ async def search_bund_projects_with_filters(
|
||||
keyword_clauses.append({
|
||||
"multi_match": {
|
||||
"query": kw,
|
||||
"fields": ["Verbundprojekt"], # searching title/acronym field
|
||||
"fields": ["Verbundprojekt","Thema"], # searching title/acronym field
|
||||
"type": "phrase_prefix",
|
||||
"max_expansions": 100,
|
||||
}
|
||||
@@ -854,21 +759,38 @@ async def search_bund_projects_with_filters(
|
||||
matching_filter_ids = await get_bund_project_ids_by_topic_ids(topic_ids=filter_topic_ids)
|
||||
if not matching_filter_ids:
|
||||
return BundProjectPage(elements=[], total=0, page=page, size=size)
|
||||
must_clauses.append({"terms": {"Förderkennzeichen.keyword": matching_filter_ids}})
|
||||
must_clauses.append({"terms": {"_id": matching_filter_ids}})
|
||||
|
||||
if title:
|
||||
must_clauses.append({
|
||||
"multi_match": {
|
||||
"query": title,
|
||||
"fields": ["Verbundprojekt"],
|
||||
"fields": ["Verbundprojekt","Thema"], # searching title field
|
||||
"type": "phrase_prefix",
|
||||
"max_expansions": 100,
|
||||
}
|
||||
})
|
||||
|
||||
# print(f"Executing BUND project search with institution_ids: {institution_ids}, executing_agency: {executing_agency}, funding_arts: {funding_arts}, countries: {countries}, funding_start_years: {funding_start_years}, funding_end_years: {funding_end_years}")
|
||||
if executing_agency:
|
||||
must_clauses.append({"terms": {"Ausführende Stelle.keyword": executing_agency}})
|
||||
|
||||
# institution_names = await institutions_search_client.get_institution_aliases_by_oa_institution_id(executing_agency[0].split("/")[-1])
|
||||
# institution_page = await institutions_search_client.get_institutions_by_alias(alias=institution_names[0])
|
||||
# print(f"Retrieved institution names for IDs {executing_agency}: {institution_names}")
|
||||
# print(f"Retrieved institution page for names {institution_names}: {institution_page}")
|
||||
# if not institution_names:
|
||||
# return BundProjectPage(elements=[], total=0, page=page, size=size)
|
||||
must_clauses.append({
|
||||
"bool": {
|
||||
"should": [
|
||||
clause
|
||||
for name in executing_agency
|
||||
for clause in (
|
||||
{"match": {"Zuwendungsempfänger": {"query": name, "operator": "and"}}},
|
||||
{"match": {"Ausführende Stelle": {"query": name, "operator": "and"}}},
|
||||
)
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
})
|
||||
if funding_arts:
|
||||
must_clauses.append({"terms": {"Förderart.keyword": funding_arts}})
|
||||
|
||||
@@ -876,10 +798,10 @@ async def search_bund_projects_with_filters(
|
||||
must_clauses.append({"terms": {"Staat.keyword": countries}})
|
||||
|
||||
if funding_start_years:
|
||||
must_clauses.append({"terms": {"funding_start": funding_start_years}})
|
||||
must_clauses.append(_bund_year_filters("funding_start", funding_start_years))
|
||||
|
||||
if funding_end_years:
|
||||
must_clauses.append({"terms": {"funding_end": funding_end_years}})
|
||||
must_clauses.append(_bund_year_filters("funding_end", funding_end_years))
|
||||
|
||||
body["query"] = {"bool": {"must": must_clauses}} if must_clauses else {"match_all": {}}
|
||||
|
||||
@@ -914,7 +836,6 @@ async def search_bund_projects_with_filters(
|
||||
# Enrich with OpenAlex topics
|
||||
project_ids = [hit["_id"] for hit in hits]
|
||||
topic_lookup = await get_openalex_topics_for_bund_projects(project_ids=project_ids)
|
||||
print(f"Enriched BUND projects with topics: {json.dumps(topic_lookup, indent=2)}")
|
||||
for hit in hits:
|
||||
hit["_source"]["oa_topics"] = topic_lookup.get(hit["_id"], [])
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ async def test_search_dfg_projects():
|
||||
res = await projects_search_client.search_dfg_projects(
|
||||
page=0,
|
||||
size=5,
|
||||
names=["Wolfgang Ahrens"],
|
||||
names=["Bovensiepen"],
|
||||
)
|
||||
assert res is not None
|
||||
assert res.total > 0
|
||||
@@ -15,23 +15,19 @@ async def test_search_dfg_projects():
|
||||
for element in res.elements:
|
||||
assert element.id is not None
|
||||
assert any(
|
||||
all(part.lower() in name.lower() for part in "Wolfgang Ahrens".split())
|
||||
all(part.lower() in name.lower() for part in "Bovensiepen".split())
|
||||
for name in element.names
|
||||
)
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_dfg_project_by_id():
|
||||
# Get by ID of the project we found or a known one
|
||||
known_id = "164008977"
|
||||
known_id = 164008977
|
||||
project = await projects_search_client.get_dfg_project_by_id(known_id)
|
||||
assert project is not None
|
||||
assert project.id == known_id
|
||||
assert project.title is not None
|
||||
assert project.title_de is not None
|
||||
assert any(
|
||||
all(part.lower() in person.lower() for part in "Wolfgang Ahrens".split())
|
||||
for person in project.associated_persons
|
||||
)
|
||||
assert any(
|
||||
"Leibniz" in inst
|
||||
for inst in project.institutions
|
||||
all(part.lower() in person.full_name.lower() for part in "Wolfgang Ahrens".split())
|
||||
for person in project.persons
|
||||
)
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
from decimal import Decimal, ROUND_HALF_UP
|
||||
from typing import Any
|
||||
|
||||
from inse.authors.v2.service import authors_currently_belong_to_institution
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESIndex
|
||||
from inse.works.v2.model import WorkPrimaryCategory
|
||||
|
||||
from .model import PublicationType, Timespan
|
||||
from .orientation_profile_model import (
|
||||
AuthorOrientationProfile,
|
||||
AuthorOrientationProfileStatus,
|
||||
)
|
||||
|
||||
|
||||
_SCORE_FIELD = "classification.applied_orientation_score"
|
||||
_PRIMARY_CATEGORY_VALUES = {
|
||||
category.value for category in WorkPrimaryCategory
|
||||
}
|
||||
|
||||
|
||||
def _author_filter(author_ids: list[str]) -> dict[str, Any]:
|
||||
return {
|
||||
"nested": {
|
||||
"path": "authors",
|
||||
"query": {"terms": {"authors.id": author_ids}},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def _orientation_profile_query(
|
||||
author_ids: list[str],
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
) -> dict[str, Any]:
|
||||
filters: list[dict[str, Any]] = [_author_filter(author_ids)]
|
||||
|
||||
if publication_types:
|
||||
filters.append(
|
||||
{
|
||||
"terms": {
|
||||
"publication_type": [
|
||||
publication_type.value
|
||||
for publication_type in publication_types
|
||||
]
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
if timespan:
|
||||
filters.append(
|
||||
{
|
||||
"range": {
|
||||
"publication_year": {
|
||||
"gte": timespan.from_year,
|
||||
"lte": timespan.to_year,
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
"size": 0,
|
||||
"query": {"bool": {"filter": filters}},
|
||||
"aggs": {
|
||||
"authors": {
|
||||
"nested": {"path": "authors"},
|
||||
"aggs": {
|
||||
"selected": {
|
||||
"filter": {"terms": {"authors.id": author_ids}},
|
||||
"aggs": {
|
||||
"by_author": {
|
||||
"terms": {
|
||||
"field": "authors.id",
|
||||
"size": len(author_ids),
|
||||
"execution_hint": "map",
|
||||
},
|
||||
"aggs": {
|
||||
"works": {
|
||||
"reverse_nested": {},
|
||||
"aggs": {
|
||||
"classified": {
|
||||
"filter": {
|
||||
"exists": {
|
||||
"field": (
|
||||
"classification."
|
||||
"primary_category"
|
||||
)
|
||||
}
|
||||
},
|
||||
"aggs": {
|
||||
"by_primary_category": {
|
||||
"terms": {
|
||||
"field": (
|
||||
"classification."
|
||||
"primary_category"
|
||||
),
|
||||
"size": len(
|
||||
WorkPrimaryCategory
|
||||
),
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
"scored": {
|
||||
"filter": {
|
||||
"exists": {
|
||||
"field": _SCORE_FIELD
|
||||
}
|
||||
},
|
||||
"aggs": {
|
||||
"average_score": {
|
||||
"avg": {
|
||||
"field": _SCORE_FIELD
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _rounded_score(value: float) -> int:
|
||||
return int(Decimal(str(value)).quantize(Decimal("1"), rounding=ROUND_HALF_UP))
|
||||
|
||||
|
||||
def _profile_from_bucket(
|
||||
author_id: str,
|
||||
bucket: dict[str, Any] | None,
|
||||
) -> AuthorOrientationProfile:
|
||||
works = (bucket or {}).get("works", {})
|
||||
classified_count = works.get("classified", {}).get("doc_count", 0)
|
||||
category_buckets = (
|
||||
works.get("classified", {})
|
||||
.get("by_primary_category", {})
|
||||
.get("buckets", [])
|
||||
)
|
||||
category_counts = {
|
||||
WorkPrimaryCategory(category_bucket["key"]): category_bucket["doc_count"]
|
||||
for category_bucket in category_buckets
|
||||
if category_bucket.get("key") in _PRIMARY_CATEGORY_VALUES
|
||||
}
|
||||
scored = works.get("scored", {})
|
||||
scored_count = scored.get("doc_count", 0)
|
||||
average_score = scored.get("average_score", {}).get("value")
|
||||
|
||||
if classified_count == 0:
|
||||
status = AuthorOrientationProfileStatus.NO_CLASSIFIED_PUBLICATIONS
|
||||
elif scored_count == 0 or average_score is None:
|
||||
status = AuthorOrientationProfileStatus.NO_ORIENTATION_SCORE
|
||||
else:
|
||||
score = _rounded_score(average_score)
|
||||
return AuthorOrientationProfile(
|
||||
author_id=author_id,
|
||||
status=AuthorOrientationProfileStatus.AVAILABLE,
|
||||
orientation_score=score,
|
||||
primary_category_counts=category_counts,
|
||||
classified_work_count=classified_count,
|
||||
scored_work_count=scored_count,
|
||||
)
|
||||
|
||||
return AuthorOrientationProfile(
|
||||
author_id=author_id,
|
||||
status=status,
|
||||
primary_category_counts=category_counts,
|
||||
classified_work_count=classified_count,
|
||||
scored_work_count=scored_count,
|
||||
)
|
||||
|
||||
|
||||
async def orientation_profiles_for_authors(
|
||||
author_ids: list[str],
|
||||
institution_id: str | None,
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
) -> list[AuthorOrientationProfile]:
|
||||
"""Return protected orientation profiles in the requested author order.
|
||||
|
||||
Institution membership is checked for all authors in one query. Only
|
||||
matching active members are included in the work-classification
|
||||
aggregation, so restricted classification data is never retrieved.
|
||||
"""
|
||||
|
||||
if not institution_id:
|
||||
allowed_author_ids: set[str] = set()
|
||||
else:
|
||||
allowed_author_ids = await authors_currently_belong_to_institution(
|
||||
author_ids,
|
||||
institution_id,
|
||||
)
|
||||
|
||||
restricted_profiles = {
|
||||
author_id: AuthorOrientationProfile(
|
||||
author_id=author_id,
|
||||
status=AuthorOrientationProfileStatus.RESTRICTED,
|
||||
)
|
||||
for author_id in author_ids
|
||||
if author_id not in allowed_author_ids
|
||||
}
|
||||
|
||||
allowed_in_request_order = [
|
||||
author_id for author_id in author_ids if author_id in allowed_author_ids
|
||||
]
|
||||
profiles_by_id: dict[str, AuthorOrientationProfile] = restricted_profiles
|
||||
|
||||
if allowed_in_request_order:
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.WORK_CLASSIFICATIONS,
|
||||
body=_orientation_profile_query(
|
||||
allowed_in_request_order,
|
||||
publication_types,
|
||||
timespan,
|
||||
),
|
||||
)
|
||||
buckets = (
|
||||
response.get("aggregations", {})
|
||||
.get("authors", {})
|
||||
.get("selected", {})
|
||||
.get("by_author", {})
|
||||
.get("buckets", [])
|
||||
)
|
||||
buckets_by_author = {
|
||||
bucket.get("key"): bucket
|
||||
for bucket in buckets
|
||||
if isinstance(bucket.get("key"), str)
|
||||
}
|
||||
for author_id in allowed_in_request_order:
|
||||
profiles_by_id[author_id] = _profile_from_bucket(
|
||||
author_id,
|
||||
buckets_by_author.get(author_id),
|
||||
)
|
||||
|
||||
return [profiles_by_id[author_id] for author_id in author_ids]
|
||||
@@ -0,0 +1,78 @@
|
||||
from enum import StrEnum
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
|
||||
from inse.works.v2.model import WorkPrimaryCategory
|
||||
|
||||
from .model import PublicationType, Timespan
|
||||
|
||||
|
||||
class AuthorOrientationProfileStatus(StrEnum):
|
||||
AVAILABLE = "available"
|
||||
INSUFFICIENT_SCORED_PUBLICATIONS = "insufficient_scored_publications"
|
||||
NO_CLASSIFIED_PUBLICATIONS = "no_classified_publications"
|
||||
NO_ORIENTATION_SCORE = "no_orientation_score"
|
||||
RESTRICTED = "restricted"
|
||||
|
||||
|
||||
class AuthorOrientationProfilesRequest(BaseModel):
|
||||
"""Filters used to compare the research orientation of selected authors."""
|
||||
|
||||
author_ids: list[str] = Field(
|
||||
min_length=1,
|
||||
max_length=4,
|
||||
description="One to four unique OpenAlex author IDs.",
|
||||
)
|
||||
publication_types: list[PublicationType] = Field(
|
||||
default_factory=list,
|
||||
description="Optional publication-type filter. Empty means all types.",
|
||||
)
|
||||
timespan: Timespan | None = Field(
|
||||
default=None,
|
||||
description="Optional inclusive publication-year filter.",
|
||||
)
|
||||
|
||||
@field_validator("author_ids")
|
||||
@classmethod
|
||||
def normalize_author_ids(cls, values: list[str]) -> list[str]:
|
||||
normalized: list[str] = []
|
||||
for value in values:
|
||||
author_id = value.strip()
|
||||
if not author_id:
|
||||
raise ValueError("author IDs must not be empty")
|
||||
if not author_id.startswith("https://openalex.org/"):
|
||||
author_id = f"https://openalex.org/{author_id}"
|
||||
if author_id in normalized:
|
||||
raise ValueError("author IDs must be unique")
|
||||
normalized.append(author_id)
|
||||
return normalized
|
||||
|
||||
|
||||
class AuthorOrientationProfile(BaseModel):
|
||||
"""Aggregated research-orientation result for one selected author."""
|
||||
|
||||
author_id: str = Field(description="The full OpenAlex author ID.")
|
||||
status: AuthorOrientationProfileStatus
|
||||
orientation_score: int | None = Field(
|
||||
default=None,
|
||||
ge=0,
|
||||
le=100,
|
||||
description="Rounded mean score, available when at least one work has a score.",
|
||||
)
|
||||
primary_category_counts: dict[WorkPrimaryCategory, int] | None = Field(
|
||||
default=None,
|
||||
description=(
|
||||
"Matching work counts grouped by primary category; hidden when "
|
||||
"access is restricted."
|
||||
),
|
||||
)
|
||||
classified_work_count: int | None = Field(
|
||||
default=None,
|
||||
ge=0,
|
||||
description="Matching classified works; hidden when access is restricted.",
|
||||
)
|
||||
scored_work_count: int | None = Field(
|
||||
default=None,
|
||||
ge=0,
|
||||
description="Matching works with an orientation score; hidden when restricted.",
|
||||
)
|
||||
@@ -7,6 +7,11 @@ from inse.auth.model import AccessTokenMetadata
|
||||
from inse.auth.service import CurrentUserAccessTokenPayloadDep
|
||||
from inse.tags import Tags
|
||||
from . import logic
|
||||
from .orientation_profile_logic import orientation_profiles_for_authors
|
||||
from .orientation_profile_model import (
|
||||
AuthorOrientationProfile,
|
||||
AuthorOrientationProfilesRequest,
|
||||
)
|
||||
from .model import (
|
||||
AuthorMetricsRequest,
|
||||
AuthorStaticStats,
|
||||
@@ -117,3 +122,23 @@ async def static_stats(request: AuthorMetricsRequest):
|
||||
request.author_ids,
|
||||
request.company_status,
|
||||
)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/orientation-profiles",
|
||||
response_model=List[AuthorOrientationProfile],
|
||||
)
|
||||
async def orientation_profiles(
|
||||
request: AuthorOrientationProfilesRequest,
|
||||
access_token_metadata: Annotated[
|
||||
AccessTokenMetadata, CurrentUserAccessTokenPayloadDep
|
||||
],
|
||||
):
|
||||
"""Compare orientation scores for active members of the account institution."""
|
||||
|
||||
return await orientation_profiles_for_authors(
|
||||
author_ids=request.author_ids,
|
||||
institution_id=access_token_metadata.effective_institution_id,
|
||||
publication_types=request.publication_types,
|
||||
timespan=request.timespan,
|
||||
)
|
||||
|
||||
@@ -24,3 +24,5 @@ class Tags(StrEnum):
|
||||
DFG_INSTITUTIONS = "DFG Institutions"
|
||||
DFG_PERSONS = "DFG Persons"
|
||||
BACKGROUND_JOBS = "Background Jobs"
|
||||
|
||||
BUND_INSTITUTIONS = "BUND Institutions"
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
from enum import StrEnum
|
||||
|
||||
from inse.model import Page
|
||||
from inse.models.openalex.topic import Topic
|
||||
|
||||
|
||||
class TopicSortBy(StrEnum):
|
||||
DISPLAY_NAME = "display_name"
|
||||
WORKS_COUNT = "works_count"
|
||||
CITED_BY_COUNT = "cited_by_count"
|
||||
|
||||
|
||||
class TopicPageV2(Page[Topic]):
|
||||
pass
|
||||
|
||||
@@ -2,10 +2,12 @@ import logging
|
||||
from typing import Annotated
|
||||
|
||||
import inse.topics.v2.service as topics_service
|
||||
from fastapi import APIRouter, Query
|
||||
from fastapi import APIRouter, Path, Query
|
||||
from inse.model import SortDirection
|
||||
from inse.models.openalex.topic import Topic
|
||||
from inse.router_prefixes import RouterPrefixes
|
||||
from inse.tags import Tags
|
||||
from inse.topics.v2.model import TopicPageV2
|
||||
from inse.topics.v2.model import TopicPageV2, TopicSortBy
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -13,6 +15,69 @@ logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix=RouterPrefixes.TOPICS_V2, tags=[Tags.TOPICS_V2])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/search",
|
||||
operation_id="searchTopics",
|
||||
summary="Searches for topics based on the provided criteria.",
|
||||
)
|
||||
async def search_topics(
|
||||
search_term: Annotated[
|
||||
str | None,
|
||||
Query(description="The term to search for in topic display names."),
|
||||
] = None,
|
||||
page: Annotated[
|
||||
int,
|
||||
Query(
|
||||
description="The page number to retrieve.",
|
||||
ge=0,
|
||||
),
|
||||
] = 0,
|
||||
size: Annotated[
|
||||
int,
|
||||
Query(
|
||||
description="The number of topics to retrieve per page.",
|
||||
ge=1,
|
||||
le=100,
|
||||
),
|
||||
] = 10,
|
||||
sort_by: Annotated[
|
||||
TopicSortBy,
|
||||
Query(
|
||||
description="The field to sort by.",
|
||||
),
|
||||
] = TopicSortBy.WORKS_COUNT,
|
||||
sort_direction: Annotated[
|
||||
SortDirection,
|
||||
Query(
|
||||
description="The direction to sort.",
|
||||
),
|
||||
] = SortDirection.DESCENDING,
|
||||
) -> TopicPageV2:
|
||||
return await topics_service.search_topics(
|
||||
search_term=search_term,
|
||||
page=page,
|
||||
size=size,
|
||||
sort_by=sort_by,
|
||||
sort_direction=sort_direction,
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/single/{raw_oa_topic_id}",
|
||||
operation_id="getTopicById",
|
||||
summary="Returns a topic for a given topic ID.",
|
||||
)
|
||||
async def get_topic_by_id(
|
||||
raw_oa_topic_id: Annotated[
|
||||
str,
|
||||
Path(description="The ID of the topic to retrieve."),
|
||||
],
|
||||
) -> Topic:
|
||||
return await topics_service.get_topic_by_id_or_raise(
|
||||
raw_oa_topic_id=raw_oa_topic_id
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/topics/id",
|
||||
operation_id="getTopicsByIds",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
from inse.exceptions import NotFoundException
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESIndex
|
||||
from inse.model import ESIndex, SortDirection
|
||||
from inse.models.openalex.topic import Topic
|
||||
from inse.topics.v2.model import TopicPageV2
|
||||
from inse.topics.v2.model import TopicPageV2, TopicSortBy
|
||||
|
||||
|
||||
async def search_topics(
|
||||
async def _search_topics(
|
||||
page: int = 0,
|
||||
size: int = 10,
|
||||
query: dict | None = None,
|
||||
@@ -38,11 +38,80 @@ async def search_topics(
|
||||
|
||||
hits_block = response.get("hits", {})
|
||||
hits = hits_block.get("hits", [])
|
||||
total_hits = hits_block.get("total", {}).get("value", 0)
|
||||
topics: list[Topic] = []
|
||||
for hit in hits:
|
||||
_source = hit.get("_source", {})
|
||||
topics.append(Topic.from_dict(_source)) # type: ignore
|
||||
return TopicPageV2(elements=topics, total=len(topics), page=page, size=size)
|
||||
return TopicPageV2(elements=topics, total=total_hits, page=page, size=size)
|
||||
|
||||
|
||||
async def search_topics(
|
||||
search_term: str | None = None,
|
||||
page: int = 0,
|
||||
size: int = 10,
|
||||
sort_by: TopicSortBy = TopicSortBy.WORKS_COUNT,
|
||||
sort_direction: SortDirection = SortDirection.DESCENDING,
|
||||
) -> TopicPageV2:
|
||||
"""Searches for topics based on a search term.
|
||||
|
||||
Args:
|
||||
search_term (str | None): The term to search for in topic display names. Defaults to None.
|
||||
page (int, optional): The page number to retrieve. Defaults to 0.
|
||||
size (int, optional): The number of topics to retrieve per page. Defaults to 10.
|
||||
sort_by (TopicSortBy, optional): The field to sort by. Defaults to TopicSortBy.WORKS_COUNT.
|
||||
sort_direction (SortDirection, optional): The direction to sort. Defaults to SortDirection.DESCENDING.
|
||||
|
||||
Returns:
|
||||
TopicPageV2: A page of topics matching the search term.
|
||||
"""
|
||||
|
||||
sort = None
|
||||
if sort_by in [TopicSortBy.DISPLAY_NAME]:
|
||||
sort = [{f"{sort_by.value}.keyword": {"order": sort_direction.value}}]
|
||||
else:
|
||||
sort = [{sort_by.value: {"order": sort_direction.value}}]
|
||||
|
||||
query = None
|
||||
if search_term:
|
||||
search_terms = [
|
||||
term.strip() for term in search_term.split(",") if term.strip()
|
||||
]
|
||||
if len(search_terms) == 1:
|
||||
query = {
|
||||
"match_phrase_prefix": {"display_name": search_terms[0]}
|
||||
}
|
||||
elif search_terms:
|
||||
query = {
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match_phrase_prefix": {
|
||||
"display_name": search_term
|
||||
}
|
||||
}
|
||||
for search_term in search_terms
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
}
|
||||
|
||||
return await _search_topics(
|
||||
page=page,
|
||||
size=size,
|
||||
query=query,
|
||||
source=[
|
||||
"id",
|
||||
"display_name",
|
||||
"description",
|
||||
"subfield",
|
||||
"field",
|
||||
"domain",
|
||||
"works_count",
|
||||
"cited_by_count",
|
||||
],
|
||||
sort=sort,
|
||||
)
|
||||
|
||||
|
||||
async def autocomplete_topics_for_selector(query: str) -> TopicPageV2:
|
||||
@@ -54,7 +123,7 @@ async def autocomplete_topics_for_selector(query: str) -> TopicPageV2:
|
||||
Returns:
|
||||
TopicPageV2: A page of topics matching the autocomplete criteria.
|
||||
"""
|
||||
return await search_topics(
|
||||
return await _search_topics(
|
||||
page=0,
|
||||
size=10,
|
||||
query={"match_phrase_prefix": {"display_name": query}},
|
||||
@@ -68,6 +137,53 @@ async def autocomplete_topics_for_selector(query: str) -> TopicPageV2:
|
||||
)
|
||||
|
||||
|
||||
async def get_topic_by_id(raw_oa_topic_id: str) -> Topic | None:
|
||||
"""Retrieves a topic based on its ID.
|
||||
|
||||
Args:
|
||||
raw_oa_topic_id (str): The ID of the topic to retrieve.
|
||||
|
||||
Returns:
|
||||
Topic | None: The topic matching the provided ID, or None if not found.
|
||||
"""
|
||||
response = await elasticsearch.get(
|
||||
index=ESIndex.OPENALEX_TOPICS,
|
||||
doc_id=raw_oa_topic_id,
|
||||
source=[
|
||||
"id",
|
||||
"display_name",
|
||||
"description",
|
||||
"subfield",
|
||||
"field",
|
||||
"domain",
|
||||
"works_count",
|
||||
"cited_by_count",
|
||||
],
|
||||
)
|
||||
if response.get("found"):
|
||||
_source = response.get("_source", {})
|
||||
return Topic.from_dict(_source) # type: ignore
|
||||
return None
|
||||
|
||||
|
||||
async def get_topic_by_id_or_raise(raw_oa_topic_id: str) -> Topic:
|
||||
"""Retrieves a topic based on its ID, raising an exception if not found.
|
||||
|
||||
Args:
|
||||
raw_oa_topic_id (str): The ID of the topic to retrieve.
|
||||
|
||||
Raises:
|
||||
NotFoundException: If the topic with the specified ID is not found.
|
||||
|
||||
Returns:
|
||||
Topic: The topic matching the provided ID.
|
||||
"""
|
||||
topic = await get_topic_by_id(raw_oa_topic_id)
|
||||
if topic is None:
|
||||
raise NotFoundException(f"Topic with ID {raw_oa_topic_id} not found.")
|
||||
return topic
|
||||
|
||||
|
||||
async def get_topics_by_ids(topic_ids: list[str]) -> TopicPageV2:
|
||||
"""Retrieves topics based on a list of topic IDs.
|
||||
|
||||
@@ -80,7 +196,7 @@ async def get_topics_by_ids(topic_ids: list[str]) -> TopicPageV2:
|
||||
if not topic_ids:
|
||||
return TopicPageV2(elements=[], total=0, page=0, size=0)
|
||||
|
||||
return await search_topics(
|
||||
return await _search_topics(
|
||||
page=0,
|
||||
size=len(topic_ids),
|
||||
query={"terms": {"id": topic_ids}},
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from inse.topics.v2.service import search_topics
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_search_topics_treats_comma_separated_terms_as_alternatives():
|
||||
with patch(
|
||||
"inse.topics.v2.service.elasticsearch.search",
|
||||
new=AsyncMock(
|
||||
return_value={
|
||||
"hits": {"hits": [], "total": {"value": 0}}
|
||||
}
|
||||
),
|
||||
) as search:
|
||||
await search_topics("Artificial Intelligence, Machine Learning")
|
||||
|
||||
assert search.await_args.kwargs["query"] == {
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match_phrase_prefix": {
|
||||
"display_name": "Artificial Intelligence"
|
||||
}
|
||||
},
|
||||
{
|
||||
"match_phrase_prefix": {
|
||||
"display_name": "Machine Learning"
|
||||
}
|
||||
},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
}
|
||||
@@ -170,6 +170,19 @@ async def test_get_top_topics_for_entity_projects():
|
||||
assert "items" in res
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_top_topics_for_entity_news():
|
||||
res = await get_top_topics_for_entity(
|
||||
entity_id="UDE",
|
||||
entity_type="institution",
|
||||
start_year=2018,
|
||||
end_year=2024,
|
||||
search_type="news",
|
||||
)
|
||||
assert isinstance(res, dict)
|
||||
assert "items" in res
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_get_trend_data_delegation():
|
||||
res = await get_trend_data(
|
||||
|
||||
@@ -456,31 +456,99 @@ async def get_top_topics_for_entity(
|
||||
|
||||
if search_type == "news":
|
||||
try:
|
||||
res = await elasticsearch.search(
|
||||
index=ESIndex.AKTUELLES_POSTPROC.value,
|
||||
body={
|
||||
"query": {"match_all": {}},
|
||||
"size": 0,
|
||||
"_source": False,
|
||||
"aggs": {
|
||||
"top_topics": {
|
||||
"terms": {
|
||||
"field": "topics.display_name.keyword",
|
||||
"size": DEFAULT_TOP_TOPICS_SIZE,
|
||||
date_filter = TrendQueryBuilder.build_date_range_filter("date_year", start_year, end_year)
|
||||
news_ids = []
|
||||
try:
|
||||
async for hit in elasticsearch.scan(
|
||||
index=ESIndex.AKTUELLES.value,
|
||||
query={"bool": {"filter": [date_filter]}},
|
||||
source=["news_id"],
|
||||
cluster=ESCluster.INSE,
|
||||
):
|
||||
nid = hit.get("_id") or hit.get("_source", {}).get("news_id")
|
||||
if nid:
|
||||
news_ids.append(str(nid))
|
||||
except Exception as e:
|
||||
logger.warning("Failed scanning aktuell for news IDs in date range: %s", e)
|
||||
|
||||
topic_counts: Dict[str, int] = {}
|
||||
if news_ids:
|
||||
msearch_queries = []
|
||||
for i in range(0, len(news_ids), 2000):
|
||||
chunk = news_ids[i : i + 2000]
|
||||
payload = {
|
||||
"query": {
|
||||
"bool": {
|
||||
"should": [
|
||||
{"ids": {"values": chunk}},
|
||||
{"terms": {"news_id.keyword": chunk}},
|
||||
{"terms": {"news_id": chunk}},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
cluster=ESCluster.INSE,
|
||||
)
|
||||
buckets = res.get("aggregations", {}).get("top_topics", {}).get("buckets", [])
|
||||
items = [{"name": b["key"], "count": b["doc_count"]} for b in buckets]
|
||||
total_hits = res.get("hits", {}).get("total", {})
|
||||
total_val = total_hits.get("value", 0) if isinstance(total_hits, dict) else int(total_hits or 0)
|
||||
sum_top = sum(b["count"] for b in items)
|
||||
other_count = max(0, total_val - sum_top)
|
||||
},
|
||||
"size": 0,
|
||||
"_source": False,
|
||||
"aggs": {
|
||||
"top_topics": {
|
||||
"terms": {
|
||||
"field": "topic_matches.topic_display_name.keyword",
|
||||
"size": 100,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
msearch_queries.append((ESIndex.AKTUELLES_OPENALEX_TOPICS.value, payload))
|
||||
|
||||
if msearch_queries:
|
||||
try:
|
||||
responses = await elasticsearch.msearch(msearch_queries, cluster=ESCluster.INSE)
|
||||
for res in responses:
|
||||
buckets = res.get("aggregations", {}).get("top_topics", {}).get("buckets", [])
|
||||
for b in buckets:
|
||||
t_name = b["key"]
|
||||
cnt = b["doc_count"]
|
||||
topic_counts[t_name] = topic_counts.get(t_name, 0) + cnt
|
||||
except Exception as e:
|
||||
logger.warning("Failed to aggregate news top topics via msearch: %s", e)
|
||||
else:
|
||||
# If no year filter bounds active or scan returned no IDs, aggregate all topics directly from openalex_topics
|
||||
try:
|
||||
res = await elasticsearch.search(
|
||||
index=ESIndex.AKTUELLES_OPENALEX_TOPICS.value,
|
||||
body={
|
||||
"query": {"match_all": {}},
|
||||
"size": 0,
|
||||
"_source": False,
|
||||
"aggs": {
|
||||
"top_topics": {
|
||||
"terms": {
|
||||
"field": "topic_matches.topic_display_name.keyword",
|
||||
"size": 100,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
cluster=ESCluster.INSE,
|
||||
)
|
||||
buckets = res.get("aggregations", {}).get("top_topics", {}).get("buckets", [])
|
||||
for b in buckets:
|
||||
t_name = b["key"]
|
||||
cnt = b["doc_count"]
|
||||
topic_counts[t_name] = topic_counts.get(t_name, 0) + cnt
|
||||
except Exception as e:
|
||||
logger.warning("Failed to fallback query news top topics: %s", e)
|
||||
|
||||
sorted_topics = sorted(topic_counts.items(), key=lambda x: x[1], reverse=True)
|
||||
top_slice = sorted_topics[:DEFAULT_TOP_TOPICS_SIZE]
|
||||
items = [{"name": name, "count": count} for name, count in top_slice]
|
||||
|
||||
sum_top = sum(count for name, count in top_slice)
|
||||
total_topics = sum(topic_counts.values())
|
||||
other_count = max(0, total_topics - sum_top)
|
||||
if other_count > 0:
|
||||
items.append({"name": "Andere Themen", "count": other_count})
|
||||
|
||||
return {"items": items}
|
||||
except Exception as e:
|
||||
logger.error("Failed to query top news topics for entity: %s", e)
|
||||
|
||||
@@ -1066,11 +1066,24 @@ class NewsTrendStrategy(TrendStrategy):
|
||||
|
||||
STOP_WORDS = {"in", "and", "or", "und", "oder", "der", "die", "das", "von", "mit", "zu", "at", "by", "on", "for", "to", "a", "an", "the"}
|
||||
|
||||
# Scan UDE news postprocessed index to get matching news IDs without size limit cutoffs
|
||||
# Scan UDE news OpenAlex topics index to get matching news IDs without size limit cutoffs
|
||||
async def fetch_news_ids_for_term(idx: int, t_name: str) -> List[str]:
|
||||
news_ids: Set[str] = set()
|
||||
if fuzzy:
|
||||
term = t_name
|
||||
es_query = {"match": {"topics.display_name": term}}
|
||||
es_query = {"term": {"topic_matches.topic_display_name.keyword": term}}
|
||||
try:
|
||||
async for hit in elasticsearch.scan(
|
||||
index=ESIndex.AKTUELLES_OPENALEX_TOPICS.value,
|
||||
query=es_query,
|
||||
source=["news_id"],
|
||||
cluster=ESCluster.INSE,
|
||||
):
|
||||
nid = hit.get("_source", {}).get("news_id") or hit.get("_id")
|
||||
if nid:
|
||||
news_ids.add(str(nid))
|
||||
except Exception as e:
|
||||
logger.warning("Failed to scan UDE news OpenAlex topics index %s: %s", ESIndex.AKTUELLES_OPENALEX_TOPICS.value, e)
|
||||
else:
|
||||
if keywords and idx < len(keywords) and keywords[idx]:
|
||||
raw_kw = keywords[idx]
|
||||
@@ -1079,43 +1092,28 @@ class NewsTrendStrategy(TrendStrategy):
|
||||
term = t_name
|
||||
else:
|
||||
term = t_name
|
||||
es_query = {"match": {"keywords": term}}
|
||||
|
||||
news_ids: Set[str] = set()
|
||||
try:
|
||||
async for hit in elasticsearch.scan(
|
||||
index=ESIndex.AKTUELLES_POSTPROC.value,
|
||||
query=es_query,
|
||||
source=["news_id"],
|
||||
cluster=ESCluster.INSE,
|
||||
):
|
||||
nid = hit.get("_source", {}).get("news_id")
|
||||
if nid:
|
||||
news_ids.add(nid)
|
||||
except Exception as e:
|
||||
logger.warning("Failed to scan UDE news postproc: %s", e)
|
||||
|
||||
# If non-fuzzy keyword search, also search article content fields in 'aktuell' index
|
||||
if not fuzzy and term and term.lower() not in STOP_WORDS and len(term.strip()) > 1:
|
||||
try:
|
||||
content_query = {
|
||||
"query_string": {
|
||||
"query": term,
|
||||
"fields": AKTUELLES_SEARCH_FIELDS,
|
||||
"default_operator": "AND",
|
||||
# If non-fuzzy keyword search, search article content fields in 'aktuell' index
|
||||
if term and term.lower() not in STOP_WORDS and len(term.strip()) > 1:
|
||||
try:
|
||||
content_query = {
|
||||
"query_string": {
|
||||
"query": term,
|
||||
"fields": AKTUELLES_SEARCH_FIELDS,
|
||||
"default_operator": "AND",
|
||||
}
|
||||
}
|
||||
}
|
||||
async for hit in elasticsearch.scan(
|
||||
index=ESIndex.AKTUELLES.value,
|
||||
query=content_query,
|
||||
source=["news_id"],
|
||||
cluster=ESCluster.INSE,
|
||||
):
|
||||
nid = hit.get("_id") or hit.get("_source", {}).get("news_id")
|
||||
if nid:
|
||||
news_ids.add(nid)
|
||||
except Exception as e:
|
||||
logger.warning("Failed to scan UDE news content in aktuell: %s", e)
|
||||
async for hit in elasticsearch.scan(
|
||||
index=ESIndex.AKTUELLES.value,
|
||||
query=content_query,
|
||||
source=["news_id"],
|
||||
cluster=ESCluster.INSE,
|
||||
):
|
||||
nid = hit.get("_id") or hit.get("_source", {}).get("news_id")
|
||||
if nid:
|
||||
news_ids.add(str(nid))
|
||||
except Exception as e:
|
||||
logger.warning("Failed to scan UDE news content in aktuell: %s", e)
|
||||
|
||||
return list(news_ids)
|
||||
|
||||
@@ -1134,7 +1132,16 @@ class NewsTrendStrategy(TrendStrategy):
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{"ids": {"values": chunk}},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{"ids": {"values": chunk}},
|
||||
{"terms": {"news_id.keyword": chunk}},
|
||||
{"terms": {"news_id": chunk}},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
},
|
||||
TrendQueryBuilder.build_date_range_filter("date_year", start_year, end_year),
|
||||
]
|
||||
}
|
||||
|
||||
@@ -22,6 +22,68 @@ logger = logging.getLogger(__name__)
|
||||
router = APIRouter(prefix=RouterPrefixes.WORKS_V2, tags=[Tags.WORKS_V2])
|
||||
|
||||
|
||||
@router.get(
|
||||
"/search",
|
||||
operation_id="searchWorks",
|
||||
summary="Search works with filters.",
|
||||
)
|
||||
async def search_works(
|
||||
page: Annotated[
|
||||
int, Query(description="The page number to retrieve. (0-based)", ge=0)
|
||||
] = 0,
|
||||
size: Annotated[
|
||||
int,
|
||||
Query(description="The number of works to retrieve per page.", ge=1, le=100),
|
||||
] = 10,
|
||||
title: Annotated[
|
||||
str, Query(description="A title to filter by (partial matches allowed).")
|
||||
] = "",
|
||||
publication_years: Annotated[
|
||||
list[int] | None,
|
||||
Query(description="A list of publication years to filter by."),
|
||||
] = None,
|
||||
publication_types: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of publication types to filter by."),
|
||||
] = None,
|
||||
author_ids: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of author IDs to filter by."),
|
||||
] = None,
|
||||
institution_ids: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of institution IDs to filter by."),
|
||||
] = None,
|
||||
topic_ids: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of topic IDs to filter by."),
|
||||
] = None,
|
||||
language_codes: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of language codes to filter by."),
|
||||
] = None,
|
||||
sort_by: Annotated[
|
||||
WorkSortBy, Query(description="The field to sort by.")
|
||||
] = WorkSortBy.PUBLICATION_YEAR,
|
||||
sort_order: Annotated[
|
||||
SortDirection, Query(description="The order to sort by.")
|
||||
] = SortDirection.DESCENDING,
|
||||
) -> WorkPageV2:
|
||||
return await works_service.search_works(
|
||||
page=page,
|
||||
size=size,
|
||||
title=title,
|
||||
publication_years=publication_years or [],
|
||||
publication_types=publication_types or [],
|
||||
author_ids=author_ids or [],
|
||||
institution_ids=institution_ids or [],
|
||||
topic_ids=topic_ids or [],
|
||||
language_codes=language_codes or [],
|
||||
sort_by=sort_by,
|
||||
sort_order=sort_order,
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/author/{raw_oa_author_id}",
|
||||
operation_id="getAuthorWorkPage",
|
||||
@@ -218,6 +280,65 @@ async def get_institution_works(
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/topic/{raw_oa_topic_id}",
|
||||
operation_id="getTopicWorkPage",
|
||||
summary="Returns a paginated list of works for a given topic based on its ID.",
|
||||
)
|
||||
async def get_topic_works(
|
||||
raw_oa_topic_id: Annotated[str, Path(description="The raw OpenAlex topic id.")],
|
||||
page: Annotated[
|
||||
int, Query(description="The page number to retrieve. (0-based)", ge=0)
|
||||
] = 0,
|
||||
size: Annotated[
|
||||
int,
|
||||
Query(description="The number of works to retrieve per page.", ge=1, le=100),
|
||||
] = 10,
|
||||
title: Annotated[
|
||||
str, Query(description="A title to filter by (partial matches allowed).")
|
||||
] = "",
|
||||
publication_years: Annotated[
|
||||
list[int] | None,
|
||||
Query(description="A list of publication years to filter by."),
|
||||
] = None,
|
||||
publication_types: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of publication types to filter by."),
|
||||
] = None,
|
||||
author_ids: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of author IDs to filter by."),
|
||||
] = None,
|
||||
institution_ids: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of institution IDs to filter by."),
|
||||
] = None,
|
||||
language_codes: Annotated[
|
||||
list[str] | None,
|
||||
Query(description="A list of language codes to filter by."),
|
||||
] = None,
|
||||
sort_by: Annotated[
|
||||
WorkSortBy, Query(description="The field to sort by.")
|
||||
] = WorkSortBy.PUBLICATION_YEAR,
|
||||
sort_order: Annotated[
|
||||
SortDirection, Query(description="The order to sort by.")
|
||||
] = SortDirection.DESCENDING,
|
||||
) -> WorkPageV2:
|
||||
return await works_service.get_topic_works(
|
||||
raw_oa_topic_id=raw_oa_topic_id,
|
||||
page=page,
|
||||
size=size,
|
||||
title=title,
|
||||
publication_years=publication_years or [],
|
||||
publication_types=publication_types or [],
|
||||
author_ids=author_ids or [],
|
||||
institution_ids=institution_ids or [],
|
||||
language_codes=language_codes or [],
|
||||
sort_by=sort_by,
|
||||
sort_order=sort_order,
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/classification/work/{raw_oa_work_id}",
|
||||
operation_id="getWorkClassificationByWorkId",
|
||||
|
||||
@@ -60,6 +60,19 @@ def _institutions_nested_query(institution_ids: list[str]) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def _topics_nested_query(topic_ids: list[str]) -> dict:
|
||||
"""Returns a nested query for filtering works by a list of topic IDs.
|
||||
|
||||
Args:
|
||||
topic_ids (list[str]): A list of topic IDs to filter by.
|
||||
|
||||
Returns:
|
||||
dict: A nested query for filtering works by the specified topic IDs.
|
||||
"""
|
||||
prefixed = [_prefix_id(tid) for tid in topic_ids]
|
||||
return {"nested": {"path": "topics", "query": {"terms": {"topics.id": prefixed}}}}
|
||||
|
||||
|
||||
def _title_query(title: str) -> dict:
|
||||
"""Returns a query for filtering works by title using a multi-match query.
|
||||
|
||||
@@ -87,7 +100,6 @@ def _apply_common_filters(
|
||||
publication_years: list[int] | None,
|
||||
publication_types: list[str] | None,
|
||||
language_codes: list[str] | None,
|
||||
topic_ids: list[str] | None,
|
||||
title: str | None = None,
|
||||
) -> None:
|
||||
"""Applies common filters to the provided list of must conditions for filtering works.
|
||||
@@ -106,10 +118,6 @@ def _apply_common_filters(
|
||||
must.append({"terms": {"type": publication_types}})
|
||||
if language_codes:
|
||||
must.append({"terms": {"language": language_codes}})
|
||||
if topic_ids:
|
||||
must.append(
|
||||
{"nested": {"path": "topics", "query": {"terms": {"topics.id": topic_ids}}}}
|
||||
)
|
||||
if title and len(title.strip()) > 0:
|
||||
must.append(_title_query(title))
|
||||
|
||||
@@ -148,7 +156,7 @@ async def _execute_works_search(
|
||||
Returns:
|
||||
WorkPageV2: The page of works matching the search criteria.
|
||||
"""
|
||||
return await search_works(
|
||||
return await _search_works(
|
||||
source=[
|
||||
"id",
|
||||
"title",
|
||||
@@ -172,8 +180,6 @@ async def _execute_works_search(
|
||||
async def get_works(
|
||||
page: int,
|
||||
size: int,
|
||||
raw_oa_author_id: str | None = None,
|
||||
raw_oa_institution_id: str | None = None,
|
||||
title: str | None = None,
|
||||
author_ids: list[str] | None = None,
|
||||
institution_ids: list[str] | None = None,
|
||||
@@ -189,8 +195,6 @@ async def get_works(
|
||||
Args:
|
||||
page (int): The page number for pagination.
|
||||
size (int): The number of results per page.
|
||||
raw_oa_author_id (Optional[str], optional): The ID of the author to filter by. Defaults to None.
|
||||
raw_oa_institution_id (Optional[str], optional): The ID of the institution to filter by. Defaults to None.
|
||||
title (Optional[str], optional): The title of the works to filter by. Defaults to None.
|
||||
author_ids (Optional[List[str]], optional): A list of author IDs to filter by. Defaults to None.
|
||||
institution_ids (Optional[List[str]], optional): A list of institution IDs to filter by. Defaults to None.
|
||||
@@ -201,34 +205,31 @@ async def get_works(
|
||||
sort_by (WorkSortBy, optional): The field to sort by. Defaults to WorkSortBy.PUBLICATION_YEAR.
|
||||
sort_order (SortDirection, optional): The direction to sort in. Defaults to SortDirection.DESCENDING.
|
||||
|
||||
Raises:
|
||||
ValueError: If neither raw_oa_author_id nor raw_oa_institution_id is provided.
|
||||
|
||||
Returns:
|
||||
WorkPageV2: The page of works matching the criteria.
|
||||
"""
|
||||
if not raw_oa_author_id and not raw_oa_institution_id:
|
||||
raise ValueError(
|
||||
"get_works requires at least one of raw_oa_author_id or raw_oa_institution_id"
|
||||
)
|
||||
|
||||
must: list = []
|
||||
|
||||
if raw_oa_author_id:
|
||||
must.append(_authors_nested_query([raw_oa_author_id]))
|
||||
elif author_ids:
|
||||
must.append(_authors_nested_query(author_ids))
|
||||
if author_ids:
|
||||
must.append(_authors_nested_query(author_ids=author_ids))
|
||||
|
||||
if raw_oa_institution_id:
|
||||
must.append(_institutions_nested_query([raw_oa_institution_id]))
|
||||
elif institution_ids:
|
||||
must.append(_institutions_nested_query(institution_ids))
|
||||
if institution_ids:
|
||||
must.append(_institutions_nested_query(institution_ids=institution_ids))
|
||||
|
||||
if topic_ids:
|
||||
must.append(_topics_nested_query(topic_ids=topic_ids))
|
||||
|
||||
_apply_common_filters(
|
||||
must, publication_years, publication_types, language_codes, topic_ids, title
|
||||
must=must,
|
||||
publication_years=publication_years,
|
||||
publication_types=publication_types,
|
||||
language_codes=language_codes,
|
||||
title=title,
|
||||
)
|
||||
|
||||
return await _execute_works_search(must, page, size, sort_by, sort_order)
|
||||
return await _execute_works_search(
|
||||
must=must, page=page, size=size, sort_by=sort_by, sort_order=sort_order
|
||||
)
|
||||
|
||||
|
||||
async def get_works_by_keywords(
|
||||
@@ -427,7 +428,7 @@ async def get_author_works(
|
||||
return await get_works(
|
||||
page=page,
|
||||
size=size,
|
||||
raw_oa_author_id=raw_oa_author_id,
|
||||
author_ids=[raw_oa_author_id],
|
||||
title=title,
|
||||
institution_ids=institution_ids,
|
||||
publication_years=publication_years,
|
||||
@@ -474,7 +475,7 @@ async def get_institution_works(
|
||||
return await get_works(
|
||||
page=page,
|
||||
size=size,
|
||||
raw_oa_institution_id=raw_oa_institution_id,
|
||||
institution_ids=[raw_oa_institution_id],
|
||||
author_ids=author_ids,
|
||||
title=title,
|
||||
publication_years=publication_years,
|
||||
@@ -486,6 +487,100 @@ async def get_institution_works(
|
||||
)
|
||||
|
||||
|
||||
async def get_topic_works(
|
||||
raw_oa_topic_id: str,
|
||||
page: int,
|
||||
size: int,
|
||||
title: str = "",
|
||||
publication_years: list[int] | None = None,
|
||||
publication_types: list[str] | None = None,
|
||||
institution_ids: list[str] | None = None,
|
||||
author_ids: list[str] | None = None,
|
||||
language_codes: list[str] | None = None,
|
||||
sort_by: WorkSortBy = WorkSortBy.PUBLICATION_YEAR,
|
||||
sort_order: SortDirection = SortDirection.DESCENDING,
|
||||
) -> WorkPageV2:
|
||||
"""Retrieves works for a specific topic based on the provided criteria.
|
||||
|
||||
Args:
|
||||
raw_oa_topic_id (str): The ID of the topic for whom to retrieve works.
|
||||
page (int): The page number of the results to retrieve.
|
||||
size (int): The number of results per page.
|
||||
title (str, optional): The title of the works to filter by. Defaults to "".
|
||||
publication_years (Optional[List[int]], optional): A list of publication years to filter by. Defaults to None.
|
||||
publication_types (Optional[List[str]], optional): A list of publication types to filter by. Defaults to None.
|
||||
institution_ids (Optional[List[str]], optional): A list of institution IDs to filter by. Defaults to None.
|
||||
author_ids (Optional[List[str]], optional): A list of author IDs to filter by. Defaults to None.
|
||||
language_codes (Optional[List[str]], optional): A list of language codes to filter by. Defaults to None.
|
||||
sort_by (WorkSortBy, optional): The field by which to sort the results. Defaults to WorkSortBy.PUBLICATION_YEAR.
|
||||
sort_order (SortDirection, optional): The direction to sort in. Defaults to SortDirection.DESCENDING.
|
||||
|
||||
Returns:
|
||||
WorkPageV2: The page of works matching the criteria.
|
||||
"""
|
||||
|
||||
return await get_works(
|
||||
page=page,
|
||||
size=size,
|
||||
topic_ids=[raw_oa_topic_id],
|
||||
title=title,
|
||||
institution_ids=institution_ids,
|
||||
author_ids=author_ids,
|
||||
publication_years=publication_years,
|
||||
publication_types=publication_types,
|
||||
language_codes=language_codes,
|
||||
sort_by=sort_by,
|
||||
sort_order=sort_order,
|
||||
)
|
||||
|
||||
|
||||
async def search_works(
|
||||
page: int,
|
||||
size: int,
|
||||
title: str | None = None,
|
||||
author_ids: list[str] | None = None,
|
||||
institution_ids: list[str] | None = None,
|
||||
publication_years: list[int] | None = None,
|
||||
publication_types: list[str] | None = None,
|
||||
topic_ids: list[str] | None = None,
|
||||
language_codes: list[str] | None = None,
|
||||
sort_by: WorkSortBy = WorkSortBy.PUBLICATION_YEAR,
|
||||
sort_order: SortDirection = SortDirection.DESCENDING,
|
||||
) -> WorkPageV2:
|
||||
"""Searches for works based on the provided criteria.
|
||||
|
||||
Args:
|
||||
page (int): The page number of the results to retrieve.
|
||||
size (int): The number of results per page.
|
||||
title (str | None, optional): The title of the works to filter by. Defaults to None.
|
||||
author_ids (list[str] | None, optional): A list of author IDs to filter by. Defaults to None.
|
||||
institution_ids (list[str] | None, optional): A list of institution IDs to filter by. Defaults to None.
|
||||
publication_years (list[int] | None, optional): A list of publication years to filter by. Defaults to None.
|
||||
publication_types (list[str] | None, optional): A list of publication types to filter by. Defaults to None.
|
||||
topic_ids (list[str] | None, optional): A list of topic IDs to filter by. Defaults to None.
|
||||
language_codes (list[str] | None, optional): A list of language codes to filter by. Defaults to None.
|
||||
sort_by (WorkSortBy, optional): The field by which to sort the results. Defaults to WorkSortBy.PUBLICATION_YEAR.
|
||||
sort_order (SortDirection, optional): The direction to sort in. Defaults to SortDirection.DESCENDING.
|
||||
|
||||
Returns:
|
||||
WorkPageV2: The page of works matching the criteria.
|
||||
"""
|
||||
|
||||
return await get_works(
|
||||
page=page,
|
||||
size=size,
|
||||
title=title,
|
||||
author_ids=author_ids,
|
||||
institution_ids=institution_ids,
|
||||
publication_years=publication_years,
|
||||
publication_types=publication_types,
|
||||
topic_ids=topic_ids,
|
||||
language_codes=language_codes,
|
||||
sort_by=sort_by,
|
||||
sort_order=sort_order,
|
||||
)
|
||||
|
||||
|
||||
async def get_work(raw_oa_work_id: str, source: list[str] | None = None) -> Work | None:
|
||||
"""Retrieves a work based on its OpenAlex ID.
|
||||
|
||||
@@ -498,7 +593,7 @@ async def get_work(raw_oa_work_id: str, source: list[str] | None = None) -> Work
|
||||
"""
|
||||
|
||||
# search instead of get, because multiple indices are used for works
|
||||
work_page = await search_works(
|
||||
work_page = await _search_works(
|
||||
query={"term": {"id": _prefix_id(raw_oa_work_id)}},
|
||||
source=source,
|
||||
page=0,
|
||||
@@ -510,7 +605,7 @@ async def get_work(raw_oa_work_id: str, source: list[str] | None = None) -> Work
|
||||
return None
|
||||
|
||||
|
||||
async def search_works(
|
||||
async def _search_works(
|
||||
query: dict | None = None,
|
||||
source: list[str] | None = None,
|
||||
page: int = 0,
|
||||
@@ -568,7 +663,7 @@ async def _get_works_by_work_ids_and_institution_id(
|
||||
prefixed_work_ids = [_prefix_id(wid) for wid in work_ids]
|
||||
prefixed_institution_id = _prefix_id(raw_oa_institution_id)
|
||||
|
||||
return await search_works(
|
||||
return await _search_works(
|
||||
query={
|
||||
"bool": {
|
||||
"must": [
|
||||
|
||||
@@ -6,6 +6,7 @@ api.module.ts
|
||||
api/api.ts
|
||||
api/auth.service.ts
|
||||
api/authorsV2.service.ts
|
||||
api/bUNDInstitutions.service.ts
|
||||
api/backgroundJobs.service.ts
|
||||
api/bookmarks.service.ts
|
||||
api/companyConnections.service.ts
|
||||
@@ -43,6 +44,9 @@ model/authorCountsByYearInner.ts
|
||||
model/authorIds.ts
|
||||
model/authorMetricsRequest.ts
|
||||
model/authorNode.ts
|
||||
model/authorOrientationProfile.ts
|
||||
model/authorOrientationProfileStatus.ts
|
||||
model/authorOrientationProfilesRequest.ts
|
||||
model/authorPage.ts
|
||||
model/authorParsedLongestName.ts
|
||||
model/authorPositionCount.ts
|
||||
@@ -66,6 +70,8 @@ model/bodyLogin.ts
|
||||
model/bodyRequestOtk.ts
|
||||
model/bodyRequestPasswordReset.ts
|
||||
model/bodyResetPassword.ts
|
||||
model/bundInstitutionSummary.ts
|
||||
model/bundInstitutionSummaryPage.ts
|
||||
model/bundProjectDetails.ts
|
||||
model/bundProjectPage.ts
|
||||
model/bundProjectSummary.ts
|
||||
@@ -96,7 +102,12 @@ model/dfgInstitutionSummaryPage.ts
|
||||
model/dfgPersonSummary.ts
|
||||
model/dfgPersonSummaryPage.ts
|
||||
model/dfgProjectDetails.ts
|
||||
model/dfgProjectInstitutionRole.ts
|
||||
model/dfgProjectPage.ts
|
||||
model/dfgProjectPersonRole.ts
|
||||
model/dfgProjectPublicationSummary.ts
|
||||
model/dfgProjectSubjectArea.ts
|
||||
model/dfgProjectSubprojectSummary.ts
|
||||
model/dfgProjectSummary.ts
|
||||
model/dfgProjectTopic.ts
|
||||
model/dfgProjectTopics.ts
|
||||
@@ -249,6 +260,7 @@ model/topicHeatmapTopic.ts
|
||||
model/topicHeatmapValue.ts
|
||||
model/topicIds.ts
|
||||
model/topicPageV2.ts
|
||||
model/topicSortBy.ts
|
||||
model/topicSubfield.ts
|
||||
model/topicWordCloud.ts
|
||||
model/topicWordCloudWord.ts
|
||||
|
||||
@@ -2,6 +2,8 @@ export * from './auth.service';
|
||||
import { AuthService } from './auth.service';
|
||||
export * from './authorsV2.service';
|
||||
import { AuthorsV2Service } from './authorsV2.service';
|
||||
export * from './bUNDInstitutions.service';
|
||||
import { BUNDInstitutionsService } from './bUNDInstitutions.service';
|
||||
export * from './backgroundJobs.service';
|
||||
import { BackgroundJobsService } from './backgroundJobs.service';
|
||||
export * from './bookmarks.service';
|
||||
@@ -46,4 +48,30 @@ export * from './works.service';
|
||||
import { WorksService } from './works.service';
|
||||
export * from './worksV2.service';
|
||||
import { WorksV2Service } from './worksV2.service';
|
||||
export const APIS = [AuthService, AuthorsV2Service, 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,
|
||||
INSEServiceService,
|
||||
InstitutionsService,
|
||||
InstitutionsV2Service,
|
||||
KeywordsService,
|
||||
NewsService,
|
||||
OrganizationService,
|
||||
PatentsService,
|
||||
PersonsService,
|
||||
ProjectsService,
|
||||
RankingService,
|
||||
TopicsService,
|
||||
TopicsV2Service,
|
||||
UniversityRankingsService,
|
||||
WorksService,
|
||||
WorksV2Service,
|
||||
];
|
||||
|
||||
@@ -16,6 +16,8 @@ import { HttpClient, HttpHeaders, HttpParams,
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { Author } from '../model/author';
|
||||
// @ts-ignore
|
||||
import { AuthorPage } from '../model/authorPage';
|
||||
// @ts-ignore
|
||||
@@ -98,6 +100,61 @@ export class AuthorsV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | '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/${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
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
/**
|
||||
* Innovation Search Engine 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 { BundInstitutionSummaryPage } from '../model/bundInstitutionSummaryPage';
|
||||
// @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 BUNDInstitutionsService extends BaseService {
|
||||
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 =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let responseType_: 'text' | 'json' | '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/autocomplete/selector`;
|
||||
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,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 });
|
||||
if (institutionNames) {
|
||||
institutionNames.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'institution_names',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
let responseType_: 'text' | 'json' | '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,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ import { Observable } from 'rxjs';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { Institution } from '../model/institution';
|
||||
// @ts-ignore
|
||||
import { InstitutionPageV2 } from '../model/institutionPageV2';
|
||||
|
||||
// @ts-ignore
|
||||
@@ -94,9 +96,64 @@ export class InstitutionsV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | '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
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of institutions based on their IDs.
|
||||
* @endpoint get /api/institutions/v2/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.
|
||||
@@ -139,7 +196,7 @@ export class InstitutionsV2Service extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/institutions/v2/ids`;
|
||||
let localVarPath = `/api/institutions/v2/multiple/ids`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InstitutionPageV2>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -9,16 +9,26 @@
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import {
|
||||
HttpClient,
|
||||
HttpHeaders,
|
||||
HttpParams,
|
||||
HttpResponse,
|
||||
HttpEvent,
|
||||
HttpParameterCodec,
|
||||
HttpContext,
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { AuthorMetricsRequest } from '../model/authorMetricsRequest';
|
||||
// @ts-ignore
|
||||
import { AuthorOrientationProfile } from '../model/authorOrientationProfile';
|
||||
// @ts-ignore
|
||||
import { AuthorOrientationProfilesRequest } from '../model/authorOrientationProfilesRequest';
|
||||
// @ts-ignore
|
||||
import { AuthorStaticStats } from '../model/authorStaticStats';
|
||||
// @ts-ignore
|
||||
import { AuthorTopicProfile } from '../model/authorTopicProfile';
|
||||
@@ -34,283 +44,628 @@ import { RankedAuthor } from '../model/rankedAuthor';
|
||||
import { SelectedAuthorsRequest } from '../model/selectedAuthorsRequest';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class RankingService 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);
|
||||
/**
|
||||
* Orientation Profiles
|
||||
* Compare orientation scores for active members of the account institution.
|
||||
* @endpoint post /api/rank/orientation-profiles
|
||||
* @param authorOrientationProfilesRequest
|
||||
* @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 orientationProfilesApiRankOrientationProfilesPost(
|
||||
authorOrientationProfilesRequest: AuthorOrientationProfilesRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<AuthorOrientationProfile>>;
|
||||
public orientationProfilesApiRankOrientationProfilesPost(
|
||||
authorOrientationProfilesRequest: AuthorOrientationProfilesRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<AuthorOrientationProfile>>>;
|
||||
public orientationProfilesApiRankOrientationProfilesPost(
|
||||
authorOrientationProfilesRequest: AuthorOrientationProfilesRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<AuthorOrientationProfile>>>;
|
||||
public orientationProfilesApiRankOrientationProfilesPost(
|
||||
authorOrientationProfilesRequest: AuthorOrientationProfilesRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (
|
||||
authorOrientationProfilesRequest === null ||
|
||||
authorOrientationProfilesRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter authorOrientationProfilesRequest was null or undefined when calling orientationProfilesApiRankOrientationProfilesPost.',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Rank Author
|
||||
* @endpoint post /api/rank/rank-author
|
||||
* @param keywordToAuthorRequest
|
||||
* @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 rankAuthorApiRankRankAuthorPost(keywordToAuthorRequest: KeywordToAuthorRequest, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<RankedAuthor>>;
|
||||
public rankAuthorApiRankRankAuthorPost(keywordToAuthorRequest: KeywordToAuthorRequest, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<RankedAuthor>>>;
|
||||
public rankAuthorApiRankRankAuthorPost(keywordToAuthorRequest: KeywordToAuthorRequest, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<RankedAuthor>>>;
|
||||
public rankAuthorApiRankRankAuthorPost(keywordToAuthorRequest: KeywordToAuthorRequest, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (keywordToAuthorRequest === null || keywordToAuthorRequest === undefined) {
|
||||
throw new Error('Required parameter keywordToAuthorRequest was null or undefined when calling rankAuthorApiRankRankAuthorPost.');
|
||||
}
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders(
|
||||
'HTTPBearer',
|
||||
'Authorization',
|
||||
localVarHeaders,
|
||||
'Bearer ',
|
||||
);
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const 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/rank/rank-author`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<RankedAuthor>>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: keywordToAuthorRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.selectHeaderAccept(['application/json']);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Accept',
|
||||
localVarHttpHeaderAcceptSelected,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Static Stats
|
||||
* @endpoint post /api/rank/static-stats
|
||||
* @param authorMetricsRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public staticStatsApiRankStaticStatsPost(authorMetricsRequest: AuthorMetricsRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<AuthorStaticStats>>;
|
||||
public staticStatsApiRankStaticStatsPost(authorMetricsRequest: AuthorMetricsRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<AuthorStaticStats>>>;
|
||||
public staticStatsApiRankStaticStatsPost(authorMetricsRequest: AuthorMetricsRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<AuthorStaticStats>>>;
|
||||
public staticStatsApiRankStaticStatsPost(authorMetricsRequest: AuthorMetricsRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (authorMetricsRequest === null || authorMetricsRequest === undefined) {
|
||||
throw new Error('Required parameter authorMetricsRequest was null or undefined when calling staticStatsApiRankStaticStatsPost.');
|
||||
}
|
||||
const localVarHttpContext: HttpContext =
|
||||
options?.context ?? new HttpContext();
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.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/rank/static-stats`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<AuthorStaticStats>>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: authorMetricsRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = ['application/json'];
|
||||
const httpContentTypeSelected: string | undefined =
|
||||
this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set(
|
||||
'Content-Type',
|
||||
httpContentTypeSelected,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Topic Profile
|
||||
* @endpoint post /api/rank/topic-profile
|
||||
* @param selectedAuthorsRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public topicProfileApiRankTopicProfilePost(selectedAuthorsRequest: SelectedAuthorsRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<AuthorTopicProfile>>;
|
||||
public topicProfileApiRankTopicProfilePost(selectedAuthorsRequest: SelectedAuthorsRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<AuthorTopicProfile>>>;
|
||||
public topicProfileApiRankTopicProfilePost(selectedAuthorsRequest: SelectedAuthorsRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<AuthorTopicProfile>>>;
|
||||
public topicProfileApiRankTopicProfilePost(selectedAuthorsRequest: SelectedAuthorsRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (selectedAuthorsRequest === null || selectedAuthorsRequest === undefined) {
|
||||
throw new Error('Required parameter selectedAuthorsRequest was null or undefined when calling topicProfileApiRankTopicProfilePost.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.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/rank/topic-profile`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<AuthorTopicProfile>>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: selectedAuthorsRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (
|
||||
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||
) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Topic Stats
|
||||
* @endpoint post /api/rank/topic-stats
|
||||
* @param selectedAuthorsRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public topicStatsApiRankTopicStatsPost(selectedAuthorsRequest: SelectedAuthorsRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<AuthorTopicStats>>;
|
||||
public topicStatsApiRankTopicStatsPost(selectedAuthorsRequest: SelectedAuthorsRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<AuthorTopicStats>>>;
|
||||
public topicStatsApiRankTopicStatsPost(selectedAuthorsRequest: SelectedAuthorsRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<AuthorTopicStats>>>;
|
||||
public topicStatsApiRankTopicStatsPost(selectedAuthorsRequest: SelectedAuthorsRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (selectedAuthorsRequest === null || selectedAuthorsRequest === undefined) {
|
||||
throw new Error('Required parameter selectedAuthorsRequest was null or undefined when calling topicStatsApiRankTopicStatsPost.');
|
||||
}
|
||||
let localVarPath = `/api/rank/orientation-profiles`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<AuthorOrientationProfile>>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: authorOrientationProfilesRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// 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/rank/topic-stats`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<AuthorTopicStats>>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: selectedAuthorsRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
/**
|
||||
* Rank Author
|
||||
* @endpoint post /api/rank/rank-author
|
||||
* @param keywordToAuthorRequest
|
||||
* @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 rankAuthorApiRankRankAuthorPost(
|
||||
keywordToAuthorRequest: KeywordToAuthorRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<RankedAuthor>>;
|
||||
public rankAuthorApiRankRankAuthorPost(
|
||||
keywordToAuthorRequest: KeywordToAuthorRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<RankedAuthor>>>;
|
||||
public rankAuthorApiRankRankAuthorPost(
|
||||
keywordToAuthorRequest: KeywordToAuthorRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<RankedAuthor>>>;
|
||||
public rankAuthorApiRankRankAuthorPost(
|
||||
keywordToAuthorRequest: KeywordToAuthorRequest,
|
||||
secureFgpAcc?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (
|
||||
keywordToAuthorRequest === null ||
|
||||
keywordToAuthorRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter keywordToAuthorRequest was null or undefined when calling rankAuthorApiRankRankAuthorPost.',
|
||||
);
|
||||
}
|
||||
|
||||
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/rank/rank-author`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<RankedAuthor>>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: keywordToAuthorRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Static Stats
|
||||
* @endpoint post /api/rank/static-stats
|
||||
* @param authorMetricsRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public staticStatsApiRankStaticStatsPost(
|
||||
authorMetricsRequest: AuthorMetricsRequest,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<AuthorStaticStats>>;
|
||||
public staticStatsApiRankStaticStatsPost(
|
||||
authorMetricsRequest: AuthorMetricsRequest,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<AuthorStaticStats>>>;
|
||||
public staticStatsApiRankStaticStatsPost(
|
||||
authorMetricsRequest: AuthorMetricsRequest,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<AuthorStaticStats>>>;
|
||||
public staticStatsApiRankStaticStatsPost(
|
||||
authorMetricsRequest: AuthorMetricsRequest,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (authorMetricsRequest === null || authorMetricsRequest === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter authorMetricsRequest was null or undefined when calling staticStatsApiRankStaticStatsPost.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.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/rank/static-stats`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<AuthorStaticStats>>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: authorMetricsRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Topic Profile
|
||||
* @endpoint post /api/rank/topic-profile
|
||||
* @param selectedAuthorsRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public topicProfileApiRankTopicProfilePost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<AuthorTopicProfile>>;
|
||||
public topicProfileApiRankTopicProfilePost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<AuthorTopicProfile>>>;
|
||||
public topicProfileApiRankTopicProfilePost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<AuthorTopicProfile>>>;
|
||||
public topicProfileApiRankTopicProfilePost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (
|
||||
selectedAuthorsRequest === null ||
|
||||
selectedAuthorsRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter selectedAuthorsRequest was null or undefined when calling topicProfileApiRankTopicProfilePost.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.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/rank/topic-profile`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<AuthorTopicProfile>>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: selectedAuthorsRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Topic Stats
|
||||
* @endpoint post /api/rank/topic-stats
|
||||
* @param selectedAuthorsRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public topicStatsApiRankTopicStatsPost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<AuthorTopicStats>>;
|
||||
public topicStatsApiRankTopicStatsPost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<AuthorTopicStats>>>;
|
||||
public topicStatsApiRankTopicStatsPost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<AuthorTopicStats>>>;
|
||||
public topicStatsApiRankTopicStatsPost(
|
||||
selectedAuthorsRequest: SelectedAuthorsRequest,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (
|
||||
selectedAuthorsRequest === null ||
|
||||
selectedAuthorsRequest === undefined
|
||||
) {
|
||||
throw new Error(
|
||||
'Required parameter selectedAuthorsRequest was null or undefined when calling topicStatsApiRankTopicStatsPost.',
|
||||
);
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||
options?.httpHeaderAccept ??
|
||||
this.configuration.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/rank/topic-stats`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<AuthorTopicStats>>(
|
||||
'post',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: selectedAuthorsRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,13 @@ import { Observable } from 'rxjs';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { SortDirection } from '../model/sortDirection';
|
||||
// @ts-ignore
|
||||
import { Topic } from '../model/topic';
|
||||
// @ts-ignore
|
||||
import { TopicPageV2 } from '../model/topicPageV2';
|
||||
// @ts-ignore
|
||||
import { TopicSortBy } from '../model/topicSortBy';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
@@ -94,6 +100,61 @@ export class TopicsV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a topic for a given topic ID.
|
||||
* @endpoint get /api/topics/v2/single/{raw_oa_topic_id}
|
||||
* @param rawOaTopicId The ID of the topic 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 getTopicById(rawOaTopicId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Topic>;
|
||||
public getTopicById(rawOaTopicId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Topic>>;
|
||||
public getTopicById(rawOaTopicId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Topic>>;
|
||||
public getTopicById(rawOaTopicId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (rawOaTopicId === null || rawOaTopicId === undefined) {
|
||||
throw new Error('Required parameter rawOaTopicId was null or undefined when calling getTopicById.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | '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/single/${this.configuration.encodeParam({name: "rawOaTopicId", value: rawOaTopicId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Topic>('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.
|
||||
* @endpoint get /api/topics/v2/topics/id
|
||||
@@ -155,4 +216,73 @@ export class TopicsV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches for topics based on the provided criteria.
|
||||
* @endpoint get /api/topics/v2/search
|
||||
* @param searchTerm The term to search for in topic display names.
|
||||
* @param page The page number to retrieve.
|
||||
* @param size The number of topics to retrieve per page.
|
||||
* @param sortBy The field to sort by.
|
||||
* @param sortDirection The direction to sort.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchTopics(searchTerm?: string, page?: number, size?: number, sortBy?: TopicSortBy, sortDirection?: SortDirection, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<TopicPageV2>;
|
||||
public searchTopics(searchTerm?: string, page?: number, size?: number, sortBy?: TopicSortBy, sortDirection?: SortDirection, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<TopicPageV2>>;
|
||||
public searchTopics(searchTerm?: string, page?: number, size?: number, sortBy?: TopicSortBy, sortDirection?: SortDirection, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<TopicPageV2>>;
|
||||
public searchTopics(searchTerm?: string, page?: number, size?: number, sortBy?: TopicSortBy, sortDirection?: SortDirection, 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>searchTerm, 'search_term');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>size, 'size');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortBy, 'sort_by');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortDirection, 'sort_direction');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/topics/v2/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<TopicPageV2>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -399,6 +399,114 @@ export class WorksV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a paginated list of works for a given topic based on its ID.
|
||||
* @endpoint get /api/works/v2/topic/{raw_oa_topic_id}
|
||||
* @param rawOaTopicId The raw OpenAlex topic id.
|
||||
* @param page The page number to retrieve. (0-based)
|
||||
* @param size The number of works to retrieve per page.
|
||||
* @param title A title to filter by (partial matches allowed).
|
||||
* @param publicationYears A list of publication years to filter by.
|
||||
* @param publicationTypes A list of publication types to filter by.
|
||||
* @param authorIds A list of author IDs to filter by.
|
||||
* @param institutionIds A list of institution IDs to filter by.
|
||||
* @param languageCodes A list of language codes to filter by.
|
||||
* @param sortBy The field to sort by.
|
||||
* @param sortOrder The order to sort by.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getTopicWorkPage(rawOaTopicId: string, page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorkPageV2>;
|
||||
public getTopicWorkPage(rawOaTopicId: string, page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkPageV2>>;
|
||||
public getTopicWorkPage(rawOaTopicId: string, page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkPageV2>>;
|
||||
public getTopicWorkPage(rawOaTopicId: string, page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (rawOaTopicId === null || rawOaTopicId === undefined) {
|
||||
throw new Error('Required parameter rawOaTopicId was null or undefined when calling getTopicWorkPage.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>page, 'page');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>size, 'size');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>title, 'title');
|
||||
if (publicationYears) {
|
||||
publicationYears.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_years');
|
||||
})
|
||||
}
|
||||
if (publicationTypes) {
|
||||
publicationTypes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_types');
|
||||
})
|
||||
}
|
||||
if (authorIds) {
|
||||
authorIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'author_ids');
|
||||
})
|
||||
}
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'institution_ids');
|
||||
})
|
||||
}
|
||||
if (languageCodes) {
|
||||
languageCodes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'language_codes');
|
||||
})
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortBy, 'sort_by');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortOrder, 'sort_order');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/works/v2/topic/${this.configuration.encodeParam({name: "rawOaTopicId", value: rawOaTopicId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<WorkPageV2>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the classifications of a work based on its ID.
|
||||
* @endpoint get /api/works/v2/classification/work/{raw_oa_work_id}
|
||||
@@ -670,4 +778,115 @@ export class WorksV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search works with filters.
|
||||
* @endpoint get /api/works/v2/search
|
||||
* @param page The page number to retrieve. (0-based)
|
||||
* @param size The number of works to retrieve per page.
|
||||
* @param title A title to filter by (partial matches allowed).
|
||||
* @param publicationYears A list of publication years to filter by.
|
||||
* @param publicationTypes A list of publication types to filter by.
|
||||
* @param authorIds A list of author IDs to filter by.
|
||||
* @param institutionIds A list of institution IDs to filter by.
|
||||
* @param topicIds A list of topic IDs to filter by.
|
||||
* @param languageCodes A list of language codes to filter by.
|
||||
* @param sortBy The field to sort by.
|
||||
* @param sortOrder The order to sort by.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchWorks(page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorkPageV2>;
|
||||
public searchWorks(page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkPageV2>>;
|
||||
public searchWorks(page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkPageV2>>;
|
||||
public searchWorks(page?: number, size?: number, title?: string, publicationYears?: Array<number>, publicationTypes?: Array<string>, authorIds?: Array<string>, institutionIds?: Array<string>, topicIds?: Array<string>, languageCodes?: Array<string>, sortBy?: WorkSortBy, sortOrder?: SortDirection, 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>size, 'size');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>title, 'title');
|
||||
if (publicationYears) {
|
||||
publicationYears.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_years');
|
||||
})
|
||||
}
|
||||
if (publicationTypes) {
|
||||
publicationTypes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'publication_types');
|
||||
})
|
||||
}
|
||||
if (authorIds) {
|
||||
authorIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'author_ids');
|
||||
})
|
||||
}
|
||||
if (institutionIds) {
|
||||
institutionIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'institution_ids');
|
||||
})
|
||||
}
|
||||
if (topicIds) {
|
||||
topicIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'topic_ids');
|
||||
})
|
||||
}
|
||||
if (languageCodes) {
|
||||
languageCodes.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>element, 'language_codes');
|
||||
})
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortBy, 'sort_by');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>sortOrder, 'sort_order');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/works/v2/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<WorkPageV2>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { AuthorOrientationProfileStatus } from './authorOrientationProfileStatus';
|
||||
import { WorkPrimaryCategory } from './workPrimaryCategory';
|
||||
|
||||
/**
|
||||
* Aggregated research-orientation result for one selected author.
|
||||
*/
|
||||
export interface AuthorOrientationProfile {
|
||||
/**
|
||||
* The full OpenAlex author ID.
|
||||
*/
|
||||
author_id: string;
|
||||
status: AuthorOrientationProfileStatus;
|
||||
orientation_score?: number | null;
|
||||
primary_category_counts?: Partial<Record<WorkPrimaryCategory, number>> | null;
|
||||
classified_work_count?: number | null;
|
||||
scored_work_count?: number | null;
|
||||
}
|
||||
export namespace AuthorOrientationProfile {}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
export const AuthorOrientationProfileStatus = {
|
||||
available: 'available',
|
||||
insufficient_scored_publications: 'insufficient_scored_publications',
|
||||
no_classified_publications: 'no_classified_publications',
|
||||
no_orientation_score: 'no_orientation_score',
|
||||
restricted: 'restricted',
|
||||
} as const;
|
||||
export type AuthorOrientationProfileStatus =
|
||||
(typeof AuthorOrientationProfileStatus)[keyof typeof AuthorOrientationProfileStatus];
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Timespan } from './timespan';
|
||||
import { PublicationType } from './publicationType';
|
||||
|
||||
/**
|
||||
* Filters used to compare the research orientation of selected authors.
|
||||
*/
|
||||
export interface AuthorOrientationProfilesRequest {
|
||||
/**
|
||||
* One to four unique OpenAlex author IDs.
|
||||
*/
|
||||
author_ids: Array<string>;
|
||||
/**
|
||||
* Optional publication-type filter. Empty means all types.
|
||||
*/
|
||||
publication_types?: Array<PublicationType>;
|
||||
timespan?: Timespan | null;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
department?: string | null;
|
||||
department_fullname?: string | null;
|
||||
name?: string | null;
|
||||
recepient?: string | null;
|
||||
municipality?: string | null;
|
||||
place?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { BundInstitutionSummary } from './bundInstitutionSummary';
|
||||
|
||||
/**
|
||||
* A paginated response containing a list of institutions.
|
||||
*/
|
||||
export interface BundInstitutionSummaryPage {
|
||||
/**
|
||||
* The elements of the page.
|
||||
*/
|
||||
elements?: Array<BundInstitutionSummary>;
|
||||
/**
|
||||
* The page number. (0-based)
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* The page size in elements.
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* The total number of elements.
|
||||
*/
|
||||
total?: number;
|
||||
}
|
||||
@@ -1,57 +1,57 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { Topic } from './topic';
|
||||
|
||||
/**
|
||||
* Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types.
|
||||
*/
|
||||
export interface BundProjectDetails {
|
||||
/**
|
||||
* The ID of the Bund project
|
||||
*/
|
||||
id: string;
|
||||
funding_reference?: string | null;
|
||||
title?: string | null;
|
||||
description?: string | null;
|
||||
joint_project?: string | null;
|
||||
funding_type?: string | null;
|
||||
funding_profile?: string | null;
|
||||
funding_amount?: number | null;
|
||||
funding_start_date?: string | null;
|
||||
funding_end_date?: string | null;
|
||||
duration?: string | null;
|
||||
performance_plan_code?: string | null;
|
||||
performance_plan_fullname?: string | null;
|
||||
executing_agency?: string | null;
|
||||
funding_recipient?: string | null;
|
||||
project_agency?: string | null;
|
||||
project_agency_fullname?: string | null;
|
||||
department?: string | null;
|
||||
department_fullname?: string | null;
|
||||
division?: string | null;
|
||||
location?: string | null;
|
||||
municipality?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
municipality_code?: string | null;
|
||||
publication_date?: string | null;
|
||||
is_new?: boolean | null;
|
||||
record_date?: string | null;
|
||||
unix_timestamp?: number | null;
|
||||
/**
|
||||
* All persons associated with the Bund project (from nested Arb object)
|
||||
*/
|
||||
associated_persons?: Array<string>;
|
||||
/**
|
||||
* All institutions associated with the Bund project
|
||||
*/
|
||||
institutions?: Array<string>;
|
||||
export interface BundProjectDetails {
|
||||
/**
|
||||
* The ID of the Bund project
|
||||
*/
|
||||
id: string;
|
||||
funding_reference?: string | null;
|
||||
title?: string | null;
|
||||
description?: string | null;
|
||||
joint_project?: string | null;
|
||||
funding_type?: string | null;
|
||||
funding_profile?: string | null;
|
||||
funding_amount?: number | null;
|
||||
funding_start_date?: string | null;
|
||||
funding_end_date?: string | null;
|
||||
duration?: string | null;
|
||||
performance_plan_code?: string | null;
|
||||
performance_plan_fullname?: string | null;
|
||||
executing_agency?: string | null;
|
||||
funding_recipient?: string | null;
|
||||
project_agency?: string | null;
|
||||
project_agency_fullname?: string | null;
|
||||
department?: string | null;
|
||||
department_fullname?: string | null;
|
||||
division?: string | null;
|
||||
location?: string | null;
|
||||
municipality?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
municipality_code?: string | null;
|
||||
publication_date?: string | null;
|
||||
is_new?: boolean | null;
|
||||
record_date?: string | null;
|
||||
unix_timestamp?: number | null;
|
||||
/**
|
||||
* All persons associated with the Bund project (from nested Arb object)
|
||||
*/
|
||||
associated_persons?: Array<string>;
|
||||
/**
|
||||
* All institutions associated with the Bund project
|
||||
*/
|
||||
institutions?: Array<string>;
|
||||
oa_topics?: Array<Topic> | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Topic } from './topic';
|
||||
import { BundInstitutionSummary } from './bundInstitutionSummary';
|
||||
|
||||
|
||||
export interface BundProjectSummary {
|
||||
funding_code?: string | null;
|
||||
department?: string | null;
|
||||
department_fullname?: string | null;
|
||||
referat?: string | null;
|
||||
project_sponsor?: string | null;
|
||||
project_sponsor_fullname?: string | null;
|
||||
work_unit?: string | null;
|
||||
recipient?: string | null;
|
||||
municipal_code?: string | null;
|
||||
municipality?: string | null;
|
||||
place?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
implementing_agency?: string | null;
|
||||
topic?: string | null;
|
||||
performance_plan_system?: string | null;
|
||||
performance_plan_system_text?: string | null;
|
||||
funding_start?: string | null;
|
||||
funding_end?: string | null;
|
||||
grant_amount?: number | null;
|
||||
funding_profile?: string | null;
|
||||
joint_project?: string | null;
|
||||
funding_type?: string | null;
|
||||
publication_date?: string | null;
|
||||
unix_timestamp?: number | null;
|
||||
date?: string | null;
|
||||
'new'?: boolean | null;
|
||||
duration?: string | null;
|
||||
oa_topics?: Array<Topic> | null;
|
||||
export interface BundProjectSummary {
|
||||
funding_code?: string | null;
|
||||
department?: string | null;
|
||||
department_fullname?: string | null;
|
||||
referat?: string | null;
|
||||
project_sponsor?: string | null;
|
||||
project_sponsor_fullname?: string | null;
|
||||
work_unit?: string | null;
|
||||
recipient?: string | null;
|
||||
municipal_code?: string | null;
|
||||
municipality?: string | null;
|
||||
place?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
implementing_agency?: string | null;
|
||||
topic?: string | null;
|
||||
performance_plan_system?: string | null;
|
||||
performance_plan_system_text?: string | null;
|
||||
funding_start?: string | null;
|
||||
funding_end?: string | null;
|
||||
grant_amount?: number | null;
|
||||
funding_profile?: string | null;
|
||||
joint_project?: string | null;
|
||||
funding_type?: string | null;
|
||||
publication_date?: string | null;
|
||||
unix_timestamp?: number | null;
|
||||
date?: string | null;
|
||||
new?: boolean | null;
|
||||
duration?: string | null;
|
||||
oa_topics?: Array<Topic> | null;
|
||||
institution?: BundInstitutionSummary | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,82 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { DfgProjectPersonRole } from './dfgProjectPersonRole';
|
||||
import { DfgProjectSubprojectSummary } from './dfgProjectSubprojectSummary';
|
||||
import { DfgProjectInstitutionRole } from './dfgProjectInstitutionRole';
|
||||
import { DfgProjectSubjectArea } from './dfgProjectSubjectArea';
|
||||
import { Topic } from './topic';
|
||||
import { DfgProjectPublicationSummary } from './dfgProjectPublicationSummary';
|
||||
|
||||
/**
|
||||
* Clean summary model for a DFG project, consolidating all person roles and institution references into unified lists.
|
||||
* Clean, enriched summary model for a DFG project.
|
||||
*/
|
||||
export interface DfgProjectDetails {
|
||||
/**
|
||||
* The ID of the DFG project
|
||||
*/
|
||||
id: string;
|
||||
link?: string | null;
|
||||
title?: string | null;
|
||||
description?: string | null;
|
||||
project_identifier?: string | null;
|
||||
funding_start_date?: string | null;
|
||||
funding_end_date?: string | null;
|
||||
dfg_procedure?: string | null;
|
||||
subject_area?: string | null;
|
||||
funding_type?: string | null;
|
||||
international_reference?: string | null;
|
||||
website?: string | null;
|
||||
/**
|
||||
* All persons associated with the DFG project (any role)
|
||||
*/
|
||||
associated_persons?: Array<string>;
|
||||
/**
|
||||
* All institutions associated with the DFG project
|
||||
*/
|
||||
institutions?: Array<string>;
|
||||
subproject_of?: string | null;
|
||||
export interface DfgProjectDetails {
|
||||
id?: number | null;
|
||||
link?: string | null;
|
||||
page_url?: string | null;
|
||||
external_link?: string | null;
|
||||
title_de?: string | null;
|
||||
title_en?: string | null;
|
||||
description_de?: string | null;
|
||||
description_en?: string | null;
|
||||
final_report_abstract_de?: string | null;
|
||||
final_report_abstract_en?: string | null;
|
||||
project_identifier_de?: string | null;
|
||||
project_identifier_en?: string | null;
|
||||
funding_start?: number | null;
|
||||
funding_end?: number | null;
|
||||
funding_period_de?: string | null;
|
||||
funding_period_en?: string | null;
|
||||
funding_type_de?: string | null;
|
||||
funding_type_en?: string | null;
|
||||
funding_type_key?: string | null;
|
||||
dfg_procedure?: string | null;
|
||||
is_transfer_project?: boolean | null;
|
||||
website_html_de?: string | null;
|
||||
website_html_en?: string | null;
|
||||
equipment_group?: string | null;
|
||||
equipment_name?: string | null;
|
||||
subject_area_de?: string | null;
|
||||
subject_area_en?: string | null;
|
||||
/**
|
||||
* Detailed DFG subject-area classification entries (Fachsystematik)
|
||||
*/
|
||||
subject_classifications?: Array<DfgProjectSubjectArea>;
|
||||
international_relation_de?: string | null;
|
||||
international_relation_en?: string | null;
|
||||
/**
|
||||
* All persons associated with the project, each with their role
|
||||
*/
|
||||
persons?: Array<DfgProjectPersonRole>;
|
||||
/**
|
||||
* All institutions associated with the project, each with their role
|
||||
*/
|
||||
institutions?: Array<DfgProjectInstitutionRole>;
|
||||
/**
|
||||
* Flat, de-duplicated list of all person full names (convenience view)
|
||||
*/
|
||||
associated_persons?: Array<string>;
|
||||
/**
|
||||
* Flat, de-duplicated list of all institution names (convenience view)
|
||||
*/
|
||||
associated_institutions?: Array<string>;
|
||||
parent_project_id?: number | null;
|
||||
parent_title_de?: string | null;
|
||||
parent_title_en?: string | null;
|
||||
/**
|
||||
* Sub-projects of this project, if any
|
||||
*/
|
||||
subprojects?: Array<DfgProjectSubprojectSummary>;
|
||||
/**
|
||||
* Publications resulting from the project
|
||||
*/
|
||||
publications?: Array<DfgProjectPublicationSummary>;
|
||||
topics?: Array<Topic> | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* An institution associated with the project, together with its role.
|
||||
*/
|
||||
export interface DfgProjectInstitutionRole {
|
||||
institute_id?: number | null;
|
||||
name_de?: string | null;
|
||||
name_en?: string | null;
|
||||
role_key?: string | null;
|
||||
role_label_de?: string | null;
|
||||
role_label_en?: string | null;
|
||||
is_dissolved?: boolean | null;
|
||||
is_head?: boolean | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* A person associated with the project, together with their role.
|
||||
*/
|
||||
export interface DfgProjectPersonRole {
|
||||
person_id?: number | null;
|
||||
full_name?: string | null;
|
||||
orcid_id?: string | null;
|
||||
role_key?: string | null;
|
||||
role_label_de?: string | null;
|
||||
role_label_en?: string | null;
|
||||
affiliation_de?: string | null;
|
||||
affiliation_en?: string | null;
|
||||
is_deceased?: boolean | null;
|
||||
is_head?: boolean | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* A lightweight reference to a publication resulting from the project.
|
||||
*/
|
||||
export interface DfgProjectPublicationSummary {
|
||||
publication_id?: number | null;
|
||||
title?: string | null;
|
||||
authors_editors?: string | null;
|
||||
doi?: string | null;
|
||||
publication_year?: number | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* A single subject-area classification entry (DFG \'Fachsystematik\').
|
||||
*/
|
||||
export interface DfgProjectSubjectArea {
|
||||
fach?: string | null;
|
||||
fachgebiet?: string | null;
|
||||
fachkollegium?: string | null;
|
||||
wissenschaftsbereich?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* A lightweight reference to a sub-project of this project.
|
||||
*/
|
||||
export interface DfgProjectSubprojectSummary {
|
||||
subproject_id?: number | null;
|
||||
title_de?: string | null;
|
||||
title_en?: string | null;
|
||||
short_title?: string | null;
|
||||
role_label_de?: string | null;
|
||||
person_full_name?: string | null;
|
||||
status_de?: string | null;
|
||||
funding_start?: number | null;
|
||||
funding_end?: number | null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -13,6 +13,7 @@ import { HEUOrganization } from './hEUOrganization';
|
||||
import { HEUPublication } from './hEUPublication';
|
||||
import { Fp7WebLink } from './fp7WebLink';
|
||||
import { HEUWebLink } from './hEUWebLink';
|
||||
import { AuthorPage } from './authorPage';
|
||||
import { HEUDeliverable } from './hEUDeliverable';
|
||||
import { Fp7ProjectIPR } from './fp7ProjectIPR';
|
||||
import { HEUEurosciVoc } from './hEUEurosciVoc';
|
||||
@@ -21,51 +22,52 @@ import { HEULegalBasis } from './hEULegalBasis';
|
||||
import { HEUTopic } from './hEUTopic';
|
||||
import { Fp7ReportSummary } from './fp7ReportSummary';
|
||||
import { HEUReportSummary } from './hEUReportSummary';
|
||||
import { Topic } from './topic';
|
||||
import { HEUProjectDetails } from './hEUProjectDetails';
|
||||
|
||||
|
||||
/**
|
||||
* The project data
|
||||
*/
|
||||
export interface EuProjectData {
|
||||
acronym?: string;
|
||||
contentUpdateDate?: string;
|
||||
ecMaxContribution?: number;
|
||||
ecSignatureDate?: string;
|
||||
endDate?: string;
|
||||
frameworkProgramme?: string;
|
||||
fundingScheme?: string;
|
||||
grantDoi?: string;
|
||||
humanValidated?: boolean;
|
||||
id?: string;
|
||||
keywords?: string;
|
||||
legalBasis?: string;
|
||||
masterCall?: string;
|
||||
nature?: string;
|
||||
objective?: string;
|
||||
rcn?: string;
|
||||
startDate?: string;
|
||||
status?: string;
|
||||
subCall?: string;
|
||||
title?: string;
|
||||
topics?: string;
|
||||
totalCost?: number;
|
||||
organizations?: Array<HEUOrganization>;
|
||||
publications?: Array<HEUPublication>;
|
||||
iprs?: Array<Fp7ProjectIPR>;
|
||||
report_summaries?: Array<Fp7ReportSummary>;
|
||||
topicsList?: Array<HEUTopic>;
|
||||
web_links?: Array<Fp7WebLink>;
|
||||
eurosciVoc?: Array<HEUEurosciVoc>;
|
||||
legalBasisList?: Array<HEULegalBasis>;
|
||||
organizationCount?: number;
|
||||
publicationCount?: number;
|
||||
iprCount?: number;
|
||||
deliverables?: Array<HEUDeliverable>;
|
||||
reportSummaries?: Array<HEUReportSummary>;
|
||||
webLinks?: Array<HEUWebLink>;
|
||||
ercPrincipalInvestigators?: Array<H2020ErcPI>;
|
||||
deliverableCount?: number;
|
||||
ercPiCount?: number;
|
||||
export interface EuProjectData {
|
||||
acronym?: string;
|
||||
contentUpdateDate?: string;
|
||||
ecMaxContribution?: number;
|
||||
ecSignatureDate?: string;
|
||||
endDate?: string;
|
||||
frameworkProgramme?: string;
|
||||
fundingScheme?: string;
|
||||
grantDoi?: string;
|
||||
humanValidated?: boolean;
|
||||
id?: string;
|
||||
keywords?: string;
|
||||
legalBasis?: string;
|
||||
masterCall?: string;
|
||||
nature?: string;
|
||||
objective?: string;
|
||||
rcn?: string;
|
||||
startDate?: string;
|
||||
status?: string;
|
||||
subCall?: string;
|
||||
title?: string;
|
||||
topics?: string;
|
||||
totalCost?: number;
|
||||
organizations?: Array<HEUOrganization>;
|
||||
publications?: Array<HEUPublication>;
|
||||
iprs?: Array<Fp7ProjectIPR>;
|
||||
report_summaries?: Array<Fp7ReportSummary>;
|
||||
topicsList?: Array<HEUTopic>;
|
||||
web_links?: Array<Fp7WebLink>;
|
||||
eurosciVoc?: Array<HEUEurosciVoc>;
|
||||
legalBasisList?: Array<HEULegalBasis>;
|
||||
organizationCount?: number;
|
||||
publicationCount?: number;
|
||||
iprCount?: number;
|
||||
oaTopics?: Array<Topic>;
|
||||
oaAuthors?: AuthorPage;
|
||||
deliverables?: Array<HEUDeliverable>;
|
||||
reportSummaries?: Array<HEUReportSummary>;
|
||||
webLinks?: Array<HEUWebLink>;
|
||||
ercPrincipalInvestigators?: Array<H2020ErcPI>;
|
||||
deliverableCount?: number;
|
||||
ercPiCount?: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -12,47 +12,49 @@ import { Fp7WebLink } from './fp7WebLink';
|
||||
import { Fp7Publication } from './fp7Publication';
|
||||
import { Fp7ReportSummary } from './fp7ReportSummary';
|
||||
import { Fp7Topic } from './fp7Topic';
|
||||
import { AuthorPage } from './authorPage';
|
||||
import { Fp7ProjectIPR } from './fp7ProjectIPR';
|
||||
import { Topic } from './topic';
|
||||
import { Fp7Organization } from './fp7Organization';
|
||||
import { Fp7LegalBasis } from './fp7LegalBasis';
|
||||
|
||||
|
||||
/**
|
||||
* Comprehensive FP7 Project model combining all related entities. This model extends the base Fp7Project with all associated data.
|
||||
*/
|
||||
export interface Fp7ProjectDetails {
|
||||
acronym?: string | null;
|
||||
contentUpdateDate?: string | null;
|
||||
ecMaxContribution?: number | null;
|
||||
ecSignatureDate?: string | null;
|
||||
endDate?: string | null;
|
||||
frameworkProgramme?: string | null;
|
||||
fundingScheme?: string | null;
|
||||
grantDoi?: string | null;
|
||||
humanValidated?: boolean | null;
|
||||
id?: string | null;
|
||||
keywords?: string | null;
|
||||
legalBasis?: string | null;
|
||||
masterCall?: string | null;
|
||||
nature?: string | null;
|
||||
objective?: string | null;
|
||||
rcn?: string | null;
|
||||
startDate?: string | null;
|
||||
status?: string | null;
|
||||
subCall?: string | null;
|
||||
title?: string | null;
|
||||
topics?: string | null;
|
||||
totalCost?: number | null;
|
||||
organizations?: Array<Fp7Organization> | null;
|
||||
publications?: Array<Fp7Publication> | null;
|
||||
iprs?: Array<Fp7ProjectIPR> | null;
|
||||
report_summaries?: Array<Fp7ReportSummary> | null;
|
||||
topicsList?: Array<Fp7Topic> | null;
|
||||
web_links?: Array<Fp7WebLink> | null;
|
||||
eurosciVoc?: Array<Fp7EurosciVoc> | null;
|
||||
legalBasisList?: Array<Fp7LegalBasis> | null;
|
||||
organizationCount?: number | null;
|
||||
publicationCount?: number | null;
|
||||
iprCount?: number | null;
|
||||
export interface Fp7ProjectDetails {
|
||||
acronym?: string | null;
|
||||
contentUpdateDate?: string | null;
|
||||
ecMaxContribution?: number | null;
|
||||
ecSignatureDate?: string | null;
|
||||
endDate?: string | null;
|
||||
frameworkProgramme?: string | null;
|
||||
fundingScheme?: string | null;
|
||||
grantDoi?: string | null;
|
||||
humanValidated?: boolean | null;
|
||||
id?: string | null;
|
||||
keywords?: string | null;
|
||||
legalBasis?: string | null;
|
||||
masterCall?: string | null;
|
||||
nature?: string | null;
|
||||
objective?: string | null;
|
||||
rcn?: string | null;
|
||||
startDate?: string | null;
|
||||
status?: string | null;
|
||||
subCall?: string | null;
|
||||
title?: string | null;
|
||||
topics?: string | null;
|
||||
totalCost?: number | null;
|
||||
organizations?: Array<Fp7Organization> | null;
|
||||
publications?: Array<Fp7Publication> | null;
|
||||
iprs?: Array<Fp7ProjectIPR> | null;
|
||||
report_summaries?: Array<Fp7ReportSummary> | null;
|
||||
topicsList?: Array<Fp7Topic> | null;
|
||||
web_links?: Array<Fp7WebLink> | null;
|
||||
eurosciVoc?: Array<Fp7EurosciVoc> | null;
|
||||
legalBasisList?: Array<Fp7LegalBasis> | null;
|
||||
organizationCount?: number | null;
|
||||
publicationCount?: number | null;
|
||||
iprCount?: number | null;
|
||||
oaTopics?: Array<Topic> | null;
|
||||
oaAuthors?: AuthorPage | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -11,51 +11,53 @@ import { H2020LegalBasis } from './h2020LegalBasis';
|
||||
import { H2020ErcPI } from './h2020ErcPI';
|
||||
import { H2020Deliverable } from './h2020Deliverable';
|
||||
import { H2020WebLink } from './h2020WebLink';
|
||||
import { AuthorPage } from './authorPage';
|
||||
import { H2020Publication } from './h2020Publication';
|
||||
import { H2020ReportSummary } from './h2020ReportSummary';
|
||||
import { H2020Topic } from './h2020Topic';
|
||||
import { H2020EurosciVoc } from './h2020EurosciVoc';
|
||||
import { Topic } from './topic';
|
||||
import { H2020Organization } from './h2020Organization';
|
||||
|
||||
|
||||
/**
|
||||
* Comprehensive Horizon 2020 Project model combining all related entities. This model extends the base H2020Project with all associated data.
|
||||
*/
|
||||
export interface H2020ProjectDetails {
|
||||
acronym?: string | null;
|
||||
contentUpdateDate?: string | null;
|
||||
ecMaxContribution?: number | null;
|
||||
ecSignatureDate?: string | null;
|
||||
endDate?: string | null;
|
||||
frameworkProgramme?: string | null;
|
||||
fundingScheme?: string | null;
|
||||
grantDoi?: string | null;
|
||||
humanValidated?: boolean | null;
|
||||
id?: string | null;
|
||||
keywords?: string | null;
|
||||
legalBasis?: string | null;
|
||||
masterCall?: string | null;
|
||||
nature?: string | null;
|
||||
objective?: string | null;
|
||||
rcn?: string | null;
|
||||
startDate?: string | null;
|
||||
status?: string | null;
|
||||
subCall?: string | null;
|
||||
title?: string | null;
|
||||
topics?: string | null;
|
||||
totalCost?: number | null;
|
||||
organizations?: Array<H2020Organization> | null;
|
||||
publications?: Array<H2020Publication> | null;
|
||||
deliverables?: Array<H2020Deliverable> | null;
|
||||
reportSummaries?: Array<H2020ReportSummary> | null;
|
||||
topicsList?: Array<H2020Topic> | null;
|
||||
webLinks?: Array<H2020WebLink> | null;
|
||||
eurosciVoc?: Array<H2020EurosciVoc> | null;
|
||||
legalBasisList?: Array<H2020LegalBasis> | null;
|
||||
ercPrincipalInvestigators?: Array<H2020ErcPI> | null;
|
||||
organizationCount?: number | null;
|
||||
publicationCount?: number | null;
|
||||
deliverableCount?: number | null;
|
||||
ercPiCount?: number | null;
|
||||
export interface H2020ProjectDetails {
|
||||
acronym?: string | null;
|
||||
contentUpdateDate?: string | null;
|
||||
ecMaxContribution?: number | null;
|
||||
ecSignatureDate?: string | null;
|
||||
endDate?: string | null;
|
||||
frameworkProgramme?: string | null;
|
||||
fundingScheme?: string | null;
|
||||
grantDoi?: string | null;
|
||||
humanValidated?: boolean | null;
|
||||
id?: string | null;
|
||||
keywords?: string | null;
|
||||
legalBasis?: string | null;
|
||||
masterCall?: string | null;
|
||||
nature?: string | null;
|
||||
objective?: string | null;
|
||||
rcn?: string | null;
|
||||
startDate?: string | null;
|
||||
status?: string | null;
|
||||
subCall?: string | null;
|
||||
title?: string | null;
|
||||
topics?: string | null;
|
||||
totalCost?: number | null;
|
||||
organizations?: Array<H2020Organization> | null;
|
||||
publications?: Array<H2020Publication> | null;
|
||||
deliverables?: Array<H2020Deliverable> | null;
|
||||
reportSummaries?: Array<H2020ReportSummary> | null;
|
||||
topicsList?: Array<H2020Topic> | null;
|
||||
webLinks?: Array<H2020WebLink> | null;
|
||||
eurosciVoc?: Array<H2020EurosciVoc> | null;
|
||||
legalBasisList?: Array<H2020LegalBasis> | null;
|
||||
ercPrincipalInvestigators?: Array<H2020ErcPI> | null;
|
||||
organizationCount?: number | null;
|
||||
publicationCount?: number | null;
|
||||
deliverableCount?: number | null;
|
||||
ercPiCount?: number | null;
|
||||
oaTopics?: Array<Topic> | null;
|
||||
oaAuthors?: AuthorPage | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -12,47 +12,49 @@ import { HEUOrganization } from './hEUOrganization';
|
||||
import { HEUTopic } from './hEUTopic';
|
||||
import { HEUPublication } from './hEUPublication';
|
||||
import { HEUWebLink } from './hEUWebLink';
|
||||
import { AuthorPage } from './authorPage';
|
||||
import { HEUReportSummary } from './hEUReportSummary';
|
||||
import { HEUDeliverable } from './hEUDeliverable';
|
||||
import { Topic } from './topic';
|
||||
import { HEUEurosciVoc } from './hEUEurosciVoc';
|
||||
|
||||
|
||||
/**
|
||||
* Comprehensive Horizon Europe Project model combining all related entities. This model extends the base HEUProject with all associated data.
|
||||
*/
|
||||
export interface HEUProjectDetails {
|
||||
acronym?: string | null;
|
||||
contentUpdateDate?: string | null;
|
||||
ecMaxContribution?: number | null;
|
||||
ecSignatureDate?: string | null;
|
||||
endDate?: string | null;
|
||||
frameworkProgramme?: string | null;
|
||||
fundingScheme?: string | null;
|
||||
grantDoi?: string | null;
|
||||
humanValidated?: boolean | null;
|
||||
id?: string | null;
|
||||
keywords?: string | null;
|
||||
legalBasis?: string | null;
|
||||
masterCall?: string | null;
|
||||
nature?: string | null;
|
||||
objective?: string | null;
|
||||
rcn?: string | null;
|
||||
startDate?: string | null;
|
||||
status?: string | null;
|
||||
subCall?: string | null;
|
||||
title?: string | null;
|
||||
topics?: string | null;
|
||||
totalCost?: number | null;
|
||||
organizations?: Array<HEUOrganization> | null;
|
||||
publications?: Array<HEUPublication> | null;
|
||||
deliverables?: Array<HEUDeliverable> | null;
|
||||
reportSummaries?: Array<HEUReportSummary> | null;
|
||||
topicsList?: Array<HEUTopic> | null;
|
||||
webLinks?: Array<HEUWebLink> | null;
|
||||
eurosciVoc?: Array<HEUEurosciVoc> | null;
|
||||
legalBasisList?: Array<HEULegalBasis> | null;
|
||||
organizationCount?: number | null;
|
||||
publicationCount?: number | null;
|
||||
deliverableCount?: number | null;
|
||||
export interface HEUProjectDetails {
|
||||
acronym?: string | null;
|
||||
contentUpdateDate?: string | null;
|
||||
ecMaxContribution?: number | null;
|
||||
ecSignatureDate?: string | null;
|
||||
endDate?: string | null;
|
||||
frameworkProgramme?: string | null;
|
||||
fundingScheme?: string | null;
|
||||
grantDoi?: string | null;
|
||||
humanValidated?: boolean | null;
|
||||
id?: string | null;
|
||||
keywords?: string | null;
|
||||
legalBasis?: string | null;
|
||||
masterCall?: string | null;
|
||||
nature?: string | null;
|
||||
objective?: string | null;
|
||||
rcn?: string | null;
|
||||
startDate?: string | null;
|
||||
status?: string | null;
|
||||
subCall?: string | null;
|
||||
title?: string | null;
|
||||
topics?: string | null;
|
||||
totalCost?: number | null;
|
||||
organizations?: Array<HEUOrganization> | null;
|
||||
publications?: Array<HEUPublication> | null;
|
||||
deliverables?: Array<HEUDeliverable> | null;
|
||||
reportSummaries?: Array<HEUReportSummary> | null;
|
||||
topicsList?: Array<HEUTopic> | null;
|
||||
webLinks?: Array<HEUWebLink> | null;
|
||||
eurosciVoc?: Array<HEUEurosciVoc> | null;
|
||||
legalBasisList?: Array<HEULegalBasis> | null;
|
||||
organizationCount?: number | null;
|
||||
publicationCount?: number | null;
|
||||
deliverableCount?: number | null;
|
||||
oaTopics?: Array<Topic> | null;
|
||||
oaAuthors?: AuthorPage | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ export * from './authorCountsByYearInner';
|
||||
export * from './authorIds';
|
||||
export * from './authorMetricsRequest';
|
||||
export * from './authorNode';
|
||||
export * from './authorOrientationProfile';
|
||||
export * from './authorOrientationProfileStatus';
|
||||
export * from './authorOrientationProfilesRequest';
|
||||
export * from './authorPage';
|
||||
export * from './authorParsedLongestName';
|
||||
export * from './authorPositionCount';
|
||||
@@ -32,6 +35,8 @@ export * from './bodyLogin';
|
||||
export * from './bodyRequestOtk';
|
||||
export * from './bodyRequestPasswordReset';
|
||||
export * from './bodyResetPassword';
|
||||
export * from './bundInstitutionSummary';
|
||||
export * from './bundInstitutionSummaryPage';
|
||||
export * from './bundProjectDetails';
|
||||
export * from './bundProjectPage';
|
||||
export * from './bundProjectSummary';
|
||||
@@ -62,7 +67,12 @@ export * from './dfgInstitutionSummaryPage';
|
||||
export * from './dfgPersonSummary';
|
||||
export * from './dfgPersonSummaryPage';
|
||||
export * from './dfgProjectDetails';
|
||||
export * from './dfgProjectInstitutionRole';
|
||||
export * from './dfgProjectPage';
|
||||
export * from './dfgProjectPersonRole';
|
||||
export * from './dfgProjectPublicationSummary';
|
||||
export * from './dfgProjectSubjectArea';
|
||||
export * from './dfgProjectSubprojectSummary';
|
||||
export * from './dfgProjectSummary';
|
||||
export * from './dfgProjectTopic';
|
||||
export * from './dfgProjectTopics';
|
||||
@@ -214,6 +224,7 @@ export * from './topicHeatmapTopic';
|
||||
export * from './topicHeatmapValue';
|
||||
export * from './topicIds';
|
||||
export * from './topicPageV2';
|
||||
export * from './topicSortBy';
|
||||
export * from './topicSubfield';
|
||||
export * from './topicWordCloud';
|
||||
export * from './topicWordCloudWord';
|
||||
|
||||
@@ -13,6 +13,7 @@ import { TopAuthor } from './topAuthor';
|
||||
export interface TopAuthorStatistics {
|
||||
institution_id: string;
|
||||
works: Array<TopAuthor>;
|
||||
projects: Array<TopAuthor>;
|
||||
eu_projects: Array<TopAuthor>;
|
||||
patents: Array<TopAuthor>;
|
||||
news: Array<TopAuthor>;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export const TopicSortBy = {
|
||||
DisplayName: 'display_name',
|
||||
WorksCount: 'works_count',
|
||||
CitedByCount: 'cited_by_count'
|
||||
} as const;
|
||||
export type TopicSortBy = typeof TopicSortBy[keyof typeof TopicSortBy];
|
||||
|
||||
+124
-14
@@ -35,9 +35,11 @@ import { UniTrendParentComponent } from './modules/university-ranking/uni-trend-
|
||||
import {
|
||||
RESOLVING_WORK_PAGE_FOR,
|
||||
workPageResolver,
|
||||
workQueryParamKeys,
|
||||
} from './resolvers/work-page.resolver';
|
||||
import { selectedTopicsResolver } from './resolvers/selected-topics.resolver';
|
||||
import { selectedInstitutionsResolver } from './resolvers/selected-institutions.resolver';
|
||||
import { selectedBundInstitutionsResolver } from './resolvers/selected-bund-institutions.resolver';
|
||||
import { SearchResultsStateService } from './modules/keywords-search/search-results/search-results-state.service';
|
||||
import { roleGuard } from './shared/guards/role.guard';
|
||||
import { UserRole } from './api';
|
||||
@@ -58,6 +60,11 @@ import {
|
||||
collaborationGraphQueryParamKeys,
|
||||
collaborationGraphResolver,
|
||||
} from './resolvers/collaboration-graph.resolver';
|
||||
import {
|
||||
topicPageResolver,
|
||||
topicQueryParamKeys,
|
||||
} from './resolvers/topic-page.resolver';
|
||||
import { topicResolver } from './resolvers/topic.resolver';
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
@@ -235,6 +242,20 @@ export const routes: Routes = [
|
||||
resolvingFor: RESOLVING_PROJECT_PAGE_FOR.KEYWORDS_SEARCH,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'bund',
|
||||
component: BundProjectsComponent,
|
||||
resolve: {
|
||||
bundProjectPage: bundProjectsResolver,
|
||||
selectedBundInstitutionsPage: selectedBundInstitutionsResolver,
|
||||
selectedBundAuthorsPage: selectedAuthorsResolver,
|
||||
selectedTopicsPage: selectedTopicsResolver,
|
||||
},
|
||||
runGuardsAndResolvers: 'always',
|
||||
data: {
|
||||
resolvingFor: RESOLVING_PROJECT_PAGE_FOR.KEYWORDS_SEARCH,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{ path: 'patents', component: KeywordsToPatentsResultsComponent },
|
||||
@@ -520,20 +541,6 @@ export const routes: Routes = [
|
||||
resolvingFor: RESOLVING_PROJECT_PAGE_FOR.PERSON,
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'bund',
|
||||
component: BundProjectsComponent,
|
||||
resolve: {
|
||||
bundProjectPage: bundProjectsResolver,
|
||||
selectedBundInstitutionsPage: selectedInstitutionsResolver,
|
||||
selectedBundAuthorsPage: selectedAuthorsResolver,
|
||||
selectedTopicsPage: selectedTopicsResolver,
|
||||
},
|
||||
runGuardsAndResolvers: 'always',
|
||||
data: {
|
||||
resolvingFor: RESOLVING_PROJECT_PAGE_FOR.KEYWORDS_SEARCH,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -704,6 +711,109 @@ export const routes: Routes = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'publications',
|
||||
canActivate: [
|
||||
roleGuard([
|
||||
UserRole.User,
|
||||
UserRole.Manager,
|
||||
UserRole.Admin,
|
||||
UserRole.SuperAdmin,
|
||||
]),
|
||||
],
|
||||
loadComponent: () =>
|
||||
import('./modules/publications/publications.component').then(
|
||||
(mod) => mod.PublicationsComponent,
|
||||
),
|
||||
resolve: {
|
||||
workPage: workPageResolver,
|
||||
selectedAuthorsPage: selectedAuthorsResolver,
|
||||
selectedInstitutionsPage: selectedInstitutionsResolver,
|
||||
selectedTopicsPage: selectedTopicsResolver,
|
||||
},
|
||||
data: {
|
||||
resolvingFor: RESOLVING_WORK_PAGE_FOR.PUBLICATION_SEARCH,
|
||||
},
|
||||
runGuardsAndResolvers: (from, to) => {
|
||||
return Object.values(workQueryParamKeys).some(
|
||||
(key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'topics',
|
||||
canActivate: [
|
||||
roleGuard([
|
||||
UserRole.User,
|
||||
UserRole.Manager,
|
||||
UserRole.Admin,
|
||||
UserRole.SuperAdmin,
|
||||
]),
|
||||
],
|
||||
loadComponent: () =>
|
||||
import('./modules/topics/topics.component').then(
|
||||
(mod) => mod.TopicsComponent,
|
||||
),
|
||||
resolve: {
|
||||
topicPage: topicPageResolver,
|
||||
},
|
||||
runGuardsAndResolvers: (from, to) => {
|
||||
return Object.values(topicQueryParamKeys).some((key) => {
|
||||
const fromValues = from.queryParamMap.getAll(key);
|
||||
const toValues = to.queryParamMap.getAll(key);
|
||||
return (
|
||||
fromValues.length !== toValues.length ||
|
||||
fromValues.some((value, index) => value !== toValues[index])
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'topic/:topicId',
|
||||
canActivate: [
|
||||
roleGuard([
|
||||
UserRole.User,
|
||||
UserRole.Manager,
|
||||
UserRole.Admin,
|
||||
UserRole.SuperAdmin,
|
||||
]),
|
||||
],
|
||||
loadComponent: () =>
|
||||
import('./modules/topic/topic.component').then(
|
||||
(mod) => mod.TopicComponent,
|
||||
),
|
||||
resolve: {
|
||||
topic: topicResolver,
|
||||
},
|
||||
runGuardsAndResolvers: 'paramsChange',
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'publications',
|
||||
},
|
||||
{
|
||||
path: 'publications',
|
||||
loadComponent: () =>
|
||||
import('./modules/topic-publications/topic-publications.component').then(
|
||||
(mod) => mod.TopicPublicationsComponent,
|
||||
),
|
||||
runGuardsAndResolvers: (from, to) => {
|
||||
return Object.values(workQueryParamKeys).some(
|
||||
(key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
|
||||
);
|
||||
},
|
||||
resolve: {
|
||||
workPage: workPageResolver,
|
||||
selectedAuthorsPage: selectedAuthorsResolver,
|
||||
selectedInstitutionsPage: selectedInstitutionsResolver,
|
||||
},
|
||||
data: {
|
||||
resolvingFor: RESOLVING_WORK_PAGE_FOR.TOPIC,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: 'projects',
|
||||
canActivate: [
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
import {
|
||||
Directive,
|
||||
ElementRef,
|
||||
OnDestroy,
|
||||
Injector,
|
||||
ComponentRef,
|
||||
HostListener,
|
||||
input,
|
||||
inject,
|
||||
effect,
|
||||
InputSignal,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
Overlay,
|
||||
OverlayRef,
|
||||
OverlayPositionBuilder,
|
||||
ConnectedPosition,
|
||||
} from '@angular/cdk/overlay';
|
||||
import { ComponentPortal, ComponentType } from '@angular/cdk/portal';
|
||||
|
||||
type UnwrapInputSignals<T> = {
|
||||
[K in keyof T]: T[K] extends InputSignal<infer V> ? V : T[K];
|
||||
};
|
||||
|
||||
@Directive({
|
||||
selector: '[appComponentTooltip]',
|
||||
standalone: true,
|
||||
})
|
||||
export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
readonly component = input.required<ComponentType<T>>({
|
||||
alias: 'appComponentTooltip',
|
||||
});
|
||||
readonly tooltipInputs = input<Partial<UnwrapInputSignals<T>> | null>(null);
|
||||
readonly tooltipShowDelay = input(150);
|
||||
readonly tooltipHideDelay = input(100);
|
||||
readonly tooltipDisabled = input(false);
|
||||
readonly tooltipMaxWidth = input<string | number | null>(null);
|
||||
|
||||
private readonly elementRef = inject(ElementRef);
|
||||
private readonly overlay = inject(Overlay);
|
||||
private readonly overlayPositionBuilder = inject(OverlayPositionBuilder);
|
||||
private readonly injector = inject(Injector);
|
||||
|
||||
private overlayRef: OverlayRef | null = null;
|
||||
private componentRef: ComponentRef<T> | null = null;
|
||||
private showTimeout?: ReturnType<typeof setTimeout>;
|
||||
private hideTimeout?: ReturnType<typeof setTimeout>;
|
||||
|
||||
private isOverHost = false;
|
||||
private isOverOverlay = false;
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const inputs = this.tooltipInputs();
|
||||
if (this.componentRef && inputs) {
|
||||
for (const [key, value] of Object.entries(inputs)) {
|
||||
this.componentRef.setInput(key, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
effect(() => {
|
||||
const maxWidth = this.tooltipMaxWidth();
|
||||
if (this.overlayRef?.hasAttached()) {
|
||||
this.applyMaxWidth(this.overlayRef.overlayElement, maxWidth);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@HostListener('mouseenter')
|
||||
@HostListener('focus')
|
||||
onEnter(): void {
|
||||
if (this.tooltipDisabled()) return;
|
||||
this.isOverHost = true;
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.showTimeout = setTimeout(() => this.show(), this.tooltipShowDelay());
|
||||
}
|
||||
|
||||
@HostListener('mouseleave')
|
||||
@HostListener('blur')
|
||||
onLeave(): void {
|
||||
this.isOverHost = false;
|
||||
clearTimeout(this.showTimeout);
|
||||
this.scheduleHide();
|
||||
}
|
||||
|
||||
private scheduleHide(): void {
|
||||
this.hideTimeout = setTimeout(() => {
|
||||
if (!this.isOverHost && !this.isOverOverlay) {
|
||||
this.hide();
|
||||
}
|
||||
}, this.tooltipHideDelay());
|
||||
}
|
||||
|
||||
private show(): void {
|
||||
if (this.overlayRef?.hasAttached()) return;
|
||||
|
||||
const positions: ConnectedPosition[] = [
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'top',
|
||||
overlayX: 'center',
|
||||
overlayY: 'bottom',
|
||||
offsetY: -8,
|
||||
},
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'bottom',
|
||||
overlayX: 'center',
|
||||
overlayY: 'top',
|
||||
offsetY: 8,
|
||||
},
|
||||
{
|
||||
originX: 'end',
|
||||
originY: 'center',
|
||||
overlayX: 'start',
|
||||
overlayY: 'center',
|
||||
offsetX: 8,
|
||||
},
|
||||
{
|
||||
originX: 'start',
|
||||
originY: 'center',
|
||||
overlayX: 'end',
|
||||
overlayY: 'center',
|
||||
offsetX: -8,
|
||||
},
|
||||
];
|
||||
|
||||
const positionStrategy = this.overlayPositionBuilder
|
||||
.flexibleConnectedTo(this.elementRef)
|
||||
.withPositions(positions)
|
||||
.withFlexibleDimensions(false)
|
||||
.withPush(true);
|
||||
|
||||
this.overlayRef = this.overlay.create({
|
||||
positionStrategy,
|
||||
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
||||
panelClass: 'app-tooltip-panel',
|
||||
});
|
||||
|
||||
const portal = new ComponentPortal(this.component(), null, this.injector);
|
||||
this.componentRef = this.overlayRef.attach(portal);
|
||||
|
||||
const inputs = this.tooltipInputs();
|
||||
if (inputs) {
|
||||
for (const [key, value] of Object.entries(inputs)) {
|
||||
this.componentRef!.setInput(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
const overlayElement = this.overlayRef.overlayElement;
|
||||
this.applyMaxWidth(overlayElement, this.tooltipMaxWidth());
|
||||
|
||||
overlayElement.addEventListener('mouseenter', this.onOverlayEnter);
|
||||
overlayElement.addEventListener('mouseleave', this.onOverlayLeave);
|
||||
}
|
||||
|
||||
private applyMaxWidth(
|
||||
element: HTMLElement,
|
||||
maxWidth: string | number | null,
|
||||
): void {
|
||||
if (maxWidth === null) {
|
||||
element.style.maxWidth = '';
|
||||
return;
|
||||
}
|
||||
element.style.maxWidth =
|
||||
typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth;
|
||||
}
|
||||
|
||||
private readonly onOverlayEnter = (): void => {
|
||||
this.isOverOverlay = true;
|
||||
clearTimeout(this.hideTimeout);
|
||||
};
|
||||
|
||||
private readonly onOverlayLeave = (): void => {
|
||||
this.isOverOverlay = false;
|
||||
this.scheduleHide();
|
||||
};
|
||||
|
||||
private hide(): void {
|
||||
if (this.overlayRef) {
|
||||
const overlayElement = this.overlayRef.overlayElement;
|
||||
overlayElement.removeEventListener('mouseenter', this.onOverlayEnter);
|
||||
overlayElement.removeEventListener('mouseleave', this.onOverlayLeave);
|
||||
this.overlayRef.detach();
|
||||
}
|
||||
this.componentRef = null;
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.overlayRef?.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
import {
|
||||
ConnectedPosition,
|
||||
Overlay,
|
||||
OverlayPositionBuilder,
|
||||
OverlayRef,
|
||||
} from '@angular/cdk/overlay';
|
||||
import { TemplatePortal } from '@angular/cdk/portal';
|
||||
import {
|
||||
Directive,
|
||||
effect,
|
||||
ElementRef,
|
||||
HostListener,
|
||||
inject,
|
||||
input,
|
||||
OnDestroy,
|
||||
TemplateRef,
|
||||
ViewContainerRef,
|
||||
} from '@angular/core';
|
||||
|
||||
@Directive({
|
||||
selector: '[appTooltip]',
|
||||
standalone: true,
|
||||
})
|
||||
export class TooltipDirective<T> implements OnDestroy {
|
||||
readonly template = input.required<TemplateRef<T>>({ alias: 'appTooltip' });
|
||||
|
||||
readonly tooltipContext = input<T | null>(null);
|
||||
|
||||
readonly tooltipShowDelay = input<number>(150);
|
||||
|
||||
readonly tooltipHideDelay = input<number>(150);
|
||||
|
||||
readonly tooltipDisabled = input<boolean>(false);
|
||||
|
||||
private readonly elementRef = inject(ElementRef);
|
||||
private readonly overlay = inject(Overlay);
|
||||
private readonly overlayPositionBuilder = inject(OverlayPositionBuilder);
|
||||
private readonly viewContainerRef = inject(ViewContainerRef);
|
||||
|
||||
private overlayRef: OverlayRef | null = null;
|
||||
private portal: TemplatePortal<T> | null = null;
|
||||
private showTimeout?: ReturnType<typeof setTimeout>;
|
||||
private hideTimeout?: ReturnType<typeof setTimeout>;
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const context = this.tooltipContext();
|
||||
if (this.portal?.isAttached) {
|
||||
Object.assign(this.portal.context as object, context ?? {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@HostListener('mouseenter')
|
||||
@HostListener('focus')
|
||||
onEnter(): void {
|
||||
if (this.tooltipDisabled()) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.showTimeout = setTimeout(() => this.show(), this.tooltipShowDelay());
|
||||
}
|
||||
|
||||
@HostListener('mouseleave')
|
||||
@HostListener('blur')
|
||||
onLeave(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
this.hideTimeout = setTimeout(() => this.hide(), this.tooltipHideDelay());
|
||||
}
|
||||
|
||||
private show(): void {
|
||||
if (this.overlayRef?.hasAttached()) return;
|
||||
|
||||
const positions: ConnectedPosition[] = [
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'top',
|
||||
overlayX: 'center',
|
||||
overlayY: 'bottom',
|
||||
offsetY: -8,
|
||||
},
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'bottom',
|
||||
overlayX: 'center',
|
||||
overlayY: 'top',
|
||||
offsetY: 8,
|
||||
},
|
||||
{
|
||||
originX: 'end',
|
||||
originY: 'center',
|
||||
overlayX: 'start',
|
||||
overlayY: 'center',
|
||||
offsetX: 8,
|
||||
},
|
||||
{
|
||||
originX: 'start',
|
||||
originY: 'center',
|
||||
overlayX: 'end',
|
||||
overlayY: 'center',
|
||||
offsetX: -8,
|
||||
},
|
||||
];
|
||||
|
||||
const positionStrategy = this.overlayPositionBuilder
|
||||
.flexibleConnectedTo(this.elementRef)
|
||||
.withPositions(positions)
|
||||
.withFlexibleDimensions(false)
|
||||
.withPush(true);
|
||||
|
||||
this.overlayRef = this.overlay.create({
|
||||
positionStrategy,
|
||||
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
||||
panelClass: 'app-tooltip-panel',
|
||||
});
|
||||
|
||||
this.portal = new TemplatePortal(
|
||||
this.template(),
|
||||
this.viewContainerRef,
|
||||
(this.tooltipContext() ?? {}) as T,
|
||||
);
|
||||
|
||||
this.overlayRef.attach(this.portal);
|
||||
}
|
||||
|
||||
private hide(): void {
|
||||
this.overlayRef?.detach();
|
||||
this.portal = null;
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.overlayRef?.dispose();
|
||||
}
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { EChartsOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
import { WorkPrimaryCategory } from '../../../api';
|
||||
import { SUBFIELD_COLORS } from '../compare-authors-colors';
|
||||
|
||||
export interface AuthorCategoryLegendItem {
|
||||
category: WorkPrimaryCategory;
|
||||
label: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
const categoryLegendItem = (
|
||||
category: WorkPrimaryCategory,
|
||||
label: string,
|
||||
color: string,
|
||||
): AuthorCategoryLegendItem => ({
|
||||
category,
|
||||
label,
|
||||
color,
|
||||
});
|
||||
|
||||
export const AUTHOR_CATEGORY_LEGEND: readonly AuthorCategoryLegendItem[] = [
|
||||
categoryLegendItem(
|
||||
WorkPrimaryCategory.BasicResearch,
|
||||
'Grundlagenforschung',
|
||||
SUBFIELD_COLORS[0],
|
||||
),
|
||||
categoryLegendItem(
|
||||
WorkPrimaryCategory.AppliedResearch,
|
||||
'Anwendungsbasierte Forschung',
|
||||
SUBFIELD_COLORS[1],
|
||||
),
|
||||
categoryLegendItem(
|
||||
WorkPrimaryCategory.ExperimentalDevelopment,
|
||||
'Experimentelle Entwicklung',
|
||||
SUBFIELD_COLORS[2],
|
||||
),
|
||||
categoryLegendItem(
|
||||
WorkPrimaryCategory.NonResearch,
|
||||
'Nicht-forschende Tätigkeit',
|
||||
SUBFIELD_COLORS[3],
|
||||
),
|
||||
categoryLegendItem(
|
||||
WorkPrimaryCategory.NotClassified,
|
||||
'Nicht klassifiziert',
|
||||
SUBFIELD_COLORS[4],
|
||||
),
|
||||
];
|
||||
|
||||
@Component({
|
||||
selector: 'app-author-category-pie',
|
||||
standalone: true,
|
||||
imports: [NgxEchartsDirective],
|
||||
template: '<div echarts class="category-chart" [options]="options()"></div>',
|
||||
styles: `
|
||||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.category-chart {
|
||||
width: 100%;
|
||||
height: 220px;
|
||||
}
|
||||
`,
|
||||
})
|
||||
export class AuthorCategoryPieComponent {
|
||||
counts = input<Partial<Record<WorkPrimaryCategory, number>> | null>(null);
|
||||
|
||||
readonly total = computed(() =>
|
||||
Object.values(this.counts() ?? {}).reduce(
|
||||
(sum, count) => sum + Math.max(0, count),
|
||||
0,
|
||||
),
|
||||
);
|
||||
|
||||
readonly options = computed<EChartsOption>(() => {
|
||||
const counts = this.counts() ?? {};
|
||||
const total = this.total();
|
||||
const textColor = this.cssColor('--sg-text', '#0f172a');
|
||||
const mutedColor = this.cssColor('--sg-text-muted', '#64748b');
|
||||
|
||||
return {
|
||||
animation: false,
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
formatter: '{b}: {c} Publikationen ({d} %)',
|
||||
},
|
||||
graphic: {
|
||||
type: 'text',
|
||||
left: 'center',
|
||||
top: 'middle',
|
||||
silent: true,
|
||||
style: {
|
||||
text: `{value|${total}}\n{label|klassifiziert}`,
|
||||
textAlign: 'center',
|
||||
textVerticalAlign: 'middle',
|
||||
rich: {
|
||||
value: {
|
||||
fill: textColor,
|
||||
fontSize: 22,
|
||||
fontWeight: 700,
|
||||
lineHeight: 23,
|
||||
},
|
||||
label: {
|
||||
fill: mutedColor,
|
||||
fontSize: 11,
|
||||
fontWeight: 600,
|
||||
lineHeight: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: 'pie',
|
||||
radius: ['40%', '70%'],
|
||||
center: ['50%', '50%'],
|
||||
avoidLabelOverlap: true,
|
||||
silent: false,
|
||||
selectedMode: false,
|
||||
padAngle: 1,
|
||||
itemStyle: {
|
||||
borderRadius: 2,
|
||||
},
|
||||
label: {
|
||||
show: false,
|
||||
},
|
||||
labelLine: { show: false },
|
||||
emphasis: {
|
||||
scale: true,
|
||||
scaleSize: 6,
|
||||
},
|
||||
data: AUTHOR_CATEGORY_LEGEND.map((item) => ({
|
||||
name: item.label,
|
||||
value: Math.max(0, counts[item.category] ?? 0),
|
||||
itemStyle: { color: item.color },
|
||||
})).filter((item) => item.value > 0),
|
||||
},
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
private cssColor(variable: string, fallback: string): string {
|
||||
if (typeof getComputedStyle !== 'function') {
|
||||
return fallback;
|
||||
}
|
||||
return (
|
||||
getComputedStyle(document.documentElement)
|
||||
.getPropertyValue(variable)
|
||||
.trim() || fallback
|
||||
);
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
@if (visible()) {
|
||||
<mat-card appearance="outlined" class="research-profile-card">
|
||||
<mat-card-header class="profile-header">
|
||||
<mat-icon class="profile-icon">science</mat-icon>
|
||||
<div class="profile-heading">
|
||||
<mat-card-title>Forschungsprofil</mat-card-title>
|
||||
<mat-card-subtitle>
|
||||
Vergleich der Forschungsorientierung
|
||||
</mat-card-subtitle>
|
||||
</div>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-card-content>
|
||||
<section aria-labelledby="category-distribution-title">
|
||||
<h3 id="category-distribution-title" class="section-title">
|
||||
Verteilung der Forschungskategorien
|
||||
</h3>
|
||||
|
||||
<div class="author-grid">
|
||||
@for (view of views(); track view.author.authorId) {
|
||||
<mat-card appearance="outlined" class="author-card">
|
||||
<mat-card-header class="author-header">
|
||||
<div class="author-heading">
|
||||
<span
|
||||
class="author-color"
|
||||
[style.background]="view.author.color"></span>
|
||||
<mat-card-title>{{ view.author.name }}</mat-card-title>
|
||||
</div>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-card-content class="distribution-content">
|
||||
@if (hasCategoryData(view.profile)) {
|
||||
<app-author-category-pie
|
||||
[counts]="view.profile.primary_category_counts ?? null" />
|
||||
} @else {
|
||||
<p class="status-label distribution-status">
|
||||
{{ categoryStatusLabel(view.profile) }}
|
||||
</p>
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
</div>
|
||||
|
||||
<mat-chip-set class="category-legend" aria-label="Forschungskategorien">
|
||||
@for (item of categoryLegend; track item.category) {
|
||||
<mat-chip class="legend-chip" [style.--legend-color]="item.color">
|
||||
<span class="legend-color" [style.background]="item.color"></span>
|
||||
{{ item.label }}
|
||||
</mat-chip>
|
||||
}
|
||||
</mat-chip-set>
|
||||
</section>
|
||||
|
||||
<mat-divider class="section-divider"></mat-divider>
|
||||
|
||||
<section aria-labelledby="average-score-title">
|
||||
<h3 id="average-score-title" class="section-title">
|
||||
Durchschnittlicher Orientierungsscore
|
||||
</h3>
|
||||
|
||||
<div class="author-grid">
|
||||
@for (view of views(); track view.author.authorId) {
|
||||
<mat-card appearance="outlined" class="author-card">
|
||||
<mat-card-header class="author-header">
|
||||
<div class="author-heading">
|
||||
<span
|
||||
class="author-color"
|
||||
[style.background]="view.author.color"></span>
|
||||
<mat-card-title>{{ view.author.name }}</mat-card-title>
|
||||
</div>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-card-content class="score-content">
|
||||
<app-orientation-gauge
|
||||
[score]="view.profile.orientation_score ?? null" />
|
||||
|
||||
@if (hasLowScoreSample(view.profile)) {
|
||||
<mat-card
|
||||
appearance="outlined"
|
||||
class="warning-note"
|
||||
[style.--warning-border]="lowSampleTokens.border"
|
||||
[style.--warning-background]="lowSampleTokens.background"
|
||||
[style.--warning-text]="lowSampleTokens.color">
|
||||
<span>Geringe Datengrundlage</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
[matTooltip]="lowScoreSampleTooltip(view.profile)"
|
||||
matTooltipPosition="above"
|
||||
aria-label="Erläuterung zur Datengrundlage">
|
||||
info_outline
|
||||
</mat-icon>
|
||||
</mat-card>
|
||||
} @else if (!isAvailable(view.profile)) {
|
||||
<p class="status-label">
|
||||
{{ statusLabel(view.profile.status) }}
|
||||
</p>
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.research-profile-card {
|
||||
border-color: var(--sg-border);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 24px rgb(15 23 42 / 4%);
|
||||
}
|
||||
|
||||
.profile-header {
|
||||
align-items: center;
|
||||
padding: 20px 22px 16px;
|
||||
}
|
||||
|
||||
.profile-icon {
|
||||
flex: 0 0 30px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin: 0 12px 0 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.profile-heading {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
mat-card-title {
|
||||
color: var(--sg-text);
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
mat-card-subtitle {
|
||||
margin: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.research-profile-card > mat-card-content {
|
||||
padding: 10px 22px 22px;
|
||||
}
|
||||
|
||||
section {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin: 8px 0 12px;
|
||||
color: var(--sg-text);
|
||||
font-size: 15px;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.author-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.author-card {
|
||||
min-width: 0;
|
||||
border-color: var(--sg-border);
|
||||
background: var(--sg-surface);
|
||||
}
|
||||
|
||||
.author-header {
|
||||
align-items: center;
|
||||
min-height: 52px;
|
||||
padding: 14px 16px 4px;
|
||||
}
|
||||
|
||||
.author-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.author-heading mat-card-title {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.author-color {
|
||||
flex: 0 0 auto;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.distribution-content,
|
||||
.score-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 0 16px 16px;
|
||||
}
|
||||
|
||||
.distribution-content {
|
||||
justify-content: center;
|
||||
min-height: 232px;
|
||||
}
|
||||
|
||||
.score-content {
|
||||
min-height: 220px;
|
||||
}
|
||||
|
||||
.score-content app-orientation-gauge {
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
.category-legend {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.legend-chip {
|
||||
--mdc-chip-elevated-container-color: color-mix(
|
||||
in srgb,
|
||||
var(--legend-color) 10%,
|
||||
var(--sg-surface)
|
||||
);
|
||||
--mdc-chip-label-text-color: var(--legend-color);
|
||||
--mdc-chip-outline-color: color-mix(
|
||||
in srgb,
|
||||
var(--legend-color) 28%,
|
||||
transparent
|
||||
);
|
||||
|
||||
border: 1px solid color-mix(in srgb, var(--legend-color) 28%, transparent);
|
||||
}
|
||||
|
||||
.legend-color {
|
||||
display: inline-block;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
margin-right: 6px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.section-divider {
|
||||
margin: 22px 0 18px;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 34px;
|
||||
margin: 20px 0 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.warning-note {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 42px;
|
||||
margin-top: 12px;
|
||||
padding: 9px 12px;
|
||||
border-color: var(--warning-border);
|
||||
border-radius: 12px;
|
||||
background: var(--warning-background);
|
||||
color: var(--warning-text);
|
||||
box-shadow: none;
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.warning-note .info-icon {
|
||||
flex: 0 0 auto;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: inherit;
|
||||
font-size: 16px;
|
||||
line-height: 16px;
|
||||
opacity: 0.7;
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.distribution-status {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.research-profile-card > mat-card-header,
|
||||
.research-profile-card > mat-card-content {
|
||||
padding-right: 16px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.author-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import {
|
||||
AuthorOrientationProfile,
|
||||
AuthorOrientationProfileStatus,
|
||||
} from '../../../api';
|
||||
import { OrientationGaugeComponent } from '../../../shared/ui/orientation-gauge/orientation-gauge.component';
|
||||
import { topicChipColorTokens } from '../../../shared/ui/topic-chip/topic-chip.component';
|
||||
import {
|
||||
AUTHOR_CATEGORY_LEGEND,
|
||||
AuthorCategoryPieComponent,
|
||||
} from './author-category-pie.component';
|
||||
|
||||
export interface ResearchProfileAuthor {
|
||||
authorId: string;
|
||||
name: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
interface AuthorOrientationView {
|
||||
author: ResearchProfileAuthor;
|
||||
profile: AuthorOrientationProfile;
|
||||
}
|
||||
|
||||
const LOW_SAMPLE_MAX_WORKS = 4;
|
||||
const LOW_SAMPLE_TOKENS = topicChipColorTokens('orange');
|
||||
|
||||
@Component({
|
||||
selector: 'app-author-research-profile',
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCardModule,
|
||||
MatChipsModule,
|
||||
MatDividerModule,
|
||||
MatIconModule,
|
||||
MatTooltipModule,
|
||||
AuthorCategoryPieComponent,
|
||||
OrientationGaugeComponent,
|
||||
],
|
||||
templateUrl: './author-research-profile.component.html',
|
||||
styleUrl: './author-research-profile.component.scss',
|
||||
})
|
||||
export class AuthorResearchProfileComponent {
|
||||
authors = input.required<ResearchProfileAuthor[]>();
|
||||
profiles = input.required<AuthorOrientationProfile[]>();
|
||||
loading = input(false);
|
||||
readonly categoryLegend = AUTHOR_CATEGORY_LEGEND;
|
||||
readonly lowSampleTokens = LOW_SAMPLE_TOKENS;
|
||||
|
||||
readonly views = computed<AuthorOrientationView[]>(() => {
|
||||
const profilesById = new Map(
|
||||
this.profiles().map((profile) => [profile.author_id, profile]),
|
||||
);
|
||||
return this.authors()
|
||||
.map((author) => {
|
||||
const profile = profilesById.get(author.authorId);
|
||||
return profile ? { author, profile } : null;
|
||||
})
|
||||
.filter((view): view is AuthorOrientationView => view !== null);
|
||||
});
|
||||
|
||||
readonly visible = computed(() => {
|
||||
const profiles = this.profiles();
|
||||
const profilesWithoutClassifiedWorks = profiles.filter(
|
||||
(profile) => (profile.classified_work_count ?? 0) === 0,
|
||||
).length;
|
||||
|
||||
return (
|
||||
!this.loading() &&
|
||||
profiles.length >= 2 &&
|
||||
profilesWithoutClassifiedWorks < 3
|
||||
);
|
||||
});
|
||||
|
||||
statusLabel(status: AuthorOrientationProfileStatus): string {
|
||||
switch (status) {
|
||||
case AuthorOrientationProfileStatus.insufficient_scored_publications:
|
||||
return 'Zu wenige Publikationen für einen Orientierungsscore';
|
||||
case AuthorOrientationProfileStatus.no_classified_publications:
|
||||
return 'Keine klassifizierten Publikationen';
|
||||
case AuthorOrientationProfileStatus.no_orientation_score:
|
||||
return 'Kein Orientierungsscore verfügbar';
|
||||
case AuthorOrientationProfileStatus.restricted:
|
||||
return 'Orientierungsscore nicht verfügbar';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
isAvailable(profile: AuthorOrientationProfile): boolean {
|
||||
return profile.status === AuthorOrientationProfileStatus.available;
|
||||
}
|
||||
|
||||
hasLowScoreSample(profile: AuthorOrientationProfile): boolean {
|
||||
const scoredWorkCount = profile.scored_work_count ?? 0;
|
||||
return (
|
||||
profile.orientation_score != null &&
|
||||
scoredWorkCount > 0 &&
|
||||
scoredWorkCount <= LOW_SAMPLE_MAX_WORKS
|
||||
);
|
||||
}
|
||||
|
||||
lowScoreSampleTooltip(profile: AuthorOrientationProfile): string {
|
||||
const scoredWorkCount = profile.scored_work_count ?? 0;
|
||||
const publicationLabel =
|
||||
scoredWorkCount === 1
|
||||
? 'einer Publikation'
|
||||
: `${scoredWorkCount} Publikationen`;
|
||||
return `Der Orientierungsscore basiert auf nur ${publicationLabel} und ist daher nur eingeschränkt aussagekräftig.`;
|
||||
}
|
||||
|
||||
hasCategoryData(profile: AuthorOrientationProfile): boolean {
|
||||
return Object.values(profile.primary_category_counts ?? {}).some(
|
||||
(count) => count > 0,
|
||||
);
|
||||
}
|
||||
|
||||
categoryStatusLabel(profile: AuthorOrientationProfile): string {
|
||||
if (profile.status === AuthorOrientationProfileStatus.restricted) {
|
||||
return 'Forschungsprofil nicht verfügbar';
|
||||
}
|
||||
if (
|
||||
profile.status ===
|
||||
AuthorOrientationProfileStatus.no_classified_publications
|
||||
) {
|
||||
return 'Keine klassifizierten Publikationen';
|
||||
}
|
||||
return 'Keine Kategoriedaten verfügbar';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
export const AUTHOR_COLORS = ['#1565c0', '#e6550d', '#2ca02c', '#9467bd'];
|
||||
|
||||
export const SUBFIELD_COLORS = [
|
||||
'#2563eb',
|
||||
'#16a34a',
|
||||
'#d97706',
|
||||
'#7c3aed',
|
||||
'#0891b2',
|
||||
'#db2777',
|
||||
'#65a30d',
|
||||
'#b45309',
|
||||
];
|
||||
|
||||
export const OTHER_COLOR = '#9ca3af';
|
||||
@@ -97,6 +97,11 @@
|
||||
<p class="compare-hint">Keine Daten für das Themenprofil.</p>
|
||||
}
|
||||
</section>
|
||||
|
||||
<app-author-research-profile
|
||||
[authors]="researchProfileAuthors()"
|
||||
[profiles]="orientationProfiles()"
|
||||
[loading]="orientationProfilesLoading()" />
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import { EChartsOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
|
||||
import {
|
||||
AuthorOrientationProfile,
|
||||
AuthorOrientationProfilesRequest,
|
||||
AuthorStaticStats,
|
||||
AuthorTopicProfile,
|
||||
AuthorTopicStats,
|
||||
@@ -13,19 +15,16 @@ import {
|
||||
RankingService,
|
||||
SelectedAuthorsRequest,
|
||||
} from '../../api';
|
||||
import {
|
||||
AuthorResearchProfileComponent,
|
||||
ResearchProfileAuthor,
|
||||
} from './author-research-profile/author-research-profile.component';
|
||||
import {
|
||||
AUTHOR_COLORS,
|
||||
OTHER_COLOR,
|
||||
SUBFIELD_COLORS,
|
||||
} from './compare-authors-colors';
|
||||
|
||||
const AUTHOR_COLORS = ['#1565c0', '#e6550d', '#2ca02c', '#9467bd'];
|
||||
const SUBFIELD_COLORS = [
|
||||
'#2563eb',
|
||||
'#16a34a',
|
||||
'#d97706',
|
||||
'#7c3aed',
|
||||
'#0891b2',
|
||||
'#db2777',
|
||||
'#65a30d',
|
||||
'#b45309',
|
||||
];
|
||||
const OTHER_COLOR = '#9ca3af';
|
||||
const SUBFIELD_LIMIT = 5;
|
||||
|
||||
interface AuthorSummary {
|
||||
@@ -110,7 +109,13 @@ interface SegmentDef {
|
||||
@Component({
|
||||
selector: 'app-compare-authors',
|
||||
standalone: true,
|
||||
imports: [DecimalPipe, NgTemplateOutlet, MatIconModule, NgxEchartsDirective],
|
||||
imports: [
|
||||
DecimalPipe,
|
||||
NgTemplateOutlet,
|
||||
MatIconModule,
|
||||
NgxEchartsDirective,
|
||||
AuthorResearchProfileComponent,
|
||||
],
|
||||
templateUrl: './compare-authors.component.html',
|
||||
styleUrl: './compare-authors.component.scss',
|
||||
})
|
||||
@@ -129,7 +134,9 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
readonly staticStats = signal<AuthorStaticStats[]>([]);
|
||||
// section 3: topic profile over ALL works of each author
|
||||
readonly profile = signal<AuthorTopicProfile[]>([]);
|
||||
readonly orientationProfiles = signal<AuthorOrientationProfile[]>([]);
|
||||
readonly profileLoading = signal(false);
|
||||
readonly orientationProfilesLoading = signal(false);
|
||||
readonly loading = signal(false);
|
||||
|
||||
// maps both sections onto one row per author, in the requested order
|
||||
@@ -357,6 +364,14 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
.filter((p): p is AuthorTopicProfile => p !== undefined);
|
||||
});
|
||||
|
||||
readonly researchProfileAuthors = computed<ResearchProfileAuthor[]>(() => {
|
||||
return this.summary().map((author) => ({
|
||||
authorId: author.authorId,
|
||||
name: author.name,
|
||||
color: author.color,
|
||||
}));
|
||||
});
|
||||
|
||||
// colours the author names on the chart axes like the legend chips
|
||||
private authorAxisLabel(profiles: AuthorTopicProfile[]) {
|
||||
const rich: Record<string, { color: string; fontWeight: number }> = {};
|
||||
@@ -657,6 +672,11 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
publication_types: publication_types,
|
||||
timespan: timespan,
|
||||
};
|
||||
const orientationRequest: AuthorOrientationProfilesRequest = {
|
||||
author_ids: fullIds,
|
||||
publication_types: publication_types,
|
||||
timespan: timespan,
|
||||
};
|
||||
|
||||
// section 1: topic-filtered works stats
|
||||
this.loading.set(true);
|
||||
@@ -698,6 +718,23 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
this.staticStats.set([]);
|
||||
},
|
||||
});
|
||||
|
||||
if (fullIds.length >= 2) {
|
||||
this.orientationProfilesLoading.set(true);
|
||||
this.rankingService
|
||||
.orientationProfilesApiRankOrientationProfilesPost(orientationRequest)
|
||||
.subscribe({
|
||||
next: (results) => {
|
||||
this.orientationProfiles.set(results);
|
||||
this.orientationProfilesLoading.set(false);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this.orientationProfiles.set([]);
|
||||
this.orientationProfilesLoading.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private parseList(raw: string): string[] {
|
||||
|
||||
@@ -5,7 +5,10 @@ import { Observable } from 'rxjs';
|
||||
import { Configuration } from '../../api';
|
||||
import { TopicTreemapData } from '../../shared/ui/topic-treemap/topic-treemap.models';
|
||||
|
||||
export type TopAuthorsWorksPeriod = 'all_time' | 'last_5_years';
|
||||
export interface DashboardPeriodBounds {
|
||||
fromYear?: number;
|
||||
toYear?: number;
|
||||
}
|
||||
|
||||
export interface DashboardStatistics {
|
||||
institution_id: string;
|
||||
@@ -41,6 +44,14 @@ export interface BmbfProjectStatusStatistics {
|
||||
completed: number;
|
||||
}
|
||||
|
||||
export interface DfgProjectStatusStatistics {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
ongoing: number;
|
||||
upcoming: number;
|
||||
completed: number;
|
||||
}
|
||||
|
||||
export interface DfgProjectTopic {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -67,6 +78,7 @@ export interface TopAuthor {
|
||||
export interface TopAuthorStatistics {
|
||||
institution_id: string;
|
||||
works: TopAuthor[];
|
||||
projects: TopAuthor[];
|
||||
eu_projects: TopAuthor[];
|
||||
patents: TopAuthor[];
|
||||
news: TopAuthor[];
|
||||
@@ -94,9 +106,12 @@ export class DashboardStatisticsService {
|
||||
);
|
||||
}
|
||||
|
||||
getPublicationCount(): Observable<DashboardStatisticValue> {
|
||||
getPublicationCount(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/publications`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -106,56 +121,84 @@ export class DashboardStatisticsService {
|
||||
);
|
||||
}
|
||||
|
||||
getPatentCount(): Observable<DashboardStatisticValue> {
|
||||
getPatentCount(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/patents`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getEuProjectCount(): Observable<DashboardStatisticValue> {
|
||||
getEuProjectCount(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/eu`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getEuProjectStatuses(): Observable<EuProjectStatusStatistics> {
|
||||
getEuProjectStatuses(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<EuProjectStatusStatistics> {
|
||||
return this.httpClient.get<EuProjectStatusStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/projects/eu/status`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getBmbfProjectStatuses(): Observable<BmbfProjectStatusStatistics> {
|
||||
getBmbfProjectStatuses(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<BmbfProjectStatusStatistics> {
|
||||
return this.httpClient.get<BmbfProjectStatusStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/projects/bmbf/status`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getBmbfProjectCount(): Observable<DashboardStatisticValue> {
|
||||
getDfgProjectStatuses(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<DfgProjectStatusStatistics> {
|
||||
return this.httpClient.get<DfgProjectStatusStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/projects/dfg/status`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getBmbfProjectCount(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/bmbf`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getDfgProjectCount(): Observable<DashboardStatisticValue> {
|
||||
getDfgProjectCount(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<DashboardStatisticValue> {
|
||||
return this.httpClient.get<DashboardStatisticValue>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/statistics/projects/dfg`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getDfgProjectTopics(): Observable<DfgProjectTopics> {
|
||||
getDfgProjectTopics(
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<DfgProjectTopics> {
|
||||
return this.httpClient.get<DfgProjectTopics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/projects/dfg/topics`,
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
getTopAuthors(
|
||||
worksPeriod: TopAuthorsWorksPeriod = 'all_time',
|
||||
period: DashboardPeriodBounds = {},
|
||||
): Observable<TopAuthorStatistics> {
|
||||
return this.httpClient.get<TopAuthorStatistics>(
|
||||
`${this.apiConfiguration?.basePath ?? ''}/api/dashboard/top-authors`,
|
||||
{
|
||||
params: { works_period: worksPeriod },
|
||||
},
|
||||
{ params: this.periodParams(period) },
|
||||
);
|
||||
}
|
||||
|
||||
@@ -186,4 +229,13 @@ export class DashboardStatisticsService {
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
private periodParams(
|
||||
period: DashboardPeriodBounds,
|
||||
): Record<string, number> {
|
||||
const params: Record<string, number> = {};
|
||||
if (period.fromYear !== undefined) params['from_year'] = period.fromYear;
|
||||
if (period.toYear !== undefined) params['to_year'] = period.toYear;
|
||||
return params;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,37 @@
|
||||
<div class="dashboard-wrapper">
|
||||
<section class="dashboard-period-filter" aria-label="Dashboard-Zeitraum">
|
||||
<div class="dashboard-period-presets">
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="dashboardPeriodMode === 'all_time'"
|
||||
(click)="setDashboardPeriodMode('all_time')">
|
||||
Alle Zeiten
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="dashboardPeriodMode === 'last_10_years'"
|
||||
(click)="setDashboardPeriodMode('last_10_years')">
|
||||
Letzte 10 Jahre
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="dashboardPeriodMode === 'last_5_years'"
|
||||
(click)="setDashboardPeriodMode('last_5_years')">
|
||||
Letzte 5 Jahre
|
||||
</button>
|
||||
</div>
|
||||
<div class="dashboard-period-slider">
|
||||
<app-year-range-slider
|
||||
[minYear]="topicTreemapMinYear"
|
||||
[maxYear]="topicTreemapMaxYear"
|
||||
[(startYear)]="dashboardFromYear"
|
||||
[(endYear)]="dashboardToYear"
|
||||
(startYearChange)="onDashboardPeriodRangeChange()"
|
||||
(endYearChange)="onDashboardPeriodRangeChange()">
|
||||
</app-year-range-slider>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="statistics-grid" aria-label="Kennzahlen">
|
||||
<a
|
||||
class="statistics-card"
|
||||
@@ -132,20 +165,22 @@
|
||||
@if (
|
||||
euProjectStatusesLoading ||
|
||||
bmbfProjectStatusesLoading ||
|
||||
dfgProjectStatusesLoading ||
|
||||
euProjectStatusesError ||
|
||||
bmbfProjectStatusesError ||
|
||||
(euProjectStatuses && bmbfProjectStatuses)
|
||||
dfgProjectStatusesError ||
|
||||
(euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses)
|
||||
) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>Projektstatus nach Fördergeber</h2>
|
||||
<p>
|
||||
Laufende, kommende und abgeschlossene EU- und Bund-Projekte Ihrer
|
||||
Organisation.
|
||||
Laufende, kommende und abgeschlossene EU-, Bund- und DFG-Projekte
|
||||
Ihrer Organisation.
|
||||
</p>
|
||||
</div>
|
||||
@if (euProjectStatuses && bmbfProjectStatuses) {
|
||||
@if (euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses) {
|
||||
<div class="project-status-summary">
|
||||
<span>
|
||||
EU:
|
||||
@@ -163,11 +198,23 @@
|
||||
bmbfProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
<span>
|
||||
DFG:
|
||||
{{
|
||||
dfgProjectStatuses.ongoing +
|
||||
dfgProjectStatuses.upcoming +
|
||||
dfgProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</header>
|
||||
|
||||
@if (euProjectStatusesLoading || bmbfProjectStatusesLoading) {
|
||||
@if (
|
||||
euProjectStatusesLoading ||
|
||||
bmbfProjectStatusesLoading ||
|
||||
dfgProjectStatusesLoading
|
||||
) {
|
||||
<div class="project-status-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="Projektstatus wird geladen …"
|
||||
@@ -175,14 +222,22 @@
|
||||
size="64"
|
||||
diameter="64"></app-loading>
|
||||
</div>
|
||||
} @else if (euProjectStatusesError || bmbfProjectStatusesError) {
|
||||
} @else if (
|
||||
euProjectStatusesError ||
|
||||
bmbfProjectStatusesError ||
|
||||
dfgProjectStatusesError
|
||||
) {
|
||||
<p class="statistics-error">
|
||||
Der Status der EU- und Bund-Projekte konnte nicht geladen werden.
|
||||
Der Status der EU-, Bund- und DFG-Projekte konnte nicht geladen
|
||||
werden.
|
||||
</p>
|
||||
} @else if (euProjectStatuses && bmbfProjectStatuses) {
|
||||
} @else if (
|
||||
euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses
|
||||
) {
|
||||
<app-eu-project-status-chart
|
||||
[statuses]="euProjectStatuses"
|
||||
[bmbfStatuses]="bmbfProjectStatuses"></app-eu-project-status-chart>
|
||||
[bmbfStatuses]="bmbfProjectStatuses"
|
||||
[dfgStatuses]="dfgProjectStatuses"></app-eu-project-status-chart>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@@ -194,16 +249,6 @@
|
||||
<h2>Field Treemap</h2>
|
||||
<p>Publikationen Ihrer Organisation nach Field.</p>
|
||||
</div>
|
||||
<div class="topic-treemap-year-slider">
|
||||
<app-year-range-slider
|
||||
[minYear]="topicTreemapMinYear"
|
||||
[maxYear]="topicTreemapMaxYear"
|
||||
[(startYear)]="topicTreemapFromYear"
|
||||
[(endYear)]="topicTreemapToYear"
|
||||
(startYearChange)="onTopicTreemapRangeChange()"
|
||||
(endYearChange)="onTopicTreemapRangeChange()">
|
||||
</app-year-range-slider>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (topicTreemapLoading) {
|
||||
@@ -270,22 +315,8 @@
|
||||
<section class="top-authors-section">
|
||||
<header class="top-authors-header">
|
||||
<div>
|
||||
<h2>Top 10 Personen aller Zeiten</h2>
|
||||
<p>Nach Anzahl der Works, Patente und News Ihrer Organisation.</p>
|
||||
</div>
|
||||
<div class="top-authors-period-toggle" aria-label="Works-Zeitraum">
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="topAuthorsWorksPeriod === 'all_time'"
|
||||
(click)="setTopAuthorsWorksPeriod('all_time')">
|
||||
Alle Zeiten
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="topAuthorsWorksPeriod === 'last_5_years'"
|
||||
(click)="setTopAuthorsWorksPeriod('last_5_years')">
|
||||
Letzte 5 Jahre
|
||||
</button>
|
||||
<h2>Top 10 Personen</h2>
|
||||
<p>Nach Anzahl der Works, DFG-Projekte, Patente und News Ihrer Organisation.</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -312,13 +343,18 @@
|
||||
<div class="author-bar-label">
|
||||
@if (entry.id) {
|
||||
<a
|
||||
class="author-link"
|
||||
[routerLink]="['/person', entry.id, 'overview']"
|
||||
[title]="entry.name">
|
||||
{{ entry.name }}
|
||||
class="author-name author-link"
|
||||
[routerLink]="authorLink(dataset, entry)"
|
||||
[queryParams]="authorQueryParams(dataset, entry)"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</a>
|
||||
} @else {
|
||||
<span [title]="entry.name">{{ entry.name }}</span>
|
||||
<span
|
||||
class="author-name"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</span>
|
||||
}
|
||||
<strong>{{ entry.count | number }}</strong>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,46 @@
|
||||
font-family: 'Inter', sans-serif;
|
||||
color: #333;
|
||||
|
||||
.dashboard-period-filter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-bottom: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.dashboard-period-presets {
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
flex: 0 0 auto;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
|
||||
button {
|
||||
padding: 0.55rem 0.8rem;
|
||||
border: 0;
|
||||
border-right: 1px solid #cbd5e1;
|
||||
background: transparent;
|
||||
color: #334155;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
|
||||
&.active {
|
||||
background: #1d4ed8;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
button:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard-period-slider {
|
||||
width: min(100%, 34rem);
|
||||
}
|
||||
|
||||
.statistics-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||
@@ -134,10 +174,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.topic-treemap-year-slider {
|
||||
width: min(100%, 34rem);
|
||||
}
|
||||
|
||||
.topic-heatmap-loading {
|
||||
min-height: 25rem;
|
||||
display: grid;
|
||||
@@ -194,38 +230,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.top-authors-period-toggle {
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 6px;
|
||||
background: #fff;
|
||||
|
||||
button {
|
||||
padding: 0.55rem 0.8rem;
|
||||
border: 0;
|
||||
border-right: 1px solid #cbd5e1;
|
||||
background: transparent;
|
||||
color: #334155;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
|
||||
&:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
background: #1d4ed8;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 3px solid #93c5fd;
|
||||
outline-offset: -3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.top-authors-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
@@ -281,8 +285,10 @@
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 0.85rem;
|
||||
|
||||
span {
|
||||
.author-name {
|
||||
overflow: hidden;
|
||||
color: #1d4ed8;
|
||||
font-weight: 600;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@@ -290,8 +296,6 @@
|
||||
|
||||
.author-link {
|
||||
overflow: hidden;
|
||||
color: #1d4ed8;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
@@ -19,14 +19,15 @@ import {
|
||||
} from './topic-wordcloud-dialog/topic-wordcloud-dialog.component';
|
||||
import {
|
||||
BmbfProjectStatusStatistics,
|
||||
DashboardPeriodBounds,
|
||||
DashboardStatisticValue,
|
||||
DashboardStatistics,
|
||||
DashboardStatisticsService,
|
||||
DfgProjectStatusStatistics,
|
||||
DfgProjectTopics,
|
||||
EuProjectStatusStatistics,
|
||||
TopAuthor,
|
||||
TopAuthorStatistics,
|
||||
TopAuthorsWorksPeriod,
|
||||
} from './dashboard-statistics.service';
|
||||
import {
|
||||
activeInstitutionPersonListQueryParams,
|
||||
@@ -39,6 +40,17 @@ type DashboardStatisticKey =
|
||||
| 'eu_projects'
|
||||
| 'bmbf_projects'
|
||||
| 'dfg_projects';
|
||||
type TopAuthorDataset = {
|
||||
title: string;
|
||||
icon: string;
|
||||
entries: TopAuthor[];
|
||||
stripAuthorTitle?: boolean;
|
||||
};
|
||||
type DashboardPeriodMode =
|
||||
| 'all_time'
|
||||
| 'last_10_years'
|
||||
| 'last_5_years'
|
||||
| 'custom';
|
||||
@Component({
|
||||
selector: 'dashboard',
|
||||
imports: [
|
||||
@@ -78,7 +90,6 @@ export class DashboardComponent implements OnInit {
|
||||
topAuthors?: TopAuthorStatistics;
|
||||
topAuthorsLoading = false;
|
||||
topAuthorsError = false;
|
||||
topAuthorsWorksPeriod: TopAuthorsWorksPeriod = 'all_time';
|
||||
topicTreemap?: TopicTreemapData;
|
||||
topicTreemapLoading = false;
|
||||
topicTreemapError = false;
|
||||
@@ -91,10 +102,14 @@ export class DashboardComponent implements OnInit {
|
||||
bmbfProjectStatuses?: BmbfProjectStatusStatistics;
|
||||
bmbfProjectStatusesLoading = false;
|
||||
bmbfProjectStatusesError = false;
|
||||
dfgProjectStatuses?: DfgProjectStatusStatistics;
|
||||
dfgProjectStatusesLoading = false;
|
||||
dfgProjectStatusesError = false;
|
||||
readonly topicTreemapMinYear = 1900;
|
||||
readonly topicTreemapMaxYear = new Date().getFullYear();
|
||||
topicTreemapFromYear = this.topicTreemapMaxYear - 4;
|
||||
topicTreemapToYear = this.topicTreemapMaxYear;
|
||||
dashboardPeriodMode: DashboardPeriodMode = 'all_time';
|
||||
dashboardFromYear = this.topicTreemapMaxYear - 4;
|
||||
dashboardToYear = this.topicTreemapMaxYear;
|
||||
selectedTopicTreemapNode?: string;
|
||||
private topicTreemapReloadQueued = false;
|
||||
private topicTreemapRequestId = 0;
|
||||
@@ -107,34 +122,36 @@ export class DashboardComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.restoreTopicTreemapState();
|
||||
this.restoreDashboardPeriodState();
|
||||
this.loadStatistics();
|
||||
this.loadTopAuthors();
|
||||
this.loadTopicTreemap();
|
||||
this.loadDfgProjectTopics();
|
||||
this.loadEuProjectStatuses();
|
||||
this.loadBmbfProjectStatuses();
|
||||
this.loadDfgProjectStatuses();
|
||||
}
|
||||
|
||||
private loadStatistics(): void {
|
||||
this.statisticsError = false;
|
||||
const period = this.selectedPeriodBounds();
|
||||
this.loadStatistic(
|
||||
'publications',
|
||||
this.statisticsService.getPublicationCount(),
|
||||
this.statisticsService.getPublicationCount(period),
|
||||
);
|
||||
this.loadStatistic('persons', this.statisticsService.getPersonCount());
|
||||
this.loadStatistic('patents', this.statisticsService.getPatentCount());
|
||||
this.loadStatistic('patents', this.statisticsService.getPatentCount(period));
|
||||
this.loadStatistic(
|
||||
'eu_projects',
|
||||
this.statisticsService.getEuProjectCount(),
|
||||
this.statisticsService.getEuProjectCount(period),
|
||||
);
|
||||
this.loadStatistic(
|
||||
'bmbf_projects',
|
||||
this.statisticsService.getBmbfProjectCount(),
|
||||
this.statisticsService.getBmbfProjectCount(period),
|
||||
);
|
||||
this.loadStatistic(
|
||||
'dfg_projects',
|
||||
this.statisticsService.getDfgProjectCount(),
|
||||
this.statisticsService.getDfgProjectCount(period),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -142,11 +159,7 @@ export class DashboardComponent implements OnInit {
|
||||
return this.statisticLoading[key];
|
||||
}
|
||||
|
||||
topAuthorDatasets(): Array<{
|
||||
title: string;
|
||||
icon: string;
|
||||
entries: TopAuthor[];
|
||||
}> {
|
||||
topAuthorDatasets(): TopAuthorDataset[] {
|
||||
return [
|
||||
{
|
||||
title: 'Publikationen',
|
||||
@@ -163,15 +176,17 @@ export class DashboardComponent implements OnInit {
|
||||
icon: 'description',
|
||||
entries: this.topAuthors?.patents ?? [],
|
||||
},
|
||||
{
|
||||
title: 'DFG Projekte',
|
||||
icon: 'account_tree',
|
||||
entries: this.topAuthors?.projects ?? [],
|
||||
stripAuthorTitle: true,
|
||||
},
|
||||
{ title: 'News', icon: 'article', entries: this.topAuthors?.news ?? [] },
|
||||
];
|
||||
}
|
||||
|
||||
visibleTopAuthorDatasets(): Array<{
|
||||
title: string;
|
||||
icon: string;
|
||||
entries: TopAuthor[];
|
||||
}> {
|
||||
visibleTopAuthorDatasets(): TopAuthorDataset[] {
|
||||
const datasets = this.topAuthorDatasets();
|
||||
return this.topAuthorsLoading
|
||||
? datasets
|
||||
@@ -195,10 +210,12 @@ export class DashboardComponent implements OnInit {
|
||||
return (this.dfgProjectTopics?.topics.length ?? 0) > 0;
|
||||
}
|
||||
|
||||
setTopAuthorsWorksPeriod(period: TopAuthorsWorksPeriod): void {
|
||||
if (period === this.topAuthorsWorksPeriod) return;
|
||||
this.topAuthorsWorksPeriod = period;
|
||||
this.loadTopAuthors();
|
||||
setDashboardPeriodMode(mode: DashboardPeriodMode): void {
|
||||
if (mode === this.dashboardPeriodMode) return;
|
||||
this.dashboardPeriodMode = mode;
|
||||
this.applyPresetPeriod();
|
||||
this.updateDashboardPeriodUrl();
|
||||
this.reloadPeriodData();
|
||||
}
|
||||
|
||||
authorBarWidth(entries: TopAuthor[], count: number): number {
|
||||
@@ -206,6 +223,30 @@ export class DashboardComponent implements OnInit {
|
||||
return (count / maximum) * 100;
|
||||
}
|
||||
|
||||
authorDisplayName(dataset: TopAuthorDataset, entry: TopAuthor): string {
|
||||
if (!dataset.stripAuthorTitle) return entry.name;
|
||||
|
||||
return (
|
||||
entry.name
|
||||
.replace(
|
||||
/^(?:(?:(?:apl\.\s*)?prof(?:essor)?\.?|priv\.-doz\.?|pd|dr\.?)\s+)+/i,
|
||||
'',
|
||||
)
|
||||
.trim() || entry.name
|
||||
);
|
||||
}
|
||||
|
||||
authorLink(_dataset: TopAuthorDataset, entry: TopAuthor): string[] {
|
||||
return ['/person', entry.id!, 'overview'];
|
||||
}
|
||||
|
||||
authorQueryParams(
|
||||
_dataset: TopAuthorDataset,
|
||||
_entry: TopAuthor,
|
||||
): Record<string, string | number> | null {
|
||||
return null;
|
||||
}
|
||||
|
||||
organizationName(): string {
|
||||
return this.statistics?.organization_name ?? 'Ihre Organisation';
|
||||
}
|
||||
@@ -225,57 +266,86 @@ export class DashboardComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
onTopicTreemapRangeChange(): void {
|
||||
onDashboardPeriodRangeChange(): void {
|
||||
this.dashboardPeriodMode = 'custom';
|
||||
this.topicTreemapLoading = true;
|
||||
this.topicTreemapError = false;
|
||||
this.topicTreemapRequestId += 1;
|
||||
this.updateTopicTreemapUrl();
|
||||
this.updateDashboardPeriodUrl();
|
||||
if (this.topicTreemapReloadQueued) return;
|
||||
this.topicTreemapReloadQueued = true;
|
||||
setTimeout(() => {
|
||||
this.topicTreemapReloadQueued = false;
|
||||
this.loadTopicTreemap();
|
||||
this.reloadPeriodData();
|
||||
});
|
||||
}
|
||||
|
||||
onTopicTreemapNodeChange(nodeId: string | undefined): void {
|
||||
this.selectedTopicTreemapNode = nodeId;
|
||||
this.updateTopicTreemapUrl();
|
||||
this.updateDashboardPeriodUrl();
|
||||
}
|
||||
|
||||
onTopicTreemapTopicSelect(topic: TopicTreemapTopicSelect): void {
|
||||
const period = this.selectedPeriodBounds();
|
||||
this.dialog.open<TopicWordCloudDialogComponent, TopicWordCloudDialogData>(
|
||||
TopicWordCloudDialogComponent,
|
||||
{
|
||||
width: '85vw',
|
||||
maxWidth: '92vw',
|
||||
data: topic,
|
||||
data: {
|
||||
...topic,
|
||||
fromYear: period.fromYear,
|
||||
toYear: period.toYear,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
private restoreTopicTreemapState(): void {
|
||||
private restoreDashboardPeriodState(): void {
|
||||
const params = this.route.snapshot.queryParamMap;
|
||||
this.topicTreemapFromYear = this.parseTreemapYear(
|
||||
params.get('treemapFrom'),
|
||||
this.topicTreemapFromYear,
|
||||
const mode = params.get('period');
|
||||
if (
|
||||
mode === 'all_time' ||
|
||||
mode === 'last_10_years' ||
|
||||
mode === 'last_5_years' ||
|
||||
mode === 'custom'
|
||||
) {
|
||||
this.dashboardPeriodMode = mode;
|
||||
}
|
||||
this.applyPresetPeriod();
|
||||
this.dashboardFromYear = this.parseDashboardYear(
|
||||
params.get('fromYear'),
|
||||
this.dashboardFromYear,
|
||||
);
|
||||
this.topicTreemapToYear = this.parseTreemapYear(
|
||||
params.get('treemapTo'),
|
||||
this.topicTreemapToYear,
|
||||
this.dashboardToYear = this.parseDashboardYear(
|
||||
params.get('toYear'),
|
||||
this.dashboardToYear,
|
||||
);
|
||||
if (this.topicTreemapFromYear > this.topicTreemapToYear) {
|
||||
this.topicTreemapFromYear = this.topicTreemapToYear;
|
||||
if (this.dashboardFromYear > this.dashboardToYear) {
|
||||
this.dashboardFromYear = this.dashboardToYear;
|
||||
}
|
||||
this.selectedTopicTreemapNode = params.get('treemapNode') ?? undefined;
|
||||
}
|
||||
|
||||
private updateTopicTreemapUrl(): void {
|
||||
private applyPresetPeriod(): void {
|
||||
const currentYear = this.topicTreemapMaxYear;
|
||||
if (this.dashboardPeriodMode === 'last_10_years') {
|
||||
this.dashboardFromYear = currentYear - 9;
|
||||
this.dashboardToYear = currentYear;
|
||||
} else if (this.dashboardPeriodMode === 'last_5_years') {
|
||||
this.dashboardFromYear = currentYear - 4;
|
||||
this.dashboardToYear = currentYear;
|
||||
}
|
||||
}
|
||||
|
||||
private updateDashboardPeriodUrl(): void {
|
||||
const period = this.selectedPeriodBounds();
|
||||
void this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: {
|
||||
treemapFrom: this.topicTreemapFromYear,
|
||||
treemapTo: this.topicTreemapToYear,
|
||||
period: this.dashboardPeriodMode,
|
||||
fromYear: period.fromYear ?? null,
|
||||
toYear: period.toYear ?? null,
|
||||
treemapNode: this.selectedTopicTreemapNode ?? null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
@@ -283,7 +353,7 @@ export class DashboardComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private parseTreemapYear(value: string | null, fallback: number): number {
|
||||
private parseDashboardYear(value: string | null, fallback: number): number {
|
||||
const year = Number(value);
|
||||
return Number.isInteger(year) &&
|
||||
year >= this.topicTreemapMinYear &&
|
||||
@@ -292,6 +362,25 @@ export class DashboardComponent implements OnInit {
|
||||
: fallback;
|
||||
}
|
||||
|
||||
private selectedPeriodBounds(): DashboardPeriodBounds {
|
||||
return this.dashboardPeriodMode === 'all_time'
|
||||
? {}
|
||||
: {
|
||||
fromYear: this.dashboardFromYear,
|
||||
toYear: this.dashboardToYear,
|
||||
};
|
||||
}
|
||||
|
||||
private reloadPeriodData(): void {
|
||||
this.loadStatistics();
|
||||
this.loadTopAuthors();
|
||||
this.loadTopicTreemap();
|
||||
this.loadDfgProjectTopics();
|
||||
this.loadEuProjectStatuses();
|
||||
this.loadBmbfProjectStatuses();
|
||||
this.loadDfgProjectStatuses();
|
||||
}
|
||||
|
||||
private loadStatistic(
|
||||
key: DashboardStatisticKey,
|
||||
request: Observable<DashboardStatisticValue>,
|
||||
@@ -341,7 +430,7 @@ export class DashboardComponent implements OnInit {
|
||||
this.topAuthorsLoading = true;
|
||||
this.topAuthorsError = false;
|
||||
this.statisticsService
|
||||
.getTopAuthors(this.topAuthorsWorksPeriod)
|
||||
.getTopAuthors(this.selectedPeriodBounds())
|
||||
.pipe(finalize(() => (this.topAuthorsLoading = false)))
|
||||
.subscribe({
|
||||
next: (statistics) => {
|
||||
@@ -357,7 +446,7 @@ export class DashboardComponent implements OnInit {
|
||||
this.dfgTopicsLoading = true;
|
||||
this.dfgTopicsError = false;
|
||||
this.statisticsService
|
||||
.getDfgProjectTopics()
|
||||
.getDfgProjectTopics(this.selectedPeriodBounds())
|
||||
.pipe(finalize(() => (this.dfgTopicsLoading = false)))
|
||||
.subscribe({
|
||||
next: (topics) => {
|
||||
@@ -373,7 +462,7 @@ export class DashboardComponent implements OnInit {
|
||||
this.euProjectStatusesLoading = true;
|
||||
this.euProjectStatusesError = false;
|
||||
this.statisticsService
|
||||
.getEuProjectStatuses()
|
||||
.getEuProjectStatuses(this.selectedPeriodBounds())
|
||||
.pipe(finalize(() => (this.euProjectStatusesLoading = false)))
|
||||
.subscribe({
|
||||
next: (statuses) => {
|
||||
@@ -389,7 +478,7 @@ export class DashboardComponent implements OnInit {
|
||||
this.bmbfProjectStatusesLoading = true;
|
||||
this.bmbfProjectStatusesError = false;
|
||||
this.statisticsService
|
||||
.getBmbfProjectStatuses()
|
||||
.getBmbfProjectStatuses(this.selectedPeriodBounds())
|
||||
.pipe(finalize(() => (this.bmbfProjectStatusesLoading = false)))
|
||||
.subscribe({
|
||||
next: (statuses) => {
|
||||
@@ -401,18 +490,35 @@ export class DashboardComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private loadDfgProjectStatuses(): void {
|
||||
this.dfgProjectStatusesLoading = true;
|
||||
this.dfgProjectStatusesError = false;
|
||||
this.statisticsService
|
||||
.getDfgProjectStatuses(this.selectedPeriodBounds())
|
||||
.pipe(finalize(() => (this.dfgProjectStatusesLoading = false)))
|
||||
.subscribe({
|
||||
next: (statuses) => {
|
||||
this.dfgProjectStatuses = statuses;
|
||||
},
|
||||
error: () => {
|
||||
this.dfgProjectStatusesError = true;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private loadTopicTreemap(): void {
|
||||
if (this.topicTreemapFromYear > this.topicTreemapToYear) {
|
||||
if (this.dashboardFromYear > this.dashboardToYear) {
|
||||
this.topicTreemapLoading = false;
|
||||
this.topicTreemapError = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const requestId = ++this.topicTreemapRequestId;
|
||||
const period = this.selectedPeriodBounds();
|
||||
this.topicTreemapLoading = true;
|
||||
this.topicTreemapError = false;
|
||||
this.statisticsService
|
||||
.getTopicTreemap(this.topicTreemapFromYear, this.topicTreemapToYear)
|
||||
.getTopicTreemap(period.fromYear, period.toYear)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
if (requestId === this.topicTreemapRequestId) {
|
||||
|
||||
+14
-3
@@ -4,6 +4,7 @@ import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
|
||||
import {
|
||||
BmbfProjectStatusStatistics,
|
||||
DfgProjectStatusStatistics,
|
||||
EuProjectStatusStatistics,
|
||||
} from '../dashboard-statistics.service';
|
||||
|
||||
@@ -16,6 +17,7 @@ import {
|
||||
export class EuProjectStatusChartComponent implements OnChanges {
|
||||
@Input({ required: true }) statuses!: EuProjectStatusStatistics;
|
||||
@Input({ required: true }) bmbfStatuses!: BmbfProjectStatusStatistics;
|
||||
@Input({ required: true }) dfgStatuses!: DfgProjectStatusStatistics;
|
||||
|
||||
options: EChartsOption = {};
|
||||
|
||||
@@ -23,12 +25,20 @@ export class EuProjectStatusChartComponent implements OnChanges {
|
||||
const values = [
|
||||
{
|
||||
name: 'Laufend',
|
||||
data: [this.statuses?.ongoing ?? 0, this.bmbfStatuses?.ongoing ?? 0],
|
||||
data: [
|
||||
this.statuses?.ongoing ?? 0,
|
||||
this.bmbfStatuses?.ongoing ?? 0,
|
||||
this.dfgStatuses?.ongoing ?? 0,
|
||||
],
|
||||
color: '#2563eb',
|
||||
},
|
||||
{
|
||||
name: 'Kommend',
|
||||
data: [this.statuses?.upcoming ?? 0, this.bmbfStatuses?.upcoming ?? 0],
|
||||
data: [
|
||||
this.statuses?.upcoming ?? 0,
|
||||
this.bmbfStatuses?.upcoming ?? 0,
|
||||
this.dfgStatuses?.upcoming ?? 0,
|
||||
],
|
||||
color: '#f59e0b',
|
||||
},
|
||||
{
|
||||
@@ -36,6 +46,7 @@ export class EuProjectStatusChartComponent implements OnChanges {
|
||||
data: [
|
||||
this.statuses?.completed ?? 0,
|
||||
this.bmbfStatuses?.completed ?? 0,
|
||||
this.dfgStatuses?.completed ?? 0,
|
||||
],
|
||||
color: '#64748b',
|
||||
},
|
||||
@@ -69,7 +80,7 @@ export class EuProjectStatusChartComponent implements OnChanges {
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
data: ['EU-Projekte', 'Bund-Projekte'],
|
||||
data: ['EU-Projekte', 'Bund-Projekte', 'DFG-Projekte'],
|
||||
axisTick: { show: false },
|
||||
axisLine: { show: false },
|
||||
axisLabel: { color: '#334155', fontWeight: 600 },
|
||||
|
||||
+87
-3
@@ -91,16 +91,100 @@
|
||||
<span>Die Keywords konnten nicht geladen werden.</span>
|
||||
</div>
|
||||
} @else if (words.length) {
|
||||
<div class="keyword-toolbar" aria-label="Ausgewählte Keywords">
|
||||
<div class="keyword-toolbar-label">
|
||||
<mat-icon aria-hidden="true">tune</mat-icon>
|
||||
<span>
|
||||
<strong>Keyword-Auswahl</strong>
|
||||
<small
|
||||
>Klicken Sie auf Begriffe in der Wordcloud, um sie
|
||||
auszuwählen.</small
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="keyword-selection" aria-live="polite">
|
||||
@for (word of selectedWords(); track word.id) {
|
||||
<button
|
||||
type="button"
|
||||
class="keyword-chip"
|
||||
[attr.aria-label]="word.name + ' aus Auswahl entfernen'"
|
||||
(click)="toggleWord(word)">
|
||||
{{ word.name }}
|
||||
<mat-icon aria-hidden="true">close</mat-icon>
|
||||
</button>
|
||||
} @empty {
|
||||
<span class="keyword-selection-empty">Noch nichts ausgewählt</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="keyword-toolbar-actions">
|
||||
@if (selectedWordIds.size) {
|
||||
<button
|
||||
mat-button
|
||||
type="button"
|
||||
class="keyword-clear"
|
||||
(click)="clearSelection()">
|
||||
Auswahl löschen
|
||||
</button>
|
||||
}
|
||||
<a
|
||||
mat-stroked-button
|
||||
class="keyword-search keyword-search--secondary"
|
||||
routerLink="/keywords"
|
||||
[queryParams]="{
|
||||
manual: selectedWordsQuery(),
|
||||
selected: selectedWordsQuery(),
|
||||
}"
|
||||
[class.keyword-search--disabled]="!selectedWordIds.size"
|
||||
[attr.aria-disabled]="!selectedWordIds.size"
|
||||
[attr.tabindex]="selectedWordIds.size ? 0 : -1"
|
||||
(click)="
|
||||
!selectedWordIds.size
|
||||
? $event.preventDefault()
|
||||
: closeForSearchNavigation()
|
||||
">
|
||||
<mat-icon aria-hidden="true">manage_search</mat-icon>
|
||||
Suche in Keywords
|
||||
</a>
|
||||
<a
|
||||
mat-flat-button
|
||||
class="keyword-search"
|
||||
routerLink="/topics"
|
||||
[queryParams]="{
|
||||
query: selectedWordNames(),
|
||||
page: 0,
|
||||
sortBy: 'works_count',
|
||||
sortDirection: 'desc',
|
||||
}"
|
||||
[class.keyword-search--disabled]="!selectedWordIds.size"
|
||||
[attr.aria-disabled]="!selectedWordIds.size"
|
||||
[attr.tabindex]="selectedWordIds.size ? 0 : -1"
|
||||
(click)="
|
||||
!selectedWordIds.size
|
||||
? $event.preventDefault()
|
||||
: closeForSearchNavigation()
|
||||
">
|
||||
<mat-icon aria-hidden="true">search</mat-icon>
|
||||
Suche in Themen
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="word-cloud-chart" aria-label="Wordcloud verwandter Themen">
|
||||
@for (word of words; track word.id) {
|
||||
<span
|
||||
<button
|
||||
type="button"
|
||||
class="word-cloud-word"
|
||||
[class.word-cloud-word--selected]="isWordSelected(word)"
|
||||
[attr.aria-pressed]="isWordSelected(word)"
|
||||
[style.color]="word.color"
|
||||
[style.fontSize.px]="word.fontSize"
|
||||
[style.fontWeight]="word.fontWeight"
|
||||
[title]="word.name + ': ' + word.count + ' Publikationen'">
|
||||
[title]="word.name + ': ' + word.count + ' Publikationen'"
|
||||
(click)="toggleWord(word)">
|
||||
{{ word.name }}
|
||||
</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
|
||||
+138
-1
@@ -187,6 +187,113 @@ mat-dialog-content {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.keyword-toolbar {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(160px, 1fr) auto;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 10px 14px;
|
||||
border-bottom: 1px solid #e8edf5;
|
||||
background: #f8faff;
|
||||
}
|
||||
|
||||
.keyword-toolbar-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: #334155;
|
||||
|
||||
> mat-icon {
|
||||
width: 19px;
|
||||
height: 19px;
|
||||
color: #7255d9;
|
||||
font-size: 19px;
|
||||
}
|
||||
|
||||
> span {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
small {
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
font-size: 0.6875rem;
|
||||
}
|
||||
}
|
||||
|
||||
.keyword-selection {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.keyword-chip {
|
||||
display: inline-flex;
|
||||
min-height: 28px;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 4px 7px 4px 9px;
|
||||
border: 1px solid #c9bafa;
|
||||
border-radius: 999px;
|
||||
background: #f6f0ff;
|
||||
color: #6347c8;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 600;
|
||||
|
||||
mat-icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
border-color: #a992ef;
|
||||
background: #eee7ff;
|
||||
}
|
||||
}
|
||||
|
||||
.keyword-selection-empty {
|
||||
color: var(--sg-text-soft, #8a95b3);
|
||||
font-size: 0.75rem;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.keyword-clear {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.keyword-toolbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.keyword-search {
|
||||
mat-icon {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.keyword-search--secondary {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.keyword-search--disabled {
|
||||
pointer-events: none;
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.word-cloud-chart {
|
||||
display: flex;
|
||||
min-height: 280px;
|
||||
@@ -211,9 +318,13 @@ mat-dialog-content {
|
||||
}
|
||||
|
||||
.word-cloud-word {
|
||||
appearance: none;
|
||||
padding: 3px 5px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 6px;
|
||||
cursor: help;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
line-height: 1.1;
|
||||
text-align: center;
|
||||
transition:
|
||||
@@ -224,6 +335,18 @@ mat-dialog-content {
|
||||
background: rgba(241, 243, 247, 0.9);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
outline: 3px solid rgba(114, 85, 217, 0.25);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.word-cloud-word--selected {
|
||||
border-color: currentColor;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 2px 8px rgba(51, 65, 85, 0.16);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.word-cloud-state {
|
||||
@@ -303,6 +426,20 @@ mat-dialog-content {
|
||||
gap: 10px 14px;
|
||||
padding: 24px 18px;
|
||||
}
|
||||
|
||||
.keyword-toolbar {
|
||||
grid-template-columns: 1fr auto;
|
||||
}
|
||||
|
||||
.keyword-toolbar-actions {
|
||||
grid-column: 2;
|
||||
grid-row: 1;
|
||||
}
|
||||
|
||||
.keyword-selection {
|
||||
grid-column: 1 / -1;
|
||||
grid-row: 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
|
||||
+53
-2
@@ -1,9 +1,14 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, DestroyRef, inject } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogModule,
|
||||
MatDialogRef,
|
||||
} from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { RouterLink } from '@angular/router';
|
||||
|
||||
import {
|
||||
DashboardStatisticsService,
|
||||
@@ -28,16 +33,26 @@ interface DisplayWord extends TopicWordCloudWord {
|
||||
@Component({
|
||||
selector: 'app-topic-wordcloud-dialog',
|
||||
standalone: true,
|
||||
imports: [CommonModule, MatButtonModule, MatDialogModule, MatIconModule],
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatButtonModule,
|
||||
MatDialogModule,
|
||||
MatIconModule,
|
||||
RouterLink,
|
||||
],
|
||||
templateUrl: './topic-wordcloud-dialog.component.html',
|
||||
styleUrl: './topic-wordcloud-dialog.component.scss',
|
||||
})
|
||||
export class TopicWordCloudDialogComponent {
|
||||
readonly data = inject<TopicWordCloudDialogData>(MAT_DIALOG_DATA);
|
||||
private readonly dialogRef = inject(
|
||||
MatDialogRef<TopicWordCloudDialogComponent>,
|
||||
);
|
||||
private readonly statisticsService = inject(DashboardStatisticsService);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
words: DisplayWord[] = [];
|
||||
selectedWordIds = new Set<string>();
|
||||
loading = true;
|
||||
loadFailed = false;
|
||||
|
||||
@@ -74,6 +89,42 @@ export class TopicWordCloudDialogComponent {
|
||||
});
|
||||
}
|
||||
|
||||
toggleWord(word: DisplayWord): void {
|
||||
const selected = new Set(this.selectedWordIds);
|
||||
if (selected.has(word.id)) {
|
||||
selected.delete(word.id);
|
||||
} else {
|
||||
selected.add(word.id);
|
||||
}
|
||||
this.selectedWordIds = selected;
|
||||
}
|
||||
|
||||
isWordSelected(word: DisplayWord): boolean {
|
||||
return this.selectedWordIds.has(word.id);
|
||||
}
|
||||
|
||||
selectedWords(): DisplayWord[] {
|
||||
return this.words.filter((word) => this.selectedWordIds.has(word.id));
|
||||
}
|
||||
|
||||
selectedWordsQuery(): string {
|
||||
return this.selectedWordNames().join(', ');
|
||||
}
|
||||
|
||||
selectedWordNames(): string[] {
|
||||
return this.selectedWords().map((word) => word.name);
|
||||
}
|
||||
|
||||
clearSelection(): void {
|
||||
this.selectedWordIds = new Set<string>();
|
||||
}
|
||||
|
||||
closeForSearchNavigation(): void {
|
||||
if (this.selectedWordIds.size) {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
}
|
||||
|
||||
private buildWords(words: TopicWordCloudWord[]): DisplayWord[] {
|
||||
if (!words.length) return [];
|
||||
const values = words.map((word) => word.count);
|
||||
|
||||
@@ -15,80 +15,5 @@
|
||||
</div>
|
||||
|
||||
<ng-template #cardTmp let-institution>
|
||||
<mat-card
|
||||
class="card"
|
||||
appearance="outlined"
|
||||
[routerLink]="
|
||||
institution.id
|
||||
? ['/institution', institution.id.split('/').pop() ?? '']
|
||||
: null
|
||||
">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ getDisplayName(institution) }}</mat-card-title>
|
||||
<mat-card-subtitle
|
||||
>{{ institution.geo?.city }},
|
||||
{{ institution.geo?.country }}</mat-card-subtitle
|
||||
>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-card-content class="card-content">
|
||||
<mat-divider />
|
||||
<div class="card-metadata">
|
||||
<span>Publikationen: {{ institution.works_count }}</span>
|
||||
<span>Zitationen: {{ institution.cited_by_count }}</span>
|
||||
</div>
|
||||
<mat-divider />
|
||||
</mat-card-content>
|
||||
|
||||
<mat-card-footer>
|
||||
<mat-card-actions>
|
||||
<a
|
||||
mat-button
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
extractInstitutionId(institution),
|
||||
'overview',
|
||||
]"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>info</mat-icon>
|
||||
Übersicht
|
||||
</a>
|
||||
<a
|
||||
mat-button
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
extractInstitutionId(institution),
|
||||
'publications',
|
||||
]"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>article</mat-icon>
|
||||
Publikationen
|
||||
</a>
|
||||
<a
|
||||
mat-button
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
extractInstitutionId(institution),
|
||||
'projects',
|
||||
]"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>work</mat-icon>
|
||||
Projekte
|
||||
</a>
|
||||
@if (hasPatents(institution)) {
|
||||
<a
|
||||
mat-button
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
extractInstitutionId(institution),
|
||||
'patents',
|
||||
]"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>verified</mat-icon>
|
||||
Patente
|
||||
</a>
|
||||
}
|
||||
</mat-card-actions>
|
||||
</mat-card-footer>
|
||||
</mat-card>
|
||||
<app-institution-card [institution]="institution" />
|
||||
</ng-template>
|
||||
|
||||
@@ -3,54 +3,4 @@
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.cards {
|
||||
display: grid;
|
||||
gap: 1.5rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(550px, 1fr));
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 0.5rem;
|
||||
background-color: var(--sg-background);
|
||||
transition: transform 0.3s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
cursor: pointer;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.card-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
gap: 0.5rem;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.card-metadata {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.2rem;
|
||||
font-size: 0.9rem;
|
||||
color: var(--sg-text-secondary);
|
||||
}
|
||||
|
||||
mat-card-actions {
|
||||
padding-top: 0.5rem;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
mat-card-actions a {
|
||||
width: 100%;
|
||||
text-decoration: none;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Component, computed, effect, inject, input } from '@angular/core';
|
||||
import { Institution, InstitutionPage } from '../../api';
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { InstitutionPage } from '../../api';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { RouterModule } from '@angular/router';
|
||||
@@ -13,6 +12,7 @@ import {
|
||||
CardSearchComponent,
|
||||
} from '../../shared/ui/card-search/card-search.component';
|
||||
import { FilterObserver } from '../../shared/ui/selected-filters/selected-filters.component';
|
||||
import { AppInstitutionCardComponent } from '../../shared/ui/app-institution-card/app-institution-card.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institutions',
|
||||
@@ -23,13 +23,12 @@ import { FilterObserver } from '../../shared/ui/selected-filters/selected-filter
|
||||
MatDividerModule,
|
||||
RouterModule,
|
||||
CardSearchComponent,
|
||||
AppInstitutionCardComponent,
|
||||
],
|
||||
templateUrl: './institutions.component.html',
|
||||
styleUrl: './institutions.component.scss',
|
||||
})
|
||||
export class InstitutionsComponent {
|
||||
private readonly patentsApi = inject(PatentsService);
|
||||
|
||||
institutionPage = input.required<InstitutionPage>();
|
||||
|
||||
observers: FilterObserver[] = [
|
||||
@@ -47,35 +46,6 @@ export class InstitutionsComponent {
|
||||
elements: this.institutionPage().elements || [],
|
||||
}));
|
||||
|
||||
// The "Patente" action only makes sense once org_patents has been indexed
|
||||
// for that institution (currently a manual, per-institution process), so
|
||||
// it's hidden by default and only shown once a cheap count check confirms
|
||||
// there is actually data behind it.
|
||||
private readonly patentsAvailable = new Map<string, boolean>();
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
for (const institution of this.page().elements) {
|
||||
const id = this.extractInstitutionId(institution);
|
||||
if (!id || this.patentsAvailable.has(id)) continue;
|
||||
this.patentsAvailable.set(id, false);
|
||||
this.patentsApi
|
||||
.getOrgPatentsByInstitution(id, undefined, 0, 0)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
this.patentsAvailable.set(id, (result.patent_count ?? 0) > 0);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
hasPatents(institution: Institution): boolean {
|
||||
return (
|
||||
this.patentsAvailable.get(this.extractInstitutionId(institution)) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
sortingOptions: SelectorOption[] = [
|
||||
{ value: 'relevance', display_name: 'Relevanz' },
|
||||
{ value: 'name', display_name: 'Name' },
|
||||
@@ -86,18 +56,4 @@ export class InstitutionsComponent {
|
||||
{ value: 'asc', display_name: 'Aufsteigend' },
|
||||
{ value: 'desc', display_name: 'Absteigend' },
|
||||
];
|
||||
|
||||
extractInstitutionId(institution: Institution): string {
|
||||
return institution.id?.split('/').pop() ?? '';
|
||||
}
|
||||
|
||||
getDisplayName(institution: Institution): string {
|
||||
const primary = institution.display_name?.trim();
|
||||
if (primary && primary.length > 0) return primary;
|
||||
|
||||
const alt = institution.display_name_alternatives?.[0]?.trim();
|
||||
if (alt && alt.length > 0) return alt;
|
||||
|
||||
return 'Unbekannte Institution';
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -41,5 +41,9 @@ export class KeywordsToProjectsResultsComponent {
|
||||
path: 'eu',
|
||||
label: 'EU-Projekte',
|
||||
},
|
||||
{
|
||||
path: 'bund',
|
||||
label: 'BUND-Projekte',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
+18
-8
@@ -132,14 +132,24 @@ export class SearchResultsStateService {
|
||||
// without a resolvable keyword are skipped when building the lookup map
|
||||
// so they can never collide on an `undefined` key and shadow a real one.
|
||||
readonly topicsList = computed(() => {
|
||||
const list = this.keywords().map((kw) => {
|
||||
const entry = this.selectedKeywordEntries().find(
|
||||
(e) =>
|
||||
e.llm_keyword?.keyword?.trim().toLowerCase() ===
|
||||
kw.trim().toLowerCase(),
|
||||
);
|
||||
return entry?.topic_mapping?.topic?.display_name ?? kw;
|
||||
});
|
||||
const list = this.keywords()
|
||||
.map((kw) => {
|
||||
const normalized = kw.trim().toLowerCase();
|
||||
const entry = this.selectedKeywordEntries().find(
|
||||
(e) =>
|
||||
e.llm_keyword?.keyword?.trim().toLowerCase() === normalized ||
|
||||
e.topic_mapping?.topic?.id?.trim().toLowerCase() === normalized,
|
||||
);
|
||||
const displayName = entry?.topic_mapping?.topic?.display_name;
|
||||
if (displayName && !displayName.startsWith('http')) {
|
||||
return displayName;
|
||||
}
|
||||
if (kw.startsWith('http') || kw.includes('openalex.org/topics')) {
|
||||
return '';
|
||||
}
|
||||
return kw;
|
||||
})
|
||||
.filter((t) => t.length > 0);
|
||||
return Array.from(new Set(list));
|
||||
});
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
keywords: state.payload()?.keywords?.join(','),
|
||||
fuzzy: state.payload()?.options?.fuzzy,
|
||||
topics: state.payload()?.options?.fuzzy ? state.topicIds() : null,
|
||||
topicId: null,
|
||||
}"
|
||||
queryParamsHandling="replace">
|
||||
<mat-icon>{{ route.icon }}</mat-icon>
|
||||
|
||||
@@ -1,117 +1,110 @@
|
||||
<div class="content">
|
||||
<div class="description-container">
|
||||
<h5 style="font-weight: bold">Netzwerk</h5>
|
||||
<p>Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.</p>
|
||||
</div>
|
||||
@if (this.isPending()) {
|
||||
<app-loading
|
||||
text="Das Netzwerk wird gebaut, kleinen Moment..."
|
||||
icon="graph_3"
|
||||
[size]="150"
|
||||
[diameter]="150" />
|
||||
} @else if (this.isFailed()) {
|
||||
<div class="error">
|
||||
<mat-icon>error</mat-icon>
|
||||
<span class="error-message">{{
|
||||
this.collaborationGraphError()
|
||||
? this.collaborationGraphError()
|
||||
: 'Fehler beim Laden des Netzwerks. Bitte versuchen Sie es später erneut.'
|
||||
}}</span>
|
||||
|
||||
@if (this.isPending()) {
|
||||
<app-loading
|
||||
text="Das Netzwerk wird gebaut, kleinen Moment..."
|
||||
icon="graph_3"
|
||||
[size]="150"
|
||||
[diameter]="150" />
|
||||
} @else if (this.isFailed()) {
|
||||
<div class="error">
|
||||
<mat-icon>error</mat-icon>
|
||||
<span class="error-message">{{
|
||||
this.collaborationGraphError()
|
||||
? this.collaborationGraphError()
|
||||
: 'Fehler beim Laden des Netzwerks. Bitte versuchen Sie es später erneut.'
|
||||
}}</span>
|
||||
<app-selected-filters [observers]="observers" />
|
||||
<button matButton="outlined" type="button" (click)="openFilterDialog()">
|
||||
<mat-icon>filter_alt</mat-icon>
|
||||
Filter
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="grid">
|
||||
<div class="cell">
|
||||
<mat-card appearance="outlined" style="height: 100%">
|
||||
<mat-card-content>
|
||||
<app-collaboration-graph
|
||||
[collaborationGraph]="collaborationGraph()!"
|
||||
(handleNodeClick)="handleNodeClick($event)" />
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="toggle-group">
|
||||
<mat-button-toggle-group
|
||||
class="mat-button-toggle-group"
|
||||
aria-label="Select view"
|
||||
(change)="onToggleChange($event)"
|
||||
[value]="displayedTable()"
|
||||
style="width: 100%">
|
||||
<mat-button-toggle value="collaborator">
|
||||
Kollaborierende
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="publication"
|
||||
>Publikationen</mat-button-toggle
|
||||
>
|
||||
<mat-button-toggle value="institution">
|
||||
Institutionen
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button
|
||||
class="filter-button"
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
(click)="openFilterDialog()">
|
||||
<mat-icon>filter_alt</mat-icon>
|
||||
Filter
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<app-query-param-input
|
||||
style="width: 100%"
|
||||
queryParamKey="search_term"
|
||||
[label]="this.searchTermLabel()" />
|
||||
|
||||
<app-selected-filters [observers]="observers" />
|
||||
<button matButton="outlined" type="button" (click)="openFilterDialog()">
|
||||
<mat-icon>filter_alt</mat-icon>
|
||||
Filter
|
||||
</button>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="grid">
|
||||
<div class="cell">
|
||||
<mat-card appearance="outlined" style="height: 100%">
|
||||
<mat-card-content>
|
||||
<app-collaboration-graph
|
||||
[collaborationGraph]="collaborationGraph()!"
|
||||
(handleNodeClick)="handleNodeClick($event)" />
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="cell">
|
||||
<div class="toggle-group">
|
||||
<mat-button-toggle-group
|
||||
class="mat-button-toggle-group"
|
||||
aria-label="Select view"
|
||||
(change)="onToggleChange($event)"
|
||||
[value]="displayedTable()"
|
||||
style="width: 100%">
|
||||
<mat-button-toggle value="collaborator">
|
||||
Kollaborierende
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="publication"
|
||||
>Publikationen</mat-button-toggle
|
||||
>
|
||||
<mat-button-toggle value="institution">
|
||||
Institutionen
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button
|
||||
class="filter-button"
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
(click)="openFilterDialog()">
|
||||
<mat-icon>filter_alt</mat-icon>
|
||||
Filter
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<app-query-param-input
|
||||
style="width: 100%"
|
||||
queryParamKey="search_term"
|
||||
[label]="this.searchTermLabel()" />
|
||||
|
||||
<app-selected-filters [observers]="observers" />
|
||||
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-content class="scroll-viewport-container">
|
||||
@if (this.displayedTable() === 'collaborator') {
|
||||
<app-data-table
|
||||
[columns]="collaboratorsColumns"
|
||||
[data]="collaboratorsData()"
|
||||
[filterTerm]="searchTerm()"
|
||||
[detailTemplate]="collaboratorsDetailRow"
|
||||
[maxHeight]="'100%'" />
|
||||
} @else if (this.displayedTable() === 'publication') {
|
||||
<app-data-table
|
||||
[columns]="publicationsColumns"
|
||||
[data]="publicationsData()"
|
||||
[filterTerm]="searchTerm()"
|
||||
[detailTemplate]="publicationsDetailRow"
|
||||
[maxHeight]="'100%'" />
|
||||
} @else if (this.displayedTable() === 'institution') {
|
||||
<app-data-table
|
||||
[columns]="institutionsColumns"
|
||||
[data]="institutionsData()"
|
||||
[filterTerm]="searchTerm()"
|
||||
[detailTemplate]="institutionsDetailRow"
|
||||
[maxHeight]="'100%'" />
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
<div class="cell full-width">
|
||||
<div class="summary-container">
|
||||
@for (summary of this.summaryCards(); track $index) {
|
||||
<app-info-card
|
||||
[icon]="summary.icon"
|
||||
[value]="summary.value.toString()"
|
||||
[description]="summary.description" />
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-content class="scroll-viewport-container">
|
||||
@if (this.displayedTable() === 'collaborator') {
|
||||
<app-data-table
|
||||
[columns]="collaboratorsColumns"
|
||||
[data]="collaboratorsData()"
|
||||
[filterTerm]="searchTerm()"
|
||||
[detailTemplate]="collaboratorsDetailRow"
|
||||
[maxHeight]="'100%'" />
|
||||
} @else if (this.displayedTable() === 'publication') {
|
||||
<app-data-table
|
||||
[columns]="publicationsColumns"
|
||||
[data]="publicationsData()"
|
||||
[filterTerm]="searchTerm()"
|
||||
[detailTemplate]="publicationsDetailRow"
|
||||
[maxHeight]="'100%'" />
|
||||
} @else if (this.displayedTable() === 'institution') {
|
||||
<app-data-table
|
||||
[columns]="institutionsColumns"
|
||||
[data]="institutionsData()"
|
||||
[filterTerm]="searchTerm()"
|
||||
[detailTemplate]="institutionsDetailRow"
|
||||
[maxHeight]="'100%'" />
|
||||
}
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
|
||||
<div class="cell full-width">
|
||||
<div class="summary-container">
|
||||
@for (summary of this.summaryCards(); track $index) {
|
||||
<app-info-card
|
||||
[icon]="summary.icon"
|
||||
[value]="summary.value.toString()"
|
||||
[description]="summary.description" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<ng-template #collaboratorsActionTmp let-element>
|
||||
<a
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
<div class="page">
|
||||
<div>
|
||||
<h6>Nachrichten</h6>
|
||||
<p>Aktuelle Nachrichten zu dieser Person.</p>
|
||||
</div>
|
||||
|
||||
<ng-template #cardTmp let-article>
|
||||
<app-news-card [article]="article" />
|
||||
</ng-template>
|
||||
|
||||
<app-card-search
|
||||
[page]="page()"
|
||||
[loading]="loading"
|
||||
@@ -17,3 +8,7 @@
|
||||
sortingDirectionLabel="Sortierung"
|
||||
searchLabel="Nachrichten durchsuchen" />
|
||||
</div>
|
||||
|
||||
<ng-template #cardTmp let-article>
|
||||
<app-news-card [article]="article" />
|
||||
</ng-template>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user