From 3caa759e4f42956e61ec95f4d78a24e16969058c Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Fri, 29 May 2026 12:14:38 +0200 Subject: [PATCH 01/60] Add topic timeline response models --- service/src/main/inse/works/model.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/service/src/main/inse/works/model.py b/service/src/main/inse/works/model.py index 02c8bf25..1e3aa5f7 100644 --- a/service/src/main/inse/works/model.py +++ b/service/src/main/inse/works/model.py @@ -216,3 +216,19 @@ class WorkPage(BaseModel): class WorkList(BaseModel): elements: List[Work] = Field(default_factory=list, description="All works.") total: int = Field(default=0, description="The total number of works.") + + +class TopicCount(BaseModel): + name: str = Field(description="The topic display name.") + count: int = Field(default=0, description="The number of occurrences.") + + +class TopicsByYear(BaseModel): + year: int = Field(description="The publication year.") + publication_count: int = Field(default=0, description="The number of works in this year.") + topics: List[TopicCount] = Field(default_factory=list, description="The topics in this year.") + + +class TopicsByTime(BaseModel): + elements: List[TopicsByYear] = Field(default_factory=list, description="Topics grouped by year.") + total: int = Field(default=0, description="The number of years.") \ No newline at end of file From f2bca2f6464ea5a5a69de84aa49e57e6b9b899b5 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Fri, 29 May 2026 12:14:56 +0200 Subject: [PATCH 02/60] Add topic aggregation by year --- service/src/main/inse/works/logic.py | 58 ++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/service/src/main/inse/works/logic.py b/service/src/main/inse/works/logic.py index 752176e4..12b8da99 100644 --- a/service/src/main/inse/works/logic.py +++ b/service/src/main/inse/works/logic.py @@ -70,6 +70,64 @@ async def get_all_author_works( return model.WorkList(elements=all_elements, total=total) +async def get_topics_by_time_by_author( + author_id: str, + max_topics_per_year: int = 3, + client: OpenAlexWorksSearchClient | None = None, +) -> model.TopicsByTime: + works = await get_all_author_works(author_id, client=client) + + years = {} + + for work in works.elements: + if work.publication_year is None: + continue + + year = work.publication_year + + if year not in years: + years[year] = { + "publication_count": 0, + "topics": {}, + } + + years[year]["publication_count"] += 1 + + for topic in work.topics: + if topic.display_name: + topic_name = topic.display_name + + if topic_name not in years[year]["topics"]: + years[year]["topics"][topic_name] = 0 + + years[year]["topics"][topic_name] += 1 + + elements = [] + + for year in sorted(years.keys()): + topic_items = list(years[year]["topics"].items()) + topic_items.sort(key=lambda item: item[1], reverse=True) + + topics = [] + + for topic_name, count in topic_items[:max_topics_per_year]: + topics.append(model.TopicCount( + name=topic_name, + count=count, + )) + + elements.append(model.TopicsByYear( + year=year, + publication_count=years[year]["publication_count"], + topics=topics, + )) + + return model.TopicsByTime( + elements=elements, + total=len(elements), + ) + + async def _search_author_works_data( search_client: OpenAlexWorksSearchClient, author_id: str, From 32cb67df7257eb1e03cf78f85cc901afd53c0316 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Fri, 29 May 2026 12:15:05 +0200 Subject: [PATCH 03/60] Add topics by time endpoint --- service/src/main/inse/works/service.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/service/src/main/inse/works/service.py b/service/src/main/inse/works/service.py index 82665c20..f60328ae 100644 --- a/service/src/main/inse/works/service.py +++ b/service/src/main/inse/works/service.py @@ -50,3 +50,18 @@ async def get_all_author_works( principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), ): return await logic.get_all_author_works(author_id) + + +@router.get("/{author_id}/topics-by-time", + operation_id="getTopicsByTimeByAuthor", + response_model=model.TopicsByTime, + summary="Returns topics grouped by publication year for an author.") +async def get_topics_by_time_by_author( + author_id: Annotated[str, Path(description="The author id, for example A5023888391.")], + max_topics_per_year: Annotated[int, Query(description="The maximum number of topics per year.", ge=1, le=20)] = 3, + principal: security.Principal = Depends(security.roles_allowed(["SUPER_ADMIN", "UNI_ADMIN"])), +): + return await logic.get_topics_by_time_by_author( + author_id, + max_topics_per_year=max_topics_per_year, + ) From 22dd33c0a9fc5ce355e9ffb0b8cb9ce820815fac Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Sat, 30 May 2026 09:10:09 +0200 Subject: [PATCH 04/60] Add funders by author endpoint with position counts --- service/src/main/inse/config.py | 2 + service/src/main/inse/logic.py | 182 +++++++++++++++++++++++++++++++ service/src/main/inse/service.py | 19 ++++ 3 files changed, 203 insertions(+) diff --git a/service/src/main/inse/config.py b/service/src/main/inse/config.py index fbd6098f..2b70a56c 100644 --- a/service/src/main/inse/config.py +++ b/service/src/main/inse/config.py @@ -29,6 +29,8 @@ class Settings(BaseSettings): llm_model: str = 'gemma4:e4b' elasticsearch_url: str = 'https://project.nes.uni-due.de/elastic/' elasticsearch_api_key: str = 'am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==' + elasticsearch_works_url: str = 'https://project.nes.uni-due.de/elastic/openalex-works/_search' + settings = Settings() logger.info(f"Database URL: {settings.database_url}.") diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index d98c878f..013d2547 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -287,3 +287,185 @@ def generate_person_bio(author_id: str) -> str: return llm.call(system_prompt=system_prompt, user_prompt=user_prompt) +def create_publications_by_author_query( + author_id: str, + page: int = 1, + page_size: int = 20 +) -> dict: + if not author_id.startswith("https://openalex.org/"): + author_id = f"https://openalex.org/{author_id}" + + from_value = (page - 1) * page_size + + return { + "from": from_value, + "size": page_size, + "_source": [ + "id", + "title", + "display_name", + "publication_year", + "authorships.author.id", + "authorships.author.display_name", + "authorships.author_position", + "funders.id", + "funders.display_name", + "funders.ror" + ], + "query": { + "bool": { + "must": [ + { + "nested": { + "path": "authorships", + "query": { + "term": { + "authorships.author.id": author_id + } + } + } + }, + { + "nested": { + "path": "funders", + "query": { + "exists": { + "field": "funders.id" + } + } + } + } + ] + } + } + } + +def get_publications_by_author_id( + author_id: str, + page: int = 1, + page_size: int = 20 +) -> dict: + headers = { + "Authorization": f"ApiKey {config.settings.elasticsearch_api_key}", + "Content-Type": "application/json" + } + + payload = create_publications_by_author_query(author_id, page, page_size) + + with httpx.Client() as client: + response = client.post( + config.settings.elasticsearch_works_url, + json=payload, + headers=headers + ) + response.raise_for_status() + data = response.json() + + total = data.get("hits", {}).get("total", {}).get("value", 0) + hits = data.get("hits", {}).get("hits", []) + + return { + "author_id": author_id if author_id.startswith("https://openalex.org/") else f"https://openalex.org/{author_id}", + "page": page, + "page_size": page_size, + "total": total, + "results_count": len(hits), + "results": hits + } + +def get_author_name(author_id: str) -> str | None: + short_author_id = author_id.replace("https://openalex.org/", "") + + search_result = search_persons(author_id=short_author_id) + + if not search_result.persons: + return None + + return search_result.persons[0].name + +def get_author_position_in_publication(publication: dict, author_id: str) -> str: + normalized_author_id = ( + author_id if author_id.startswith("https://openalex.org/") + else f"https://openalex.org/{author_id}" + ) + + for authorship in publication.get("authorships", []): + author = authorship.get("author", {}) + if author.get("id") == normalized_author_id: + return authorship.get("author_position", "unknown") + + return "unknown" + +def get_funders_by_author_id(author_id: str) -> dict: + page = 1 + page_size = 100 + funder_counts = {} + + normalized_author_id = ( + author_id if author_id.startswith("https://openalex.org/") + else f"https://openalex.org/{author_id}" + ) + + author_name = get_author_name(author_id) + + while True: + data = get_publications_by_author_id(author_id, page, page_size) + results = data.get("results", []) + + if not results: + break + + for hit in results: + publication = hit.get("_source", {}) + publication_id = publication.get("id") + author_position = get_author_position_in_publication(publication, author_id) + publication_funders = set() + + # Funders field + for funder in publication.get("funders", []): + funder_id = funder.get("id") + funder_name = funder.get("display_name") + + if funder_id or funder_name: + key = funder_id or funder_name + publication_funders.add((key, funder_id, funder_name)) + + # Count each funder only once per publication + for key, funder_id, funder_name in publication_funders: + if key not in funder_counts: + funder_counts[key] = { + "funder_id": funder_id, + "funder_name": funder_name, + "publication_count": 0, + "author_position_count": { + "first": 0, + "middle": 0, + "last": 0, + "unknown": 0 + }, + "publication_ids": { + "first": [], + "middle": [], + "last": [], + "unknown": [] + } + } + + funder_counts[key]["publication_count"] += 1 + if author_position not in funder_counts[key]["author_position_count"]: + author_position = "unknown" + + funder_counts[key]["author_position_count"][author_position] += 1 + funder_counts[key]["publication_ids"][author_position].append(publication_id) + + if len(results) < page_size: + break + + page += 1 + + return { + "author_id": normalized_author_id, + "author_name": author_name, + "funder_count": len(funder_counts), + "funders": list(funder_counts.values()) + } \ No newline at end of file diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index 22a16a19..43a78e5f 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -179,3 +179,22 @@ def search_persons(author_id: Annotated[str, Query(description="OpenAlex author def generate_person_bio(author_id: Annotated[str, Query(description="OpenAlex author ID (e.g., A5093075883)")]): bio = logic.generate_person_bio(author_id) return model.PersonBio(bio=bio) + + +@app.get('/authors/{author_id}/publications', + operation_id='getPublicationsByAuthor', + summary='Get publications by author.', + tags=['Publications']) +def get_publications_by_author( + author_id: str, + page: int = 1, + page_size: int = 20 +): + return logic.get_publications_by_author_id(author_id, page, page_size) + +@app.get('/authors/{author_id}/funders', + operation_id='getFundersByAuthor', + summary='Get funding organizations by author.', + tags=['Funding']) +def get_funders_by_author(author_id: str): + return logic.get_funders_by_author_id(author_id) \ No newline at end of file From ce4ccbf15456be8e0b69f1dd08b29a772c26dabc Mon Sep 17 00:00:00 2001 From: Khuder Khalti Date: Sun, 31 May 2026 09:10:50 +0200 Subject: [PATCH 05/60] Add person funding frontend view --- webapp/src/app/app.routes.ts | 7 +++++++ .../person-funding/person-funding.component.html | 1 + .../person-funding/person-funding.component.scss | 0 .../person-funding/person-funding.component.ts | 11 +++++++++++ webapp/src/app/modules/person/person.component.ts | 1 + 5 files changed, 20 insertions(+) create mode 100644 webapp/src/app/modules/person-funding/person-funding.component.html create mode 100644 webapp/src/app/modules/person-funding/person-funding.component.scss create mode 100644 webapp/src/app/modules/person-funding/person-funding.component.ts diff --git a/webapp/src/app/app.routes.ts b/webapp/src/app/app.routes.ts index a257d1fc..cacc3028 100644 --- a/webapp/src/app/app.routes.ts +++ b/webapp/src/app/app.routes.ts @@ -51,6 +51,13 @@ export const routes: Routes = [ (mod) => mod.PersonPublicationsComponent, ), }, + { + path: 'funding', + loadComponent: () => + import('./modules/person-funding/person-funding.component').then( + (mod) => mod.PersonFundingComponent, + ), + }, ], }, { diff --git a/webapp/src/app/modules/person-funding/person-funding.component.html b/webapp/src/app/modules/person-funding/person-funding.component.html new file mode 100644 index 00000000..364b6d5b --- /dev/null +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -0,0 +1 @@ +

person-funding!

diff --git a/webapp/src/app/modules/person-funding/person-funding.component.scss b/webapp/src/app/modules/person-funding/person-funding.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts new file mode 100644 index 00000000..db6f9dc1 --- /dev/null +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -0,0 +1,11 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-person-funding', + imports: [], + templateUrl: './person-funding.component.html', + styleUrl: './person-funding.component.scss', +}) +export class PersonFundingComponent { + +} diff --git a/webapp/src/app/modules/person/person.component.ts b/webapp/src/app/modules/person/person.component.ts index f8f6ebe6..faa3ffe5 100644 --- a/webapp/src/app/modules/person/person.component.ts +++ b/webapp/src/app/modules/person/person.component.ts @@ -77,6 +77,7 @@ export class PersonComponent implements OnInit, OnDestroy { { label: 'Publikationen', path: 'publications', disabled: false }, { label: 'Netzwerk', path: 'network', disabled: false }, { label: 'Gründungen', path: 'foundings', disabled: true }, + { label: 'Förderungen', path: 'funding', disabled: false }, ]; ngOnInit(): void { From 404386e153add1a1bb152ae108f6205bd00a3576 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Sun, 31 May 2026 23:07:25 +0200 Subject: [PATCH 06/60] Fix topic timeline response models --- service/src/main/inse/models/topic_count.py | 6 ++++++ service/src/main/inse/models/topics_by_time.py | 9 ++++----- service/src/main/inse/models/topics_by_year.py | 11 +++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/service/src/main/inse/models/topic_count.py b/service/src/main/inse/models/topic_count.py index e69de29b..3e0d1f1e 100644 --- a/service/src/main/inse/models/topic_count.py +++ b/service/src/main/inse/models/topic_count.py @@ -0,0 +1,6 @@ +from pydantic import BaseModel, Field + + +class TopicCount(BaseModel): + name: str = Field(description="The topic display name.") + count: int = Field(default=0, description="The number of occurrences.") diff --git a/service/src/main/inse/models/topics_by_time.py b/service/src/main/inse/models/topics_by_time.py index 1fdfded0..4b495e5a 100644 --- a/service/src/main/inse/models/topics_by_time.py +++ b/service/src/main/inse/models/topics_by_time.py @@ -2,10 +2,9 @@ from typing import List from pydantic import BaseModel, Field -from inse.models.topic_count import TopicCount +from inse.models.topics_by_year import TopicsByYear -class TopicsByYear(BaseModel): - year: int = Field(description="The publication year.") - publication_count: int = Field(default=0, description="The number of works in this year.") - topics: List[TopicCount] = Field(default_factory=list, description="The topics in this year.") \ No newline at end of file +class TopicsByTime(BaseModel): + elements: List[TopicsByYear] = Field(default_factory=list, description="Topics grouped by year.") + total: int = Field(default=0, description="The number of years.") diff --git a/service/src/main/inse/models/topics_by_year.py b/service/src/main/inse/models/topics_by_year.py index e69de29b..f1c90610 100644 --- a/service/src/main/inse/models/topics_by_year.py +++ b/service/src/main/inse/models/topics_by_year.py @@ -0,0 +1,11 @@ +from typing import List + +from pydantic import BaseModel, Field + +from inse.models.topic_count import TopicCount + + +class TopicsByYear(BaseModel): + year: int = Field(description="The publication year.") + publication_count: int = Field(default=0, description="The number of works in this year.") + topics: List[TopicCount] = Field(default_factory=list, description="The topics in this year.") From 96b3355f46154a543b220af7b309eced344eb8dd Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 00:01:01 +0200 Subject: [PATCH 07/60] Add research timeline with dummy data --- .../research-timeline.component.html | 63 ++++ .../research-timeline.component.scss | 275 ++++++++++++++++++ .../research-timeline.component.ts | 57 ++++ .../person-overview.component.html | 4 +- .../person-overview.component.scss | 4 + .../person-overview.component.ts | 7 +- 6 files changed, 405 insertions(+), 5 deletions(-) create mode 100644 webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html create mode 100644 webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss create mode 100644 webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts 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 new file mode 100644 index 00000000..fde6ab41 --- /dev/null +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.html @@ -0,0 +1,63 @@ +
+
+
+

Forschungstimeline

+

+ Entwicklung der Forschungsthemen im Zeitverlauf + (basierend auf Projekten und Publikationen) +

+
+ +
+ + + +
+
+ +
+
+
+ {{ item.year }} + +
+ + +
+ +
+
+

{{ item.title }}

+ +
+ + {{ keyword }} + +
+
+
+ +
+ + Hauptforschungsschwerpunkte im jeweiligen Zeitraum +
+
+
\ No newline at end of file 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 new file mode 100644 index 00000000..2c641366 --- /dev/null +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.scss @@ -0,0 +1,275 @@ +.research-timeline-card { + width: 100%; + padding: 24px 28px; + border: 1px solid #d7e4ff; + border-radius: 16px; + background: #ffffff; + box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04); +} + +.timeline-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + gap: 24px; + margin-bottom: 34px; + + h2 { + margin: 0 0 6px; + color: #07163d; + font-size: 20px; + font-weight: 700; + } + + p { + margin: 0; + color: #64718f; + font-size: 14px; + line-height: 1.4; + + span { + color: #74809b; + } + } +} + +.view-toggle { + display: flex; + gap: 4px; + padding: 4px; + border: 1px solid #dbe5f6; + border-radius: 10px; + background: #ffffff; + + button { + border: none; + border-radius: 8px; + padding: 9px 16px; + background: transparent; + color: #3f4b66; + font-size: 14px; + cursor: pointer; + transition: all 0.2s ease; + + &:hover { + background: #f2f6ff; + } + + &.active { + background: #eef4ff; + color: #0057ff; + box-shadow: inset 0 0 0 1px #3d7cff; + } + + &.inactive-button { + cursor: default; + } + + &.inactive-button:hover { + background: transparent; + } + } +} + +.timeline-wrapper { + width: 100%; + overflow-x: auto; + padding-top: 8px; +} + +.timeline-line { + position: relative; + display: grid; + align-items: center; + min-width: 1000px; + margin: 0 32px 18px; + border-top: 2px solid #23395d; +} + +.timeline-point { + position: relative; + transform: translateY(-50%); + text-align: center; + + .year { + position: absolute; + top: -28px; + left: 50%; + transform: translateX(-50%); + color: #15213f; + font-size: 14px; + font-weight: 600; + white-space: nowrap; + } + + .dot { + display: inline-block; + width: 12px; + height: 12px; + border: 3px solid #ffffff; + border-radius: 50%; + box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1); + } +} + +.line-arrow { + position: absolute; + right: -2px; + top: -6px; + width: 0; + height: 0; + border-top: 6px solid transparent; + border-bottom: 6px solid transparent; + border-left: 12px solid #23395d; +} + +.timeline-content { + display: grid; + min-width: 1000px; + gap: 20px; +} + +.timeline-item { + text-align: center; + + h3 { + min-height: 44px; + margin: 0 0 14px; + color: #07163d; + font-size: 15px; + font-weight: 600; + line-height: 1.35; + } +} + +.keyword-list { + display: flex; + flex-direction: column; + align-items: center; + gap: 8px; +} + +.keyword-chip { + display: inline-flex; + align-items: center; + justify-content: center; + width: fit-content; + max-width: 100%; + padding: 6px 12px; + border-radius: 7px; + font-size: 12px; + font-weight: 500; + white-space: nowrap; +} + +.purple { + .dot { + background: #7255d9; + } +} + +.blue { + .dot { + background: #2678e8; + } +} + +.green { + .dot { + background: #39a96b; + } +} + +.orange { + .dot { + background: #f59e0b; + } +} + +.pink { + .dot { + background: #e0527c; + } +} + +.keyword-chip.purple { + border: 1px solid #d8cafe; + background: #f6f0ff; + color: #7255d9; +} + +.keyword-chip.blue { + border: 1px solid #bdd4ff; + background: #f0f6ff; + color: #0b63ce; +} + +.keyword-chip.green { + border: 1px solid #bdebcf; + background: #effaf3; + color: #24834f; +} + +.keyword-chip.orange { + border: 1px solid #ffd796; + background: #fff7e8; + color: #c67500; +} + +.keyword-chip.pink { + border: 1px solid #ffc7d7; + background: #fff1f5; + color: #d12f61; +} + +.timeline-note { + display: flex; + justify-content: center; + align-items: center; + gap: 10px; + margin-top: 24px; + color: #68748f; + font-size: 13px; +} + +.note-dot { + width: 10px; + height: 10px; + border: 3px solid #dce5f5; + border-radius: 50%; + background: #52627f; +} + +@media (max-width: 1100px) { + .timeline-line { + display: none; + } + + .timeline-content { + min-width: 0; + grid-template-columns: repeat(3, 1fr) !important; + row-gap: 28px; + } +} + +@media (max-width: 700px) { + .research-timeline-card { + padding: 20px; + } + + .timeline-header { + flex-direction: column; + } + + .timeline-content { + grid-template-columns: 1fr !important; + } + + .timeline-item { + text-align: left; + } + + .keyword-list { + align-items: flex-start; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..ff324de8 --- /dev/null +++ b/webapp/src/app/modules/person-overview/components/research-timeline/research-timeline.component.ts @@ -0,0 +1,57 @@ +import { CommonModule } from '@angular/common'; +import { Component } from '@angular/core'; + +interface ResearchTimelineItem { + year: number; + title: string; + keywords: string[]; + color: 'purple' | 'blue' | 'green' | 'orange' | 'pink'; +} + +@Component({ + selector: 'app-research-timeline', + standalone: true, + imports: [CommonModule], + templateUrl: './research-timeline.component.html', + styleUrls: ['./research-timeline.component.scss'], +}) +export class ResearchTimelineComponent { + timelineItems: ResearchTimelineItem[] = [ + { + year: 2014, + title: 'Datenanalyse und Statistik', + keywords: ['Datenanalyse', 'Statistik', 'Big Data'], + color: 'purple', + }, + { + year: 2016, + title: 'Maschinelles Lernen Grundlagen', + keywords: ['Machine Learning', 'Klassifikation', 'Feature Engineering'], + color: 'blue', + }, + { + year: 2018, + title: 'Deep Learning Anwendungen', + keywords: ['Deep Learning', 'Neuronale Netze', 'Bildverarbeitung'], + color: 'green', + }, + { + year: 2020, + title: 'KI in der Industrie', + keywords: ['Industrie 4.0', 'Predictive Analytics', 'Prozessoptimierung'], + color: 'orange', + }, + { + year: 2022, + title: 'Nachhaltige KI und Ethik', + keywords: ['Nachhaltigkeit', 'Responsible AI', 'Ethik'], + color: 'pink', + }, + { + year: 2024, + title: 'KI und Gesellschaft', + keywords: ['Smart Systems', 'Gesellschaft', 'Digitale Transformation'], + color: 'purple', + }, + ]; +} \ No newline at end of file diff --git a/webapp/src/app/modules/person-overview/person-overview.component.html b/webapp/src/app/modules/person-overview/person-overview.component.html index bc281a0c..fa007d36 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.html +++ b/webapp/src/app/modules/person-overview/person-overview.component.html @@ -1 +1,3 @@ -

person-overview works!

+
+ +
\ No newline at end of file diff --git a/webapp/src/app/modules/person-overview/person-overview.component.scss b/webapp/src/app/modules/person-overview/person-overview.component.scss index e69de29b..52461a52 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.scss +++ b/webapp/src/app/modules/person-overview/person-overview.component.scss @@ -0,0 +1,4 @@ +.person-overview { + width: 100%; + display: block; +} \ No newline at end of file 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 37c8461e..e8891dd7 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -1,11 +1,10 @@ import { Component } from '@angular/core'; +import { ResearchTimelineComponent } from './components/research-timeline/research-timeline.component'; @Component({ selector: 'app-person-overview', - imports: [], + imports: [ResearchTimelineComponent], templateUrl: './person-overview.component.html', styleUrl: './person-overview.component.scss', }) -export class PersonOverviewComponent { - -} +export class PersonOverviewComponent {} \ No newline at end of file From aaead76390a160d33b6130c782d5307b7b032c40 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 00:18:05 +0200 Subject: [PATCH 08/60] Adapt research timeline to topic timeline data --- .../research-timeline.component.html | 75 ++++--- .../research-timeline.component.scss | 195 ++++++++++-------- .../research-timeline.component.ts | 90 ++++---- .../person-overview.component.html | 2 +- .../person-overview.component.ts | 172 ++++++++++++++- 5 files changed, 373 insertions(+), 161 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 fde6ab41..4f1fe51a 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 @@ -4,7 +4,7 @@

Forschungstimeline

Entwicklung der Forschungsthemen im Zeitverlauf - (basierend auf Projekten und Publikationen) + (basierend auf Publikationen)

@@ -19,45 +19,56 @@ -
-
-
- {{ item.year }} - +
+
+ + +
+
+ {{ item.year }} + +
- -
+
+
+

{{ getMainTopic(item) }}

-
-
-

{{ item.title }}

- -
- - {{ keyword }} + + {{ item.publication_count }} + {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} -
-
+ +
+ + {{ topic.name }} + {{ topic.count }} + +
+
+
- Hauptforschungsschwerpunkte im jeweiligen Zeitraum + Die drei häufigsten Topics je Jahr, gezählt über Publikationen.
+ + +
+ Keine Timeline-Daten vorhanden. +
+
\ No newline at end of file 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 2c641366..6fad9a1c 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 @@ -12,7 +12,7 @@ justify-content: space-between; align-items: flex-start; gap: 24px; - margin-bottom: 34px; + margin-bottom: 28px; h2 { margin: 0 0 6px; @@ -74,48 +74,28 @@ .timeline-wrapper { width: 100%; overflow-x: auto; - padding-top: 8px; + padding: 4px 0 8px; } -.timeline-line { +.timeline-inner { position: relative; - display: grid; - align-items: center; - min-width: 1000px; - margin: 0 32px 18px; - border-top: 2px solid #23395d; + padding: 0 34px 8px; } -.timeline-point { - position: relative; - transform: translateY(-50%); - text-align: center; - - .year { - position: absolute; - top: -28px; - left: 50%; - transform: translateX(-50%); - color: #15213f; - font-size: 14px; - font-weight: 600; - white-space: nowrap; - } - - .dot { - display: inline-block; - width: 12px; - height: 12px; - border: 3px solid #ffffff; - border-radius: 50%; - box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.1); - } -} - -.line-arrow { +.timeline-axis { position: absolute; - right: -2px; - top: -6px; + top: 34px; + left: 34px; + right: 34px; + height: 2px; + background: #23395d; +} + +.timeline-axis::after { + content: ""; + position: absolute; + top: -5px; + right: -10px; width: 0; height: 0; border-top: 6px solid transparent; @@ -123,43 +103,107 @@ border-left: 12px solid #23395d; } -.timeline-content { +.timeline-points { + position: relative; + z-index: 1; display: grid; - min-width: 1000px; - gap: 20px; + align-items: start; + min-height: 58px; } -.timeline-item { - text-align: center; +.timeline-point { + display: flex; + flex-direction: column; + align-items: center; + min-width: 0; - h3 { - min-height: 44px; - margin: 0 0 14px; - color: #07163d; - font-size: 15px; - font-weight: 600; - line-height: 1.35; + .year { + margin-bottom: 9px; + color: #15213f; + font-size: 14px; + font-weight: 700; + line-height: 18px; + white-space: nowrap; + } + + .dot { + width: 13px; + height: 13px; + border: 3px solid #ffffff; + border-radius: 50%; + box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16); } } -.keyword-list { +.timeline-content { + display: grid; + gap: 0; + margin-top: 8px; +} + +.timeline-item { + min-width: 0; + padding: 0 16px; + text-align: center; + + h3 { + min-height: 42px; + margin: 0 0 8px; + color: #07163d; + font-size: 15px; + font-weight: 700; + line-height: 1.35; + overflow-wrap: anywhere; + } +} + +.publication-count { + display: block; + margin-bottom: 14px; + color: #68748f; + font-size: 12px; +} + +.topic-list { display: flex; flex-direction: column; align-items: center; gap: 8px; } -.keyword-chip { +.topic-chip { display: inline-flex; align-items: center; justify-content: center; + gap: 7px; width: fit-content; - max-width: 100%; - padding: 6px 12px; - border-radius: 7px; + max-width: 210px; + min-height: 34px; + padding: 6px 10px; + border-radius: 8px; font-size: 12px; font-weight: 500; - white-space: nowrap; + line-height: 1.25; +} + +.topic-name { + min-width: 0; + overflow-wrap: anywhere; +} + +.topic-count { + display: inline-flex; + flex: 0 0 auto; + align-items: center; + justify-content: center; + min-width: 18px; + height: 18px; + padding: 0 5px; + border-radius: 999px; + background: rgba(255, 255, 255, 0.78); + color: inherit; + font-size: 11px; + font-weight: 700; } .purple { @@ -192,31 +236,31 @@ } } -.keyword-chip.purple { +.topic-chip.purple { border: 1px solid #d8cafe; background: #f6f0ff; color: #7255d9; } -.keyword-chip.blue { +.topic-chip.blue { border: 1px solid #bdd4ff; background: #f0f6ff; color: #0b63ce; } -.keyword-chip.green { +.topic-chip.green { border: 1px solid #bdebcf; background: #effaf3; color: #24834f; } -.keyword-chip.orange { +.topic-chip.orange { border: 1px solid #ffd796; background: #fff7e8; color: #c67500; } -.keyword-chip.pink { +.topic-chip.pink { border: 1px solid #ffc7d7; background: #fff1f5; color: #d12f61; @@ -227,7 +271,7 @@ justify-content: center; align-items: center; gap: 10px; - margin-top: 24px; + margin-top: 22px; color: #68748f; font-size: 13px; } @@ -240,16 +284,13 @@ background: #52627f; } -@media (max-width: 1100px) { - .timeline-line { - display: none; - } - - .timeline-content { - min-width: 0; - grid-template-columns: repeat(3, 1fr) !important; - row-gap: 28px; - } +.empty-timeline { + display: flex; + min-height: 120px; + align-items: center; + justify-content: center; + color: #68748f; + font-size: 14px; } @media (max-width: 700px) { @@ -260,16 +301,4 @@ .timeline-header { flex-direction: column; } - - .timeline-content { - grid-template-columns: 1fr !important; - } - - .timeline-item { - text-align: left; - } - - .keyword-list { - align-items: flex-start; - } } \ No newline at end of file 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 ff324de8..665acc45 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 @@ -1,11 +1,15 @@ import { CommonModule } from '@angular/common'; -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; -interface ResearchTimelineItem { +export interface TopicTimelineTopic { + name: string; + count: number; +} + +export interface TopicTimelineElement { year: number; - title: string; - keywords: string[]; - color: 'purple' | 'blue' | 'green' | 'orange' | 'pink'; + publication_count: number; + topics: TopicTimelineTopic[]; } @Component({ @@ -16,42 +20,42 @@ interface ResearchTimelineItem { styleUrls: ['./research-timeline.component.scss'], }) export class ResearchTimelineComponent { - timelineItems: ResearchTimelineItem[] = [ - { - year: 2014, - title: 'Datenanalyse und Statistik', - keywords: ['Datenanalyse', 'Statistik', 'Big Data'], - color: 'purple', - }, - { - year: 2016, - title: 'Maschinelles Lernen Grundlagen', - keywords: ['Machine Learning', 'Klassifikation', 'Feature Engineering'], - color: 'blue', - }, - { - year: 2018, - title: 'Deep Learning Anwendungen', - keywords: ['Deep Learning', 'Neuronale Netze', 'Bildverarbeitung'], - color: 'green', - }, - { - year: 2020, - title: 'KI in der Industrie', - keywords: ['Industrie 4.0', 'Predictive Analytics', 'Prozessoptimierung'], - color: 'orange', - }, - { - year: 2022, - title: 'Nachhaltige KI und Ethik', - keywords: ['Nachhaltigkeit', 'Responsible AI', 'Ethik'], - color: 'pink', - }, - { - year: 2024, - title: 'KI und Gesellschaft', - keywords: ['Smart Systems', 'Gesellschaft', 'Digitale Transformation'], - color: 'purple', - }, - ]; + @Input() elements: TopicTimelineElement[] = []; + + private readonly colors = ['purple', 'blue', 'green', 'orange', 'pink']; + private readonly columnWidth = 240; + + get timelineItems(): TopicTimelineElement[] { + return this.elements ?? []; + } + + get gridTemplateColumns(): string { + const count = Math.max(this.timelineItems.length, 1); + return `repeat(${count}, minmax(${this.columnWidth}px, 1fr))`; + } + + get timelineMinWidth(): number { + const count = Math.max(this.timelineItems.length, 1); + return Math.max(count * this.columnWidth, 1000); + } + + getTopTopics(item: TopicTimelineElement): TopicTimelineTopic[] { + return (item.topics ?? []).slice(0, 3); + } + + getMainTopic(item: TopicTimelineElement): string { + return this.getTopTopics(item)[0]?.name ?? 'Keine Topics'; + } + + getColorClass(index: number): string { + return this.colors[index % this.colors.length]; + } + + trackByYear(_: number, item: TopicTimelineElement): number { + return item.year; + } + + trackByTopic(_: number, topic: TopicTimelineTopic): string { + return topic.name; + } } \ No newline at end of file diff --git a/webapp/src/app/modules/person-overview/person-overview.component.html b/webapp/src/app/modules/person-overview/person-overview.component.html index fa007d36..8831e155 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.html +++ b/webapp/src/app/modules/person-overview/person-overview.component.html @@ -1,3 +1,3 @@
- +
\ No newline at end of file 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 e8891dd7..6416bbf3 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -1,5 +1,8 @@ import { Component } from '@angular/core'; -import { ResearchTimelineComponent } from './components/research-timeline/research-timeline.component'; +import { + ResearchTimelineComponent, + TopicTimelineElement, +} from './components/research-timeline/research-timeline.component'; @Component({ selector: 'app-person-overview', @@ -7,4 +10,169 @@ import { ResearchTimelineComponent } from './components/research-timeline/resear templateUrl: './person-overview.component.html', styleUrl: './person-overview.component.scss', }) -export class PersonOverviewComponent {} \ No newline at end of file +export class PersonOverviewComponent { + topicTimelineElements: TopicTimelineElement[] = [ + { + year: 2009, + publication_count: 1, + topics: [ + { name: 'Security and Verification in Computing', count: 1 }, + { name: 'Advanced Malware Detection Techniques', count: 1 }, + { name: 'Cloud Data Security Solutions', count: 1 }, + ], + }, + { + year: 2010, + publication_count: 2, + topics: [ + { name: 'Security and Verification in Computing', count: 2 }, + { name: 'Distributed systems and fault tolerance', count: 2 }, + { name: 'Parallel Computing and Optimization Techniques', count: 1 }, + ], + }, + { + year: 2011, + publication_count: 9, + topics: [ + { name: 'Advanced Malware Detection Techniques', count: 8 }, + { name: 'Security and Verification in Computing', count: 8 }, + { name: 'Digital and Cyber Forensics', count: 3 }, + ], + }, + { + year: 2012, + publication_count: 5, + topics: [ + { name: 'Advanced Malware Detection Techniques', count: 3 }, + { name: 'Security and Verification in Computing', count: 3 }, + { name: 'Network Security and Intrusion Detection', count: 3 }, + ], + }, + { + year: 2013, + publication_count: 6, + topics: [ + { name: 'Security and Verification in Computing', count: 6 }, + { name: 'Advanced Malware Detection Techniques', count: 6 }, + { name: 'Network Security and Intrusion Detection', count: 2 }, + ], + }, + { + year: 2014, + publication_count: 14, + topics: [ + { name: 'Advanced Malware Detection Techniques', count: 9 }, + { name: 'Security and Verification in Computing', count: 8 }, + { name: 'Diamond and Carbon-based Materials Research', count: 3 }, + ], + }, + { + year: 2015, + publication_count: 19, + topics: [ + { name: 'Security and Verification in Computing', count: 19 }, + { name: 'Advanced Malware Detection Techniques', count: 19 }, + { name: 'Diamond and Carbon-based Materials Research', count: 6 }, + ], + }, + { + year: 2016, + publication_count: 23, + topics: [ + { name: 'Security and Verification in Computing', count: 13 }, + { name: 'Advanced Malware Detection Techniques', count: 8 }, + { name: 'Cloud Data Security Solutions', count: 4 }, + ], + }, + { + year: 2017, + publication_count: 7, + topics: [ + { name: 'Security and Verification in Computing', count: 7 }, + { name: 'Advanced Malware Detection Techniques', count: 5 }, + { name: 'Diamond and Carbon-based Materials Research', count: 4 }, + ], + }, + { + year: 2018, + publication_count: 5, + topics: [ + { name: 'Security and Verification in Computing', count: 5 }, + { name: 'Advanced Malware Detection Techniques', count: 4 }, + { name: 'Diamond and Carbon-based Materials Research', count: 2 }, + ], + }, + { + year: 2019, + publication_count: 4, + topics: [ + { name: 'Advanced Malware Detection Techniques', count: 2 }, + { name: 'Security and Verification in Computing', count: 2 }, + { name: 'Blockchain Technology Applications and Security', count: 2 }, + ], + }, + { + year: 2020, + publication_count: 5, + topics: [ + { name: 'Security and Verification in Computing', count: 5 }, + { name: 'Advanced Malware Detection Techniques', count: 4 }, + { name: 'Diamond and Carbon-based Materials Research', count: 2 }, + ], + }, + { + year: 2021, + publication_count: 7, + topics: [ + { name: 'Physical Unclonable Functions (PUFs) and Hardware Security', count: 3 }, + { name: 'Parallel Computing and Optimization Techniques', count: 2 }, + { name: 'Security and Verification in Computing', count: 2 }, + ], + }, + { + year: 2022, + publication_count: 5, + topics: [ + { name: 'Security and Verification in Computing', count: 5 }, + { name: 'Advanced Malware Detection Techniques', count: 5 }, + { name: 'Physical Unclonable Functions (PUFs) and Hardware Security', count: 2 }, + ], + }, + { + year: 2023, + publication_count: 6, + topics: [ + { name: 'Security and Verification in Computing', count: 5 }, + { name: 'Advanced Malware Detection Techniques', count: 5 }, + { name: 'Blockchain Technology Applications and Security', count: 2 }, + ], + }, + { + year: 2024, + publication_count: 6, + topics: [ + { name: 'Security and Verification in Computing', count: 5 }, + { name: 'Advanced Malware Detection Techniques', count: 3 }, + { name: 'User Authentication and Security Systems', count: 2 }, + ], + }, + { + year: 2025, + publication_count: 6, + topics: [ + { name: 'Blockchain Technology Applications and Security', count: 2 }, + { name: 'Radiation Effects in Electronics', count: 1 }, + { name: 'Risk and Safety Analysis', count: 1 }, + ], + }, + { + year: 2026, + publication_count: 6, + topics: [ + { name: 'Advanced Malware Detection Techniques', count: 6 }, + { name: 'Security and Verification in Computing', count: 6 }, + { name: 'Web Application Security Vulnerabilities', count: 2 }, + ], + }, + ]; +} \ No newline at end of file From 644b111280a7a4291c3884cbf4b361bf5e5a5f43 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 00:25:05 +0200 Subject: [PATCH 09/60] Keep research timeline legend centered --- .../research-timeline.component.html | 76 ++++++++++--------- .../research-timeline.component.scss | 3 +- 2 files changed, 41 insertions(+), 38 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 4f1fe51a..5f469cd8 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 @@ -19,44 +19,46 @@
-
-
- + +
+
+ -
-
- {{ item.year }} - -
-
- -
-
-

{{ getMainTopic(item) }}

- - - {{ item.publication_count }} - {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} - - -
- - {{ topic.name }} - {{ topic.count }} - +
+
+ {{ item.year }} +
-
+
+ +
+
+

{{ getMainTopic(item) }}

+ + + {{ item.publication_count }} + {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} + + +
+ + {{ topic.name }} + {{ topic.count }} + +
+
+
@@ -64,7 +66,7 @@ Die drei häufigsten Topics je Jahr, gezählt über Publikationen.
-
+
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 6fad9a1c..4a3d9654 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 @@ -271,9 +271,10 @@ justify-content: center; align-items: center; gap: 10px; - margin-top: 22px; + margin-top: 18px; color: #68748f; font-size: 13px; + text-align: center; } .note-dot { From de571d47bd2db0c5185d95cf2baf7ed0994a1024 Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 00:44:21 +0200 Subject: [PATCH 10/60] Connect research timeline to topics by time in backend --- .../research-timeline.component.html | 96 +++---- .../research-timeline.component.scss | 22 +- .../research-timeline.component.ts | 4 +- .../person-overview.component.html | 6 +- .../person-overview.component.ts | 240 ++++++------------ 5 files changed, 154 insertions(+), 214 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 5f469cd8..2034bfd4 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 @@ -19,57 +19,67 @@
- -
-
- +
+ Forschungstimeline wird geladen ... +
-
-
- {{ item.year }} - +
+ Forschungstimeline konnte nicht geladen werden. +
+ + + +
+
+ + +
+
+ {{ item.year }} + +
+
+ +
+
+

{{ getMainTopic(item) }}

+ + + {{ item.publication_count }} + {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} + + +
+ + {{ topic.name }} + {{ topic.count }} + +
+
- -
-
-

{{ getMainTopic(item) }}

- - - {{ item.publication_count }} - {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} - - -
- - {{ topic.name }} - {{ topic.count }} - -
-
-
-
-
- - Die drei häufigsten Topics je Jahr, gezählt über Publikationen. -
+
+ + Die drei häufigsten Topics je Jahr, gezählt über Publikationen. +
+ -
+
Keine Timeline-Daten vorhanden.
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 4a3d9654..f41b3916 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 @@ -5,6 +5,7 @@ border-radius: 16px; background: #ffffff; box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04); + box-sizing: border-box; } .timeline-header { @@ -19,6 +20,7 @@ color: #07163d; font-size: 20px; font-weight: 700; + line-height: 1.25; } p { @@ -36,6 +38,7 @@ .view-toggle { display: flex; gap: 4px; + flex: 0 0 auto; padding: 4px; border: 1px solid #dbe5f6; border-radius: 10px; @@ -74,6 +77,7 @@ .timeline-wrapper { width: 100%; overflow-x: auto; + overflow-y: hidden; padding: 4px 0 8px; } @@ -285,13 +289,19 @@ background: #52627f; } -.empty-timeline { +.timeline-state { display: flex; - min-height: 120px; + min-height: 140px; align-items: center; justify-content: center; + padding: 20px; color: #68748f; font-size: 14px; + text-align: center; +} + +.timeline-state-error { + color: #b42318; } @media (max-width: 700px) { @@ -302,4 +312,12 @@ .timeline-header { flex-direction: column; } + + .view-toggle { + width: 100%; + + button { + flex: 1; + } + } } \ No newline at end of file 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 665acc45..fa6bd6f3 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,10 +17,12 @@ export interface TopicTimelineElement { standalone: true, imports: [CommonModule], templateUrl: './research-timeline.component.html', - styleUrls: ['./research-timeline.component.scss'], + styleUrl: './research-timeline.component.scss', }) export class ResearchTimelineComponent { @Input() elements: TopicTimelineElement[] = []; + @Input() loading = false; + @Input() loadFailed = false; private readonly colors = ['purple', 'blue', 'green', 'orange', 'pink']; private readonly columnWidth = 240; diff --git a/webapp/src/app/modules/person-overview/person-overview.component.html b/webapp/src/app/modules/person-overview/person-overview.component.html index 8831e155..3f70b27a 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.html +++ b/webapp/src/app/modules/person-overview/person-overview.component.html @@ -1,3 +1,7 @@
- +
\ No newline at end of file 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 6416bbf3..ff40b5a9 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -1,178 +1,84 @@ -import { Component } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { HttpClient } from '@angular/common/http'; +import { Component, DestroyRef, OnInit, inject } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { ActivatedRoute, ParamMap } from '@angular/router'; +import { combineLatest, distinctUntilChanged, map } from 'rxjs'; + import { ResearchTimelineComponent, TopicTimelineElement, } from './components/research-timeline/research-timeline.component'; +interface TopicTimelineResponse { + elements: TopicTimelineElement[]; + total: number; +} + @Component({ selector: 'app-person-overview', - imports: [ResearchTimelineComponent], + standalone: true, + imports: [CommonModule, ResearchTimelineComponent], templateUrl: './person-overview.component.html', styleUrl: './person-overview.component.scss', }) -export class PersonOverviewComponent { - topicTimelineElements: TopicTimelineElement[] = [ - { - year: 2009, - publication_count: 1, - topics: [ - { name: 'Security and Verification in Computing', count: 1 }, - { name: 'Advanced Malware Detection Techniques', count: 1 }, - { name: 'Cloud Data Security Solutions', count: 1 }, - ], - }, - { - year: 2010, - publication_count: 2, - topics: [ - { name: 'Security and Verification in Computing', count: 2 }, - { name: 'Distributed systems and fault tolerance', count: 2 }, - { name: 'Parallel Computing and Optimization Techniques', count: 1 }, - ], - }, - { - year: 2011, - publication_count: 9, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 8 }, - { name: 'Security and Verification in Computing', count: 8 }, - { name: 'Digital and Cyber Forensics', count: 3 }, - ], - }, - { - year: 2012, - publication_count: 5, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 3 }, - { name: 'Security and Verification in Computing', count: 3 }, - { name: 'Network Security and Intrusion Detection', count: 3 }, - ], - }, - { - year: 2013, - publication_count: 6, - topics: [ - { name: 'Security and Verification in Computing', count: 6 }, - { name: 'Advanced Malware Detection Techniques', count: 6 }, - { name: 'Network Security and Intrusion Detection', count: 2 }, - ], - }, - { - year: 2014, - publication_count: 14, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 9 }, - { name: 'Security and Verification in Computing', count: 8 }, - { name: 'Diamond and Carbon-based Materials Research', count: 3 }, - ], - }, - { - year: 2015, - publication_count: 19, - topics: [ - { name: 'Security and Verification in Computing', count: 19 }, - { name: 'Advanced Malware Detection Techniques', count: 19 }, - { name: 'Diamond and Carbon-based Materials Research', count: 6 }, - ], - }, - { - year: 2016, - publication_count: 23, - topics: [ - { name: 'Security and Verification in Computing', count: 13 }, - { name: 'Advanced Malware Detection Techniques', count: 8 }, - { name: 'Cloud Data Security Solutions', count: 4 }, - ], - }, - { - year: 2017, - publication_count: 7, - topics: [ - { name: 'Security and Verification in Computing', count: 7 }, - { name: 'Advanced Malware Detection Techniques', count: 5 }, - { name: 'Diamond and Carbon-based Materials Research', count: 4 }, - ], - }, - { - year: 2018, - publication_count: 5, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 4 }, - { name: 'Diamond and Carbon-based Materials Research', count: 2 }, - ], - }, - { - year: 2019, - publication_count: 4, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 2 }, - { name: 'Security and Verification in Computing', count: 2 }, - { name: 'Blockchain Technology Applications and Security', count: 2 }, - ], - }, - { - year: 2020, - publication_count: 5, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 4 }, - { name: 'Diamond and Carbon-based Materials Research', count: 2 }, - ], - }, - { - year: 2021, - publication_count: 7, - topics: [ - { name: 'Physical Unclonable Functions (PUFs) and Hardware Security', count: 3 }, - { name: 'Parallel Computing and Optimization Techniques', count: 2 }, - { name: 'Security and Verification in Computing', count: 2 }, - ], - }, - { - year: 2022, - publication_count: 5, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 5 }, - { name: 'Physical Unclonable Functions (PUFs) and Hardware Security', count: 2 }, - ], - }, - { - year: 2023, - publication_count: 6, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 5 }, - { name: 'Blockchain Technology Applications and Security', count: 2 }, - ], - }, - { - year: 2024, - publication_count: 6, - topics: [ - { name: 'Security and Verification in Computing', count: 5 }, - { name: 'Advanced Malware Detection Techniques', count: 3 }, - { name: 'User Authentication and Security Systems', count: 2 }, - ], - }, - { - year: 2025, - publication_count: 6, - topics: [ - { name: 'Blockchain Technology Applications and Security', count: 2 }, - { name: 'Radiation Effects in Electronics', count: 1 }, - { name: 'Risk and Safety Analysis', count: 1 }, - ], - }, - { - year: 2026, - publication_count: 6, - topics: [ - { name: 'Advanced Malware Detection Techniques', count: 6 }, - { name: 'Security and Verification in Computing', count: 6 }, - { name: 'Web Application Security Vulnerabilities', count: 2 }, - ], - }, - ]; +export class PersonOverviewComponent implements OnInit { + private readonly route = inject(ActivatedRoute); + private readonly http = inject(HttpClient); + private readonly destroyRef = inject(DestroyRef); + + topicTimelineElements: TopicTimelineElement[] = []; + loadingTimeline = false; + timelineLoadFailed = false; + + ngOnInit(): void { + combineLatest(this.route.pathFromRoot.map((route) => route.paramMap)) + .pipe( + map((paramMaps) => this.findAuthorId(paramMaps)), + distinctUntilChanged(), + takeUntilDestroyed(this.destroyRef), + ) + .subscribe((authorId) => { + this.loadTopicTimeline(authorId); + }); + } + + private findAuthorId(paramMaps: readonly ParamMap[]): string { + return ( + paramMaps + .map((paramMap) => paramMap.get('id')) + .find((id): id is string => Boolean(id)) ?? '' + ); + } + + private loadTopicTimeline(authorId: string): void { + if (!authorId || authorId === '0') { + this.topicTimelineElements = []; + this.loadingTimeline = false; + this.timelineLoadFailed = false; + return; + } + + this.loadingTimeline = true; + this.timelineLoadFailed = false; + + const url = `/inse-service/authors/${encodeURIComponent(authorId)}/topics-by-time`; + + this.http + .get(url) + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe({ + next: (response) => { + this.topicTimelineElements = response.elements ?? []; + this.loadingTimeline = false; + this.timelineLoadFailed = false; + }, + error: (error) => { + console.error('Topic timeline could not be loaded.', error); + this.topicTimelineElements = []; + this.loadingTimeline = false; + this.timelineLoadFailed = true; + }, + }); + } } \ No newline at end of file From 0a86a3f5bccb8282eac6200a1bd144ac280c3311 Mon Sep 17 00:00:00 2001 From: spsaefan <117728614+spsaefan@users.noreply.github.com> Date: Mon, 1 Jun 2026 10:32:29 +0200 Subject: [PATCH 11/60] Add primary topics to topic timeline --- .../src/main/inse/models/topics_by_year.py | 1 + service/src/main/inse/works/logic.py | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/service/src/main/inse/models/topics_by_year.py b/service/src/main/inse/models/topics_by_year.py index f1c90610..91efe7c6 100644 --- a/service/src/main/inse/models/topics_by_year.py +++ b/service/src/main/inse/models/topics_by_year.py @@ -9,3 +9,4 @@ class TopicsByYear(BaseModel): year: int = Field(description="The publication year.") publication_count: int = Field(default=0, description="The number of works in this year.") topics: List[TopicCount] = Field(default_factory=list, description="The topics in this year.") + primary_topics: List[TopicCount] = Field(default_factory=list, description="The primary topics in this year.") diff --git a/service/src/main/inse/works/logic.py b/service/src/main/inse/works/logic.py index cf522fca..94557c87 100644 --- a/service/src/main/inse/works/logic.py +++ b/service/src/main/inse/works/logic.py @@ -107,6 +107,7 @@ async def get_topics_by_time_by_author( years[year] = { "publication_count": 0, "topics": {}, + "primary_topics": {}, } years[year]["publication_count"] += 1 @@ -120,6 +121,16 @@ async def get_topics_by_time_by_author( years[year]["topics"][topic_name] += 1 + primary_topic = work.primary_topic + + if primary_topic and primary_topic.display_name: + primary_topic_name = primary_topic.display_name + + if primary_topic_name not in years[year]["primary_topics"]: + years[year]["primary_topics"][primary_topic_name] = 0 + + years[year]["primary_topics"][primary_topic_name] += 1 + elements = [] for year in sorted(years.keys()): @@ -134,10 +145,22 @@ async def get_topics_by_time_by_author( count=count, )) + primary_topic_items = list(years[year]["primary_topics"].items()) + primary_topic_items.sort(key=lambda item: item[1], reverse=True) + + primary_topics = [] + + for topic_name, count in primary_topic_items[:max_topics_per_year]: + primary_topics.append(TopicCount( + name=topic_name, + count=count, + )) + elements.append(TopicsByYear( year=year, publication_count=years[year]["publication_count"], topics=topics, + primary_topics=primary_topics, )) return TopicsByTime( From fac08044a8682677f02ee8098734bbfcc01aa67e Mon Sep 17 00:00:00 2001 From: Khuder Khalti Date: Mon, 1 Jun 2026 14:02:25 +0200 Subject: [PATCH 12/60] Add Person funding View and API integration --- webapp/src/app/api/api/persons.service.ts | 26 ++- .../person-funding.component.html | 94 ++++++++- .../person-funding.component.scss | 197 ++++++++++++++++++ .../person-funding.component.ts | 81 ++++++- 4 files changed, 392 insertions(+), 6 deletions(-) diff --git a/webapp/src/app/api/api/persons.service.ts b/webapp/src/app/api/api/persons.service.ts index cd7c95f2..5d72133b 100644 --- a/webapp/src/app/api/api/persons.service.ts +++ b/webapp/src/app/api/api/persons.service.ts @@ -1,7 +1,7 @@ /** * My App Service * - * + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -11,7 +11,7 @@ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams, - HttpResponse, HttpEvent, HttpParameterCodec, HttpContext + HttpResponse, HttpEvent, HttpParameterCodec, HttpContext } from '@angular/common/http'; import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; @@ -165,4 +165,26 @@ export class PersonsOpenApiService extends BaseService implements PersonsOpenApi ); } + public getFundersByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (authorId === null || authorId === undefined) { + throw new Error('Required parameter authorId was null or undefined when calling getFundersByAuthor.'); + } + + let localVarHeaders = this.defaultHeaders; + const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); + + let localVarPath = `/authors/${encodeURIComponent(authorId)}/funders`; + const { basePath, withCredentials } = this.configuration; + return this.httpClient.request('get', `${basePath}${localVarPath}`, + { + context: localVarHttpContext, + responseType: 'json', + ...(withCredentials ? { withCredentials } : {}), + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); +} + } 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 364b6d5b..56eef4cb 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -1 +1,93 @@ -

person-funding!

+@if (loading) { +

Lade Förderungen...

+} @else if (error) { +

Fehler beim Laden der Förderungen.

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

Keine Förderungen gefunden.

+} @else { +
+ Einzigartige Publikationen: + {{ getUniquePublicationCount() }} +
+
+
+ Förderer: + {{ funders.length }} +
+
+ + +
+ + +
+ Filter nach Position: + + + + +
+ +
+ + +
+ + + + + + + + + @for (funder of filteredFunders; track funder.funder_id) { + + + + + } + +
FördererPublikationen
{{ funder.funder_name }}{{ funder.publication_count }}
+
+ + + @if (selectedFunder) { +
+

{{ selectedFunder.funder_name }}

+ +
+
+ Erstautor + {{ selectedFunder.author_position_count.first }} +
+
+ Mitautor + {{ selectedFunder.author_position_count.middle }} +
+
+ Letztautor + {{ selectedFunder.author_position_count.last }} +
+
+ +

Publikationen

+
    + @for (id of getPublicationIds(selectedFunder); track id) { +
  • + {{ id }} +
  • + } +
+
+ } @else { +
+

Klicke auf einen Förderer für Details.

+
+ } + +
+
+} diff --git a/webapp/src/app/modules/person-funding/person-funding.component.scss b/webapp/src/app/modules/person-funding/person-funding.component.scss index e69de29b..f9337e9d 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.scss +++ b/webapp/src/app/modules/person-funding/person-funding.component.scss @@ -0,0 +1,197 @@ +.message { + padding: 16px; + color: #666; +} + +.funding-container { + padding: 16px; + display: flex; + flex-direction: column; + gap: 16px; +} + +.filter-bar { + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; + + span { + font-weight: 500; + color: #555; + } + + button { + padding: 6px 14px; + border: 1px solid #ccc; + border-radius: 20px; + background: white; + cursor: pointer; + font-size: 14px; + transition: all 0.2s; + + &:hover { + background: #f0f0f0; + } + + &.active { + background: #3f51b5; + color: white; + border-color: #3f51b5; + } + } +} + +.funding-content { + display: flex; + gap: 24px; + align-items: flex-start; +} + +.funding-list { + flex: 1; + + table { + width: 100%; + border-collapse: collapse; + + th { + text-align: left; + padding: 10px 12px; + border-bottom: 2px solid #e0e0e0; + font-weight: 600; + color: #333; + } + + tr { + cursor: pointer; + transition: background 0.15s; + + &:hover { + background: #f5f5f5; + } + + &.selected { + background: #e8eaf6; + } + } + + td { + padding: 10px 12px; + border-bottom: 1px solid #f0f0f0; + } + + .funder-name { + color: #3f51b5; + font-weight: 500; + } + } +} + +.funding-detail { + width: 340px; + border: 1px solid #e0e0e0; + border-radius: 8px; + padding: 20px; + background: #fafafa; + + &.empty { + display: flex; + align-items: center; + justify-content: center; + color: #999; + min-height: 200px; + } + + h3 { + margin: 0 0 16px 0; + font-size: 16px; + color: #333; + } + + h4 { + margin: 16px 0 8px 0; + font-size: 14px; + color: #555; + } +} + +.position-stats { + display: flex; + gap: 12px; + margin-bottom: 16px; + + .stat { + flex: 1; + text-align: center; + background: white; + border: 1px solid #e0e0e0; + border-radius: 8px; + padding: 10px; + + .stat-label { + display: block; + font-size: 12px; + color: #666; + margin-bottom: 4px; + } + + .stat-value { + display: block; + font-size: 22px; + font-weight: bold; + color: #3f51b5; + } + } +} + +.publication-list { + list-style: none; + padding: 0; + margin: 0; + max-height: 300px; + overflow-y: auto; + + li { + padding: 6px 0; + border-bottom: 1px solid #f0f0f0; + font-size: 13px; + + a { + color: #3f51b5; + text-decoration: none; + word-break: break-all; + + &:hover { + text-decoration: underline; + } + } + } + .funding-summary { + display: flex; + gap: 16px; + margin-bottom: 16px; + + .summary-card { + background: #e8eaf6; + border-radius: 8px; + padding: 16px 24px; + text-align: center; + min-width: 150px; + + .summary-value { + display: block; + font-size: 32px; + font-weight: bold; + color: #3f51b5; + } + + .summary-label { + display: block; + font-size: 14px; + color: #555; + margin-top: 4px; + } + } +} +} diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index db6f9dc1..59213f28 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -1,11 +1,86 @@ -import { Component } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ActivatedRoute } from '@angular/router'; +import { PersonsOpenApiService } from '../../api'; @Component({ selector: 'app-person-funding', - imports: [], + imports: [CommonModule], templateUrl: './person-funding.component.html', styleUrl: './person-funding.component.scss', }) -export class PersonFundingComponent { +export class PersonFundingComponent implements OnInit { + private route = inject(ActivatedRoute); + private personsApi = inject(PersonsOpenApiService); + funders: any[] = []; + filteredFunders: any[] = []; + selectedFunder: any = null; + activeFilter: string = 'all'; + loading = true; + error = false; + + ngOnInit(): void { + const authorId = this.route.parent?.snapshot.paramMap.get('id') ?? ''; + if (authorId) { + this.personsApi.getFundersByAuthor(authorId).subscribe({ + next: (result) => { + this.funders = result.funders ?? []; + this.filteredFunders = this.funders; + this.loading = false; + }, + error: () => { + this.error = true; + this.loading = false; + } + }); + } + } + + selectFunder(funder: any): void { + this.selectedFunder = funder; + } + + setFilter(filter: string): void { + this.activeFilter = filter; + this.selectedFunder = null; + if (filter === 'all') { + this.filteredFunders = this.funders; + } else { + this.filteredFunders = this.funders.filter( + f => f.author_position_count[filter] > 0 + ); + } + } + + getPublicationIds(funder: any): string[] { + if (this.activeFilter === 'all') { + return [ + ...funder.publication_ids.first, + ...funder.publication_ids.middle, + ...funder.publication_ids.last, + ...funder.publication_ids.unknown + ]; + } + return funder.publication_ids[this.activeFilter] ?? []; + } + + getPositionLabel(position: string): string { + const labels: Record = { + first: 'Erstautor', + middle: 'Mitautor', + last: 'Letztautor', + unknown: 'Unbekannt' + }; + return labels[position] ?? position; + } + getUniquePublicationCount(): number { + const allIds = new Set(); + for (const funder of this.funders) { + for (const ids of Object.values(funder.publication_ids) as string[][]) { + ids.forEach(id => allIds.add(id)); + } + } + return allIds.size; +} } From 0a32a2c19199a2df4b0e5f106051dbe9ef6295fd Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 19:56:20 +0200 Subject: [PATCH 13/60] Integrate primary topics into research timeline --- .../research-timeline.component.html | 28 ++++++++++------ .../research-timeline.component.scss | 5 +++ .../research-timeline.component.ts | 32 +++++++++++++++++-- .../person-overview.component.ts | 3 +- 4 files changed, 55 insertions(+), 13 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 2034bfd4..360980ba 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 @@ -57,14 +57,22 @@
- - {{ topic.name }} - {{ topic.count }} - + + + {{ topic.name }} + {{ topic.count }} + + + + + + Keine weiteren Topics + +
@@ -73,7 +81,9 @@
- Die drei häufigsten Topics je Jahr, gezählt über Publikationen. + + Hauptforschungsschwerpunkte im jeweiligen Zeitraum +
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 f41b3916..0b1b5ba4 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 @@ -210,6 +210,11 @@ font-weight: 700; } +.no-topics { + color: #9aa5bc; + font-size: 12px; +} + .purple { .dot { background: #7255d9; 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 fa6bd6f3..c170583f 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 @@ -10,6 +10,7 @@ export interface TopicTimelineElement { year: number; publication_count: number; topics: TopicTimelineTopic[]; + primary_topics?: TopicTimelineTopic[]; } @Component({ @@ -26,6 +27,7 @@ export class ResearchTimelineComponent { private readonly colors = ['purple', 'blue', 'green', 'orange', 'pink']; private readonly columnWidth = 240; + private readonly displayedTopicLimit = 3; get timelineItems(): TopicTimelineElement[] { return this.elements ?? []; @@ -41,12 +43,20 @@ export class ResearchTimelineComponent { return Math.max(count * this.columnWidth, 1000); } - getTopTopics(item: TopicTimelineElement): TopicTimelineTopic[] { - return (item.topics ?? []).slice(0, 3); + getPrimaryTopic(item: TopicTimelineElement): TopicTimelineTopic | undefined { + return (item.primary_topics ?? [])[0]; } getMainTopic(item: TopicTimelineElement): string { - return this.getTopTopics(item)[0]?.name ?? 'Keine Topics'; + return this.getPrimaryTopic(item)?.name ?? this.getFirstTopic(item)?.name ?? 'Keine Topics'; + } + + getDisplayedTopics(item: TopicTimelineElement): TopicTimelineTopic[] { + const primaryTopicName = this.getPrimaryTopic(item)?.name; + + return (item.topics ?? []) + .filter((topic) => !this.isSameTopic(topic.name, primaryTopicName)) + .slice(0, this.displayedTopicLimit); } getColorClass(index: number): string { @@ -60,4 +70,20 @@ export class ResearchTimelineComponent { trackByTopic(_: number, topic: TopicTimelineTopic): string { return topic.name; } + + private getFirstTopic(item: TopicTimelineElement): TopicTimelineTopic | undefined { + return (item.topics ?? [])[0]; + } + + private isSameTopic(topicName: string, primaryTopicName: string | undefined): boolean { + if (!primaryTopicName) { + return false; + } + + return this.normalizeTopicName(topicName) === this.normalizeTopicName(primaryTopicName); + } + + private normalizeTopicName(topicName: string): string { + return topicName.trim().toLowerCase(); + } } \ No newline at end of file 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 ff40b5a9..5edfefd6 100644 --- a/webapp/src/app/modules/person-overview/person-overview.component.ts +++ b/webapp/src/app/modules/person-overview/person-overview.component.ts @@ -62,7 +62,8 @@ export class PersonOverviewComponent implements OnInit { this.loadingTimeline = true; this.timelineLoadFailed = false; - const url = `/inse-service/authors/${encodeURIComponent(authorId)}/topics-by-time`; + const topicCountLimit = 4; + const url = `/inse-service/authors/${encodeURIComponent(authorId)}/topics-by-time?max_topics_per_year=${topicCountLimit}`; this.http .get(url) From 9a06211a0a9cfac77ae8eb0e63e9a7849d1f619c Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 20:12:10 +0200 Subject: [PATCH 14/60] Add year range filter to research timeline --- .../research-timeline.component.html | 72 ++++++- .../research-timeline.component.scss | 179 +++++++++++++++++- .../research-timeline.component.ts | 111 ++++++++++- 3 files changed, 350 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 360980ba..83f217f8 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 @@ -1,6 +1,6 @@
-
+

Forschungstimeline

Entwicklung der Forschungsthemen im Zeitverlauf @@ -8,14 +8,70 @@

-
- +
+
+
+ Zeitraum - + +
+ +
+ {{ selectedStartYear }} + bis + {{ selectedEndYear }} +
+ +
+
+ + + + +
+ +
+ {{ minYear }} + {{ maxYear }} +
+
+ +
+ + + +
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 0b1b5ba4..0d673ef0 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 @@ -14,6 +14,10 @@ align-items: flex-start; gap: 24px; margin-bottom: 28px; +} + +.timeline-title { + min-width: 260px; h2 { margin: 0 0 6px; @@ -35,6 +39,164 @@ } } +.timeline-header-actions { + display: flex; + align-items: flex-start; + justify-content: flex-end; + gap: 14px; + flex: 1; +} + +.year-filter { + width: min(250px, 100%); + padding: 1px 10px; + border: 1px solid #dbe5f6; + border-radius: 10px; + background: #fbfdff; +} + +.year-filter-top { + display: flex; + align-items: center; + justify-content: space-between; + gap: 10px; + margin-bottom: 4px; +} + +.year-filter-label { + color: #07163d; + font-size: 12px; + font-weight: 700; +} + +.reset-range-button { + border: none; + background: transparent; + color: #0057ff; + font-size: 11px; + cursor: pointer; + padding: 0; + + &:disabled { + color: #9aa5bc; + cursor: default; + } +} + +.year-filter-values { + display: flex; + align-items: center; + justify-content: center; + gap: 7px; + margin-bottom: 5px; + color: #40506f; + font-size: 12px; + font-weight: 600; +} + +.year-range-slider { + --range-start: 0%; + --range-end: 100%; + + position: relative; + height: 22px; + margin: 0; +} + +.range-track { + position: absolute; + top: 50%; + left: 0; + right: 0; + height: 5px; + transform: translateY(-50%); + border-radius: 999px; + background: + linear-gradient( + to right, + #d8e2f4 0%, + #d8e2f4 var(--range-start), + #0057ff var(--range-start), + #0057ff var(--range-end), + #d8e2f4 var(--range-end), + #d8e2f4 100% + ); +} + +.range-input { + position: absolute; + top: 0; + left: 0; + width: 100%; + margin: 0; + height: 22px; + appearance: none; + background: transparent; + pointer-events: none; +} + +.range-input::-webkit-slider-runnable-track { + height: 5px; + background: transparent; + border: none; +} + +.range-input::-moz-range-track { + height: 5px; + background: transparent; + border: none; +} + +.range-input::-webkit-slider-thumb { + appearance: none; + width: 15px; + height: 15px; + margin-top: -5px; + border: 2px solid #ffffff; + border-radius: 50%; + background: #0057ff; + box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22); + cursor: pointer; + pointer-events: auto; +} + +.range-input::-moz-range-thumb { + width: 15px; + height: 15px; + border: 2px solid #ffffff; + border-radius: 50%; + background: #0057ff; + box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22); + cursor: pointer; + pointer-events: auto; +} + +.range-input:focus-visible::-webkit-slider-thumb { + outline: 2px solid #07163d; + outline-offset: 2px; +} + +.range-input:focus-visible::-moz-range-thumb { + outline: 2px solid #07163d; + outline-offset: 2px; +} + +.range-input-start { + z-index: 2; +} + +.range-input-end { + z-index: 3; +} + +.year-filter-bounds { + display: flex; + justify-content: space-between; + margin-top: 1px; + color: #7c88a3; + font-size: 10px; +} + .view-toggle { display: flex; gap: 4px; @@ -309,15 +471,30 @@ color: #b42318; } +@media (max-width: 980px) { + .timeline-header { + flex-direction: column; + } + + .timeline-header-actions { + width: 100%; + justify-content: space-between; + } +} + @media (max-width: 700px) { .research-timeline-card { padding: 20px; } - .timeline-header { + .timeline-header-actions { flex-direction: column; } + .year-filter { + width: 100%; + } + .view-toggle { width: 100%; 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 c170583f..aa5b00c2 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 @@ -1,5 +1,5 @@ import { CommonModule } from '@angular/common'; -import { Component, Input } from '@angular/core'; +import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; export interface TopicTimelineTopic { name: string; @@ -20,17 +20,46 @@ export interface TopicTimelineElement { templateUrl: './research-timeline.component.html', styleUrl: './research-timeline.component.scss', }) -export class ResearchTimelineComponent { +export class ResearchTimelineComponent implements OnChanges { @Input() elements: TopicTimelineElement[] = []; @Input() loading = false; @Input() loadFailed = false; + minYear = 0; + maxYear = 0; + selectedStartYear = 0; + selectedEndYear = 0; + private readonly colors = ['purple', 'blue', 'green', 'orange', 'pink']; private readonly columnWidth = 240; private readonly displayedTopicLimit = 3; + ngOnChanges(changes: SimpleChanges): void { + if (changes['elements']) { + this.initializeYearRange(); + } + } + get timelineItems(): TopicTimelineElement[] { - return this.elements ?? []; + return this.sortedElements.filter((item) => { + return item.year >= this.selectedStartYear && item.year <= this.selectedEndYear; + }); + } + + get hasYearRange(): boolean { + return this.minYear > 0 && this.maxYear > 0 && this.minYear < this.maxYear; + } + + get canResetYearRange(): boolean { + return this.selectedStartYear !== this.minYear || this.selectedEndYear !== this.maxYear; + } + + get rangeStartPercent(): string { + return `${this.calculateRangePercent(this.selectedStartYear)}%`; + } + + get rangeEndPercent(): string { + return `${this.calculateRangePercent(this.selectedEndYear)}%`; } get gridTemplateColumns(): string { @@ -43,6 +72,31 @@ export class ResearchTimelineComponent { return Math.max(count * this.columnWidth, 1000); } + onStartYearInput(event: Event): void { + const nextStartYear = this.parseYearInput(event); + + this.selectedStartYear = this.clampYear(nextStartYear); + + if (this.selectedStartYear > this.selectedEndYear) { + this.selectedEndYear = this.selectedStartYear; + } + } + + onEndYearInput(event: Event): void { + const nextEndYear = this.parseYearInput(event); + + this.selectedEndYear = this.clampYear(nextEndYear); + + if (this.selectedEndYear < this.selectedStartYear) { + this.selectedStartYear = this.selectedEndYear; + } + } + + resetYearRange(): void { + this.selectedStartYear = this.minYear; + this.selectedEndYear = this.maxYear; + } + getPrimaryTopic(item: TopicTimelineElement): TopicTimelineTopic | undefined { return (item.primary_topics ?? [])[0]; } @@ -71,6 +125,28 @@ export class ResearchTimelineComponent { return topic.name; } + private get sortedElements(): TopicTimelineElement[] { + return [...(this.elements ?? [])].sort((left, right) => left.year - right.year); + } + + private initializeYearRange(): void { + const years = this.sortedElements + .map((item) => item.year) + .filter((year) => Number.isFinite(year)); + + if (years.length === 0) { + this.minYear = 0; + this.maxYear = 0; + this.selectedStartYear = 0; + this.selectedEndYear = 0; + return; + } + + this.minYear = Math.min(...years); + this.maxYear = Math.max(...years); + this.resetYearRange(); + } + private getFirstTopic(item: TopicTimelineElement): TopicTimelineTopic | undefined { return (item.topics ?? [])[0]; } @@ -86,4 +162,33 @@ export class ResearchTimelineComponent { private normalizeTopicName(topicName: string): string { return topicName.trim().toLowerCase(); } + + private parseYearInput(event: Event): number { + const input = event.target as HTMLInputElement | null; + const value = Number(input?.value ?? this.minYear); + + if (!Number.isFinite(value)) { + return this.minYear; + } + + return value; + } + + private clampYear(year: number): number { + return Math.min(Math.max(year, this.minYear), this.maxYear); + } + + private calculateRangePercent(year: number): number { + if (!this.hasYearRange) { + return 0; + } + + const totalRange = this.maxYear - this.minYear; + + if (totalRange <= 0) { + return 0; + } + + return ((year - this.minYear) / totalRange) * 100; + } } \ No newline at end of file From 24ee9df743077861558352ac6255fbd540ca1c5a Mon Sep 17 00:00:00 2001 From: louis-19041904 Date: Mon, 1 Jun 2026 20:56:45 +0200 Subject: [PATCH 15/60] Add compact research timeline view --- .../research-timeline.component.html | 299 ++++++++++++------ .../research-timeline.component.scss | 245 +++++++++++--- .../research-timeline.component.ts | 179 +++++++++++ 3 files changed, 582 insertions(+), 141 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 83f217f8..cfd25c2e 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 @@ -8,69 +8,75 @@

-
-
-
- Zeitraum +
+ - -
+ +
-
- {{ selectedStartYear }} - bis - {{ selectedEndYear }} -
+
+
+ Zeitraum -
-
- - - - -
- -
- {{ minYear }} - {{ maxYear }} -
+ Zurücksetzen +
-
- +
+ {{ selectedStartYear }} + bis + {{ selectedEndYear }} +
- +
+
+ + + + +
+ +
+ {{ minYear }} + {{ maxYear }}
@@ -85,55 +91,146 @@ -
-
- + +
+
+ -
-
- {{ item.year }} - +
+
+ {{ item.year }} + +
+
+ +
+
+

{{ getMainTopic(item) }}

+ + + {{ item.publication_count }} + {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} + + +
+ + + {{ topic.name }} + {{ topic.count }} + + + + + + Keine weiteren Topics + + +
+
- -
-
-

{{ getMainTopic(item) }}

- - - {{ item.publication_count }} - {{ item.publication_count === 1 ? 'Publikation' : 'Publikationen' }} - - -
- - - {{ topic.name }} - {{ topic.count }} - - - - - - Keine weiteren Topics - - -
-
-
-
+ + + +
+
+
+ + +
+ {{ getPhaseYearLabel(phase) }} +

{{ phase.primaryTopicName }}

+ + {{ phase.publication_count }} + {{ phase.publication_count === 1 ? 'Publikation' : 'Publikationen' }} + +
+
+ +
+ + + {{ topic.name }} + {{ topic.count }} + + + + + + Keine weiteren Topics + + +
+ + + +
+
+
+ {{ year.year }} + + {{ year.publication_count }} + {{ year.publication_count === 1 ? 'Publikation' : 'Publikationen' }} + +
+ +
+ + + {{ topic.name }} + {{ topic.count }} + + + + + + Keine weiteren Topics + + +
+
+
+
+
+
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 0d673ef0..f5daf94e 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 @@ -9,15 +9,15 @@ } .timeline-header { - display: flex; - justify-content: space-between; + display: grid; + grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr); align-items: flex-start; gap: 24px; margin-bottom: 28px; } .timeline-title { - min-width: 260px; + min-width: 0; h2 { margin: 0 0 6px; @@ -39,17 +39,10 @@ } } -.timeline-header-actions { - display: flex; - align-items: flex-start; - justify-content: flex-end; - gap: 14px; - flex: 1; -} - .year-filter { - width: min(250px, 100%); - padding: 1px 10px; + justify-self: end; + width: min(285px, 100%); + padding: 8px 10px; border: 1px solid #dbe5f6; border-radius: 10px; background: #fbfdff; @@ -198,9 +191,9 @@ } .view-toggle { + justify-self: center; display: flex; gap: 4px; - flex: 0 0 auto; padding: 4px; border: 1px solid #dbe5f6; border-radius: 10px; @@ -209,7 +202,7 @@ button { border: none; border-radius: 8px; - padding: 9px 16px; + padding: 9px 18px; background: transparent; color: #3f4b66; font-size: 14px; @@ -225,14 +218,6 @@ color: #0057ff; box-shadow: inset 0 0 0 1px #3d7cff; } - - &.inactive-button { - cursor: default; - } - - &.inactive-button:hover { - background: transparent; - } } } @@ -377,36 +362,206 @@ font-size: 12px; } +.compact-phase-list { + display: flex; + flex-wrap: wrap; + align-items: stretch; + gap: 14px; +} + +.phase-card { + flex: 0 1 calc((100% - 28px) / 3); + max-width: 520px; + min-width: 300px; + box-sizing: border-box; + padding: 15px 16px; + border: 1px solid #dbe5f6; + border-left-width: 4px; + border-radius: 14px; + background: #fbfdff; +} + +.phase-card-header { + display: flex; + align-items: flex-start; + gap: 10px; +} + +.phase-marker { + flex: 0 0 auto; + width: 11px; + height: 11px; + margin-top: 5px; + border: 3px solid #ffffff; + border-radius: 50%; + box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14); +} + +.phase-title-block { + min-width: 0; + + h3 { + margin: 3px 0 4px; + color: #07163d; + font-size: 15px; + font-weight: 700; + line-height: 1.35; + } +} + +.phase-years { + display: inline-flex; + width: fit-content; + padding: 2px 8px; + border-radius: 999px; + background: #eef4ff; + color: #0057ff; + font-size: 12px; + font-weight: 700; +} + +.phase-publications { + color: #68748f; + font-size: 12px; +} + +.phase-topics { + display: flex; + flex-wrap: wrap; + gap: 7px; + margin-top: 14px; +} + +.phase-toggle { + margin-top: 13px; + border: none; + background: transparent; + color: #0057ff; + font-size: 12px; + font-weight: 700; + cursor: pointer; + padding: 0; +} + +.phase-year-details { + display: flex; + flex-direction: column; + margin-top: 13px; + padding-top: 4px; + border-top: 1px solid #dbe5f6; +} + +.phase-year-row { + display: grid; + grid-template-columns: 72px 1fr; + gap: 10px; + align-items: start; + padding: 10px 0; +} + +.phase-year-row + .phase-year-row { + border-top: 1px solid #e4ebf7; +} + +.phase-year-meta { + display: flex; + flex-direction: column; + gap: 2px; + + strong { + color: #07163d; + font-size: 13px; + } + + span { + color: #68748f; + font-size: 11px; + } +} + +.phase-year-topics { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +.mini-topic-chip { + display: inline-flex; + align-items: center; + gap: 5px; + max-width: 100%; + padding: 4px 7px; + border-radius: 7px; + background: #f2f6ff; + color: #40506f; + font-size: 11px; + line-height: 1.25; + + span { + overflow-wrap: anywhere; + } + + strong { + color: #0057ff; + font-size: 10px; + } +} + .purple { - .dot { + .dot, + .phase-marker { background: #7255d9; } } .blue { - .dot { + .dot, + .phase-marker { background: #2678e8; } } .green { - .dot { + .dot, + .phase-marker { background: #39a96b; } } .orange { - .dot { + .dot, + .phase-marker { background: #f59e0b; } } .pink { - .dot { + .dot, + .phase-marker { background: #e0527c; } } +.phase-card.purple { + border-left-color: #7255d9; +} + +.phase-card.blue { + border-left-color: #2678e8; +} + +.phase-card.green { + border-left-color: #39a96b; +} + +.phase-card.orange { + border-left-color: #f59e0b; +} + +.phase-card.pink { + border-left-color: #e0527c; +} + .topic-chip.purple { border: 1px solid #d8cafe; background: #f6f0ff; @@ -471,14 +626,23 @@ color: #b42318; } -@media (max-width: 980px) { +@media (max-width: 1100px) { .timeline-header { - flex-direction: column; + grid-template-columns: 1fr; } - .timeline-header-actions { + .view-toggle { + justify-self: start; + } + + .year-filter { + justify-self: stretch; width: 100%; - justify-content: space-between; + } + + .phase-card { + flex-basis: calc((100% - 14px) / 2); + max-width: none; } } @@ -487,14 +651,6 @@ padding: 20px; } - .timeline-header-actions { - flex-direction: column; - } - - .year-filter { - width: 100%; - } - .view-toggle { width: 100%; @@ -502,4 +658,13 @@ flex: 1; } } + + .phase-card { + flex-basis: 100%; + min-width: 0; + } + + .phase-year-row { + grid-template-columns: 1fr; + } } \ No newline at end of file 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 aa5b00c2..1f478634 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 @@ -13,6 +13,26 @@ export interface TopicTimelineElement { primary_topics?: TopicTimelineTopic[]; } +type TimelineViewMode = 'years' | 'compact'; + +interface ResearchTimelinePhase { + id: string; + startYear: number; + endYear: number; + publication_count: number; + primaryTopicName: string; + years: TopicTimelineElement[]; + topics: TopicTimelineTopic[]; +} + +interface WorkingResearchTimelinePhase { + startYear: number; + endYear: number; + publication_count: number; + primaryTopicName: string; + years: TopicTimelineElement[]; +} + @Component({ selector: 'app-research-timeline', standalone: true, @@ -25,6 +45,8 @@ export class ResearchTimelineComponent implements OnChanges { @Input() loading = false; @Input() loadFailed = false; + timelineViewMode: TimelineViewMode = 'years'; + minYear = 0; maxYear = 0; selectedStartYear = 0; @@ -33,6 +55,8 @@ export class ResearchTimelineComponent implements OnChanges { private readonly colors = ['purple', 'blue', 'green', 'orange', 'pink']; private readonly columnWidth = 240; private readonly displayedTopicLimit = 3; + private readonly displayedPhaseTopicLimit = 4; + private readonly expandedPhaseIds = new Set(); ngOnChanges(changes: SimpleChanges): void { if (changes['elements']) { @@ -46,6 +70,10 @@ export class ResearchTimelineComponent implements OnChanges { }); } + get compactPhases(): ResearchTimelinePhase[] { + return this.buildCompactPhases(this.timelineItems); + } + get hasYearRange(): boolean { return this.minYear > 0 && this.maxYear > 0 && this.minYear < this.maxYear; } @@ -72,6 +100,10 @@ export class ResearchTimelineComponent implements OnChanges { return Math.max(count * this.columnWidth, 1000); } + setTimelineViewMode(mode: TimelineViewMode): void { + this.timelineViewMode = mode; + } + onStartYearInput(event: Event): void { const nextStartYear = this.parseYearInput(event); @@ -108,11 +140,39 @@ export class ResearchTimelineComponent implements OnChanges { getDisplayedTopics(item: TopicTimelineElement): TopicTimelineTopic[] { const primaryTopicName = this.getPrimaryTopic(item)?.name; + return this.getDisplayedTopicsForPrimaryTopic(item, primaryTopicName); + } + + getDisplayedTopicsForPrimaryTopic( + item: TopicTimelineElement, + primaryTopicName: string | undefined, + ): TopicTimelineTopic[] { return (item.topics ?? []) .filter((topic) => !this.isSameTopic(topic.name, primaryTopicName)) .slice(0, this.displayedTopicLimit); } + getPhaseYearLabel(phase: ResearchTimelinePhase): string { + if (phase.startYear === phase.endYear) { + return `${phase.startYear}`; + } + + return `${phase.startYear}–${phase.endYear}`; + } + + togglePhase(phase: ResearchTimelinePhase): void { + if (this.expandedPhaseIds.has(phase.id)) { + this.expandedPhaseIds.delete(phase.id); + return; + } + + this.expandedPhaseIds.add(phase.id); + } + + isPhaseExpanded(phase: ResearchTimelinePhase): boolean { + return this.expandedPhaseIds.has(phase.id); + } + getColorClass(index: number): string { return this.colors[index % this.colors.length]; } @@ -125,6 +185,10 @@ export class ResearchTimelineComponent implements OnChanges { return topic.name; } + trackByPhase(_: number, phase: ResearchTimelinePhase): string { + return phase.id; + } + private get sortedElements(): TopicTimelineElement[] { return [...(this.elements ?? [])].sort((left, right) => left.year - right.year); } @@ -147,6 +211,121 @@ export class ResearchTimelineComponent implements OnChanges { this.resetYearRange(); } + private buildCompactPhases(items: TopicTimelineElement[]): ResearchTimelinePhase[] { + const phases: ResearchTimelinePhase[] = []; + let currentPhase: WorkingResearchTimelinePhase | undefined; + + for (const item of items) { + const candidates = this.getDominantPrimaryTopicCandidates(item); + + if (candidates.length === 0) { + this.pushWorkingPhase(phases, currentPhase); + currentPhase = this.createWorkingPhase(item, this.getMainTopic(item)); + continue; + } + + const matchingCandidate = currentPhase + ? candidates.find((candidate) => this.isSameTopic(candidate.name, currentPhase?.primaryTopicName)) + : undefined; + + const canExtendCurrentPhase = + Boolean(currentPhase) && + Boolean(matchingCandidate) && + item.year === currentPhase!.endYear + 1; + + if (currentPhase && canExtendCurrentPhase) { + currentPhase.endYear = item.year; + currentPhase.publication_count += item.publication_count; + currentPhase.years.push(item); + continue; + } + + this.pushWorkingPhase(phases, currentPhase); + currentPhase = this.createWorkingPhase(item, candidates[0].name); + } + + this.pushWorkingPhase(phases, currentPhase); + + return phases; + } + + private createWorkingPhase( + item: TopicTimelineElement, + primaryTopicName: string, + ): WorkingResearchTimelinePhase { + return { + startYear: item.year, + endYear: item.year, + publication_count: item.publication_count, + primaryTopicName, + years: [item], + }; + } + + private pushWorkingPhase( + phases: ResearchTimelinePhase[], + workingPhase: WorkingResearchTimelinePhase | undefined, + ): void { + if (!workingPhase) { + return; + } + + phases.push({ + ...workingPhase, + id: `${workingPhase.startYear}-${workingPhase.endYear}-${this.normalizeTopicName( + workingPhase.primaryTopicName, + )}`, + topics: this.aggregatePhaseTopics(workingPhase.years, workingPhase.primaryTopicName), + }); + } + + private aggregatePhaseTopics( + years: TopicTimelineElement[], + primaryTopicName: string, + ): TopicTimelineTopic[] { + const counts = new Map(); + const originalNames = new Map(); + + for (const year of years) { + for (const topic of year.topics ?? []) { + if (this.isSameTopic(topic.name, primaryTopicName)) { + continue; + } + + const normalizedName = this.normalizeTopicName(topic.name); + + originalNames.set(normalizedName, topic.name); + counts.set(normalizedName, (counts.get(normalizedName) ?? 0) + topic.count); + } + } + + return Array.from(counts.entries()) + .map(([normalizedName, count]) => ({ + name: originalNames.get(normalizedName) ?? normalizedName, + count, + })) + .sort((left, right) => { + if (right.count !== left.count) { + return right.count - left.count; + } + + return left.name.localeCompare(right.name); + }) + .slice(0, this.displayedPhaseTopicLimit); + } + + private getDominantPrimaryTopicCandidates(item: TopicTimelineElement): TopicTimelineTopic[] { + const primaryTopics = item.primary_topics ?? []; + + if (primaryTopics.length === 0) { + return []; + } + + const maxCount = Math.max(...primaryTopics.map((topic) => topic.count)); + + return primaryTopics.filter((topic) => topic.count === maxCount); + } + private getFirstTopic(item: TopicTimelineElement): TopicTimelineTopic | undefined { return (item.topics ?? [])[0]; } From 5294d26552ad7ccab2049ec6712fa13b210bbf41 Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Mon, 1 Jun 2026 22:21:50 +0200 Subject: [PATCH 16/60] Refactor funders logic into separate module and add tests --- service/src/main/inse/funders/__init__.py | 5 + .../inse/funders/elastic_search_client.py | 123 +++++++++++ service/src/main/inse/funders/logic.py | 203 ++++++++++++++++++ service/src/main/inse/funders/model.py | 41 ++++ service/src/main/inse/funders/service.py | 39 ++++ service/src/main/inse/funders/test_logic.py | 166 ++++++++++++++ service/src/main/inse/logic.py | 186 +--------------- service/src/main/inse/service.py | 20 +- 8 files changed, 580 insertions(+), 203 deletions(-) create mode 100644 service/src/main/inse/funders/__init__.py create mode 100644 service/src/main/inse/funders/elastic_search_client.py create mode 100644 service/src/main/inse/funders/logic.py create mode 100644 service/src/main/inse/funders/model.py create mode 100644 service/src/main/inse/funders/service.py create mode 100644 service/src/main/inse/funders/test_logic.py diff --git a/service/src/main/inse/funders/__init__.py b/service/src/main/inse/funders/__init__.py new file mode 100644 index 00000000..a12699fd --- /dev/null +++ b/service/src/main/inse/funders/__init__.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + Funders domain package. +""" diff --git a/service/src/main/inse/funders/elastic_search_client.py b/service/src/main/inse/funders/elastic_search_client.py new file mode 100644 index 00000000..5b848c80 --- /dev/null +++ b/service/src/main/inse/funders/elastic_search_client.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + HTTP client for funded-publication searches in the OpenAlex works index. +""" +from typing import Any + +import httpx + +from .. import config + + +class MissingApiKeyError(Exception): + pass + + +class FundedPublicationsSearchClient: + def __init__( + self, + base_url: str | None = None, + index: str | None = None, + api_key: str | None = None, + timeout: float | None = None, + transport: httpx.AsyncBaseTransport | None = None, + ): + self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/") + self.index = index or config.settings.openalex_works_search_index + self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key + self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds + self.transport = transport + + @staticmethod + def indexed_author_id(author_id: str) -> str: + short_id = author_id.strip().removeprefix("https://openalex.org/") + return f"https://openalex.org/{short_id}" + + def funded_publications_by_author_query( + self, + author_id: str, + page: int, + size: int, + ) -> dict[str, Any]: + indexed_author_id = self.indexed_author_id(author_id) + return { + "from": (page - 1) * size, + "size": size, + "_source": [ + "id", + "title", + "display_name", + "publication_year", + "authorships.author.id", + "authorships.author.display_name", + "authorships.author_position", + "funders.id", + "funders.display_name", + "funders.ror", + "awards.id", + "awards.funder_id", + "awards.funder_display_name", + "awards.funder_award_id", + ], + "query": { + "bool": { + "must": [ + { + "nested": { + "path": "authorships", + "query": { + "term": { + "authorships.author.id": indexed_author_id, + }, + }, + }, + }, + { + "bool": { + "should": [ + { + "nested": { + "path": "funders", + "query": { + "exists": { + "field": "funders.id", + }, + }, + }, + }, + { + "nested": { + "path": "awards", + "query": { + "exists": { + "field": "awards.funder_id", + }, + }, + }, + }, + ], + "minimum_should_match": 1, + }, + }, + ], + }, + }, + } + + async def search(self, payload: dict[str, Any]) -> dict[str, Any]: + if not self.api_key: + raise MissingApiKeyError("OpenAlex works Elasticsearch API key is not configured.") + + async with httpx.AsyncClient( + base_url=self.base_url, + timeout=self.timeout, + transport=self.transport, + ) as client: + response = await client.post( + f"/{self.index}/_search", + headers={"Authorization": f"ApiKey {self.api_key}"}, + json=payload, + ) + response.raise_for_status() + return response.json() diff --git a/service/src/main/inse/funders/logic.py b/service/src/main/inse/funders/logic.py new file mode 100644 index 00000000..b7383ecf --- /dev/null +++ b/service/src/main/inse/funders/logic.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + Business logic for author funding based on publication works. +""" +import logging +from typing import Any + +import httpx +from fastapi import HTTPException +from starlette.status import HTTP_502_BAD_GATEWAY +from starlette.status import HTTP_503_SERVICE_UNAVAILABLE + +from .. import logic as person_logic +from . import model +from .elastic_search_client import FundedPublicationsSearchClient +from .elastic_search_client import MissingApiKeyError + +logger = logging.getLogger(__name__) + +_VALID_AUTHOR_POSITIONS = frozenset({"first", "middle", "last"}) + + +async def get_publications_by_author_id( + author_id: str, + page: int = 1, + page_size: int = 20, + client: FundedPublicationsSearchClient | None = None, +) -> model.PublicationsByAuthorResponse: + search_client = client or FundedPublicationsSearchClient() + data = await _search_funded_publications( + search_client, + author_id, + page, + page_size, + ) + total, hits = _parse_publication_search_response(data) + + return model.PublicationsByAuthorResponse( + author_id=FundedPublicationsSearchClient.indexed_author_id(author_id), + page=page, + page_size=page_size, + total=total, + results_count=len(hits), + results=hits, + ) + + +async def get_funders_by_author_id( + author_id: str, + client: FundedPublicationsSearchClient | None = None, +) -> model.FundersByAuthorResponse: + search_client = client or FundedPublicationsSearchClient() + page = 1 + page_size = 100 + funder_counts: dict[str, dict[str, Any]] = {} + + normalized_author_id = FundedPublicationsSearchClient.indexed_author_id(author_id) + author_name = _get_author_name(author_id) + + while True: + data = await _search_funded_publications( + search_client, + author_id, + page, + page_size, + ) + total, results = _parse_publication_search_response(data) + + if not results: + break + + _collect_funders_from_publications(results, author_id, funder_counts) + + if page * page_size >= total: + break + + page += 1 + + funders = sorted( + funder_counts.values(), + key=lambda entry: entry["publication_count"], + reverse=True, + ) + + return model.FundersByAuthorResponse( + author_id=normalized_author_id, + author_name=author_name, + funder_count=len(funders), + funders=[model.FunderByAuthor.model_validate(entry) for entry in funders], + ) + + +async def _search_funded_publications( + search_client: FundedPublicationsSearchClient, + author_id: str, + page: int, + page_size: int, +) -> dict: + try: + payload = search_client.funded_publications_by_author_query( + author_id, + page, + page_size, + ) + return await search_client.search(payload) + except MissingApiKeyError as exc: + logger.error("OpenAlex works Elasticsearch API key is not configured.") + raise HTTPException( + status_code=HTTP_503_SERVICE_UNAVAILABLE, + detail="OpenAlex works search is not configured.", + ) from exc + except httpx.HTTPError as exc: + logger.exception("OpenAlex works search request failed.") + raise HTTPException( + status_code=HTTP_502_BAD_GATEWAY, + detail="OpenAlex works search request failed.", + ) from exc + + +def _parse_publication_search_response(data: dict) -> tuple[int, list[dict]]: + hits = data.get("hits", {}) + total = hits.get("total", 0) + + if isinstance(total, dict): + total = total.get("value", 0) + + return total, hits.get("hits", []) + + +def _get_author_name(author_id: str) -> str | None: + short_author_id = author_id.replace("https://openalex.org/", "") + search_result = person_logic.search_persons(author_id=short_author_id) + + if not search_result.persons: + return None + + return search_result.persons[0].name + + +def _get_author_position_in_publication(publication: dict, author_id: str) -> str: + normalized_author_id = FundedPublicationsSearchClient.indexed_author_id(author_id) + + for authorship in publication.get("authorships", []): + author = authorship.get("author", {}) + if author.get("id") == normalized_author_id: + position = authorship.get("author_position", "unknown") + if position in _VALID_AUTHOR_POSITIONS: + return position + return "unknown" + + return "unknown" + + +def _collect_funders_from_publications( + results: list[dict], + author_id: str, + funder_counts: dict[str, dict[str, Any]], +) -> None: + for hit in results: + publication = hit.get("_source", {}) + publication_id = publication.get("id") + author_position = _get_author_position_in_publication(publication, author_id) + publication_funders: set[tuple[str, str | None, str | None]] = set() + + for funder in publication.get("funders", []): + funder_id = funder.get("id") + funder_name = funder.get("display_name") + if funder_id or funder_name: + key = funder_id or funder_name + publication_funders.add((key, funder_id, funder_name)) + + for award in publication.get("awards", []): + funder_id = award.get("funder_id") + funder_name = award.get("funder_display_name") + if funder_id or funder_name: + key = funder_id or funder_name + publication_funders.add((key, funder_id, funder_name)) + + for key, funder_id, funder_name in publication_funders: + if key not in funder_counts: + funder_counts[key] = { + "funder_id": funder_id, + "funder_name": funder_name, + "publication_count": 0, + "author_position_count": { + "first": 0, + "middle": 0, + "last": 0, + "unknown": 0, + }, + "publication_ids": { + "first": [], + "middle": [], + "last": [], + "unknown": [], + }, + } + + entry = funder_counts[key] + entry["publication_count"] += 1 + entry["author_position_count"][author_position] += 1 + entry["publication_ids"][author_position].append(publication_id) diff --git a/service/src/main/inse/funders/model.py b/service/src/main/inse/funders/model.py new file mode 100644 index 00000000..d7b90fa1 --- /dev/null +++ b/service/src/main/inse/funders/model.py @@ -0,0 +1,41 @@ +from typing import Any + +from pydantic import BaseModel + + +class PublicationsByAuthorResponse(BaseModel): + author_id: str + page: int + page_size: int + total: int + results_count: int + results: list[dict[str, Any]] + + +class PublicationIdsByAuthorPosition(BaseModel): + first: list[str] = [] + middle: list[str] = [] + last: list[str] = [] + unknown: list[str] = [] + + +class AuthorPositionCount(BaseModel): + first: int = 0 + middle: int = 0 + last: int = 0 + unknown: int = 0 + + +class FunderByAuthor(BaseModel): + funder_id: str | None = None + funder_name: str | None = None + publication_count: int + author_position_count: AuthorPositionCount + publication_ids: PublicationIdsByAuthorPosition + + +class FundersByAuthorResponse(BaseModel): + author_id: str + author_name: str | None = None + funder_count: int + funders: list[FunderByAuthor] \ No newline at end of file diff --git a/service/src/main/inse/funders/service.py b/service/src/main/inse/funders/service.py new file mode 100644 index 00000000..9ead124d --- /dev/null +++ b/service/src/main/inse/funders/service.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" + REST API for author publications and funding. +""" +from typing import Annotated + +from fastapi import APIRouter +from fastapi import Query + +from . import logic +from . import model + + +router = APIRouter(prefix="/authors", tags=["Funding"]) + + +@router.get( + "/{author_id}/publications", + operation_id="getPublicationsByAuthor", + response_model=model.PublicationsByAuthorResponse, + summary="Get funded publications by author.", +) +async def get_publications_by_author( + author_id: str, + page: Annotated[int, Query(ge=1)] = 1, + page_size: Annotated[int, Query(ge=1, le=1000)] = 20, +): + return await logic.get_publications_by_author_id(author_id, page, page_size) + + +@router.get( + "/{author_id}/funders", + operation_id="getFundersByAuthor", + response_model=model.FundersByAuthorResponse, + summary="Get funding organizations by author.", +) +async def get_funders_by_author(author_id: str): + return await logic.get_funders_by_author_id(author_id) diff --git a/service/src/main/inse/funders/test_logic.py b/service/src/main/inse/funders/test_logic.py new file mode 100644 index 00000000..a49a7559 --- /dev/null +++ b/service/src/main/inse/funders/test_logic.py @@ -0,0 +1,166 @@ +import json + +import httpx +import pytest +from fastapi import HTTPException + +from inse.funders import logic +from inse.funders.elastic_search_client import FundedPublicationsSearchClient + + +@pytest.fixture +def anyio_backend(): + return "asyncio" + + +def _funded_publication_hit( + work_id: str, + *, + funder_id: str | None = "https://openalex.org/F123", + funder_name: str | None = "Example Funder", + author_position: str = "first", + award_funder_id: str | None = None, + award_funder_name: str | None = None, +) -> dict: + source: dict = { + "id": work_id, + "authorships": [ + { + "author": { + "id": "https://openalex.org/A5023888391", + "display_name": "Example Author", + }, + "author_position": author_position, + } + ], + "funders": [], + "awards": [], + } + if funder_id or funder_name: + source["funders"].append( + { + "id": funder_id, + "display_name": funder_name, + } + ) + if award_funder_id or award_funder_name: + source["awards"].append( + { + "funder_id": award_funder_id, + "funder_display_name": award_funder_name, + } + ) + return {"_source": source} + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_aggregates_funders_and_awards(monkeypatch): + def handler(request: httpx.Request) -> httpx.Response: + payload = json.loads(request.content.decode("utf-8")) + assert payload["from"] == 0 + return httpx.Response( + 200, + json={ + "hits": { + "total": {"value": 2}, + "hits": [ + _funded_publication_hit( + "https://openalex.org/W1", + funder_id="https://openalex.org/F123", + funder_name="Funder A", + author_position="first", + ), + _funded_publication_hit( + "https://openalex.org/W2", + funder_id=None, + funder_name=None, + award_funder_id="https://openalex.org/F123", + award_funder_name="Funder A", + author_position="last", + ), + ], + }, + }, + ) + + monkeypatch.setattr( + logic.person_logic, + "search_persons", + lambda author_id: type( + "Result", + (), + {"persons": [type("Person", (), {"name": "Example Author"})()]}, + )(), + ) + + client = FundedPublicationsSearchClient( + base_url="https://project.nes.uni-due.de/elastic", + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + + response = await logic.get_funders_by_author_id("A5023888391", client=client) + + assert response.author_id == "https://openalex.org/A5023888391" + assert response.author_name == "Example Author" + assert response.funder_count == 1 + assert response.funders[0].funder_id == "https://openalex.org/F123" + assert response.funders[0].funder_name == "Funder A" + assert response.funders[0].publication_count == 2 + assert response.funders[0].author_position_count.first == 1 + assert response.funders[0].author_position_count.last == 1 + assert response.funders[0].publication_ids.first == ["https://openalex.org/W1"] + assert response.funders[0].publication_ids.last == ["https://openalex.org/W2"] + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_paginates_until_all_results_are_loaded(monkeypatch): + requested_pages: list[int] = [] + + def handler(request: httpx.Request) -> httpx.Response: + payload = json.loads(request.content.decode("utf-8")) + page = payload["from"] // payload["size"] + 1 + requested_pages.append(page) + return httpx.Response( + 200, + json={ + "hits": { + "total": {"value": 101}, + "hits": [ + _funded_publication_hit( + f"https://openalex.org/W{page}", + funder_id=f"https://openalex.org/F{page}", + funder_name=f"Funder {page}", + ) + ], + }, + }, + ) + + monkeypatch.setattr( + logic.person_logic, + "search_persons", + lambda author_id: type("Result", (), {"persons": []})(), + ) + + client = FundedPublicationsSearchClient( + base_url="https://project.nes.uni-due.de/elastic", + api_key="test-key", + transport=httpx.MockTransport(handler), + ) + + response = await logic.get_funders_by_author_id("A5023888391", client=client) + + assert requested_pages == [1, 2] + assert response.funder_count == 2 + assert {funder.funder_name for funder in response.funders} == {"Funder 1", "Funder 2"} + + +@pytest.mark.anyio +async def test_get_funders_by_author_id_maps_missing_api_key_to_service_unavailable(): + client = FundedPublicationsSearchClient(api_key="") + + with pytest.raises(HTTPException) as exc: + await logic.get_funders_by_author_id("A5023888391", client=client) + + assert exc.value.status_code == 503 diff --git a/service/src/main/inse/logic.py b/service/src/main/inse/logic.py index 013d2547..9c1728f4 100644 --- a/service/src/main/inse/logic.py +++ b/service/src/main/inse/logic.py @@ -284,188 +284,4 @@ def generate_person_bio(author_id: str) -> str: system_prompt = "Erstelle eine Beschreibung der Person in 3-5 Sätzen. Gebe nur die Beschreibung zurück, ohne Einleitung oder Schluss." user_prompt = f"Daten zur Person:\n{person_json}" - return llm.call(system_prompt=system_prompt, user_prompt=user_prompt) - - -def create_publications_by_author_query( - author_id: str, - page: int = 1, - page_size: int = 20 -) -> dict: - if not author_id.startswith("https://openalex.org/"): - author_id = f"https://openalex.org/{author_id}" - - from_value = (page - 1) * page_size - - return { - "from": from_value, - "size": page_size, - "_source": [ - "id", - "title", - "display_name", - "publication_year", - "authorships.author.id", - "authorships.author.display_name", - "authorships.author_position", - "funders.id", - "funders.display_name", - "funders.ror" - ], - "query": { - "bool": { - "must": [ - { - "nested": { - "path": "authorships", - "query": { - "term": { - "authorships.author.id": author_id - } - } - } - }, - { - "nested": { - "path": "funders", - "query": { - "exists": { - "field": "funders.id" - } - } - } - } - ] - } - } - } - -def get_publications_by_author_id( - author_id: str, - page: int = 1, - page_size: int = 20 -) -> dict: - headers = { - "Authorization": f"ApiKey {config.settings.elasticsearch_api_key}", - "Content-Type": "application/json" - } - - payload = create_publications_by_author_query(author_id, page, page_size) - - with httpx.Client() as client: - response = client.post( - config.settings.elasticsearch_works_url, - json=payload, - headers=headers - ) - response.raise_for_status() - data = response.json() - - total = data.get("hits", {}).get("total", {}).get("value", 0) - hits = data.get("hits", {}).get("hits", []) - - return { - "author_id": author_id if author_id.startswith("https://openalex.org/") else f"https://openalex.org/{author_id}", - "page": page, - "page_size": page_size, - "total": total, - "results_count": len(hits), - "results": hits - } - -def get_author_name(author_id: str) -> str | None: - short_author_id = author_id.replace("https://openalex.org/", "") - - search_result = search_persons(author_id=short_author_id) - - if not search_result.persons: - return None - - return search_result.persons[0].name - -def get_author_position_in_publication(publication: dict, author_id: str) -> str: - normalized_author_id = ( - author_id if author_id.startswith("https://openalex.org/") - else f"https://openalex.org/{author_id}" - ) - - for authorship in publication.get("authorships", []): - author = authorship.get("author", {}) - if author.get("id") == normalized_author_id: - return authorship.get("author_position", "unknown") - - return "unknown" - -def get_funders_by_author_id(author_id: str) -> dict: - page = 1 - page_size = 100 - funder_counts = {} - - normalized_author_id = ( - author_id if author_id.startswith("https://openalex.org/") - else f"https://openalex.org/{author_id}" - ) - - author_name = get_author_name(author_id) - - while True: - data = get_publications_by_author_id(author_id, page, page_size) - results = data.get("results", []) - - if not results: - break - - for hit in results: - publication = hit.get("_source", {}) - publication_id = publication.get("id") - author_position = get_author_position_in_publication(publication, author_id) - publication_funders = set() - - # Funders field - for funder in publication.get("funders", []): - funder_id = funder.get("id") - funder_name = funder.get("display_name") - - if funder_id or funder_name: - key = funder_id or funder_name - publication_funders.add((key, funder_id, funder_name)) - - # Count each funder only once per publication - for key, funder_id, funder_name in publication_funders: - if key not in funder_counts: - funder_counts[key] = { - "funder_id": funder_id, - "funder_name": funder_name, - "publication_count": 0, - "author_position_count": { - "first": 0, - "middle": 0, - "last": 0, - "unknown": 0 - }, - "publication_ids": { - "first": [], - "middle": [], - "last": [], - "unknown": [] - } - } - - funder_counts[key]["publication_count"] += 1 - if author_position not in funder_counts[key]["author_position_count"]: - author_position = "unknown" - - funder_counts[key]["author_position_count"][author_position] += 1 - funder_counts[key]["publication_ids"][author_position].append(publication_id) - - if len(results) < page_size: - break - - page += 1 - - return { - "author_id": normalized_author_id, - "author_name": author_name, - "funder_count": len(funder_counts), - "funders": list(funder_counts.values()) - } \ No newline at end of file + return llm.call(system_prompt=system_prompt, user_prompt=user_prompt) \ No newline at end of file diff --git a/service/src/main/inse/service.py b/service/src/main/inse/service.py index 43a78e5f..23fd6b05 100644 --- a/service/src/main/inse/service.py +++ b/service/src/main/inse/service.py @@ -23,6 +23,7 @@ from . import database from . import security from . import util from .works import service as works_service +from .funders import service as funders_service logger = logging.getLogger(__name__) @@ -34,6 +35,7 @@ app = FastAPI(redoc_url=None, summary='My App Service API', version='1.0.0') app.include_router(works_service.router) +app.include_router(funders_service.router) @app.get("/", include_in_schema=False) async def show_api(): @@ -180,21 +182,3 @@ def generate_person_bio(author_id: Annotated[str, Query(description="OpenAlex au bio = logic.generate_person_bio(author_id) return model.PersonBio(bio=bio) - -@app.get('/authors/{author_id}/publications', - operation_id='getPublicationsByAuthor', - summary='Get publications by author.', - tags=['Publications']) -def get_publications_by_author( - author_id: str, - page: int = 1, - page_size: int = 20 -): - return logic.get_publications_by_author_id(author_id, page, page_size) - -@app.get('/authors/{author_id}/funders', - operation_id='getFundersByAuthor', - summary='Get funding organizations by author.', - tags=['Funding']) -def get_funders_by_author(author_id: str): - return logic.get_funders_by_author_id(author_id) \ No newline at end of file From 6fe70c8738c1c7cdd59c53c3e15400e2133669e1 Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Mon, 1 Jun 2026 22:49:33 +0200 Subject: [PATCH 17/60] Update person funding frontend --- .../person-funding.component.html | 4 +-- .../person-funding.component.ts | 30 ++++++++++++++----- 2 files changed, 24 insertions(+), 10 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 56eef4cb..7c59a864 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -12,7 +12,7 @@
Förderer: - {{ funders.length }} + {{ filteredFunders.length }}
@@ -46,7 +46,7 @@ (click)="selectFunder(funder)" > {{ funder.funder_name }} - {{ funder.publication_count }} + {{ getPublicationCount(funder) }} } diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index 59213f28..6ba90014 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -16,7 +16,7 @@ export class PersonFundingComponent implements OnInit { funders: any[] = []; filteredFunders: any[] = []; selectedFunder: any = null; - activeFilter: string = 'all'; + activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all'; loading = true; error = false; @@ -41,7 +41,7 @@ export class PersonFundingComponent implements OnInit { this.selectedFunder = funder; } - setFilter(filter: string): void { + setFilter(filter: 'all' | 'first' | 'middle' | 'last'): void { this.activeFilter = filter; this.selectedFunder = null; if (filter === 'all') { @@ -53,6 +53,13 @@ export class PersonFundingComponent implements OnInit { } } + getPublicationCount(funder: any): number { + if (this.activeFilter === 'all') { + return funder.publication_count ?? 0; + } + return funder.author_position_count?.[this.activeFilter] ?? 0; + } + getPublicationIds(funder: any): string[] { if (this.activeFilter === 'all') { return [ @@ -74,13 +81,20 @@ export class PersonFundingComponent implements OnInit { }; return labels[position] ?? position; } + getUniquePublicationCount(): number { - const allIds = new Set(); - for (const funder of this.funders) { - for (const ids of Object.values(funder.publication_ids) as string[][]) { - ids.forEach(id => allIds.add(id)); + const allIds = new Set(); + for (const funder of this.funders) { + if (this.activeFilter === 'all') { + for (const ids of Object.values(funder.publication_ids) as string[][]) { + ids.forEach((id: string) => allIds.add(id)); + } + } else { + (funder.publication_ids[this.activeFilter] ?? []).forEach((id: string) => + allIds.add(id), + ); + } } + return allIds.size; } - return allIds.size; -} } From 9c4919162980aa462d4765a15a921c523b02cdbf Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Tue, 2 Jun 2026 12:35:44 +0200 Subject: [PATCH 18/60] Persist funding tab state after reload via query params --- .../person-funding.component.ts | 58 ++++++++++++++++++- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index 6ba90014..bc8446dd 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, inject } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ActivatedRoute } from '@angular/router'; +import { Router } from '@angular/router'; import { PersonsOpenApiService } from '../../api'; @Component({ @@ -11,7 +12,9 @@ import { PersonsOpenApiService } from '../../api'; }) export class PersonFundingComponent implements OnInit { private route = inject(ActivatedRoute); + private router = inject(Router); private personsApi = inject(PersonsOpenApiService); + private initialSelectedFunderKey: string | null = null; funders: any[] = []; filteredFunders: any[] = []; @@ -22,11 +25,18 @@ export class PersonFundingComponent implements OnInit { ngOnInit(): void { const authorId = this.route.parent?.snapshot.paramMap.get('id') ?? ''; + const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); + this.initialSelectedFunderKey = this.route.snapshot.queryParamMap.get('funder'); + if (this.isValidFilter(filterFromUrl)) { + this.activeFilter = filterFromUrl; + } + if (authorId) { this.personsApi.getFundersByAuthor(authorId).subscribe({ next: (result) => { this.funders = result.funders ?? []; - this.filteredFunders = this.funders; + this.applyFilter(); + this.restoreSelectedFunderFromUrl(); this.loading = false; }, error: () => { @@ -39,20 +49,62 @@ export class PersonFundingComponent implements OnInit { selectFunder(funder: any): void { this.selectedFunder = funder; + this.updateQueryParams(); } setFilter(filter: 'all' | 'first' | 'middle' | 'last'): void { this.activeFilter = filter; + this.applyFilter(); + this.updateQueryParams(); + } + + private applyFilter(): void { this.selectedFunder = null; - if (filter === 'all') { + if (this.activeFilter === 'all') { this.filteredFunders = this.funders; } else { this.filteredFunders = this.funders.filter( - f => f.author_position_count[filter] > 0 + f => f.author_position_count[this.activeFilter] > 0 ); } } + private restoreSelectedFunderFromUrl(): void { + if (!this.initialSelectedFunderKey) { + return; + } + + const matchedFunder = this.filteredFunders.find( + (funder: any) => this.getFunderKey(funder) === this.initialSelectedFunderKey + ); + + if (matchedFunder) { + this.selectedFunder = matchedFunder; + } else { + this.updateQueryParams(); + } + } + + private updateQueryParams(): void { + this.router.navigate([], { + relativeTo: this.route, + queryParams: { + filter: this.activeFilter, + funder: this.selectedFunder ? this.getFunderKey(this.selectedFunder) : null + }, + queryParamsHandling: 'merge', + replaceUrl: true + }); + } + + private getFunderKey(funder: any): string { + return funder.funder_id ?? funder.funder_name ?? ''; + } + + private isValidFilter(value: string | null): value is 'all' | 'first' | 'middle' | 'last' { + return value === 'all' || value === 'first' || value === 'middle' || value === 'last'; + } + getPublicationCount(funder: any): number { if (this.activeFilter === 'all') { return funder.publication_count ?? 0; From 300a618cfde4c3773e34a2d2a9e29693ed1cdc49 Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Tue, 2 Jun 2026 12:52:50 +0200 Subject: [PATCH 19/60] Open publication links directly as PDF with HTML fallback --- .../person-funding.component.html | 2 +- .../person-funding.component.ts | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) 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 7c59a864..075e1e2b 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -77,7 +77,7 @@
    @for (id of getPublicationIds(selectedFunder); track id) {
  • - {{ id }} + {{ id }}
  • }
diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index bc8446dd..d736bd1f 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -15,6 +15,7 @@ export class PersonFundingComponent implements OnInit { private router = inject(Router); private personsApi = inject(PersonsOpenApiService); private initialSelectedFunderKey: string | null = null; + private publicationUrlCache = new Map(); funders: any[] = []; filteredFunders: any[] = []; @@ -124,6 +125,12 @@ export class PersonFundingComponent implements OnInit { return funder.publication_ids[this.activeFilter] ?? []; } + async openPublication(event: MouseEvent, publicationId: string): Promise { + event.preventDefault(); + const url = await this.resolvePreferredPublicationUrl(publicationId); + window.open(url, '_blank', 'noopener'); + } + getPositionLabel(position: string): string { const labels: Record = { first: 'Erstautor', @@ -149,4 +156,42 @@ export class PersonFundingComponent implements OnInit { } return allIds.size; } + + private async resolvePreferredPublicationUrl(publicationId: string): Promise { + const cached = this.publicationUrlCache.get(publicationId); + if (cached) { + return cached; + } + + const fallbackUrl = publicationId; + const workId = publicationId.replace('https://openalex.org/', '').trim(); + if (!workId) { + return fallbackUrl; + } + + try { + const response = await fetch(`https://api.openalex.org/works/${encodeURIComponent(workId)}`); + if (!response.ok) { + return fallbackUrl; + } + + const work = await response.json(); + const pdfUrl = + work?.primary_location?.pdf_url ?? + work?.best_oa_location?.pdf_url ?? + null; + + const htmlUrl = + work?.primary_location?.landing_page_url ?? + work?.best_oa_location?.landing_page_url ?? + work?.open_access?.oa_url ?? + null; + + const resolvedUrl = pdfUrl || htmlUrl || fallbackUrl; + this.publicationUrlCache.set(publicationId, resolvedUrl); + return resolvedUrl; + } catch { + return fallbackUrl; + } + } } From b2996b07c66196d1c6f3aba97ce0cb50ffa5b48b Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Tue, 2 Jun 2026 13:05:36 +0200 Subject: [PATCH 20/60] Refine funding detail view by showing position stats per active filter --- .../modules/person-funding/person-funding.component.html | 6 ++++++ .../app/modules/person-funding/person-funding.component.ts | 4 ++++ 2 files changed, 10 insertions(+) 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 075e1e2b..8469b157 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -59,18 +59,24 @@

{{ selectedFunder.funder_name }}

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

Publikationen

diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index d736bd1f..76861ca0 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -141,6 +141,10 @@ export class PersonFundingComponent implements OnInit { return labels[position] ?? position; } + shouldShowPosition(position: 'first' | 'middle' | 'last'): boolean { + return this.activeFilter === 'all' || this.activeFilter === position; + } + getUniquePublicationCount(): number { const allIds = new Set(); for (const funder of this.funders) { From fd09c5e08c5d4e9be783c6c88be8c1845424f95b Mon Sep 17 00:00:00 2001 From: taguesokoudjou Date: Wed, 3 Jun 2026 09:14:46 +0200 Subject: [PATCH 21/60] Improve funding view pagination and UI styling --- .../person-funding.component.html | 42 +++++++-- .../person-funding.component.scss | 80 ++++++++++------ .../person-funding.component.ts | 94 ++++++++++++++++++- 3 files changed, 177 insertions(+), 39 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 8469b157..a93080b6 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -5,16 +5,16 @@ } @else if (funders.length === 0) {

Keine Förderungen gefunden.

} @else { -
- Einzigartige Publikationen: - {{ getUniquePublicationCount() }} -
-
- Förderer: - {{ filteredFunders.length }} +

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

+

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

-
@@ -40,7 +40,7 @@ - @for (funder of filteredFunders; track funder.funder_id) { + @for (funder of getPagedFunders(); track funder.funder_id) { + @if (hasFunderListPagination()) { +
+ + Seite {{ selectedFunderListPage }} von {{ getFunderListPageCount() }} + +
+ }
@@ -81,12 +92,23 @@

Publikationen

    - @for (id of getPublicationIds(selectedFunder); track id) { + @for (id of getSelectedPublicationIdsPage(); track id) {
  • {{ id }}
  • }
+ @if (hasPublicationPagination()) { +
+ + Seite {{ selectedPublicationPage }} von {{ getSelectedPublicationPageCount() }} + +
+ }
} @else {
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 f9337e9d..b9f511c9 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.scss +++ b/webapp/src/app/modules/person-funding/person-funding.component.scss @@ -35,9 +35,13 @@ } &.active { - background: #3f51b5; - color: white; - border-color: #3f51b5; + background: + radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.78), transparent 34%), + linear-gradient(145deg, #c8d9ff, #f7faff 48%, #88a9ee); + color: var(--sg-primary); + border-color: var(--sg-border); + font-weight: 600; + box-shadow: var(--sg-shadow-sm); } } } @@ -72,7 +76,7 @@ } &.selected { - background: #e8eaf6; + background: #f0f0f0; } } @@ -82,7 +86,7 @@ } .funder-name { - color: #3f51b5; + color: #333; font-weight: 500; } } @@ -140,7 +144,7 @@ display: block; font-size: 22px; font-weight: bold; - color: #3f51b5; + color: #333; } } } @@ -158,40 +162,60 @@ font-size: 13px; a { - color: #3f51b5; + color: #2563eb; text-decoration: none; word-break: break-all; &:hover { + color: #1d4ed8; text-decoration: underline; } } } - .funding-summary { +} + +.publication-pagination { display: flex; - gap: 16px; - margin-bottom: 16px; + align-items: center; + justify-content: space-between; + gap: 8px; + margin-top: 12px; - .summary-card { - background: #e8eaf6; - border-radius: 8px; - padding: 16px 24px; - text-align: center; - min-width: 150px; + button { + padding: 4px 10px; + border: 1px solid #d0d0d0; + border-radius: 6px; + background: white; + cursor: pointer; + font-size: 12px; - .summary-value { - display: block; - font-size: 32px; - font-weight: bold; - color: #3f51b5; - } - - .summary-label { - display: block; - font-size: 14px; - color: #555; - margin-top: 4px; + &:disabled { + opacity: 0.5; + cursor: default; } } + + span { + font-size: 12px; + color: #666; + } } + +.funding-summary { + margin-bottom: 16px; + + .summary-line { + margin: 0 0 4px 0; + font-size: 14px; + color: #333; + } + + .summary-label { + color: #333; + } + + .summary-value { + font-weight: 600; + color: #333; + } } diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index 76861ca0..5e9662ea 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -15,11 +15,17 @@ export class PersonFundingComponent implements OnInit { private router = inject(Router); private personsApi = inject(PersonsOpenApiService); private initialSelectedFunderKey: string | null = null; + private initialPublicationPage = 1; + private initialFunderListPage = 1; private publicationUrlCache = new Map(); funders: any[] = []; filteredFunders: any[] = []; selectedFunder: any = null; + selectedFunderListPage = 1; + selectedPublicationPage = 1; + readonly funderListPageSize = 10; + readonly publicationPageSize = 10; activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all'; loading = true; error = false; @@ -28,6 +34,10 @@ export class PersonFundingComponent implements OnInit { const authorId = this.route.parent?.snapshot.paramMap.get('id') ?? ''; const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); this.initialSelectedFunderKey = this.route.snapshot.queryParamMap.get('funder'); + this.initialPublicationPage = this.parsePageParam( + this.route.snapshot.queryParamMap.get('publicationPage') ?? this.route.snapshot.queryParamMap.get('page') + ); + this.initialFunderListPage = this.parsePageParam(this.route.snapshot.queryParamMap.get('funderPage')); if (this.isValidFilter(filterFromUrl)) { this.activeFilter = filterFromUrl; } @@ -37,6 +47,7 @@ export class PersonFundingComponent implements OnInit { next: (result) => { this.funders = result.funders ?? []; this.applyFilter(); + this.selectedFunderListPage = this.clampPage(this.initialFunderListPage, this.getFunderListPageCount()); this.restoreSelectedFunderFromUrl(); this.loading = false; }, @@ -50,6 +61,7 @@ export class PersonFundingComponent implements OnInit { selectFunder(funder: any): void { this.selectedFunder = funder; + this.selectedPublicationPage = 1; this.updateQueryParams(); } @@ -61,6 +73,8 @@ export class PersonFundingComponent implements OnInit { private applyFilter(): void { this.selectedFunder = null; + this.selectedFunderListPage = 1; + this.selectedPublicationPage = 1; if (this.activeFilter === 'all') { this.filteredFunders = this.funders; } else { @@ -81,6 +95,17 @@ export class PersonFundingComponent implements OnInit { if (matchedFunder) { this.selectedFunder = matchedFunder; + const matchedIndex = this.filteredFunders.findIndex( + (funder: any) => this.getFunderKey(funder) === this.getFunderKey(matchedFunder) + ); + if (matchedIndex >= 0) { + this.selectedFunderListPage = Math.floor(matchedIndex / this.funderListPageSize) + 1; + } + this.selectedPublicationPage = this.clampPublicationPage( + this.initialPublicationPage, + this.getPublicationPageCountForFunder(matchedFunder), + ); + this.updateQueryParams(); } else { this.updateQueryParams(); } @@ -91,7 +116,9 @@ export class PersonFundingComponent implements OnInit { relativeTo: this.route, queryParams: { filter: this.activeFilter, - funder: this.selectedFunder ? this.getFunderKey(this.selectedFunder) : null + funder: this.selectedFunder ? this.getFunderKey(this.selectedFunder) : null, + publicationPage: this.selectedFunder ? this.selectedPublicationPage : null, + funderPage: this.selectedFunderListPage }, queryParamsHandling: 'merge', replaceUrl: true @@ -125,6 +152,50 @@ export class PersonFundingComponent implements OnInit { return funder.publication_ids[this.activeFilter] ?? []; } + getPagedFunders(): any[] { + const startIndex = (this.selectedFunderListPage - 1) * this.funderListPageSize; + return this.filteredFunders.slice(startIndex, startIndex + this.funderListPageSize); + } + + hasFunderListPagination(): boolean { + return this.getFunderListPageCount() > 1; + } + + getFunderListPageCount(): number { + return Math.max(1, Math.ceil(this.filteredFunders.length / this.funderListPageSize)); + } + + setFunderListPage(page: number): void { + this.selectedFunderListPage = this.clampPage(page, this.getFunderListPageCount()); + this.updateQueryParams(); + } + + getSelectedPublicationIdsPage(): string[] { + if (!this.selectedFunder) { + return []; + } + const allPublicationIds = this.getPublicationIds(this.selectedFunder); + const startIndex = (this.selectedPublicationPage - 1) * this.publicationPageSize; + return allPublicationIds.slice(startIndex, startIndex + this.publicationPageSize); + } + + hasPublicationPagination(): boolean { + return this.getSelectedPublicationPageCount() > 1; + } + + getSelectedPublicationPageCount(): number { + if (!this.selectedFunder) { + return 1; + } + return this.getPublicationPageCountForFunder(this.selectedFunder); + } + + setPublicationPage(page: number): void { + const totalPages = this.getSelectedPublicationPageCount(); + this.selectedPublicationPage = this.clampPublicationPage(page, totalPages); + this.updateQueryParams(); + } + async openPublication(event: MouseEvent, publicationId: string): Promise { event.preventDefault(); const url = await this.resolvePreferredPublicationUrl(publicationId); @@ -198,4 +269,25 @@ export class PersonFundingComponent implements OnInit { return fallbackUrl; } } + + private getPublicationPageCountForFunder(funder: any): number { + const publicationCount = this.getPublicationIds(funder).length; + return Math.max(1, Math.ceil(publicationCount / this.publicationPageSize)); + } + + private clampPublicationPage(page: number, totalPages: number): number { + return this.clampPage(page, totalPages); + } + + private clampPage(page: number, totalPages: number): number { + return Math.min(Math.max(page, 1), totalPages); + } + + private parsePageParam(value: string | null): number { + const parsed = Number(value); + if (!Number.isInteger(parsed) || parsed < 1) { + return 1; + } + return parsed; + } } From e898f15583c546179afbb272ea502d77e3e59e9c Mon Sep 17 00:00:00 2001 From: Khuder Khalti Date: Wed, 3 Jun 2026 09:39:25 +0200 Subject: [PATCH 22/60] =?UTF-8?q?feat:=20Personensuche=20in=20der=20Naviga?= =?UTF-8?q?tionsleiste=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../person-funding.component.html | 21 +++++----- .../person-funding.component.ts | 12 +++++- .../ui/app-layout/app-layout.component.html | 34 +++++++++++---- .../ui/app-layout/app-layout.component.scss | 41 +++++++++++++++++++ .../ui/app-layout/app-layout.component.ts | 39 ++++++++++++++++-- 5 files changed, 123 insertions(+), 24 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 8469b157..a7492f4a 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.html +++ b/webapp/src/app/modules/person-funding/person-funding.component.html @@ -5,19 +5,18 @@ } @else if (funders.length === 0) {

Keine Förderungen gefunden.

} @else { -
- Einzigartige Publikationen: - {{ getUniquePublicationCount() }} -
-
-
- Förderer: - {{ filteredFunders.length }} -
-
-
+
+
+ {{ getUniquePublicationCount() }} + Einzigartige Publikationen +
+
+ {{ filteredFunders.length }} + Förderer +
+
diff --git a/webapp/src/app/modules/person-funding/person-funding.component.ts b/webapp/src/app/modules/person-funding/person-funding.component.ts index 76861ca0..9097ac9c 100644 --- a/webapp/src/app/modules/person-funding/person-funding.component.ts +++ b/webapp/src/app/modules/person-funding/person-funding.component.ts @@ -25,9 +25,16 @@ export class PersonFundingComponent implements OnInit { error = false; ngOnInit(): void { - const authorId = this.route.parent?.snapshot.paramMap.get('id') ?? ''; + this.route.parent?.paramMap.subscribe(params => { + const authorId = params.get('id') ?? ''; const filterFromUrl = this.route.snapshot.queryParamMap.get('filter'); this.initialSelectedFunderKey = this.route.snapshot.queryParamMap.get('funder'); + this.funders = []; + this.filteredFunders = []; + this.selectedFunder = null; + this.loading = true; + this.error = false; + if (this.isValidFilter(filterFromUrl)) { this.activeFilter = filterFromUrl; } @@ -46,7 +53,8 @@ export class PersonFundingComponent implements OnInit { } }); } - } + }); +} selectFunder(funder: any): void { this.selectedFunder = funder; diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.html b/webapp/src/app/shared/ui/app-layout/app-layout.component.html index 8f21ec4a..0467e59e 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.html +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.html @@ -35,13 +35,33 @@
- +
+ + @if (showResults) { +
+ @if (searchResults.length === 0) { +
Keine Ergebnisse gefunden.
+ } + @for (person of searchResults; track person.id) { +
+ {{ person.name }} + @if (person.affiliations?.length > 0) { + {{ person.affiliations[0].institution }} + } +
+ } +
+ } +
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 83fb51a9..a0f0070b 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 @@ -144,3 +144,44 @@ mat-toolbar.main { min-height: calc(100svh - 124px); } } +.search-wrapper { + position: relative; + width: 100%; +} + +.search-results { + position: absolute; + top: 100%; + left: 0; + right: 0; + background: white; + border: 1px solid var(--sg-border); + border-radius: var(--sg-radius-sm); + box-shadow: 0 4px 12px rgba(0,0,0,0.1); + z-index: 1000; + max-height: 300px; + overflow-y: auto; +} + +.search-result-item { + padding: 10px 16px; + cursor: pointer; + display: flex; + flex-direction: column; + border-bottom: 1px solid var(--sg-border); + + &:hover { + background: var(--sg-surface-muted); + } + + .result-name { + font-weight: 500; + font-size: 14px; + color: var(--sg-text); + } + + .result-affiliation { + font-size: 12px; + color: var(--sg-text-muted); + } +} diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts index 54911500..869a8d50 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.ts +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.ts @@ -9,10 +9,12 @@ import { MediaMatcher } from '@angular/cdk/layout'; import { AppMenuComponent } from '../app-menu/app-menu.component'; import { MatTooltipModule } from '@angular/material/tooltip'; import { CredentialService } from '../../services/credential.service'; +import { FormsModule } from '@angular/forms'; +import { PersonsOpenApiService } from '../../../api'; @Component({ selector: 'app-layout', - imports: [CommonModule, MatToolbarModule, MatSidenavModule, MatButtonModule, MatIconModule, RouterLink, AppMenuComponent, MatTooltipModule], + imports: [CommonModule, MatToolbarModule, MatSidenavModule, MatButtonModule, MatIconModule, RouterLink, AppMenuComponent, MatTooltipModule, FormsModule], templateUrl: './app-layout.component.html', styleUrl: './app-layout.component.scss', standalone: true, @@ -27,9 +29,13 @@ export class AppLayoutComponent implements OnInit, OnDestroy { mediaQueryListener: () => void; sideNavOpen = false; + searchQuery: string = ''; +searchResults: any[] = []; +showResults: boolean = false; - constructor(public credentialService: CredentialService, public router: Router, - public changeDetector: ChangeDetectorRef, media: MediaMatcher) { + constructor(public credentialService: CredentialService, public router: Router, + public changeDetector: ChangeDetectorRef, media: MediaMatcher, + private personsApi: PersonsOpenApiService) { this.mediaQuery = media.matchMedia('(max-width: 600px)'); this.mediaQueryListener = () => { this.sideNavOpen = !this.mediaQuery.matches @@ -42,6 +48,31 @@ export class AppLayoutComponent implements OnInit, OnDestroy { this.drawer.toggle(); } } + onSearch(event: KeyboardEvent): void { + if (event.key === 'Enter' && this.searchQuery.trim()) { + this.personsApi.searchPersons(undefined, this.searchQuery.trim()).subscribe({ + next: (result) => { + this.searchResults = result.persons ?? []; + this.showResults = true; + }, + error: () => { + this.searchResults = []; + this.showResults = false; + } + }); + } +} + +goToPerson(personId: string): void { + this.showResults = false; + this.searchQuery = ''; + const shortId = personId.replace('https://openalex.org/', ''); + this.router.navigate(['/person', shortId, 'funding']); +} + +hideResults(): void { + setTimeout(() => this.showResults = false, 200); +} ngOnInit() { this.sideNavOpen = !this.mediaQuery.matches; @@ -50,7 +81,7 @@ export class AppLayoutComponent implements OnInit, OnDestroy { ngOnDestroy(): void { this.mediaQuery.removeEventListener('change', this.mediaQueryListener); - } + } logout() { this.credentialService.logoutAcount(); From 8df18efd8fed29e111e2bff88795711659d56a65 Mon Sep 17 00:00:00 2001 From: Khuder Khalti Date: Wed, 3 Jun 2026 10:46:24 +0200 Subject: [PATCH 23/60] =?UTF-8?q?Personensuche=20in=20der=20Navigationslei?= =?UTF-8?q?ste=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/src/app/shared/ui/app-layout/app-layout.component.html | 2 +- webapp/src/app/shared/ui/app-layout/app-layout.component.scss | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/shared/ui/app-layout/app-layout.component.html b/webapp/src/app/shared/ui/app-layout/app-layout.component.html index 0467e59e..2cd812bb 100644 --- a/webapp/src/app/shared/ui/app-layout/app-layout.component.html +++ b/webapp/src/app/shared/ui/app-layout/app-layout.component.html @@ -36,7 +36,7 @@
-