From 5fa764e7e8814854d095410e08d0cfad22027a53 Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Fri, 12 Jun 2026 09:10:05 +0200 Subject: [PATCH 01/22] Improve funding list filters and empty-state overview for clearer navigation --- .../person-funding.component.html | 58 ++++- .../person-funding.component.scss | 205 ++++++++++++++---- 2 files changed, 207 insertions(+), 56 deletions(-) diff --git a/webapp/src/app/modules/person-funding/person-funding.component.html b/webapp/src/app/modules/person-funding/person-funding.component.html index 3145736b..4f70a9bf 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -273,17 +273,6 @@ } } @else {
-
-

- {{ getUniquePublicationCount() }} - Einzigartige Publikationen -

-

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

-
-
@@ -291,25 +280,33 @@
Filter nach Position:
} @else {
-

Klicke auf einen Förderer für Details.

+
+ @if (activeFilter !== "all") { + + Filter: {{ getPositionLabel(activeFilter) }} + + } +

Förderübersicht

+

+ @if (activeFilter === "all") { + Alle geförderten Publikationen dieser Person im Überblick. + } @else { + Nur Publikationen mit der gewählten Autorenposition. + } +

+
+
+ {{ + getUniquePublicationCount() + }} + Einzigartige Publikationen +
+
+ {{ + filteredFunders.length + }} + Förderer +
+
+
+ +

+ Wähle links einen Förderer aus, um die zugehörigen Publikationen + anzuzeigen. +

+
+
}
diff --git a/webapp/src/app/modules/person-funding/person-funding.component.scss b/webapp/src/app/modules/person-funding/person-funding.component.scss index 3101f8ce..c9560365 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.scss +++ b/webapp/src/app/modules/person-funding/person-funding.component.scss @@ -23,39 +23,84 @@ button { padding: 6px 14px; - border: 1px solid #ccc; + border: 1px solid transparent; border-radius: 20px; - background: white; + background: #fff; cursor: pointer; font-size: 14px; + font-weight: 500; + transition: background 0.15s ease, border-color 0.15s ease; - &:hover { - background: #f0f0f0; + &:not(.active):hover { + background: #fafafa; + } + + &.active { + font-weight: 600; + border-width: 2px; + padding: 5px 13px; } } + button:nth-child(2) { - background: #f0f6ff; - color: #0b63ce; - border-color: #bdd4ff; -} + color: #3b82c4; + border-color: #c7dcfa; -button:nth-child(3) { - background: #effaf3; - color: #24834f; - border-color: #bdebcf; -} + &:not(.active):hover { + background: #f5f9ff; + } -button:nth-child(4) { - background: #f6f0ff; - color: #7255d9; - border-color: #d8cafe; -} + &.active { + color: #0b4f9e; + background: #e8f2ff; + border-color: #3b82c4; + } + } -button:nth-child(5) { - background: #fff7e8; - color: #c67500; - border-color: #ffd796; -} + button:nth-child(3) { + color: #3d9a66; + border-color: #b8e6cb; + + &:not(.active):hover { + background: #f4fbf7; + } + + &.active { + color: #1a6b3f; + background: #e8f7ee; + border-color: #3d9a66; + } + } + + button:nth-child(4) { + color: #7c65d9; + border-color: #d5c8f8; + + &:not(.active):hover { + background: #f8f5ff; + } + + &.active { + color: #5b3fc9; + background: #f0ebff; + border-color: #7c65d9; + } + } + + button:nth-child(5) { + color: #d1435f; + border-color: #f8c4ce; + + &:not(.active):hover { + background: #fff5f6; + } + + &.active { + color: #a61e3a; + background: #ffe8ec; + border-color: #d1435f; + } + } } .sort-control { @@ -152,8 +197,12 @@ button:nth-child(5) { display: flex; align-items: center; justify-content: center; - color: #999; - min-height: 200px; + min-height: 280px; + padding: 24px; + background: + radial-gradient(circle at 100% 0%, rgba(200, 217, 255, 0.35), transparent 45%), + linear-gradient(160deg, #fff 0%, #f8faff 100%); + border-color: #dbe3f2; } h3 { @@ -211,8 +260,8 @@ button:nth-child(5) { } .stat-last { - background: #fff7e8; - border-color: #ffd796; + background: #fff1f2; + border-color: #fda4af; } } @@ -257,22 +306,90 @@ button:nth-child(5) { } } -.funding-summary { - margin-bottom: 16px; +.empty-overview { + width: 100%; + text-align: center; - .summary-line { - margin: 0 0 4px 0; - font-size: 14px; - color: #333; - } - - .summary-label { - color: #333; - } - - .summary-value { + &__filter { + display: inline-block; + margin-bottom: 12px; + padding: 4px 12px; + border: 1px solid #dbe3f2; + border-radius: 999px; + background: rgba(255, 255, 255, 0.9); + color: #475569; + font-size: 0.75rem; font-weight: 600; - color: #333; + letter-spacing: 0.02em; + text-transform: uppercase; + } + + &__title { + margin: 0 0 8px; + font-size: 1.125rem; + color: #1e3a5f; + } + + &__subtitle { + margin: 0 0 20px; + color: #64748b; + font-size: 0.875rem; + line-height: 1.5; + } + + &__stats { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 12px; + margin-bottom: 20px; + } + + &__stat { + display: flex; + flex-direction: column; + gap: 6px; + padding: 16px 12px; + border: 1px solid #e0e6f0; + border-radius: 10px; + background: rgba(255, 255, 255, 0.85); + } + + &__stat-value { + font-size: 1.75rem; + font-weight: 700; + line-height: 1.1; + color: #1e3a5f; + } + + &__stat-label { + font-size: 0.8rem; + line-height: 1.35; + color: #64748b; + } + + &__hint { + display: flex; + align-items: flex-start; + gap: 10px; + padding: 12px 14px; + border: 1px dashed #c7d5ea; + border-radius: 10px; + background: rgba(255, 255, 255, 0.7); + text-align: left; + + .material-icons { + flex-shrink: 0; + margin-top: 1px; + font-size: 20px; + color: #3b82c4; + } + + p { + margin: 0; + color: #475569; + font-size: 0.875rem; + line-height: 1.45; + } } } @@ -456,9 +573,9 @@ button:nth-child(5) { } &--last { - background: #fff7e8; - color: #c67500; - border: 1px solid #ffd796; + background: #fff1f2; + color: #be123c; + border: 1px solid #fda4af; } &--unknown { From 08669a4776430e2979e9a132fa148825c2987368 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Sun, 14 Jun 2026 00:23:11 +0200 Subject: [PATCH 02/22] Add career metrics --- service/src/main/inse/persons/model.py | 41 ++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/service/src/main/inse/persons/model.py b/service/src/main/inse/persons/model.py index 1973c763..039672d3 100644 --- a/service/src/main/inse/persons/model.py +++ b/service/src/main/inse/persons/model.py @@ -13,20 +13,55 @@ from inse.models.openalex.authors_list_response import AuthorsListResponse from inse.models.openalex.group_by_result import GroupByResult +class CareerMetrics(BaseModel): + first_publication_year: Optional[int] = Field( + default=None, description="First publication year of the author." + ) + last_publication_year: Optional[int] = Field( + default=None, description="Last publication year of the author." + ) + career_age: Optional[int] = Field( + default=None, description="Difference between last and first publication year." + ) + career_span: Optional[int] = Field( + default=None, description="Inclusive span from first to last publication year." + ) + active_years: int = Field( + default=0, description="Number of distinct years with at least one publication." + ) + publication_count: int = Field( + default=0, description="Number of publications used for career metrics." + ) + publications_per_active_year: Optional[float] = Field( + default=None, description="Average publications per active publication year." + ) + publications_per_career_year: Optional[float] = Field( + default=None, description="Average publications per year over the full career span." + ) + years_since_last_publication: Optional[int] = Field( + default=None, description="Years since the last publication." + ) + has_suspicious_publication_years: bool = Field( + default=False, description="True if publication years look suspicious." + ) + class CustomAuthor(Author): relevance_rating: Optional[str] = Field( default=None, description="The relevance suitability rating." ) + career_metrics: Optional[CareerMetrics] = Field( + default=None, description="Publication-history-based career metrics." + ) class CustomAuthorsListResponse(AuthorsListResponse): placeholder: Optional[CustomAuthor] = Field( default=None, description="A placeholder field for generation." ) - # meta: Optional[Meta] = None - # results: Optional[List[CustomAuthor]] = None - # group_by: Optional[List[GroupByResult]] = None + results: Optional[List[CustomAuthor]] = None + meta: Optional[Meta] = None + group_by: Optional[List[GroupByResult]] = None class PersonBio(BaseModel): From 11eb8987454f04aafde4f4c46594741a34198aee Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Sun, 14 Jun 2026 00:23:38 +0200 Subject: [PATCH 03/22] Compute career metrics for person detail --- service/src/main/inse/persons/logic.py | 129 +++++++++++++++++++++++-- 1 file changed, 122 insertions(+), 7 deletions(-) diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index 409ce5ae..1a731caf 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -7,7 +7,9 @@ Business logic for persons / authors. import json import logging import time +from datetime import datetime from typing import Optional, Callable, Any, List +from elasticsearch import ApiError, NotFoundError import hashlib import httpx from fastapi import HTTPException @@ -20,7 +22,12 @@ from inse import util from inse.integrations import elasticsearch from inse.models.openalex.meta import Meta from inse.persons.query_builder import build_authors_search_rescored -from inse.persons.model import CustomAuthor, CustomAuthorsListResponse, PersonSearchRequest +from inse.persons.model import ( + CustomAuthor, + CustomAuthorsListResponse, + PersonSearchRequest, + CareerMetrics, +) logger = logging.getLogger(__name__) INDEX_NAME="openalex-authors" @@ -156,6 +163,104 @@ def _fetch_works_and_topics(author_id: str) -> tuple[list, list]: return works, topics +def _get_publication_years_for_author(author_id: str) -> list[int]: + author_url = f"https://openalex.org/{author_id.strip()}" + + body = { + "size": 0, + "query": { + "nested": { + "path": "authorships", + "query": { + "bool": { + "filter": [ + {"term": {"authorships.author.id": author_url}}, + ], + }, + }, + }, + }, + "aggs": { + "publication_years": { + "terms": { + "field": "publication_year", + "size": 1000, + }, + }, + }, + } + + response = elasticsearch.search( + index=config.settings.openalex_works_search_index, + body=body, + ) + + buckets = ( + response.get("aggregations", {}) + .get("publication_years", {}) + .get("buckets", []) + ) + + publication_years: list[int] = [] + + for bucket in buckets: + year = bucket.get("key") + count = bucket.get("doc_count", 0) + + if isinstance(year, int): + publication_years.extend([year] * count) + + return publication_years + + +def _compute_career_metrics(publication_years: list[int]) -> CareerMetrics: + current_year = datetime.now().year + + if not publication_years: + return CareerMetrics() + + sorted_years = sorted(publication_years) + unique_years = sorted(set(publication_years)) + + first_year = sorted_years[0] + last_year = sorted_years[-1] + + publication_count = len(sorted_years) + active_years = len(unique_years) + + career_age = last_year - first_year + career_span = last_year - first_year + 1 + + publications_per_active_year = ( + publication_count / active_years if active_years > 0 else None + ) + + publications_per_career_year = ( + publication_count / career_span if career_span > 0 else None + ) + + years_since_last_publication = current_year - last_year + has_suspicious_publication_years = first_year < 1970 or career_span > 60 + + return CareerMetrics( + first_publication_year=first_year, + last_publication_year=last_year, + career_age=career_age, + career_span=career_span, + active_years=active_years, + publication_count=publication_count, + publications_per_active_year=publications_per_active_year, + publications_per_career_year=publications_per_career_year, + years_since_last_publication=years_since_last_publication, + has_suspicious_publication_years=has_suspicious_publication_years, + ) + + +def get_career_metrics_for_author(author_id: str) -> CareerMetrics: + publication_years = _get_publication_years_for_author(author_id) + return _compute_career_metrics(publication_years) + + def _build_papers(works: list) -> list: papers = [] @@ -214,27 +319,37 @@ def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> s return bio -def get_person_by_id(author_id: str, include: Optional[str] = None) -> AuthorsListResponse: + +def get_person_by_id( + author_id: str, include: Optional[str] = None +) -> CustomAuthorsListResponse: body = { - "_source":include.split(",") if include else True, + "_source": include.split(",") if include else True, } try: hit = elasticsearch.get( index="openalex-authors", body=body, - doc_id=author_id + doc_id=author_id, ) except NotFoundError: raise HTTPException( status_code=404, detail=f"Person with id {author_id} not found" ) - except ApiError as e: raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}") - persons = [util.get_persons_data(hit)] - return AuthorsListResponse(results=persons) + author = util.get_persons_data(hit) + career_metrics = get_career_metrics_for_author(author_id) + + custom_author = CustomAuthor( + **author.model_dump(), + career_metrics=career_metrics, + ) + + return CustomAuthorsListResponse(results=[custom_author]) + def search_persons_by_name( From e5efd351f0924c412224114b9adcdce12f3d330c Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Sun, 14 Jun 2026 00:27:57 +0200 Subject: [PATCH 04/22] Update person response --- service/src/main/inse/persons/service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/src/main/inse/persons/service.py b/service/src/main/inse/persons/service.py index 35034d82..fcfd4648 100644 --- a/service/src/main/inse/persons/service.py +++ b/service/src/main/inse/persons/service.py @@ -85,7 +85,7 @@ def generate_person_bio( @router.get( "/person/{id}", operation_id="getPersonByID", - response_model=AuthorsListResponse, + response_model=model.CustomAuthorsListResponse, summary="Searches for person by ID.", tags=["Persons"], ) From db853f72a1d571e547e7a5805008c28a20bf495f Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Sun, 14 Jun 2026 01:05:17 +0200 Subject: [PATCH 05/22] Fix person detail runtime --- service/src/main/inse/persons/logic.py | 20 ++++++++++++-------- service/src/main/inse/persons/service.py | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index 1a731caf..c1c790fd 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -323,16 +323,20 @@ def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> s def get_person_by_id( author_id: str, include: Optional[str] = None ) -> CustomAuthorsListResponse: - body = { - "_source": include.split(",") if include else True, - } + source = include.split(",") if include else None try: - hit = elasticsearch.get( - index="openalex-authors", - body=body, - doc_id=author_id, - ) + if source: + hit = elasticsearch.get( + index="openalex-authors", + doc_id=author_id, + source=source, + ) + else: + hit = elasticsearch.get( + index="openalex-authors", + doc_id=author_id, + ) except NotFoundError: raise HTTPException( status_code=404, detail=f"Person with id {author_id} not found" diff --git a/service/src/main/inse/persons/service.py b/service/src/main/inse/persons/service.py index fcfd4648..c6cae176 100644 --- a/service/src/main/inse/persons/service.py +++ b/service/src/main/inse/persons/service.py @@ -102,7 +102,7 @@ def get_person_by_id( ), example="topics_full,topic_share", ), - ], + ] = None, ): return logic.get_person_by_id(author_id=id, include=include) From a2ed442dcc3da507866ea81465c644cafa89d053 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 15 Jun 2026 01:38:42 +0200 Subject: [PATCH 06/22] adjusted confirmation dialog component for reusability --- .../ui/app-menu/app-menu.component.html | 5 ++-- .../shared/ui/app-menu/app-menu.component.ts | 23 ++++++++++++++-- .../confirmation-dialog.component.html | 12 ++++----- .../confirmation-dialog.component.ts | 26 ++++++++++++++++--- 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/webapp/src/app/shared/ui/app-menu/app-menu.component.html b/webapp/src/app/shared/ui/app-menu/app-menu.component.html index 942b7cbd..5963c6ee 100644 --- a/webapp/src/app/shared/ui/app-menu/app-menu.component.html +++ b/webapp/src/app/shared/ui/app-menu/app-menu.component.html @@ -37,11 +37,12 @@
+ +
+ +
+ + }
- @if (resolverState.isResolvingFromOutside('/persons')) { - - } @else if (resolverState.isResolvingFromOutside('/person/')) { - - } @else { - - } +
+ @if (resolverState.isResolvingFromOutside('/persons')) { + + } @else if (resolverState.isResolvingFromOutside('/person/')) { + + } @else { + + } +
+ +
+ +
diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.scss b/webapp/src/app/shared/ui/app-layout/app-layout.component.scss index 8311f123..6556c59f 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.scss +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.scss @@ -18,7 +18,10 @@ } .content-shell { - min-height: 100%; + display: flex; + flex-direction: column; + height: 100%; + overflow: hidden; background: var(--sg-background); } @@ -34,10 +37,9 @@ mat-toolbar.main { gap: 24px; height: 76px; padding: 0 32px; - background: rgba(255, 255, 255, 0.92); + background: var(--sg-surface-soft); border-bottom: 1px solid var(--sg-border); color: var(--sg-text); - backdrop-filter: blur(16px); box-shadow: none; } @@ -82,10 +84,30 @@ mat-toolbar.main { } .content { - min-height: calc(100svh - 76px); + display: flex; + flex-direction: column; + flex: 1; + overflow-y: auto; background: var(--sg-background); } +.main-content-body { + flex: 1; +} + +.footer-container { + flex-shrink: 0; + padding: 12px 32px; + background: var(--sg-surface-soft); + border-top: 1px solid var(--sg-border); +} + +.footer { + font-size: 12px; + color: var(--sg-text-muted); + text-align: center; +} + @media (max-width: 900px) { mat-toolbar.main { grid-template-columns: auto 1fr auto; @@ -115,7 +137,7 @@ mat-toolbar.main { } .content { - min-height: calc(100svh - 124px); + min-height: 0; } } .search-wrapper { diff --git a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss index 5572787d..2087eb9c 100644 --- a/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss +++ b/webapp/src/app/shared/ui/app-searchbar/app-searchbar.component.scss @@ -5,7 +5,7 @@ height: 44px; align-self: center; padding: 0 18px; - background: var(--sg-surface-muted); + background: white; border: 1px solid var(--sg-border); border-radius: var(--sg-radius-sm); color: var(--sg-text-soft); From 3fc0b5ca19a8d4ce01109938cf639316575cbe72 Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Mon, 15 Jun 2026 16:52:48 +0200 Subject: [PATCH 12/22] Reduce person-funding component styles below 10 kB CI budget --- .../person-funding.component.scss | 489 +++++++----------- 1 file changed, 182 insertions(+), 307 deletions(-) diff --git a/webapp/src/app/modules/person-funding/person-funding.component.scss b/webapp/src/app/modules/person-funding/person-funding.component.scss index c9560365..72e6d3cd 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.scss +++ b/webapp/src/app/modules/person-funding/person-funding.component.scss @@ -29,11 +29,6 @@ cursor: pointer; font-size: 14px; font-weight: 500; - transition: background 0.15s ease, border-color 0.15s ease; - - &:not(.active):hover { - background: #fafafa; - } &.active { font-weight: 600; @@ -45,61 +40,25 @@ button:nth-child(2) { color: #3b82c4; border-color: #c7dcfa; - - &:not(.active):hover { - background: #f5f9ff; - } - - &.active { - color: #0b4f9e; - background: #e8f2ff; - border-color: #3b82c4; - } + &.active { color: #0b4f9e; background: #e8f2ff; border-color: #3b82c4; } } button:nth-child(3) { color: #3d9a66; border-color: #b8e6cb; - - &:not(.active):hover { - background: #f4fbf7; - } - - &.active { - color: #1a6b3f; - background: #e8f7ee; - border-color: #3d9a66; - } + &.active { color: #1a6b3f; background: #e8f7ee; border-color: #3d9a66; } } button:nth-child(4) { color: #7c65d9; border-color: #d5c8f8; - - &:not(.active):hover { - background: #f8f5ff; - } - - &.active { - color: #5b3fc9; - background: #f0ebff; - border-color: #7c65d9; - } + &.active { color: #5b3fc9; background: #f0ebff; border-color: #7c65d9; } } button:nth-child(5) { color: #d1435f; border-color: #f8c4ce; - - &:not(.active):hover { - background: #fff5f6; - } - - &.active { - color: #a61e3a; - background: #ffe8ec; - border-color: #d1435f; - } + &.active { color: #a61e3a; background: #ffe8ec; border-color: #d1435f; } } } @@ -114,9 +73,7 @@ color: #333; font-size: 14px; - span { - color: #555; - } + span { color: #555; } select { border: 0; @@ -146,9 +103,7 @@ flex-wrap: wrap; } - .sort-control { - margin-left: auto; - } + .sort-control { margin-left: auto; } table { width: 100%; @@ -164,14 +119,7 @@ tr { cursor: pointer; - - &:hover { - background: #f5f5f5; - } - - &.selected { - background: #f0f0f0; - } + &.selected { background: #f0f0f0; } } td { @@ -206,13 +154,13 @@ } h3 { - margin: 0 0 16px 0; + margin: 0 0 16px; font-size: 16px; color: #333; } h4 { - margin: 16px 0 8px 0; + margin: 16px 0 8px; font-size: 14px; color: #555; } @@ -221,16 +169,13 @@ .position-stats { display: flex; gap: 12px; - margin-bottom: 16px; + margin: 0 auto 16px; width: fit-content; - margin-left: auto; - margin-right: auto; .stat { - flex: 0.0 auto; min-width: 100px; text-align: center; - background: white; + background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 10px; @@ -249,20 +194,48 @@ color: #333; } } - .stat-first { - background: #effaf3; - border-color: #bdebcf; - } +} - .stat-middle { - background: #f6f0ff; - border-color: #d8cafe; - } +.stat-first, +.position-badge--first, +.hero-highlight--open, +.publication-detail-grid .access-badge--open { + background: #effaf3; +} - .stat-last { - background: #fff1f2; - border-color: #fda4af; - } +.stat-first { border-color: #bdebcf; } + +.position-badge--first { + color: #24834f; + border: 1px solid #bdebcf; +} + +.hero-highlight--open, +.publication-detail-grid .access-badge--open { + border-color: #bdebcf; + color: #24834f; +} + +.stat-middle, +.position-badge--middle { + background: #f6f0ff; + border-color: #d8cafe; +} + +.position-badge--middle { + color: #7255d9; + border: 1px solid #d8cafe; +} + +.stat-last, +.position-badge--last { + background: #fff1f2; + border-color: #fda4af; +} + +.position-badge--last { + color: #be123c; + border: 1px solid #fda4af; } .publication-list { @@ -290,7 +263,7 @@ padding: 4px 10px; border: 1px solid #d0d0d0; border-radius: 6px; - background: white; + background: #fff; cursor: pointer; font-size: 12px; @@ -320,7 +293,6 @@ color: #475569; font-size: 0.75rem; font-weight: 600; - letter-spacing: 0.02em; text-transform: uppercase; } @@ -378,8 +350,6 @@ text-align: left; .material-icons { - flex-shrink: 0; - margin-top: 1px; font-size: 20px; color: #3b82c4; } @@ -393,19 +363,25 @@ } } -.funding-publication-page { - padding: 16px; -} +.funding-publication-page { padding: 16px; } -.publication-detail-back { +.publication-detail-back, +.publication-more-info { display: inline-flex; align-items: center; - gap: 6px; border: 0; background: transparent; cursor: pointer; } +.publication-detail-back { gap: 6px; } + +.publication-more-info { + gap: 4px; + margin-top: 6px; + padding: 0; +} + .publication-detail-hero { display: flex; justify-content: space-between; @@ -439,7 +415,6 @@ font-size: 0.75rem; font-weight: 700; text-transform: uppercase; - letter-spacing: 0.02em; } } @@ -475,7 +450,6 @@ display: inline-flex; align-items: center; gap: 6px; - flex-shrink: 0; padding: 10px 16px; border: 1px solid #bdd4ff; border-radius: 8px; @@ -484,33 +458,14 @@ font-weight: 600; font-size: 0.875rem; text-decoration: none; - white-space: nowrap; - &:hover { - background: #e3efff; - } - - .material-icons { - font-size: 18px; - } - } -} - -@media (max-width: 720px) { - .publication-detail-hero { - flex-direction: column; - align-items: stretch; - - &__action { - justify-content: center; - } + .material-icons { font-size: 18px; } } } .hero-highlight { display: inline-flex; flex-direction: column; - min-width: 72px; padding: 8px 12px; border: 1px solid #e0e6f0; border-radius: 8px; @@ -527,7 +482,6 @@ font-size: 0.7rem; color: #64748b; text-transform: uppercase; - letter-spacing: 0.03em; } &--badge { @@ -539,12 +493,6 @@ color: #475569; } - &--open { - border-color: #bdebcf; - background: #effaf3; - color: #24834f; - } - &--closed { border-color: #e0e6f0; background: #f8fafc; @@ -560,24 +508,6 @@ font-size: 0.8rem; font-weight: 700; - &--first { - background: #effaf3; - color: #24834f; - border: 1px solid #bdebcf; - } - - &--middle { - background: #f6f0ff; - color: #7255d9; - border: 1px solid #d8cafe; - } - - &--last { - background: #fff1f2; - color: #be123c; - border: 1px solid #fda4af; - } - &--unknown { background: #f1f5f9; color: #64748b; @@ -585,179 +515,123 @@ } } -.publication-detail-grid { +$g: '.publication-detail-grid'; + +#{$g} { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 12px; +} - .publication-detail-main, - .publication-detail-side { - display: grid; - gap: 12px; - min-width: 0; - } +#{$g} .publication-detail-main, +#{$g} .publication-detail-side { + display: grid; + gap: 12px; + min-width: 0; +} - .publication-detail-section { - border: 1px solid #e0e6f0; - border-radius: 10px; - padding: 18px; - background: #fff; +#{$g} .publication-detail-section { + border: 1px solid #e0e6f0; + border-radius: 10px; + padding: 18px; + background: #fff; - h3 { - margin: 0 0 14px; - font-size: 1rem; - color: #1e3a5f; - } - - &--funding { - background: #fafbfd; - } - } - - .publication-overview, - .publication-abstract { - margin: 0; - color: #334155; - line-height: 1.65; - } - - .publication-detail-facts { - display: grid; - gap: 12px; - margin: 0; - - div { - display: grid; - grid-template-columns: 130px minmax(0, 1fr); - gap: 12px; - } - - dt { - color: #64748b; - font-size: 0.875rem; - } - - dd { - margin: 0; - word-break: break-word; - color: #1e293b; - } - } - - .tag-list { - display: flex; - flex-wrap: wrap; - gap: 6px; - margin: 0; - padding: 0; - list-style: none; - - &--compact .tag { - font-size: 0.75rem; - padding: 3px 8px; - } - } - - .tag { - padding: 4px 10px; - border-radius: 999px; - background: #f0f6ff; - border: 1px solid #dbeafe; - color: #1e40af; - font-size: 0.8rem; - line-height: 1.3; - } - - .access-badge { - display: inline-flex; - padding: 4px 10px; - border-radius: 999px; - font-size: 0.8rem; - font-weight: 600; - background: #f1f5f9; - color: #64748b; - - &--open { - background: #effaf3; - color: #24834f; - } - - &--closed { - background: #f8fafc; - color: #475569; - } - } - - .access-actions { - display: flex; - flex-wrap: wrap; - gap: 10px; - align-items: center; - } - - .inline-action { - display: inline-flex; - align-items: center; - gap: 4px; - color: #0b63ce; - font-weight: 600; - font-size: 0.875rem; - text-decoration: none; - - .material-icons { - font-size: 16px; - } - } - - .warning-badge { - display: inline-flex; - padding: 4px 10px; - border-radius: 999px; - background: #fef2f2; - border: 1px solid #fecaca; - color: #b91c1c; - font-size: 0.8rem; - font-weight: 600; - } - - .citation-year-table { - border-collapse: collapse; - - th, - td { - padding: 2px 0; - font-weight: normal; - text-align: left; - vertical-align: top; - } - - th { - padding-right: 20px; - font-weight: 600; - color: #334155; - white-space: nowrap; - } - - td { - color: #1e293b; - } + h3 { + margin: 0 0 14px; + font-size: 1rem; + color: #1e3a5f; } } -@media (max-width: 960px) { - .publication-detail-grid { - grid-template-columns: 1fr; - } +#{$g} .publication-overview, +#{$g} .publication-abstract { + margin: 0; + color: #334155; + line-height: 1.65; +} + +#{$g} .publication-detail-facts { + display: grid; + gap: 12px; + margin: 0; +} + +#{$g} .publication-detail-facts div { + display: grid; + grid-template-columns: 130px minmax(0, 1fr); + gap: 12px; +} + +#{$g} .publication-detail-facts dt { + color: #64748b; + font-size: 0.875rem; +} + +#{$g} .publication-detail-facts dd { + margin: 0; + word-break: break-word; + color: #1e293b; +} + +#{$g} .tag-list { + display: flex; + flex-wrap: wrap; + gap: 6px; + margin: 0; + padding: 0; + list-style: none; +} + +#{$g} .tag, +#{$g} .access-badge, +#{$g} .warning-badge { + display: inline-flex; + padding: 4px 10px; + border-radius: 999px; + font-size: 0.8rem; +} + +#{$g} .tag { + background: #f0f6ff; + border: 1px solid #dbeafe; + color: #1e40af; + line-height: 1.3; +} + +#{$g} .access-badge { + font-weight: 600; + background: #f1f5f9; + color: #64748b; +} + +#{$g} .access-badge--closed { + background: #f8fafc; + color: #475569; +} + +#{$g} .inline-action { + display: inline-flex; + align-items: center; + gap: 4px; + color: #0b63ce; + font-weight: 600; + font-size: 0.875rem; + text-decoration: none; + + .material-icons { font-size: 16px; } +} + +#{$g} .warning-badge { + background: #fef2f2; + border: 1px solid #fecaca; + color: #b91c1c; + font-weight: 600; } .publication-item { padding: 8px 0; border-bottom: 2px solid #5b5555; cursor: pointer; - - &:hover { - background: #f9f9f9; - } } .publication-title { @@ -767,30 +641,31 @@ word-break: break-word; display: block; } -.publication-more-info { - display: flex; - align-items: center; - gap: 4px; - margin-top: 6px; - border: 0; - background: transparent; - padding: 0; - cursor: pointer; -} + +.mehr-infos-label, +.publication-link-icon { color: #1976d2; } .mehr-infos-label { font-size: 0.8rem; - color: #1976d2; font-weight: 500; } .publication-link-icon { display: flex; align-items: center; - color: #1976d2; - flex-shrink: 0; - .material-icons { - font-size: 16px; + .material-icons { font-size: 16px; } +} + +@media (max-width: 720px) { + .publication-detail-hero { + flex-direction: column; + align-items: stretch; + + &__action { justify-content: center; } } } + +@media (max-width: 960px) { + #{$g} { grid-template-columns: 1fr; } +} From 8515a01ff4aaa16653122161750b00355eaafb1a Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 15 Jun 2026 19:04:44 +0200 Subject: [PATCH 13/22] fixed institutuin autocompletion logic, used existing elastic wrapper for queries --- .../institutions_search_client.py | 223 ++++++++++++------ service/src/main/inse/institutions/logic.py | 40 ++-- service/src/main/inse/institutions/service.py | 15 +- .../src/main/inse/institutions/test_logic.py | 58 ----- .../main/inse/models/openalex/institution.py | 11 +- 5 files changed, 171 insertions(+), 176 deletions(-) diff --git a/service/src/main/inse/institutions/institutions_search_client.py b/service/src/main/inse/institutions/institutions_search_client.py index 23a736af..dd895930 100644 --- a/service/src/main/inse/institutions/institutions_search_client.py +++ b/service/src/main/inse/institutions/institutions_search_client.py @@ -1,79 +1,73 @@ import logging from typing import List, Set -import httpx - from inse.models.openalex.institution import Institution from inse.exceptions import NotFoundException +from inse.integrations import elasticsearch logger = logging.getLogger(__name__) class InstitutionsSearchClient: - def __init__( - self, - base_url: str, - api_key: str, - ): - self.base_url = base_url - self.api_key = api_key - self.headers = { - "Content-Type": "application/json", - "Authorization": f"ApiKey {self.api_key}", - } + def __init__(self): + """ + Initializes the client. Credentials and URLs are handled by the + centralized elasticsearch integration. + """ + pass async def get_institution_by_id(self, raw_institution_id: str) -> Institution: + """ + Retrieves a single institution by its OpenAlex ID from the local Elasticsearch cluster. + """ query = { - "query": { - "match": { - "id": f"https://openalex.org/{raw_institution_id.upper()}", - } - }, - "size": 1, + "match": { + "id": f"https://openalex.org/{raw_institution_id.upper()}", + } } + + res = elasticsearch.search( + index="openalex-institutions", + query=query, + size=1 + ) + + hits = res.get("hits", {}).get("hits", []) + if not hits: + raise NotFoundException(f"Institution with ID '{raw_institution_id}' not found.") + authors = await self.get_authors_by_institution_id(raw_institution_id) logger.debug( "Retrieved authors for institution_id=%s: %s", raw_institution_id, authors ) - - async with httpx.AsyncClient() as client: - response = await client.post( - f"{self.base_url}/openalex-institutions/_search", - json=query, - headers=self.headers, - ) - response.raise_for_status() - hits = response.json().get("hits", {}).get("hits", []) - if not hits: - raise NotFoundException( - f"Institution with ID '{raw_institution_id}' not found." - ) - - return Institution.from_dict(hits[0]["_source"]) + + return Institution.from_dict(hits[0]["_source"]) async def get_authors_by_institution_id(self, raw_institution_id: str) -> List[str]: + """ + Fetches authors associated with an institution. + Note: This query is specifically looking for current affiliations (2026). + """ query = { - "query": { - "nested": { - "path": "affiliations", - "query": { - "bool": { - "must": [ - { - "term": { - "affiliations.institution.id": f"https://openalex.org/{raw_institution_id.upper()}" - } - }, - { - "range": { - "affiliations.years": {"gte": 2026, "lte": 2026} - } - }, - ] - } - }, - } + "nested": { + "path": "affiliations", + "query": { + "bool": { + "must": [ + { + "term": { + "affiliations.institution.id": f"https://openalex.org/{raw_institution_id.upper()}" + } + }, + { + "range": { + "affiliations.years": {"gte": 2026, "lte": 2026} + } + }, + ] + } + }, } } logger.debug( @@ -81,30 +75,103 @@ class InstitutionsSearchClient: raw_institution_id, query, ) - async with httpx.AsyncClient() as client: - response = await client.post( - "https://project.nes.uni-due.de/elastic/openalex-authors/_search", - json=query, - headers=self.headers, - ) - try: - response.raise_for_status() - except httpx.HTTPStatusError as e: - logger.exception( - "Error fetching authors for institution_id=%s: %s, response content: %s", - raw_institution_id, - str(e), - response.text, - ) - return [] - hits = response.json().get("hits", {}).get("hits", []) - authors = set() - for hit in hits: - authors.update( - auth["author"]["display_name"] - for auth in hit["_source"].get("authorships", []) - ) - return list(authors) + + res = elasticsearch.search(index="openalex-authors", query=query) + hits = res.get("hits", {}).get("hits", []) + + # Extracting display_name directly from the author document source + authors = {hit["_source"].get("display_name") for hit in hits if hit["_source"].get("display_name")} + return list(authors) + async def search_institutions( + self, + query_text: str, + country_code: str | None = None, + institution_type: str | None = None, + limit: int = 10, + ) -> list[Institution]: + """ + Autocomplete search for institutions using multi_match on search_as_you_type fields. + Falls back to fuzzy match for typo tolerance on longer queries. + """ + must = [] + + if query_text: + stripped = query_text.strip() + + must.append({ + "bool": { + "should": [ + # Fast prefix matching via search_as_you_type shingles + { + "multi_match": { + "query": stripped, + "type": "bool_prefix", + "fields": [ + "display_name.search", + "display_name.search._2gram", + "display_name.search._3gram", + "display_name_alternatives.search", + "display_name_alternatives.search._2gram", + ], + "boost": 2, + } + }, + # Exact acronym match — high confidence signal + { + "term": { + "display_name_acronyms.keyword": { + "value": stripped.upper(), + "boost": 10, + } + } + }, + # Fuzzy fallback for typos (only worth it for longer input) + *( + [{ + "match": { + "display_name": { + "query": stripped, + "fuzziness": "AUTO", + "boost": 1, + } + } + }] + if len(stripped) >= 4 else [] + ), + ], + "minimum_should_match": 1, + } + }) + + filter_queries = [] + + if country_code: + filter_queries.append({"term": {"country_code": country_code.upper()}}) + + if institution_type: + filter_queries.append({"term": {"type": institution_type}}) + + query = { + "bool": { + "must": must, + "filter": filter_queries, + } + } + + res = elasticsearch.search( + index="openalex-institutions", + query=query, + size=limit, + # Blend relevance score with works_count popularity signal + sort=[ + {"works_count": {"order": "desc"}}, + ], + source=["id", "display_name", "country_code", "type", "works_count", "cited_by_count", "geo"], + ) + + hits = res.get("hits", {}).get("hits", []) + + return [Institution.from_dict(hit["_source"]) for hit in hits] async def get_institution_aliases_by_id(self, raw_institution_id: str) -> List[str]: """Get a list of institution aliases for a given institution ID, including both display name alternatives and predefined aliases. diff --git a/service/src/main/inse/institutions/logic.py b/service/src/main/inse/institutions/logic.py index a4f834ee..7562672e 100644 --- a/service/src/main/inse/institutions/logic.py +++ b/service/src/main/inse/institutions/logic.py @@ -114,34 +114,29 @@ async def autocomplete_institutions( country_code: str | None = None, institution_type: str | None = None, limit: int = 10, - client: OpenAlexInstitutionsClient | None = None, + client: InstitutionsSearchClient, ) -> AutocompleteResponse: - filters = [] - if country_code: - filters.append(f"country_code:{country_code}") - if institution_type: - filters.append(f"type:{institution_type}") - - response = await list_institutions( - search=query, - filter=",".join(filters) if filters else None, - sort="works_count:desc", - per_page=limit, - page=1, - select=("id,ror,display_name,country_code,type,works_count,cited_by_count,geo"), - client=client, + """ + Returns institution options for autocomplete inputs using the local + Elasticsearch cluster via the provided client. + """ + institutions = await client.search_institutions( + query_text=query, + country_code=country_code, + institution_type=institution_type, + limit=limit, ) results = [] - for institution in response.results or []: + for institution in institutions: if not institution.id or not institution.display_name: continue hint_parts = [] - if institution.geo: - if institution.geo.city: + if hasattr(institution, "geo") and institution.geo: + if hasattr(institution.geo, "city") and institution.geo.city: hint_parts.append(institution.geo.city) - if institution.geo.country: + if hasattr(institution.geo, "country") and institution.geo.country: hint_parts.append(institution.geo.country) elif institution.country_code: hint_parts.append(institution.country_code) @@ -161,12 +156,7 @@ async def autocomplete_institutions( ) return AutocompleteResponse( - meta=AutocompleteResponseMeta( - count=response.meta.count if response.meta else len(results), - db_response_time_ms=( - response.meta.db_response_time_ms if response.meta else None - ), - ), + meta=AutocompleteResponseMeta(count=len(results)), results=results, ) diff --git a/service/src/main/inse/institutions/service.py b/service/src/main/inse/institutions/service.py index 16c7d676..5c08bbdf 100644 --- a/service/src/main/inse/institutions/service.py +++ b/service/src/main/inse/institutions/service.py @@ -23,17 +23,7 @@ router = APIRouter(prefix="/api/inse-service/institutions", tags=[Tags.INSTITUTI @lru_cache def get_institutions_search_client() -> InstitutionsSearchClient: - settings = get_settings() - if not settings.elasticsearch_url: - raise ValueError("Elasticsearch URL is missing in settings.") - if not settings.elasticsearch_api_key: - raise ValueError("Elasticsearch API key is missing in settings.") - - return InstitutionsSearchClient( - api_key=settings.elasticsearch_api_key, - base_url=settings.elasticsearch_url, - ) - + return InstitutionsSearchClient() @router.get( "/autocomplete", @@ -62,12 +52,14 @@ async def autocomplete_institutions( int, Query(description="Maximum number of autocomplete options.", ge=1, le=25), ] = 10, + client: Annotated[InstitutionsSearchClient, Depends(get_institutions_search_client)] = None, ): return await logic.autocomplete_institutions( query=query, country_code=country_code, institution_type=institution_type, limit=limit, + client=client, ) @@ -155,4 +147,3 @@ async def get_institution( ], ) -> Institution: return await logic.get_institution_by_id(raw_institution_id=id, client=client) - diff --git a/service/src/main/inse/institutions/test_logic.py b/service/src/main/inse/institutions/test_logic.py index e079ff8e..bebf52c0 100644 --- a/service/src/main/inse/institutions/test_logic.py +++ b/service/src/main/inse/institutions/test_logic.py @@ -176,61 +176,3 @@ async def test_list_institutions_accepts_practical_openalex_type_variants(): assert result.results[0].counts_by_year[0].cited_by_count is None assert result.group_by[0].key == "true" - -@pytest.mark.anyio -async def test_autocomplete_institutions_returns_frontend_options(): - def handler(request: httpx.Request) -> httpx.Response: - assert request.url.params["search"] == "Duisburg Essen" - assert request.url.params["filter"] == "country_code:DE,type:education" - assert request.url.params["sort"] == "works_count:desc" - assert request.url.params["per_page"] == "5" - assert request.url.params["select"] == ( - "id,ror,display_name,country_code,type,works_count," - "cited_by_count,geo" - ) - return httpx.Response( - 200, - json={ - "meta": {"count": 1, "db_response_time_ms": 12}, - "results": [ - { - "id": "https://openalex.org/I123", - "ror": "https://ror.org/04mz5ra38", - "display_name": "University of Duisburg-Essen", - "country_code": "DE", - "type": "education", - "works_count": 123, - "cited_by_count": 456, - "geo": { - "city": "Duisburg", - "country": "Germany", - }, - } - ], - }, - ) - - client = OpenAlexInstitutionsClient( - api_key="test-key", - transport=httpx.MockTransport(handler), - ) - - result = await logic.autocomplete_institutions( - query="Duisburg Essen", - country_code="DE", - institution_type="education", - limit=5, - client=client, - ) - - assert result.meta.count == 1 - assert result.meta.db_response_time_ms == 12 - assert len(result.results) == 1 - option = result.results[0] - assert option.id == "https://openalex.org/I123" - assert option.display_name == "University of Duisburg-Essen" - assert option.hint == "Duisburg · Germany · education" - assert option.works_count == 123 - assert option.cited_by_count == 456 - assert option.entity_type == "institution" - assert option.external_id == "https://ror.org/04mz5ra38" diff --git a/service/src/main/inse/models/openalex/institution.py b/service/src/main/inse/models/openalex/institution.py index a81ae678..6121af94 100644 --- a/service/src/main/inse/models/openalex/institution.py +++ b/service/src/main/inse/models/openalex/institution.py @@ -55,13 +55,20 @@ class Institution(BaseModel): updated_date: Optional[datetime] = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).") __properties: ClassVar[List[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"] + @field_validator('created_date', mode='before') + @classmethod + def normalize_created_date(cls, v: Any) -> Any: + if isinstance(v, str) and len(v) > 10: + return v[:10] + return v + @field_validator('type') def type_validate_enum(cls, value): """Validates the enum""" if value is None: return value - if value not in set(['education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']): + if value not in set(['education','funder', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']): raise ValueError("must be one of enum values ('education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other')") return value @@ -154,5 +161,3 @@ class Institution(BaseModel): "updated_date": obj.get("updated_date") }) return _obj - - From e52204a90da97ff931515ded3f1ef2a246164133 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 15 Jun 2026 19:05:02 +0200 Subject: [PATCH 14/22] fixed routing logic --- webapp/src/app/app.routes.ts | 4 +-- .../app-register/app-register.component.ts | 25 ++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 9c674dc3..01ca7ee8 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -8,7 +8,6 @@ import { institutionResolver } from './resolvers/institution.resolver'; import { bundProjectsResolver } from './resolvers/bund-projects.resolver'; import { euProjectsResolver } from './resolvers/eu-projects.resolver'; import { dfgProjectsResolver } from './resolvers/dfg-projects.resolver'; - export const routes: Routes = [ { path: 'login', @@ -17,7 +16,7 @@ export const routes: Routes = [ (mod) => mod.AppLoginComponent, ), }, - { + { path: 'register', loadComponent: () => import('./modules/app-register/app-register.component').then( @@ -236,5 +235,6 @@ export const routes: Routes = [ routeMessage: 'Die gesuchte Seite existiert leider nicht oder wurde verschoben.', }, + canActivate: [userGuard], }, ]; diff --git a/webapp/src/app/modules/app-register/app-register.component.ts b/webapp/src/app/modules/app-register/app-register.component.ts index d485ac42..70b2f073 100644 --- a/webapp/src/app/modules/app-register/app-register.component.ts +++ b/webapp/src/app/modules/app-register/app-register.component.ts @@ -1,4 +1,4 @@ -import { Component, inject, OnDestroy, signal, DestroyRef } from '@angular/core'; +import { Component, inject, OnDestroy, signal, DestroyRef, OnInit } from '@angular/core'; import { CommonModule } from '@angular/common'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { Router, RouterLink } from '@angular/router'; @@ -36,7 +36,7 @@ import { InstitutionsService } from '../../api'; templateUrl: './app-register.component.html', styleUrl: './app-register.component.scss', }) -export class AppRegisterComponent implements OnDestroy { +export class AppRegisterComponent implements OnDestroy, OnInit { private readonly fb = inject(FormBuilder); protected readonly credentialService = inject(CredentialService); private readonly router = inject(Router); @@ -57,11 +57,30 @@ export class AppRegisterComponent implements OnDestroy { constructor() { this.setupInstitutionAutocomplete(); } - + ngOnInit(): void { + this.subscription = this.credentialService.validating.subscribe( + (validating) => { + if (validating) { + this.registerForm.disable(); + } else { + this.registerForm.enable(); + this.checkEnter(); + } + }, + ); + if (!this.credentialService.validating) { + this.checkEnter(); + } + } ngOnDestroy(): void { this.subscription?.unsubscribe(); } + checkEnter(): void { + if (this.credentialService.authenticated.value) { + this.router.navigate(['/dashboard']); + } + } submit() { if (this.registerForm.valid) { this.credentialService.validating.next(true); From 9de6d4408d62fd53c1e44f12e950cde889f0ba55 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 15 Jun 2026 19:12:12 +0200 Subject: [PATCH 15/22] undid openapi config push --- webapp/openapi-generator-ignore | 3 --- webapp/openapitools.json | 17 +++++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/webapp/openapi-generator-ignore b/webapp/openapi-generator-ignore index 844db49d..44ab4450 100644 --- a/webapp/openapi-generator-ignore +++ b/webapp/openapi-generator-ignore @@ -6,6 +6,3 @@ git_push.sh package.json ng-package.json tsconfig.json -# Ignore generated service interfaces -src/app/api/**/*Interface.ts -src/app/api/**/*.interface.ts \ No newline at end of file diff --git a/webapp/openapitools.json b/webapp/openapitools.json index 513cb883..7af6e36f 100644 --- a/webapp/openapitools.json +++ b/webapp/openapitools.json @@ -9,16 +9,13 @@ "output": "src/app/api", "ignoreFileOverride": "openapi-generator-ignore", "additionalProperties": { - "ngVersion": "21.2.14", - "providedInRoot": true, - "serviceSuffix": "Service", - "withInterfaces": false, - "generateModelDocumentation": false, - "modelPropertyNaming": "original", - "enumPropertyNaming": "original", - "fileNaming": "camelCase", - "apiModulePrefix": "" -} + "ngVersion": "21.2.14", + "providedInRoot": true, + "serviceSuffix": "Service", + "withInterfaces": true, + "enumPropertyNaming": "original", + "fileNaming": "kebab-case" + } } } } From bad95c65dd5cfbae2baf4e6f9b94301f418e02b6 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 15 Jun 2026 20:26:59 +0200 Subject: [PATCH 16/22] Timeline: show topic description on hover (frontend) --- .../research-timeline.component.html | 14 +++++++++++++ .../research-timeline.component.ts | 21 +++++++++++++++++++ .../person-overview.component.ts | 1 + 3 files changed, 36 insertions(+) diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html index 5376284b..9af028d2 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html @@ -225,6 +225,10 @@ type="button" class="main-topic-button" [disabled]="!getMainTopicItem(item)?.id" + [matTooltip]="getTopicDescription(getMainTopicItem(item))" + [matTooltipDisabled]=" + !hasTopicDescription(getMainTopicItem(item)) + " (click)=" selectTopic(getMainTopicItem(item), [item.year]) "> @@ -260,6 +264,8 @@ class="topic-chip" [ngClass]="getColorClass(index)" [disabled]="!topic.id" + [matTooltip]="getTopicDescription(topic)" + [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, [item.year])"> {{ topic.name }} {{ topic.count }} @@ -322,6 +328,10 @@ type="button" class="main-topic-button" [disabled]="!phase.primaryTopic.id" + [matTooltip]="getTopicDescription(phase.primaryTopic)" + [matTooltipDisabled]=" + !hasTopicDescription(phase.primaryTopic) + " (click)=" selectTopic(phase.primaryTopic, getPhaseYears(phase)) "> @@ -340,6 +350,8 @@ class="topic-chip" [ngClass]="getColorClass(index)" [disabled]="!topic.id" + [matTooltip]="getTopicDescription(topic)" + [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, getPhaseYears(phase))"> {{ topic.name }} {{ topic.count }} @@ -412,6 +424,8 @@ " class="mini-topic-chip" [disabled]="!topic.id" + [matTooltip]="getTopicDescription(topic)" + [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, [year.year])"> {{ topic.name }} {{ topic.count }} diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts index 90dfbe9f..37eb2013 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -17,6 +17,7 @@ export interface TopicTimelineTopic { id?: string; name: string; count: number; + description?: string; } export interface TopicTimelineElement { @@ -330,6 +331,14 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { ); } + getTopicDescription(topic: TopicTimelineTopic | undefined): string { + return (topic?.description ?? '').trim(); + } + + hasTopicDescription(topic: TopicTimelineTopic | undefined): boolean { + return this.getTopicDescription(topic).length > 0; + } + togglePhase(phase: ResearchTimelinePhase): void { if (this.expandedPhaseIds.has(phase.id)) { this.expandedPhaseIds.delete(phase.id); @@ -608,6 +617,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { const primaryTopicName = primaryTopic.name; let count = 0; let id = primaryTopic.id; + let description = primaryTopic.description; for (const year of years) { for (const topic of year.primary_topics ?? []) { @@ -620,6 +630,10 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { if (!id && topic.id) { id = topic.id; } + + if (!description && topic.description) { + description = topic.description; + } } } @@ -627,6 +641,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { id, name: primaryTopicName, count: count > 0 ? count : primaryTopic.count, + description, }; } @@ -637,6 +652,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { const counts = new Map(); const originalNames = new Map(); const ids = new Map(); + const descriptions = new Map(); for (const year of years) { for (const topic of year.topics ?? []) { @@ -652,6 +668,10 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { ids.set(normalizedName, topic.id); } + if (topic.description) { + descriptions.set(normalizedName, topic.description); + } + counts.set( normalizedName, (counts.get(normalizedName) ?? 0) + topic.count, @@ -664,6 +684,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { id: ids.get(normalizedName), name: originalNames.get(normalizedName) ?? normalizedName, count, + description: descriptions.get(normalizedName), })) .sort((left, right) => { if (right.count !== left.count) { diff --git a/webapp/src/app/modules/person-overview/person-overview.component.ts b/webapp/src/app/modules/person-overview/person-overview.component.ts index 5291c82a..57d2275c 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -453,6 +453,7 @@ export class PersonOverviewComponent implements OnInit { id: topic.id ?? undefined, name: topic.name, count: topic.count ?? 0, + description: topic.description ?? undefined, })); } From 3b220051a2d4e235f9041ba3b5a4f2088da7adc6 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 15 Jun 2026 20:51:36 +0200 Subject: [PATCH 17/22] Timeline: show topic count tooltips --- .../research-timeline.component.html | 43 +++++++++++++------ .../research-timeline.component.scss | 3 ++ .../research-timeline.component.ts | 28 ++++++++++++ 3 files changed, 62 insertions(+), 12 deletions(-) diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html index 9af028d2..65bf5eae 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html @@ -264,11 +264,18 @@ class="topic-chip" [ngClass]="getColorClass(index)" [disabled]="!topic.id" - [matTooltip]="getTopicDescription(topic)" - [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, [item.year])"> - {{ topic.name }} - {{ topic.count }} + + {{ topic.name }} + + + {{ topic.count }} + @@ -350,11 +357,18 @@ class="topic-chip" [ngClass]="getColorClass(index)" [disabled]="!topic.id" - [matTooltip]="getTopicDescription(topic)" - [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, getPhaseYears(phase))"> - {{ topic.name }} - {{ topic.count }} + + {{ topic.name }} + + + {{ topic.count }} + @@ -424,11 +438,16 @@ " class="mini-topic-chip" [disabled]="!topic.id" - [matTooltip]="getTopicDescription(topic)" - [matTooltipDisabled]="!hasTopicDescription(topic)" (click)="selectTopic(topic, [year.year])"> - {{ topic.name }} - {{ topic.count }} + + {{ topic.name }} + + + {{ topic.count }} + diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss index 0535e874..6c2ed063 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss @@ -602,6 +602,9 @@ } strong { + display: inline-flex; + align-items: center; + gap: 2px; color: var(--accent); font-size: 10px; } diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts index 37eb2013..43c99ff3 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -339,6 +339,23 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { return this.getTopicDescription(topic).length > 0; } + getYearTopicCountTooltip( + topic: TopicTimelineTopic, + item: TopicTimelineElement, + ): string { + return this.getTopicCountTooltip(topic, `im Jahr ${item.year}`); + } + + getPhaseTopicCountTooltip( + topic: TopicTimelineTopic, + phase: ResearchTimelinePhase, + ): string { + return this.getTopicCountTooltip( + topic, + this.getPhasePublicationTooltipPeriod(phase), + ); + } + togglePhase(phase: ResearchTimelinePhase): void { if (this.expandedPhaseIds.has(phase.id)) { this.expandedPhaseIds.delete(phase.id); @@ -471,6 +488,17 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked { return `Insgesamt ${count} ${publicationLabel} ${period} veröffentlicht.`; } + private getTopicCountTooltip( + topic: TopicTimelineTopic, + period: string, + ): string { + const publicationLabel = + topic.count === 1 ? 'Publikation' : 'Publikationen'; + const verb = topic.count === 1 ? 'hat' : 'haben'; + + return `${topic.count} ${publicationLabel} ${period} ${verb} das Topic ${topic.name}.`; + } + private getPhasePublicationTooltipPeriod( phase: ResearchTimelinePhase, ): string { From 678ab84995ee7cedfb8386bff57b9d80083e57c4 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 15 Jun 2026 20:59:51 +0200 Subject: [PATCH 18/22] timeline: reduce stylesheet size --- .../research-timeline/research-timeline.component.scss | 3 --- 1 file changed, 3 deletions(-) diff --git a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss index 6c2ed063..e1b43d09 100644 --- a/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss @@ -409,7 +409,6 @@ .topic-count { display: inline-flex; - flex: 0 0 auto; align-items: center; justify-content: center; min-width: 18px; @@ -453,7 +452,6 @@ } .phase-marker { - flex: 0 0 auto; width: 11px; height: 11px; margin-top: 5px; @@ -493,7 +491,6 @@ .phase-publications-button { display: inline-flex; - flex: 0 0 auto; width: fit-content; color: #68748f; font-size: 12px; From c92bb39683786c4daf59efa5fed64567c3050f6d Mon Sep 17 00:00:00 2001 From: Steven Tischer Date: Tue, 16 Jun 2026 07:03:25 +0200 Subject: [PATCH 19/22] redirect from root path to dashboard --- webapp/src/app/app.routes.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index 01ca7ee8..f6ab27f3 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -9,6 +9,11 @@ import { bundProjectsResolver } from './resolvers/bund-projects.resolver'; import { euProjectsResolver } from './resolvers/eu-projects.resolver'; import { dfgProjectsResolver } from './resolvers/dfg-projects.resolver'; export const routes: Routes = [ + { + path: '', + pathMatch: 'full', + redirectTo: 'dashboard', + }, { path: 'login', loadComponent: () => From a7620b1900acb4dc911d750aa53e80a9e965bda6 Mon Sep 17 00:00:00 2001 From: arzani Date: Tue, 16 Jun 2026 11:28:28 +0200 Subject: [PATCH 20/22] jenkins save docker step executed only in main --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4af1befe..c0715dad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,6 +28,9 @@ pipeline { } stage('Save Docker image') { + when { + branch 'main' + } steps { sh 'docker save ${IMAGE_PREFIX}-app:${IMAGE_VERSION} | gzip > app-image.tar.gz' } From 13c4975932639491b9ae1d09283c25f16d237ba0 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Tue, 16 Jun 2026 15:24:37 +0200 Subject: [PATCH 21/22] add career stage --- service/src/main/inse/persons/logic.py | 18 +++++++++++++++++- service/src/main/inse/persons/model.py | 4 ++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index c1c790fd..a2def5a9 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -212,6 +212,21 @@ def _get_publication_years_for_author(author_id: str) -> list[int]: return publication_years +def _classify_career_stage(active_years: int) -> str: + if active_years <= 0: + return "unknown" + + if active_years <= 4: + return "Early Researcher" + + if active_years <= 10: + return "Emerging Researcher" + + if active_years <= 20: + return "Established Researcher" + + return "Senior Researcher" + def _compute_career_metrics(publication_years: list[int]) -> CareerMetrics: current_year = datetime.now().year @@ -227,7 +242,7 @@ def _compute_career_metrics(publication_years: list[int]) -> CareerMetrics: publication_count = len(sorted_years) active_years = len(unique_years) - + career_stage = _classify_career_stage(active_years) career_age = last_year - first_year career_span = last_year - first_year + 1 @@ -247,6 +262,7 @@ def _compute_career_metrics(publication_years: list[int]) -> CareerMetrics: last_publication_year=last_year, career_age=career_age, career_span=career_span, + career_stage=career_stage, active_years=active_years, publication_count=publication_count, publications_per_active_year=publications_per_active_year, diff --git a/service/src/main/inse/persons/model.py b/service/src/main/inse/persons/model.py index 039672d3..300ec2d9 100644 --- a/service/src/main/inse/persons/model.py +++ b/service/src/main/inse/persons/model.py @@ -26,6 +26,10 @@ class CareerMetrics(BaseModel): career_span: Optional[int] = Field( default=None, description="Inclusive span from first to last publication year." ) + career_stage: Optional[str] = Field( + default=None, + description="Threshold-based career stage derived from active publication years.", + ) active_years: int = Field( default=0, description="Number of distinct years with at least one publication." ) From b496cfd52c499947c95f1a2fd4c681b65586c306 Mon Sep 17 00:00:00 2001 From: Kazgatari <56477241+Kazgatari@users.noreply.github.com> Date: Wed, 17 Jun 2026 11:46:16 +0200 Subject: [PATCH 22/22] removed old code and truncated cards in person search to keep layout static --- service/sentence_transformer/index_topics.py | 82 ------------------- .../person-card/person-card.component.html | 36 ++++---- .../person-card/person-card.component.scss | 39 ++++++++- .../person-card/person-card.component.ts | 40 ++++++--- 4 files changed, 86 insertions(+), 111 deletions(-) diff --git a/service/sentence_transformer/index_topics.py b/service/sentence_transformer/index_topics.py index 35cea0cb..7b506427 100644 --- a/service/sentence_transformer/index_topics.py +++ b/service/sentence_transformer/index_topics.py @@ -35,15 +35,6 @@ headers = { "Content-Type": "application/json" } -def float_array_to_base64(vector): - """ - Convert a float vector into a Base64 string representing 32-bit big-endian float bytes. - Elasticsearch expects big-endian floats for binary/Base64 dense_vector encoding. - """ - arr = np.asarray(vector, dtype=np.float32) - big_endian_bytes = arr.astype('>f4').tobytes() - return base64.b64encode(big_endian_bytes).decode('utf-8') - def split_into_sentences(text): if not text: return [] @@ -52,77 +43,6 @@ def split_into_sentences(text): # Filter out empty or extremely short sentences return [s for s in sentences if len(s.strip()) > 3] -def check_and_update_mapping(): - print("Checking 'topicvectors' index...") - - with httpx.Client(timeout=30.0) as client: - exists_resp = client.head(f"{ELASTIC_URL}topicvectors", headers=headers) - if exists_resp.status_code == 404: - print("Index 'topicvectors' does not exist. Creating index with mapping...") - create_payload = { - "mappings": { - "properties": { - "id": {"type": "keyword"}, - "display_name": { - "type": "text", - "fields": { - "keyword": {"type": "keyword", "ignore_above": 256} - } - }, - "display_name_vector": { - "type": "dense_vector", - "dims": 768, - "index": True, - "similarity": "cosine", - "index_options": { - "type": "int8_hnsw", - "m": 16, - "ef_construction": 100 - } - }, - "description": {"type": "text"}, - "description_vectors": { - "type": "nested", - "properties": { - "vector": { - "type": "dense_vector", - "dims": 768, - "index": True, - "similarity": "cosine", - "index_options": { - "type": "int8_hnsw", - "m": 16, - "ef_construction": 100 - } - } - } - }, - "keywords": { - "type": "text", - "fields": { - "keyword": {"type": "keyword"} - } - }, - "cited_by_count": {"type": "long"}, - "works_count": {"type": "long"}, - "updated_date": {"type": "date"}, - "created_date": {"type": "date"} - } - } - } - resp = client.put( - f"{ELASTIC_URL}topicvectors", - json=create_payload, - headers=headers - ) - if resp.status_code == 200: - print("Successfully created 'topicvectors' index.") - else: - print(f"Failed to create index: {resp.status_code} - {resp.text}") - resp.raise_for_status() - else: - print("Index 'topicvectors' already exists.") - def fetch_all_topics(): print("Fetching topics from 'openalex-topics'...") topics = [] @@ -204,8 +124,6 @@ def bulk_index_topics(topics, display_name_vectors, nested_description_vectors): print(f"Indexed batch {i} to {i + len(batch_topics)}") def main(): - check_and_update_mapping() - topics = fetch_all_topics() if not topics: print("No topics found. Exiting.") diff --git a/webapp/src/app/modules/person-card/person-card.component.html b/webapp/src/app/modules/person-card/person-card.component.html index d8e39eae..43698f60 100644 --- a/webapp/src/app/modules/person-card/person-card.component.html +++ b/webapp/src/app/modules/person-card/person-card.component.html @@ -5,15 +5,7 @@ {{ getInitials(person.display_name) }}
-
- @if (person.relevance_rating) { - - {{ person.relevance_rating }} - - } +
@@ -60,9 +56,12 @@ " >apartment - {{ - inst.display_name ?? '' | truncate: 30 - }} + {{ inst.display_name ?? '' }} @if (inst.country_code && !loading) { {{ inst.country_code.toUpperCase() }} diff --git a/webapp/src/app/modules/person-card/person-card.component.scss b/webapp/src/app/modules/person-card/person-card.component.scss index 02be7ac6..f3a53722 100644 --- a/webapp/src/app/modules/person-card/person-card.component.scss +++ b/webapp/src/app/modules/person-card/person-card.component.scss @@ -108,6 +108,11 @@ font-size: 16px; font-weight: 600; color: var(--sg-text); + min-height: 24px; + line-height: 24px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } .institution { display: flex; @@ -133,6 +138,26 @@ display: inline-flex; align-items: center; transition: all 0.2s ease; + max-width: 100%; + box-sizing: border-box; + + .institution-name { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-width: 0; + flex: 1; + } + + .flag-img { + flex-shrink: 0; + } + + .country-code { + display: inline-block; + flex-shrink: 0; + white-space: nowrap; + } &:hover { background: var(--sg-primary); @@ -143,13 +168,15 @@ .flag-img { border: 1px solid; - vertical-align: -10px; + vertical-align: middle; } .person-id { margin: 2px 0 0; font-size: 10px; color: var(--sg-text-soft); + min-height: 15px; + line-height: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -159,6 +186,11 @@ margin: 4px 0 0; font-size: 10px; color: var(--sg-text-muted); + min-height: 15px; + line-height: 15px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } .card-body { @@ -186,6 +218,11 @@ border-radius: 4px; cursor: pointer; transition: all 0.2s ease; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + box-sizing: border-box; &:hover { background: var(--sg-primary-soft); diff --git a/webapp/src/app/modules/person-card/person-card.component.ts b/webapp/src/app/modules/person-card/person-card.component.ts index 13e889bd..89f0440c 100644 --- a/webapp/src/app/modules/person-card/person-card.component.ts +++ b/webapp/src/app/modules/person-card/person-card.component.ts @@ -3,18 +3,11 @@ import { CommonModule } from '@angular/common'; import { RouterLink } from '@angular/router'; import { MatIconModule } from '@angular/material/icon'; import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api'; -import { TruncatePipe } from '../../shared/pipes/truncate.pipe'; import { SkTextDirective } from '../../custom-directives/sk-text.directive'; @Component({ selector: 'app-person-card', standalone: true, - imports: [ - CommonModule, - RouterLink, - MatIconModule, - TruncatePipe, - SkTextDirective, - ], + imports: [CommonModule, RouterLink, MatIconModule, SkTextDirective], templateUrl: './person-card.component.html', styleUrl: './person-card.component.scss', }) @@ -62,8 +55,11 @@ export class PersonCardComponent { if (topic.field?.display_name) parts.push(topic.field.display_name); if (topic.subfield?.display_name) parts.push(topic.subfield.display_name); - if (parts.length === 0) return topic.display_name || ''; - return parts.join(' - '); + const path = parts.join(' - '); + if (topic.display_name) { + return path ? `${topic.display_name}\n(${path})` : topic.display_name; + } + return path; } getDistinguishingId(person: CustomAuthor): string { @@ -74,6 +70,30 @@ export class PersonCardComponent { return ''; } + getStatsString(): string { + const works = this.person.works_count; + const citations = this.person.cited_by_count; + const hasWorks = works !== undefined && works !== null; + const hasCitations = citations !== undefined && citations !== null; + + if (hasWorks && hasCitations) { + return `Publikationen: ${works} · Zitationen: ${citations}`; + } else if (hasWorks) { + return `Publikationen: ${works}`; + } else if (hasCitations) { + return `Zitationen: ${citations}`; + } + return ''; + } + + getHIndexString(): string { + const hIndex = this.person.summary_stats?.h_index; + if (hIndex !== undefined && hIndex !== null) { + return `h_index: ${hIndex}`; + } + return ''; + } + toggleBookmark(): void { this.bookmarkToggle.emit(this.person); }