Compare commits
53
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27433efe72 | ||
|
|
05eb4c49f7 | ||
|
|
ab87b87072 | ||
|
|
2878667727 | ||
|
|
68f1cae4d9 | ||
|
|
bd4305e0eb | ||
|
|
46bf66c910 | ||
|
|
1bfa0f113d | ||
|
|
1482e3fdc5 | ||
|
|
3f4b032e34 | ||
|
|
56ada07d97 | ||
|
|
2f509fbbfe | ||
|
|
2c03f53604 | ||
|
|
6609b64076 | ||
|
|
a1889f13f6 | ||
|
|
0854c16a0b | ||
|
|
50ff313a57 | ||
|
|
84073854bf | ||
|
|
9440605a6f | ||
|
|
24b7364894 | ||
|
|
767f532e6f | ||
|
|
a21d5eaea4 | ||
|
|
d8de0c2156 | ||
|
|
ba1c53b642 | ||
|
|
ef00947786 | ||
|
|
9a4a4de379 | ||
|
|
04e3f97b8b | ||
|
|
2bf8e03117 | ||
|
|
1219970ba8 | ||
|
|
5c50c29760 | ||
|
|
5343c3204d | ||
|
|
613640a730 | ||
|
|
3147de9fcb | ||
|
|
7d3792c7b4 | ||
|
|
eb5d6830a5 | ||
|
|
7da36d8777 | ||
|
|
21482f3c6f | ||
|
|
b772b100d5 | ||
|
|
bbce780609 | ||
|
|
d719a34ab0 | ||
|
|
57d0daa21b | ||
|
|
1ca3db5c78 | ||
|
|
c85d3fa03f | ||
|
|
ffc02a4e59 | ||
|
|
6c20dc2b58 | ||
|
|
24cc476dbe | ||
|
|
b2f55bd05a | ||
|
|
e153e2d74a | ||
|
|
171b296c2a | ||
|
|
435c4ae3db | ||
|
|
ac6b5aa72b | ||
|
|
e7269c6bd2 | ||
|
|
5aff658c16 |
@@ -29,12 +29,17 @@ async def get_institution_by_id(
|
||||
raw_oa_institution_id=institution_id,
|
||||
source=[
|
||||
"id",
|
||||
"ror",
|
||||
"display_name",
|
||||
"country_code",
|
||||
"type",
|
||||
"homepage_url",
|
||||
"display_name_alternatives",
|
||||
"works_count",
|
||||
"cited_by_count",
|
||||
"geo",
|
||||
"summary_stats",
|
||||
"associated_institutions",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ async def call(
|
||||
)
|
||||
except APIConnectionError:
|
||||
return "Etwas ist schiefgelaufen. Bitte versuche es später erneut."
|
||||
finally:
|
||||
await client.close()
|
||||
|
||||
return response.choices[0].message.content or (
|
||||
"Etwas ist schiefgelaufen. Bitte versuche es erneut."
|
||||
@@ -126,5 +128,7 @@ async def call_stream(
|
||||
print(f"LLM streaming failed: {type(e).__name__}: {e}")
|
||||
traceback.print_exc()
|
||||
return ""
|
||||
finally:
|
||||
await client.close()
|
||||
|
||||
return full_content
|
||||
@@ -25,6 +25,7 @@ from pydantic_core import to_jsonable_python
|
||||
|
||||
from inse.models.openalex.author_counts_by_year_inner import AuthorCountsByYearInner
|
||||
from inse.models.openalex.author_summary_stats import AuthorSummaryStats
|
||||
from inse.models.openalex.dehydrated_institution import DehydratedInstitution
|
||||
from inse.models.openalex.institution_geo import InstitutionGeo
|
||||
from inse.models.openalex.institution_ids import InstitutionIds
|
||||
|
||||
@@ -51,9 +52,10 @@ class Institution(BaseModel):
|
||||
ids: InstitutionIds | None = None
|
||||
counts_by_year: list[AuthorCountsByYearInner] | None = Field(default=None, description="`works_count` and `cited_by_count` for each of the last ten years.")
|
||||
works_api_url: StrictStr | None = Field(default=None, description="A URL that will get you a list of all works affiliated with this institution.")
|
||||
associated_institutions: list[DehydratedInstitution] | None = Field(default=None, description="Associated institutions list.")
|
||||
created_date: date | None = Field(default=None, description="When this institution was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: datetime | None = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[list[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"]
|
||||
__properties: ClassVar[list[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "associated_institutions", "created_date", "updated_date"]
|
||||
|
||||
@field_validator('type')
|
||||
def type_validate_enum(cls, value):
|
||||
@@ -151,6 +153,7 @@ class Institution(BaseModel):
|
||||
"ids": InstitutionIds.from_dict(obj["ids"]) if obj.get("ids") is not None else None,
|
||||
"counts_by_year": [AuthorCountsByYearInner.from_dict(_item) for _item in obj["counts_by_year"]] if obj.get("counts_by_year") is not None else None,
|
||||
"works_api_url": obj.get("works_api_url"),
|
||||
"associated_institutions": [DehydratedInstitution.from_dict(_item) for _item in obj["associated_institutions"]] if obj.get("associated_institutions") is not None else None,
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
|
||||
@@ -94,7 +94,10 @@ class Work(BaseModel):
|
||||
content_url: StrictStr | None = Field(default=None, description="URL for downloading full-text content. Only present when `has_content.pdf` or `has_content.grobid_xml` is true.")
|
||||
created_date: date | None = Field(default=None, description="When this work was added to OpenAlex (ISO 8601 date).")
|
||||
updated_date: datetime | None = Field(default=None, description="When this work was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[list[str]] = ["id", "doi", "title", "display_name", "publication_year", "publication_date", "type", "language", "cited_by_count", "is_retracted", "is_paratext", "primary_location", "locations", "best_oa_location", "open_access", "authorships", "ids", "biblio", "abstract_inverted_index", "referenced_works", "referenced_works_count", "related_works", "topics", "primary_topic", "keywords", "funders", "awards", "fwci", "citation_normalized_percentile", "cited_by_percentile_year", "counts_by_year", "sustainable_development_goals", "mesh", "indexed_in", "has_content", "content_url", "created_date", "updated_date"]
|
||||
snippet: StrictStr | None = Field(default=None, description="Passage of the title or abstract containing the searched keyword, with the matches wrapped in `<em>`. Only set by the keyword search, and only when the keyword actually occurs in the text.")
|
||||
snippet_field: StrictStr | None = Field(default=None, description="Which field `snippet` was taken from: `title` or `abstract`.")
|
||||
matched_via: list[StrictStr] | None = Field(default=None, description="Names of the topics and OpenAlex keywords that matched the searched keywords. Set by the keyword search so a work matched purely on metadata can explain itself when there is no `snippet`.")
|
||||
__properties: ClassVar[list[str]] = ["id", "doi", "title", "display_name", "publication_year", "publication_date", "type", "language", "cited_by_count", "is_retracted", "is_paratext", "primary_location", "locations", "best_oa_location", "open_access", "authorships", "ids", "biblio", "abstract_inverted_index", "referenced_works", "referenced_works_count", "related_works", "topics", "primary_topic", "keywords", "funders", "awards", "fwci", "citation_normalized_percentile", "cited_by_percentile_year", "counts_by_year", "sustainable_development_goals", "mesh", "indexed_in", "has_content", "content_url", "created_date", "updated_date", "snippet", "snippet_field", "matched_via"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_by_name=True,
|
||||
@@ -273,7 +276,10 @@ class Work(BaseModel):
|
||||
"has_content": WorkHasContent.from_dict(obj["has_content"]) if obj.get("has_content") is not None else None,
|
||||
"content_url": obj.get("content_url"),
|
||||
"created_date": obj.get("created_date"),
|
||||
"updated_date": obj.get("updated_date")
|
||||
"updated_date": obj.get("updated_date"),
|
||||
"snippet": obj.get("snippet"),
|
||||
"snippet_field": obj.get("snippet_field"),
|
||||
"matched_via": obj.get("matched_via")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -11,6 +11,12 @@ from inse.exceptions import ElasticsearchException
|
||||
|
||||
from ..integrations import elasticsearch, llm
|
||||
from ..persons.logic import find_ude_author_by_name, get_author_name_by_id
|
||||
from ..snippets import (
|
||||
FRAGMENT_FIELD,
|
||||
HIGHLIGHT_TAGS,
|
||||
SNIPPET_FRAGMENT_CHARS,
|
||||
snippet_with_context,
|
||||
)
|
||||
from ..topics.logic import vector_search_topics_batch
|
||||
from .model import (
|
||||
MatchedTopic,
|
||||
@@ -30,6 +36,19 @@ TOPICS_INDEX = "aktuell_openalex_topics"
|
||||
|
||||
_SESSION_TOPIC_CACHE: dict[str, list] = {}
|
||||
|
||||
PREVIEW_WORD_COUNT = 80
|
||||
|
||||
CONTENT_HIGHLIGHT = {
|
||||
"fields": {
|
||||
"full_content": {
|
||||
**FRAGMENT_FIELD,
|
||||
"no_match_size": SNIPPET_FRAGMENT_CHARS,
|
||||
}
|
||||
},
|
||||
**HIGHLIGHT_TAGS,
|
||||
"require_field_match": False,
|
||||
}
|
||||
|
||||
KEYWORD_LIMIT = 6
|
||||
KEYWORD_CONTENT_CHARS = 4000
|
||||
KEYWORD_SYSTEM_PROMPT = """\
|
||||
@@ -87,13 +106,6 @@ async def search_news(
|
||||
) -> NewsPage:
|
||||
offset = (page - 1) * page_size
|
||||
|
||||
highlight = {
|
||||
"fields": {"full_content": {"fragment_size": 200, "number_of_fragments": 1}},
|
||||
"pre_tags": ["<em>"],
|
||||
"post_tags": ["</em>"],
|
||||
"encoder": "html",
|
||||
}
|
||||
|
||||
# Filter einmal berechnen (der Relevanz-Filter macht eine ES-Abfrage).
|
||||
clauses = await _filter_clauses(year_from, year_to, relevance_values)
|
||||
exact_query = {
|
||||
@@ -115,7 +127,7 @@ async def search_news(
|
||||
size=page_size,
|
||||
offset=offset,
|
||||
sort=None,
|
||||
highlight=highlight,
|
||||
highlight=CONTENT_HIGHLIGHT,
|
||||
)
|
||||
|
||||
news_page = await _build_page(response, page, page_size)
|
||||
@@ -142,6 +154,7 @@ async def search_news_by_keywords(
|
||||
year_to: int | None = None,
|
||||
relevance_values: list | None = None,
|
||||
sort_order: str | None = None,
|
||||
title: str | None = None,
|
||||
) -> NewsPage:
|
||||
"""Searches the news for the keywords of a keywords-search run.
|
||||
|
||||
@@ -177,6 +190,9 @@ async def search_news_by_keywords(
|
||||
return _empty_page(page, page_size)
|
||||
|
||||
clauses = await _filter_clauses(year_from, year_to, relevance_values)
|
||||
if title and title.strip():
|
||||
clauses.append({"match_phrase_prefix": {"maintitle": title.strip()}})
|
||||
|
||||
query = {
|
||||
"bool": {
|
||||
"should": should,
|
||||
@@ -185,13 +201,6 @@ async def search_news_by_keywords(
|
||||
}
|
||||
}
|
||||
|
||||
highlight = {
|
||||
"fields": {"full_content": {"fragment_size": 200, "number_of_fragments": 1}},
|
||||
"pre_tags": ["<em>"],
|
||||
"post_tags": ["</em>"],
|
||||
"encoder": "html",
|
||||
}
|
||||
|
||||
sort = [{"date_full": sort_order}] if sort_order in ("asc", "desc") else None
|
||||
|
||||
response = await _run_search(
|
||||
@@ -200,7 +209,7 @@ async def search_news_by_keywords(
|
||||
size=page_size,
|
||||
offset=(page - 1) * page_size,
|
||||
sort=sort,
|
||||
highlight=None if wanted_topic_ids else highlight,
|
||||
highlight=None if wanted_topic_ids else CONTENT_HIGHLIGHT,
|
||||
)
|
||||
|
||||
news_page = await _build_page(response, page, page_size)
|
||||
@@ -761,7 +770,7 @@ def _parse_hit(hit: dict) -> NewsArticle:
|
||||
fragments = hit.get("highlight", {}).get("full_content")
|
||||
|
||||
if fragments:
|
||||
snippet = fragments[0]
|
||||
snippet = snippet_with_context(source.get("full_content"), fragments)
|
||||
else:
|
||||
snippet = _make_preview(source)
|
||||
|
||||
@@ -776,14 +785,13 @@ def _parse_hit(hit: dict) -> NewsArticle:
|
||||
|
||||
|
||||
def _make_preview(source: dict) -> str | None:
|
||||
text = source.get("intro_content") or source.get("full_content")
|
||||
text = source.get("full_content") or source.get("intro_content")
|
||||
|
||||
if not text:
|
||||
return None
|
||||
|
||||
words = text.split()
|
||||
|
||||
PREVIEW_WORD_COUNT = 10
|
||||
preview = " ".join(words[:PREVIEW_WORD_COUNT])
|
||||
if len(words) > PREVIEW_WORD_COUNT:
|
||||
preview = preview + " …"
|
||||
@@ -874,3 +882,4 @@ async def _related_search_terms(query_text: str) -> list:
|
||||
terms.append(term)
|
||||
|
||||
return terms
|
||||
|
||||
|
||||
@@ -147,6 +147,10 @@ async def search_news_by_keywords(
|
||||
pattern="^(asc|desc)$",
|
||||
),
|
||||
] = None,
|
||||
title: Annotated[
|
||||
str | None,
|
||||
Query(description="Narrows the results to articles whose title matches this text."),
|
||||
] = None,
|
||||
):
|
||||
return await logic.search_news_by_keywords(
|
||||
keywords=keywords or [],
|
||||
@@ -159,6 +163,7 @@ async def search_news_by_keywords(
|
||||
year_from=year_from,
|
||||
year_to=year_to,
|
||||
relevance_values=_parse_relevance(relevance),
|
||||
title=title,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
"""
|
||||
Bio generation for persons / authors.
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
|
||||
from pydantic import ValidationError
|
||||
|
||||
from inse.exceptions import NotFoundException, UpstreamAPIException
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESIndex
|
||||
from inse.persons.model import PersonBio
|
||||
|
||||
from .. import config
|
||||
from ..integrations import llm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def _fetch_author_display_name(author_id: str) -> str | None:
|
||||
query = {
|
||||
"query_string": {
|
||||
"default_field": "_id",
|
||||
"query": author_id,
|
||||
}
|
||||
}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.OPENALEX_AUTHORS,
|
||||
query=query,
|
||||
source=["display_name"],
|
||||
)
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
if not hits:
|
||||
return None
|
||||
|
||||
return hits[0].get("_source", {}).get("display_name")
|
||||
|
||||
|
||||
async def _fetch_works_and_topics(author_id: str) -> tuple[list, list]:
|
||||
WORK_SOURCE_FIELDS = [
|
||||
"title",
|
||||
"display_name",
|
||||
"abstract",
|
||||
"cited_by_count",
|
||||
"primary_topic",
|
||||
]
|
||||
|
||||
author_url = f"https://openalex.org/{author_id.strip()}"
|
||||
|
||||
authorship_query = {
|
||||
"nested": {
|
||||
"path": "authorships",
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [{"term": {"authorships.author.id": author_url}}],
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
body = {
|
||||
"size": 100,
|
||||
"sort": [{"cited_by_count": {"order": "desc"}}],
|
||||
"_source": WORK_SOURCE_FIELDS,
|
||||
"query": authorship_query,
|
||||
"aggs": {
|
||||
"primary_topics": {
|
||||
"terms": {"field": "primary_topic.id", "size": 5},
|
||||
"aggs": {
|
||||
"topic_name": {
|
||||
"top_hits": {
|
||||
"size": 1,
|
||||
"_source": ["primary_topic.display_name"],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=config.settings.openalex_works_search_index,
|
||||
body=body,
|
||||
)
|
||||
|
||||
works = []
|
||||
for hit in response.get("hits", {}).get("hits", []):
|
||||
works.append(hit.get("_source", {}))
|
||||
|
||||
topics = []
|
||||
buckets = (
|
||||
response.get("aggregations", {}).get("primary_topics", {}).get("buckets", [])
|
||||
)
|
||||
for bucket in buckets:
|
||||
topic_hits = bucket.get("topic_name", {}).get("hits", {}).get("hits", [])
|
||||
display_name = None
|
||||
if topic_hits:
|
||||
primary_topic = topic_hits[0].get("_source", {}).get("primary_topic", {})
|
||||
display_name = primary_topic.get("display_name")
|
||||
topics.append(
|
||||
{
|
||||
"id": bucket.get("key"),
|
||||
"display_name": display_name,
|
||||
"count": bucket.get("doc_count"),
|
||||
}
|
||||
)
|
||||
|
||||
return works, topics
|
||||
|
||||
|
||||
def _build_papers(works: list) -> list:
|
||||
papers = []
|
||||
for work in works:
|
||||
name = work.get("title") or work.get("display_name")
|
||||
abstract = work.get("abstract")
|
||||
papers.append(
|
||||
{
|
||||
"name": name,
|
||||
"abstract": abstract,
|
||||
"stats": {
|
||||
"cited_by_count": work.get("cited_by_count"),
|
||||
},
|
||||
}
|
||||
)
|
||||
return papers
|
||||
|
||||
|
||||
async def get_data_for_bio(author_id: str) -> dict | None:
|
||||
display_name = await _fetch_author_display_name(author_id)
|
||||
if display_name is None:
|
||||
return None
|
||||
|
||||
works, top_topics = await _fetch_works_and_topics(author_id)
|
||||
papers = _build_papers(works)
|
||||
|
||||
author_data = {
|
||||
"display_name": display_name,
|
||||
"topics": top_topics,
|
||||
"papers": papers,
|
||||
}
|
||||
return author_data
|
||||
|
||||
|
||||
async def generate_person_bio(author_id: str) -> str:
|
||||
start_time = time.time()
|
||||
author_data = await get_data_for_bio(author_id)
|
||||
if author_data is None:
|
||||
raise NotFoundException(f"No person found for author ID {author_id}.")
|
||||
|
||||
person_json = json.dumps(author_data, ensure_ascii=False)
|
||||
|
||||
system_prompt = """\
|
||||
Beschreibe in zwei Sätzen das Hauptforschungsfeld des Autors. Formuliere dabei allgemeinverständlich, sodass auch Personen ohne Fachwissen einen Einblick in die Forschung gewinnen. Nenne keine konkreten Publikationen oder Einzelwerke, sondern konzentriere dich auf die übergeordneten Forschungsinteressen und Themen. Verzichte auf bloße Aufzählungen und verbinde die Informationen zu einem flüssigen Text.
|
||||
Beschreibe anschließend in ein bis zwei Sätzen die wirtschaftliche Relevanz der Forschung anhand von Anwendungen, Technologien oder Branchen, die davon profitieren könnten.
|
||||
Verwende insgesamt maximal 100 bis 120 Wörter. Formuliere die Antwort so, dass sie ohne weitere Anpassungen direkt als Kurzbiografie verwendet werden kann. Verwende keine Superlative oder übertriebene Formulierungen, sondern bleibe sachlich und informativ. Gebe den Text als One-Liner zurück, ohne Zeilenumbrüche oder Aufzählungen. Verwende keine Gedankenstriche (– oder —) zur Gliederung von Sätzen. Formuliere stattdessen mit Kommas, Klammern oder zwei getrennten Sätzen.
|
||||
Gib ausschließlich ein JSON-Objekt zurück, das den Text im Feld "bio" enthält.
|
||||
"""
|
||||
|
||||
user_prompt = f"Daten zur Person:\n{person_json}"
|
||||
|
||||
response = await llm.call(
|
||||
system_prompt=system_prompt,
|
||||
user_prompt=user_prompt,
|
||||
json_schema=PersonBio.model_json_schema(),
|
||||
schema_name="bio",
|
||||
temperature=0.8,
|
||||
top_p=0.95,
|
||||
)
|
||||
|
||||
try:
|
||||
bio = PersonBio.model_validate_json(response).bio
|
||||
except ValidationError as error:
|
||||
logger.warning(
|
||||
f"Bio generation for author {author_id} returned no valid bio: {response}"
|
||||
)
|
||||
raise UpstreamAPIException("Bio generation failed.") from error
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
logger.info(f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds")
|
||||
|
||||
return bio
|
||||
@@ -4,13 +4,10 @@ Business logic for persons / authors.
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import ValidationError
|
||||
|
||||
from inse.exceptions import (
|
||||
BadRequestException,
|
||||
ElasticsearchException,
|
||||
@@ -26,13 +23,11 @@ from inse.persons.model import (
|
||||
CareerMetrics,
|
||||
CustomAuthor,
|
||||
CustomAuthorsListResponse,
|
||||
PersonBio,
|
||||
)
|
||||
from inse.persons.query_builder import build_authors_search_rescored
|
||||
from inse.works.logic import enrich_topic_descriptions
|
||||
|
||||
from .. import config, util
|
||||
from ..integrations import llm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
INDEX_NAME = "openalex-authors"
|
||||
@@ -220,100 +215,6 @@ async def count_authors_by_last_name(last_name: str) -> int:
|
||||
return await _count_authors(query)
|
||||
|
||||
|
||||
async def _fetch_author_display_name(author_id: str) -> str | None:
|
||||
query = {
|
||||
"query_string": {
|
||||
"default_field": "_id",
|
||||
"query": author_id,
|
||||
}
|
||||
}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=INDEX_NAME,
|
||||
query=query,
|
||||
source=["display_name"],
|
||||
)
|
||||
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
if not hits:
|
||||
return None
|
||||
|
||||
return hits[0].get("_source", {}).get("display_name")
|
||||
|
||||
|
||||
async def _fetch_works_and_topics(author_id: str) -> tuple[list, list]:
|
||||
WORK_SOURCE_FIELDS = [
|
||||
"title",
|
||||
"display_name",
|
||||
"abstract",
|
||||
"cited_by_count",
|
||||
"primary_topic",
|
||||
]
|
||||
|
||||
author_url = f"https://openalex.org/{author_id.strip()}"
|
||||
|
||||
authorship_query = {
|
||||
"nested": {
|
||||
"path": "authorships",
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [{"term": {"authorships.author.id": author_url}}],
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
body = {
|
||||
"size": 100,
|
||||
"sort": [{"cited_by_count": {"order": "desc"}}],
|
||||
"_source": WORK_SOURCE_FIELDS,
|
||||
"query": authorship_query,
|
||||
"aggs": {
|
||||
"primary_topics": {
|
||||
"terms": {"field": "primary_topic.id", "size": 5},
|
||||
"aggs": {
|
||||
"topic_name": {
|
||||
"top_hits": {
|
||||
"size": 1,
|
||||
"_source": ["primary_topic.display_name"],
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=config.settings.openalex_works_search_index,
|
||||
body=body,
|
||||
)
|
||||
|
||||
works = []
|
||||
for hit in response.get("hits", {}).get("hits", []):
|
||||
works.append(hit.get("_source", {}))
|
||||
|
||||
topics = []
|
||||
buckets = (
|
||||
response.get("aggregations", {}).get("primary_topics", {}).get("buckets", [])
|
||||
)
|
||||
for bucket in buckets:
|
||||
topic_hits = bucket.get("topic_name", {}).get("hits", {}).get("hits", [])
|
||||
display_name = None
|
||||
if topic_hits:
|
||||
primary_topic = topic_hits[0].get("_source", {}).get("primary_topic", {})
|
||||
display_name = primary_topic.get("display_name")
|
||||
topics.append(
|
||||
{
|
||||
"id": bucket.get("key"),
|
||||
"display_name": display_name,
|
||||
"count": bucket.get("doc_count"),
|
||||
}
|
||||
)
|
||||
|
||||
return works, topics
|
||||
|
||||
|
||||
async def _get_publication_years_for_author(author_id: str) -> list[int]:
|
||||
author_url = f"https://openalex.org/{author_id.strip()}"
|
||||
|
||||
@@ -427,79 +328,6 @@ async def get_career_metrics_for_author(author_id: str) -> CareerMetrics:
|
||||
return _compute_career_metrics(publication_years)
|
||||
|
||||
|
||||
def _build_papers(works: list) -> list:
|
||||
papers = []
|
||||
for work in works:
|
||||
name = work.get("title") or work.get("display_name")
|
||||
abstract = work.get("abstract")
|
||||
papers.append(
|
||||
{
|
||||
"name": name,
|
||||
"abstract": abstract,
|
||||
"stats": {
|
||||
"cited_by_count": work.get("cited_by_count"),
|
||||
},
|
||||
}
|
||||
)
|
||||
return papers
|
||||
|
||||
|
||||
async def get_data_for_bio(author_id: str) -> dict | None:
|
||||
display_name = await _fetch_author_display_name(author_id)
|
||||
if display_name is None:
|
||||
return None
|
||||
|
||||
works, top_topics = await _fetch_works_and_topics(author_id)
|
||||
papers = _build_papers(works)
|
||||
|
||||
author_data = {
|
||||
"display_name": display_name,
|
||||
"topics": top_topics,
|
||||
"papers": papers,
|
||||
}
|
||||
return author_data
|
||||
|
||||
|
||||
async def generate_person_bio(
|
||||
author_id: str, include: set[str] | None = None
|
||||
) -> str:
|
||||
start_time = time.time()
|
||||
author_data = await get_data_for_bio(author_id)
|
||||
if author_data is None:
|
||||
return "No person found."
|
||||
|
||||
person_json = json.dumps(author_data, ensure_ascii=False)
|
||||
|
||||
system_prompt = """\
|
||||
Beschreibe in zwei Sätzen das Hauptforschungsfeld des Autors. Formuliere dabei allgemeinverständlich, sodass auch Personen ohne Fachwissen einen Einblick in die Forschung gewinnen. Nenne keine konkreten Publikationen oder Einzelwerke, sondern konzentriere dich auf die übergeordneten Forschungsinteressen und Themen. Verzichte auf bloße Aufzählungen und verbinde die Informationen zu einem flüssigen Text.
|
||||
Beschreibe anschließend in ein bis zwei Sätzen die wirtschaftliche Relevanz der Forschung anhand von Anwendungen, Technologien oder Branchen, die davon profitieren könnten.
|
||||
Verwende insgesamt maximal 100 bis 120 Wörter. Formuliere die Antwort so, dass sie ohne weitere Anpassungen direkt als Kurzbiografie verwendet werden kann. Verwende keine Superlative oder übertriebene Formulierungen, sondern bleibe sachlich und informativ. Gebe den Text als One-Liner zurück, ohne Zeilenumbrüche oder Aufzählungen. Verwende keine Gedankenstriche (– oder —) zur Gliederung von Sätzen. Formuliere stattdessen mit Kommas, Klammern oder zwei getrennten Sätzen.
|
||||
Gib ausschließlich ein JSON-Objekt zurück, das den Text im Feld "bio" enthält.
|
||||
"""
|
||||
|
||||
user_prompt = f"Daten zur Person:\n{person_json}"
|
||||
|
||||
response = await llm.call(
|
||||
system_prompt=system_prompt,
|
||||
user_prompt=user_prompt,
|
||||
json_schema=PersonBio.model_json_schema(),
|
||||
schema_name="bio",
|
||||
temperature=0.8,
|
||||
top_p=0.95,
|
||||
)
|
||||
|
||||
try:
|
||||
bio = PersonBio.model_validate_json(response).bio
|
||||
except ValidationError:
|
||||
logger.warning(f"Bio generation for author {author_id} returned no valid JSON: {response}")
|
||||
bio = "Etwas ist schiefgelaufen."
|
||||
|
||||
elapsed_time = time.time() - start_time
|
||||
logger.info(f"Bio generation for author {author_id} took {elapsed_time:.2f} seconds")
|
||||
|
||||
return bio
|
||||
|
||||
|
||||
async def get_person_by_id(
|
||||
author_id: str, include: str | None = None
|
||||
) -> CustomAuthorsListResponse:
|
||||
|
||||
@@ -9,7 +9,7 @@ from fastapi import APIRouter, HTTPException, Path, Query, status
|
||||
|
||||
from inse.models.openalex.authors_list_response import AuthorsListResponse
|
||||
|
||||
from . import logic, model
|
||||
from . import bio as bio_logic, logic, model
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/api/inse-service",
|
||||
@@ -32,23 +32,7 @@ async def search_persons(
|
||||
query: Annotated[
|
||||
str, Query(description="Search query (e.g., Arman AND Arzani)")
|
||||
] = None,
|
||||
include: Annotated[
|
||||
str | None,
|
||||
Query(
|
||||
description=(
|
||||
"Comma-separated include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, sources, counts_by_year, works_api_url, dates, "
|
||||
"cited_by_count_boost"
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
):
|
||||
include_set = (
|
||||
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
|
||||
if include
|
||||
else None
|
||||
)
|
||||
return await logic.search_persons(author_id, query)
|
||||
|
||||
|
||||
@@ -62,20 +46,8 @@ async def generate_person_bio(
|
||||
author_id: Annotated[
|
||||
str, Query(description="OpenAlex author ID (e.g., A5093075883)")
|
||||
],
|
||||
include: Annotated[
|
||||
str | None,
|
||||
Query(
|
||||
description=("Comma-separated list to include tags"),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
):
|
||||
include_set = (
|
||||
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
|
||||
if include
|
||||
else None
|
||||
)
|
||||
bio = await logic.generate_person_bio(author_id, include_set)
|
||||
bio = await bio_logic.generate_person_bio(author_id)
|
||||
return model.PersonBio(bio=bio)
|
||||
|
||||
@router.get(
|
||||
@@ -96,7 +68,7 @@ async def get_person_by_id(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
examples="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
):
|
||||
@@ -119,11 +91,11 @@ async def search_persons_by_name(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
examples="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
limit:Annotated[int | None, Query(description=("Limit of search page results"),example ="2")]= None,
|
||||
page_offset : Annotated[int | None, Query(description=("Offset of the result page"),example="2")] = None,
|
||||
limit:Annotated[int | None, Query(description=("Limit of search page results"),examples ="2")]= None,
|
||||
page_offset : Annotated[int | None, Query(description=("Offset of the result page"),examples="2")] = None,
|
||||
):
|
||||
return await logic.search_persons_by_name(author_name=author_name, include=include, page_offset=page_offset, limit=limit)
|
||||
|
||||
@@ -141,7 +113,7 @@ async def search_persons_autocomplete(
|
||||
"Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, "
|
||||
"last_known_institutions, ..."
|
||||
),
|
||||
example="topics_full,topic_share"
|
||||
examples="topics_full,topic_share"
|
||||
)]):
|
||||
return await logic.search_persons_autocomplete(author_name=author_name, include=include)
|
||||
|
||||
@@ -181,7 +153,7 @@ async def search_persons_list(
|
||||
str | None,
|
||||
Query(
|
||||
description="Comma-separated include tags",
|
||||
example="topics_full,topic_share",
|
||||
examples="topics_full,topic_share",
|
||||
),
|
||||
] = None,
|
||||
year_filter_enabled: Annotated[
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import pytest
|
||||
|
||||
from inse import config
|
||||
from inse.exceptions import NotFoundException
|
||||
from inse.persons import service
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def anyio_backend():
|
||||
return "asyncio"
|
||||
|
||||
|
||||
def elasticsearch_configured():
|
||||
return bool(
|
||||
config.settings.elasticsearch_url and config.settings.elasticsearch_api_key
|
||||
)
|
||||
|
||||
|
||||
def llm_configured():
|
||||
return bool(
|
||||
config.settings.llm_api_url
|
||||
and config.settings.llm_api_key
|
||||
and config.settings.llm_model
|
||||
)
|
||||
|
||||
|
||||
requires_elasticsearch = pytest.mark.skipif(
|
||||
not elasticsearch_configured(), reason="Elasticsearch is not configured"
|
||||
)
|
||||
requires_elasticsearch_and_llm = pytest.mark.skipif(
|
||||
not (elasticsearch_configured() and llm_configured()),
|
||||
reason="Elasticsearch and/or LLM are not configured",
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
@requires_elasticsearch_and_llm
|
||||
async def test_bio_is_generated_for_person():
|
||||
response = await service.generate_person_bio(author_id="A5093075883")
|
||||
|
||||
assert len(response.bio) >= 10, f"bio is too short: {response.bio!r}"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
@requires_elasticsearch
|
||||
async def test_bio_generation_fails_for_unknown_author():
|
||||
with pytest.raises(NotFoundException):
|
||||
await service.generate_person_bio(author_id="A000")
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from math import floor
|
||||
from time import time
|
||||
from typing import Any
|
||||
@@ -21,7 +20,6 @@ from .model import (
|
||||
AuthorTopicStats,
|
||||
CareerStage,
|
||||
CompanyStatusFilter,
|
||||
FilterType,
|
||||
KeywordOperator,
|
||||
PublicationType,
|
||||
PublicationTypeCount,
|
||||
@@ -69,59 +67,88 @@ async def _get_author_ids_from_institution(institution_id: str) -> list[str]:
|
||||
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class MatchConfig:
|
||||
"""Where a topic filter matches on a work: keyword display names or topic ids."""
|
||||
|
||||
path: str
|
||||
match_field: str
|
||||
score_field: str
|
||||
|
||||
|
||||
_KEYWORD_MATCH = MatchConfig(
|
||||
path="keywords",
|
||||
match_field="keywords.display_name.keyword",
|
||||
score_field="keywords.score",
|
||||
)
|
||||
_TOPIC_MATCH = MatchConfig(
|
||||
path="topics",
|
||||
match_field="topics.display_name.keyword",
|
||||
score_field="topics.score",
|
||||
)
|
||||
|
||||
|
||||
def _match_config(filter_type: FilterType) -> MatchConfig:
|
||||
"""Resolves the request's filter_type into the single set of fields to match on."""
|
||||
if filter_type == FilterType.TOPIC:
|
||||
return _TOPIC_MATCH
|
||||
return _KEYWORD_MATCH
|
||||
|
||||
|
||||
def _keyword_clause(value: str, config: MatchConfig = _KEYWORD_MATCH) -> dict:
|
||||
"""A single nested clause that matches one keyword/topic value on a work."""
|
||||
def _topics_nested_clause(should_clauses: list[dict]) -> dict:
|
||||
"""Wraps should-clauses on the nested topics of a work."""
|
||||
return {
|
||||
"nested": {
|
||||
"path": config.path,
|
||||
"path": "topics",
|
||||
"query": {
|
||||
"term": {config.match_field: value},
|
||||
"bool": {
|
||||
"should": should_clauses,
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _topic_id_clause(topic_id: str) -> dict:
|
||||
"""Matches one OpenAlex topic id against a work (fuzzy mode).
|
||||
|
||||
A work matches when the topic is either its primary topic or one of its
|
||||
other topics.
|
||||
"""
|
||||
return {
|
||||
"bool": {
|
||||
"should": [
|
||||
_topics_nested_clause([{"term": {"topics.id": topic_id}}]),
|
||||
{"term": {"primary_topic.id": topic_id}},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _keyword_clause(keyword: str) -> dict:
|
||||
"""Matches one raw keyword as a phrase against a work (non-fuzzy mode).
|
||||
|
||||
The keyword has to occur as a phrase in at least one of the work's own text
|
||||
fields or in one of the names of its topic hierarchy.
|
||||
"""
|
||||
return {
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"nested": {
|
||||
"path": "keywords",
|
||||
"query": {
|
||||
"match_phrase": {"keywords.display_name": keyword},
|
||||
},
|
||||
},
|
||||
},
|
||||
{"match_phrase": {"primary_topic.display_name": keyword}},
|
||||
{"match_phrase": {"title": keyword}},
|
||||
{"match_phrase": {"abstract": keyword}},
|
||||
_topics_nested_clause(
|
||||
[
|
||||
{"match_phrase": {"topics.display_name": keyword}},
|
||||
{"match_phrase": {"topics.field.display_name": keyword}},
|
||||
{"match_phrase": {"topics.subfield.display_name": keyword}},
|
||||
{"match_phrase": {"topics.domain.display_name": keyword}},
|
||||
]
|
||||
),
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _build_keyword_query(
|
||||
keywords: list[str],
|
||||
operator: KeywordOperator,
|
||||
config: MatchConfig = _KEYWORD_MATCH,
|
||||
fuzzy: bool = False,
|
||||
) -> dict:
|
||||
"""Combines the keyword/topic clauses according to the operator.
|
||||
|
||||
AND: a work must carry all values (every clause is required).
|
||||
OR: a work must carry at least one of the values.
|
||||
AND: a work must match all values (every clause is required).
|
||||
OR: a work must match at least one of the values.
|
||||
"""
|
||||
clauses = []
|
||||
for keyword in keywords:
|
||||
clauses.append(_keyword_clause(keyword, config))
|
||||
if fuzzy:
|
||||
clauses.append(_topic_id_clause(keyword))
|
||||
else:
|
||||
clauses.append(_keyword_clause(keyword))
|
||||
|
||||
if operator == KeywordOperator.OR:
|
||||
return {
|
||||
@@ -156,12 +183,12 @@ def _topic_stats_query(
|
||||
operator: KeywordOperator,
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
config: MatchConfig = _KEYWORD_MATCH,
|
||||
fuzzy: bool = False,
|
||||
) -> dict:
|
||||
"""Builds a single query with all stats for Section 1"""
|
||||
|
||||
filters = [
|
||||
_build_keyword_query(keywords, operator, config),
|
||||
_build_keyword_query(keywords, operator, fuzzy),
|
||||
_author_filter(author_ids),
|
||||
]
|
||||
|
||||
@@ -283,38 +310,6 @@ def _topic_stats_query(
|
||||
"_source": {"includes": ["cited_by_count"]},
|
||||
},
|
||||
},
|
||||
# works whose matched keyword/topic scores above 0.8
|
||||
"relevance_above_80": {
|
||||
"filter": {
|
||||
"nested": {
|
||||
"path": config.path,
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{"terms": {config.match_field: keywords}},
|
||||
{"range": {config.score_field: {"gt": 0.8}}},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
# average matched relevance score over the works
|
||||
"matched_keywords": {
|
||||
"nested": {"path": config.path},
|
||||
"aggs": {
|
||||
"only_searched": {
|
||||
"filter": {
|
||||
"terms": {config.match_field: keywords},
|
||||
},
|
||||
"aggs": {
|
||||
"avg_score": {
|
||||
"avg": {"field": config.score_field},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -347,17 +342,16 @@ async def topic_stats_for_authors(
|
||||
operator: KeywordOperator,
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
filter_type: FilterType = FilterType.KEYWORD,
|
||||
fuzzy: bool = False,
|
||||
) -> list[AuthorTopicStats]:
|
||||
|
||||
if not author_ids:
|
||||
return []
|
||||
|
||||
match_cfg = _match_config(filter_type)
|
||||
response: dict[str, Any] = await elasticsearch.search(
|
||||
index=config.settings.openalex_works_search_index,
|
||||
body=_topic_stats_query(
|
||||
author_ids, keywords, operator, publication_types, timespan, match_cfg
|
||||
author_ids, keywords, operator, publication_types, timespan, fuzzy
|
||||
),
|
||||
cluster=ESCluster.NES,
|
||||
)
|
||||
@@ -375,12 +369,6 @@ async def topic_stats_for_authors(
|
||||
for author_bucket in author_buckets:
|
||||
to_work = author_bucket.get("to_work", {})
|
||||
avg_value = to_work.get("avg_percentile", {}).get("value")
|
||||
avg_rel = (
|
||||
to_work.get("matched_keywords", {})
|
||||
.get("only_searched", {})
|
||||
.get("avg_score", {})
|
||||
.get("value")
|
||||
)
|
||||
positions = {
|
||||
bucket.get("key", ""): bucket.get("doc_count", 0)
|
||||
for bucket in author_bucket.get("positions", {}).get("buckets", [])
|
||||
@@ -413,8 +401,6 @@ async def topic_stats_for_authors(
|
||||
industry_works_count=to_work.get("industry_collab", {}).get("doc_count", 0),
|
||||
first_year=int(first_year) if first_year is not None else None,
|
||||
last_year=int(last_year) if last_year is not None else None,
|
||||
relevance_above_80_count=to_work.get("relevance_above_80", {}).get("doc_count", 0),
|
||||
avg_relevance=float(avg_rel) if avg_rel is not None else 0.0,
|
||||
first_author_count=positions.get("first", 0),
|
||||
middle_author_count=positions.get("middle", 0),
|
||||
last_author_count=positions.get("last", 0),
|
||||
@@ -424,13 +410,29 @@ async def topic_stats_for_authors(
|
||||
return results
|
||||
|
||||
|
||||
def _primary_topic_match(keywords: list[str], fuzzy: bool) -> dict:
|
||||
"""Matches works whose primary topic is one of the searched topics/keywords."""
|
||||
if fuzzy:
|
||||
return {"terms": {"primary_topic.id": keywords}}
|
||||
|
||||
return {
|
||||
"bool": {
|
||||
"should": [
|
||||
{"match_phrase": {"primary_topic.display_name": keyword}}
|
||||
for keyword in keywords
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def _topic_profile_query(
|
||||
author_ids: list[str],
|
||||
keywords: list[str],
|
||||
operator: KeywordOperator,
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
config: MatchConfig = _KEYWORD_MATCH,
|
||||
fuzzy: bool = False,
|
||||
) -> dict:
|
||||
"""Builds the Section 3 query"""
|
||||
|
||||
@@ -474,14 +476,10 @@ def _topic_profile_query(
|
||||
"reverse_nested": {},
|
||||
"aggs": {
|
||||
"matched": {
|
||||
"filter": _build_keyword_query(keywords, operator, config),
|
||||
"filter": _build_keyword_query(keywords, operator, fuzzy),
|
||||
"aggs": {
|
||||
"primary_match": {
|
||||
"filter": {
|
||||
"terms": {
|
||||
"primary_topic.display_name.keyword": keywords,
|
||||
},
|
||||
},
|
||||
"filter": _primary_topic_match(keywords, fuzzy),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -561,17 +559,16 @@ async def topic_profile_for_authors(
|
||||
operator: KeywordOperator,
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
filter_type: FilterType = FilterType.KEYWORD,
|
||||
fuzzy: bool = False,
|
||||
) -> list[AuthorTopicProfile]:
|
||||
|
||||
if not author_ids:
|
||||
return []
|
||||
|
||||
match_cfg = _match_config(filter_type)
|
||||
response: dict[str, Any] = await elasticsearch.search(
|
||||
index=config.settings.openalex_works_search_index,
|
||||
body=_topic_profile_query(
|
||||
author_ids, keywords, operator, publication_types, timespan, match_cfg
|
||||
author_ids, keywords, operator, publication_types, timespan, fuzzy
|
||||
),
|
||||
cluster=ESCluster.NES,
|
||||
)
|
||||
@@ -727,11 +724,11 @@ def _build_query(
|
||||
author_ids: list[str],
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
config: MatchConfig = _KEYWORD_MATCH,
|
||||
fuzzy: bool = False,
|
||||
) -> dict:
|
||||
"""Builds the Elasticsearch query that returns the raw stats per author."""
|
||||
work_filters = [
|
||||
_build_keyword_query(keywords, operator, config),
|
||||
_build_keyword_query(keywords, operator, fuzzy),
|
||||
_author_filter(author_ids),
|
||||
]
|
||||
if publication_types:
|
||||
@@ -794,7 +791,7 @@ def _build_publication_type_counts_query(
|
||||
operator: KeywordOperator,
|
||||
author_ids: list[str],
|
||||
timespan: Timespan | None,
|
||||
config: MatchConfig = _KEYWORD_MATCH,
|
||||
fuzzy: bool = False,
|
||||
) -> dict:
|
||||
"""Builds the query that counts matching works per publication type.
|
||||
|
||||
@@ -802,7 +799,7 @@ def _build_publication_type_counts_query(
|
||||
filter itself, since it aggregates over all types instead of one score.
|
||||
"""
|
||||
work_filters = [
|
||||
_build_keyword_query(keywords, operator, config),
|
||||
_build_keyword_query(keywords, operator, fuzzy),
|
||||
_author_filter(author_ids),
|
||||
]
|
||||
if timespan is not None:
|
||||
@@ -832,7 +829,7 @@ async def publication_type_counts_for_keywords(
|
||||
institution_id: str,
|
||||
career_stages: list[CareerStage],
|
||||
timespan: Timespan | None,
|
||||
filter_type: FilterType = FilterType.KEYWORD,
|
||||
fuzzy: bool = False,
|
||||
) -> list[PublicationTypeCount]:
|
||||
"""Counts the university's matching works per publication type, largest first."""
|
||||
author_ids = await _get_author_ids_from_institution(institution_id)
|
||||
@@ -844,7 +841,7 @@ async def publication_type_counts_for_keywords(
|
||||
author_ids = await _filter_author_ids_by_career_stage(author_ids, career_stages)
|
||||
|
||||
query_body = _build_publication_type_counts_query(
|
||||
keywords, operator, author_ids, timespan, _match_config(filter_type),
|
||||
keywords, operator, author_ids, timespan, fuzzy,
|
||||
)
|
||||
|
||||
response: dict[str, Any] = await elasticsearch.search(
|
||||
@@ -1175,7 +1172,7 @@ async def rank_authors_by_keywords(
|
||||
publication_types: list[PublicationType],
|
||||
timespan: Timespan | None,
|
||||
company_status: CompanyStatusFilter = CompanyStatusFilter.ALL,
|
||||
filter_type: FilterType = FilterType.KEYWORD,
|
||||
fuzzy: bool = False,
|
||||
) -> list[RankedAuthor]:
|
||||
"""Ranks the university's authors by a weighted score over works and citations.
|
||||
|
||||
@@ -1193,8 +1190,7 @@ async def rank_authors_by_keywords(
|
||||
author_ids = await _filter_author_ids_by_career_stage(author_ids, career_stages)
|
||||
|
||||
query_body = _build_query(
|
||||
keywords, operator, author_ids, publication_types, timespan,
|
||||
_match_config(filter_type),
|
||||
keywords, operator, author_ids, publication_types, timespan, fuzzy,
|
||||
)
|
||||
|
||||
response: dict[str, Any] = await elasticsearch.search(
|
||||
|
||||
@@ -12,11 +12,6 @@ class KeywordOperator(StrEnum):
|
||||
OR = "or"
|
||||
|
||||
|
||||
class FilterType(StrEnum):
|
||||
KEYWORD = "keyword"
|
||||
TOPIC = "topic"
|
||||
|
||||
|
||||
class CompanyStatusFilter(StrEnum):
|
||||
ALL = "all"
|
||||
ACTIVE = "active"
|
||||
@@ -107,10 +102,12 @@ class KeywordToAuthorRequest(BaseModel):
|
||||
default=KeywordOperator.AND,
|
||||
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
||||
)
|
||||
filter_type: FilterType = Field(
|
||||
default=FilterType.KEYWORD,
|
||||
description="What the 'keywords' values match against: 'keyword' (OpenAlex "
|
||||
"keyword display names) or 'topic' (OpenAlex topic display names). Defaults to 'keyword'.",
|
||||
fuzzy: bool = Field(
|
||||
default=False,
|
||||
description="How the 'keywords' values are matched: True means they are "
|
||||
"OpenAlex topic ids matched against the work's topics, False means they are "
|
||||
"raw keywords matched as phrases in the work's title, abstract, keywords and "
|
||||
"topic names. Defaults to False.",
|
||||
)
|
||||
weights: RankingWeights = Field(
|
||||
description="Weights for the ranking metrics. Required.",
|
||||
@@ -133,7 +130,7 @@ class KeywordToAuthorRequest(BaseModel):
|
||||
"'all', only 'active' (non-deleted), or only 'deleted'.",
|
||||
)
|
||||
|
||||
@field_validator("operator", "filter_type", mode="before")
|
||||
@field_validator("operator", mode="before")
|
||||
@classmethod
|
||||
def operator_case_insensitive(cls, value):
|
||||
if isinstance(value, str):
|
||||
@@ -154,10 +151,12 @@ class SelectedAuthorsRequest(BaseModel):
|
||||
default=KeywordOperator.AND,
|
||||
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
||||
)
|
||||
filter_type: FilterType = Field(
|
||||
default=FilterType.KEYWORD,
|
||||
description="What the 'keywords' values match against: 'keyword' (OpenAlex "
|
||||
"keyword display names) or 'topic' (OpenAlex topic ids). Defaults to 'keyword'.",
|
||||
fuzzy: bool = Field(
|
||||
default=False,
|
||||
description="How the 'keywords' values are matched: True means they are "
|
||||
"OpenAlex topic ids matched against the work's topics, False means they are "
|
||||
"raw keywords matched as phrases in the work's title, abstract, keywords and "
|
||||
"topic names. Defaults to False.",
|
||||
)
|
||||
publication_types: list[PublicationType] = Field(
|
||||
default_factory=list,
|
||||
@@ -175,13 +174,6 @@ class SelectedAuthorsRequest(BaseModel):
|
||||
return value.lower()
|
||||
return value
|
||||
|
||||
@field_validator("filter_type", mode="before")
|
||||
@classmethod
|
||||
def filter_type_case_insensitive(cls, value):
|
||||
if isinstance(value, str):
|
||||
return value.lower()
|
||||
return value
|
||||
|
||||
|
||||
class AuthorMetricsRequest(BaseModel):
|
||||
author_ids: list[str] = Field(
|
||||
@@ -204,10 +196,12 @@ class PublicationTypeCountsRequest(BaseModel):
|
||||
default=KeywordOperator.AND,
|
||||
description="How to combine the keywords: 'and' or 'or'. Defaults to 'and'.",
|
||||
)
|
||||
filter_type: FilterType = Field(
|
||||
default=FilterType.KEYWORD,
|
||||
description="What the 'keywords' values match against: 'keyword' (OpenAlex "
|
||||
"keyword display names) or 'topic' (OpenAlex topic display names). Defaults to 'keyword'.",
|
||||
fuzzy: bool = Field(
|
||||
default=False,
|
||||
description="How the 'keywords' values are matched: True means they are "
|
||||
"OpenAlex topic ids matched against the work's topics, False means they are "
|
||||
"raw keywords matched as phrases in the work's title, abstract, keywords and "
|
||||
"topic names. Defaults to False.",
|
||||
)
|
||||
career_stages: list[CareerStage] = Field(
|
||||
default_factory=list,
|
||||
@@ -218,7 +212,7 @@ class PublicationTypeCountsRequest(BaseModel):
|
||||
description="Optional filter: only count works whose publication_year is within [from, to].",
|
||||
)
|
||||
|
||||
@field_validator("operator", "filter_type", mode="before")
|
||||
@field_validator("operator", mode="before")
|
||||
@classmethod
|
||||
def operator_case_insensitive(cls, value):
|
||||
if isinstance(value, str):
|
||||
@@ -290,15 +284,6 @@ class AuthorTopicStats(BaseModel):
|
||||
default=None,
|
||||
description="Latest publication year among the author's topic works.",
|
||||
)
|
||||
relevance_above_80_count: int = Field(
|
||||
default=0,
|
||||
description="Number of the author's topic works where the matched keyword's "
|
||||
"relevance score is above 0.8.",
|
||||
)
|
||||
avg_relevance: float = Field(
|
||||
default=0.0,
|
||||
description="Average matched-keyword relevance score (0-1) over the author's topic works.",
|
||||
)
|
||||
first_author_count: int = Field(
|
||||
default=0,
|
||||
description="Number of the author's topic works where they are the first author.",
|
||||
@@ -355,7 +340,7 @@ class AuthorTopicProfile(BaseModel):
|
||||
)
|
||||
primary_topic_matches: int = Field(
|
||||
description="Matched works where one of the searched topics is the work's "
|
||||
"primary topic (only meaningful for filter_type 'topic').",
|
||||
"primary topic.",
|
||||
)
|
||||
distinct_topics: int = Field(
|
||||
description="Number of distinct primary topics across all works.",
|
||||
|
||||
@@ -48,11 +48,11 @@ async def rank_author(
|
||||
)
|
||||
|
||||
logger.info(
|
||||
"rank-author keywords=%s operator=%s filter_type=%s institution_id=%s career_stages=%s "
|
||||
"rank-author keywords=%s operator=%s fuzzy=%s institution_id=%s career_stages=%s "
|
||||
"publication_types=%s timespan=%s",
|
||||
request.keywords,
|
||||
request.operator,
|
||||
request.filter_type,
|
||||
request.fuzzy,
|
||||
institution_id,
|
||||
request.career_stages,
|
||||
request.publication_types,
|
||||
@@ -67,7 +67,7 @@ async def rank_author(
|
||||
publication_types=request.publication_types,
|
||||
timespan=request.timespan,
|
||||
company_status=request.company_status,
|
||||
filter_type=request.filter_type,
|
||||
fuzzy=request.fuzzy,
|
||||
)
|
||||
|
||||
# Publication-type facet counts for the "Art der Work" filter
|
||||
@@ -86,11 +86,11 @@ async def publication_type_counts(
|
||||
)
|
||||
|
||||
logger.info(
|
||||
"publication-type-counts keywords=%s operator=%s filter_type=%s institution_id=%s "
|
||||
"publication-type-counts keywords=%s operator=%s fuzzy=%s institution_id=%s "
|
||||
"career_stages=%s timespan=%s",
|
||||
request.keywords,
|
||||
request.operator,
|
||||
request.filter_type,
|
||||
request.fuzzy,
|
||||
institution_id,
|
||||
request.career_stages,
|
||||
request.timespan,
|
||||
@@ -101,18 +101,18 @@ async def publication_type_counts(
|
||||
institution_id=institution_id,
|
||||
career_stages=request.career_stages,
|
||||
timespan=request.timespan,
|
||||
filter_type=request.filter_type,
|
||||
fuzzy=request.fuzzy,
|
||||
)
|
||||
|
||||
# Compare authors table 1 (topic stats)
|
||||
@router.post("/topic-stats", response_model=list[AuthorTopicStats])
|
||||
async def topic_stats(request: SelectedAuthorsRequest):
|
||||
logger.info(
|
||||
"topic-stats author_ids=%s keywords=%s operator=%s filter_type=%s publication_types=%s timespan=%s",
|
||||
"topic-stats author_ids=%s keywords=%s operator=%s fuzzy=%s publication_types=%s timespan=%s",
|
||||
request.author_ids,
|
||||
request.keywords,
|
||||
request.operator,
|
||||
request.filter_type,
|
||||
request.fuzzy,
|
||||
request.publication_types,
|
||||
request.timespan,
|
||||
)
|
||||
@@ -122,19 +122,19 @@ async def topic_stats(request: SelectedAuthorsRequest):
|
||||
request.operator,
|
||||
request.publication_types,
|
||||
request.timespan,
|
||||
request.filter_type,
|
||||
request.fuzzy,
|
||||
)
|
||||
|
||||
# Compare authors section 3 (topic profile over ALL works of each author)
|
||||
@router.post("/topic-profile", response_model=list[AuthorTopicProfile])
|
||||
async def topic_profile(request: SelectedAuthorsRequest):
|
||||
logger.info(
|
||||
"topic-profile author_ids=%s keywords=%s operator=%s filter_type=%s "
|
||||
"topic-profile author_ids=%s keywords=%s operator=%s fuzzy=%s "
|
||||
"publication_types=%s timespan=%s",
|
||||
request.author_ids,
|
||||
request.keywords,
|
||||
request.operator,
|
||||
request.filter_type,
|
||||
request.fuzzy,
|
||||
request.publication_types,
|
||||
request.timespan,
|
||||
)
|
||||
@@ -144,7 +144,7 @@ async def topic_profile(request: SelectedAuthorsRequest):
|
||||
request.operator,
|
||||
request.publication_types,
|
||||
request.timespan,
|
||||
request.filter_type,
|
||||
request.fuzzy,
|
||||
)
|
||||
|
||||
# Compare authors table 2 (author-level stats, keyword/time-independent)
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
import re
|
||||
|
||||
SNIPPET_FRAGMENT_CHARS = 500
|
||||
SNIPPET_FRAGMENT_COUNT = 3
|
||||
SNIPPET_FRAGMENT_SEPARATOR = " … "
|
||||
|
||||
SNIPPET_CONTEXT_BEFORE_CHARS = 400
|
||||
SNIPPET_CONTEXT_AFTER_CHARS = 1100
|
||||
SNIPPET_BOUNDARY_CHARS = 150
|
||||
SNIPPET_ELLIPSIS = "…"
|
||||
|
||||
_EM_TAG = re.compile(r"<em>(.*?)</em>", re.DOTALL)
|
||||
|
||||
_SENTENCE_BREAK = re.compile(r"(?<![0-9]\.)(?<=[.!?])\s+|\n+")
|
||||
|
||||
FRAGMENT_FIELD = {
|
||||
"fragment_size": SNIPPET_FRAGMENT_CHARS,
|
||||
"number_of_fragments": SNIPPET_FRAGMENT_COUNT,
|
||||
}
|
||||
|
||||
WHOLE_FIELD = {"number_of_fragments": 0}
|
||||
|
||||
HIGHLIGHT_TAGS = {"pre_tags": ["<em>"], "post_tags": ["</em>"]}
|
||||
|
||||
|
||||
def snippet_with_context(text: str | None, fragments: list) -> str:
|
||||
joined = SNIPPET_FRAGMENT_SEPARATOR.join(fragments)
|
||||
terms = marked_terms(joined)
|
||||
|
||||
if not text or not terms:
|
||||
return joined
|
||||
|
||||
span = _first_term_span(text, terms)
|
||||
if span is None:
|
||||
return joined
|
||||
|
||||
start, end = _window_bounds(text, *span)
|
||||
window = _mark_terms(text[start:end], terms)
|
||||
|
||||
if start > 0:
|
||||
window = f"{SNIPPET_ELLIPSIS} {window}"
|
||||
if end < len(text):
|
||||
window = f"{window} {SNIPPET_ELLIPSIS}"
|
||||
|
||||
return window
|
||||
|
||||
|
||||
def marked_terms(fragment_text: str) -> list:
|
||||
by_key: dict[str, str] = {}
|
||||
for match in _EM_TAG.finditer(fragment_text):
|
||||
term = match.group(1).strip()
|
||||
if term:
|
||||
by_key.setdefault(term.lower(), term)
|
||||
return list(by_key.values())
|
||||
|
||||
|
||||
def _first_term_span(text: str, terms: list) -> tuple | None:
|
||||
lowered = text.lower()
|
||||
spans = [
|
||||
(index, index + len(term))
|
||||
for term, index in ((term, lowered.find(term.lower())) for term in terms)
|
||||
if index >= 0
|
||||
]
|
||||
return min(spans) if spans else None
|
||||
|
||||
|
||||
def _window_bounds(text: str, match_start: int, match_end: int) -> tuple:
|
||||
start = max(0, match_start - SNIPPET_CONTEXT_BEFORE_CHARS)
|
||||
end = min(len(text), match_end + SNIPPET_CONTEXT_AFTER_CHARS)
|
||||
|
||||
if start > 0:
|
||||
start = _forward_to_boundary(text, start, match_start)
|
||||
if end < len(text):
|
||||
end = _back_to_boundary(text, end, match_end)
|
||||
|
||||
return start, end
|
||||
|
||||
|
||||
def _forward_to_boundary(text: str, start: int, limit: int) -> int:
|
||||
|
||||
ahead = _SENTENCE_BREAK.search(text, start, min(limit, start + SNIPPET_BOUNDARY_CHARS))
|
||||
if ahead:
|
||||
return ahead.end()
|
||||
|
||||
behind_from = max(0, start - SNIPPET_BOUNDARY_CHARS)
|
||||
behind = list(_SENTENCE_BREAK.finditer(text, behind_from, start))
|
||||
if behind:
|
||||
return behind[-1].end()
|
||||
|
||||
if behind_from == 0:
|
||||
return 0
|
||||
|
||||
space = text.find(" ", start, start + SNIPPET_BOUNDARY_CHARS)
|
||||
return space + 1 if space >= 0 else start
|
||||
|
||||
|
||||
def _back_to_boundary(text: str, end: int, floor: int) -> int:
|
||||
|
||||
sentence = _SENTENCE_BREAK.search(text, end, end + SNIPPET_BOUNDARY_CHARS)
|
||||
if sentence:
|
||||
return sentence.start()
|
||||
|
||||
space = text.rfind(" ", floor, end)
|
||||
return space if space > floor else end
|
||||
|
||||
|
||||
def _mark_terms(window: str, terms: list) -> str:
|
||||
lowered = window.lower()
|
||||
spans = sorted(
|
||||
(index, index + len(term))
|
||||
for term, index in ((term, lowered.find(term.lower())) for term in terms)
|
||||
if index >= 0
|
||||
)
|
||||
|
||||
marked = []
|
||||
cursor = 0
|
||||
for start, end in spans:
|
||||
if start < cursor:
|
||||
continue
|
||||
marked.append(window[cursor:start])
|
||||
marked.append(f"<em>{window[start:end]}</em>")
|
||||
cursor = end
|
||||
marked.append(window[cursor:])
|
||||
|
||||
return "".join(marked)
|
||||
@@ -6,6 +6,12 @@ from inse.exceptions import ElasticsearchNotFoundException, NotFoundException
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.model import ESCluster, ESIndex, SortDirection
|
||||
from inse.models.openalex.work import Work
|
||||
from inse.snippets import (
|
||||
FRAGMENT_FIELD,
|
||||
HIGHLIGHT_TAGS,
|
||||
WHOLE_FIELD,
|
||||
snippet_with_context,
|
||||
)
|
||||
from inse.works.v2.model import (
|
||||
PrimaryCategoryYearAggregation,
|
||||
PrimaryCategoryYearAggregationPage,
|
||||
@@ -372,6 +378,17 @@ async def get_works_by_keywords(
|
||||
track_total_hits=True,
|
||||
offset=page * size,
|
||||
sort=sort,
|
||||
# A work matches on its topic and keyword metadata as well as on its
|
||||
# text, so roughly half the hits contain the searched keyword nowhere in
|
||||
# title or abstract. Highlighting tells the two apart: a fragment comes
|
||||
# back only for the works that really do carry the phrase.
|
||||
highlight={
|
||||
"fields": {
|
||||
"title": WHOLE_FIELD,
|
||||
"abstract": FRAGMENT_FIELD,
|
||||
},
|
||||
**HIGHLIGHT_TAGS,
|
||||
},
|
||||
cluster=ESCluster.NES,
|
||||
)
|
||||
print(f"Elasticsearch response: {response}")
|
||||
@@ -388,11 +405,67 @@ async def get_works_by_keywords(
|
||||
|
||||
work = Work.from_dict(source) # type: ignore
|
||||
if work is not None:
|
||||
snippet, snippet_field = _keyword_snippet(hit)
|
||||
work.snippet = snippet
|
||||
work.snippet_field = snippet_field
|
||||
work.matched_via = _matched_via(source, keywords)
|
||||
elements.append(work)
|
||||
|
||||
return WorkPageV2(elements=elements, total=total, page=page, size=size)
|
||||
|
||||
|
||||
def _keyword_snippet(hit: dict) -> tuple[str | None, str | None]:
|
||||
"""Picks the passage to show for a hit, preferring the title over the abstract."""
|
||||
highlight = hit.get("highlight") or {}
|
||||
|
||||
title_fragments = highlight.get("title")
|
||||
if title_fragments:
|
||||
return title_fragments[0], "title"
|
||||
|
||||
abstract_fragments = highlight.get("abstract")
|
||||
if abstract_fragments:
|
||||
abstract = (hit.get("_source") or {}).get("abstract")
|
||||
return snippet_with_context(abstract, abstract_fragments), "abstract"
|
||||
|
||||
return None, None
|
||||
|
||||
|
||||
def _matched_via(source: dict, keywords: list[str] | None) -> list[str] | None:
|
||||
"""Names the topics and keywords a work was matched through.
|
||||
|
||||
Only needed when there is no snippet: those works carry the searched term in
|
||||
their metadata rather than in their text, and would otherwise expand into an
|
||||
empty row. Matching mirrors the `match_phrase` clauses above closely enough
|
||||
for a label - it is not used for retrieval.
|
||||
"""
|
||||
wanted = [kw.strip().lower() for kw in (keywords or []) if kw and kw.strip()]
|
||||
if not wanted:
|
||||
return None
|
||||
|
||||
candidates: list[str] = []
|
||||
|
||||
primary_topic = source.get("primary_topic") or {}
|
||||
candidates.append(primary_topic.get("display_name"))
|
||||
|
||||
for topic in source.get("topics") or []:
|
||||
candidates.append(topic.get("display_name"))
|
||||
for level in ("field", "subfield", "domain"):
|
||||
candidates.append((topic.get(level) or {}).get("display_name"))
|
||||
|
||||
for keyword in source.get("keywords") or []:
|
||||
candidates.append(keyword.get("display_name"))
|
||||
|
||||
names: list[str] = []
|
||||
for name in candidates:
|
||||
if not name or name in names:
|
||||
continue
|
||||
lowered = name.lower()
|
||||
if any(kw in lowered for kw in wanted):
|
||||
names.append(name)
|
||||
|
||||
return names or None
|
||||
|
||||
|
||||
async def get_author_works(
|
||||
raw_oa_author_id: str,
|
||||
page: int,
|
||||
|
||||
@@ -138,7 +138,6 @@ model/extractedKeywordsLLM.ts
|
||||
model/extractedKeywordsResponse.ts
|
||||
model/fieldNode.ts
|
||||
model/fileUpload.ts
|
||||
model/filterType.ts
|
||||
model/fp7EurosciVoc.ts
|
||||
model/fp7LegalBasis.ts
|
||||
model/fp7Organization.ts
|
||||
|
||||
@@ -563,6 +563,7 @@ export class NewsService extends BaseService {
|
||||
* @param yearFrom Earliest publication year (inclusive).
|
||||
* @param yearTo Latest publication year (inclusive).
|
||||
* @param sortOrder Overrides relevance ranking with a date sort: \'desc\' (newest first) or \'asc\' (oldest first).
|
||||
* @param title Narrows the results to articles whose title matches this text.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
@@ -577,6 +578,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -596,6 +598,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -615,6 +618,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -634,6 +638,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -705,6 +710,11 @@ export class NewsService extends BaseService {
|
||||
<any>sortOrder,
|
||||
'sortOrder',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>title,
|
||||
'title',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -769,6 +779,7 @@ export class NewsService extends BaseService {
|
||||
* @param yearFrom Earliest publication year (inclusive).
|
||||
* @param yearTo Latest publication year (inclusive).
|
||||
* @param sortOrder Overrides relevance ranking with a date sort: \'desc\' (newest first) or \'asc\' (oldest first).
|
||||
* @param title Narrows the results to articles whose title matches this text.
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
@@ -783,6 +794,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -802,6 +814,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -821,6 +834,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -840,6 +854,7 @@ export class NewsService extends BaseService {
|
||||
yearFrom?: number,
|
||||
yearTo?: number,
|
||||
sortOrder?: string,
|
||||
title?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -911,6 +926,11 @@ export class NewsService extends BaseService {
|
||||
<any>sortOrder,
|
||||
'sortOrder',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>title,
|
||||
'title',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
|
||||
@@ -52,13 +52,11 @@ export class PersonsService extends BaseService {
|
||||
* Generates a bio for a person by author ID.
|
||||
* @endpoint get /api/inse-service/persons/bio
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
* @param include Comma-separated list to include tags
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public generatePersonBio(
|
||||
authorId: string,
|
||||
include?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -69,7 +67,6 @@ export class PersonsService extends BaseService {
|
||||
): Observable<PersonBio>;
|
||||
public generatePersonBio(
|
||||
authorId: string,
|
||||
include?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -80,7 +77,6 @@ export class PersonsService extends BaseService {
|
||||
): Observable<HttpResponse<PersonBio>>;
|
||||
public generatePersonBio(
|
||||
authorId: string,
|
||||
include?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -91,7 +87,6 @@ export class PersonsService extends BaseService {
|
||||
): Observable<HttpEvent<PersonBio>>;
|
||||
public generatePersonBio(
|
||||
authorId: string,
|
||||
include?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -112,11 +107,6 @@ export class PersonsService extends BaseService {
|
||||
<any>authorId,
|
||||
'author_id',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>include,
|
||||
'include',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -403,14 +393,12 @@ export class PersonsService extends BaseService {
|
||||
* @endpoint get /api/inse-service/persons/search
|
||||
* @param authorId OpenAlex author ID (e.g., A5093075883)
|
||||
* @param query Search query (e.g., Arman AND Arzani)
|
||||
* @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public searchPersons(
|
||||
authorId?: string,
|
||||
query?: string,
|
||||
include?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -422,7 +410,6 @@ export class PersonsService extends BaseService {
|
||||
public searchPersons(
|
||||
authorId?: string,
|
||||
query?: string,
|
||||
include?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -434,7 +421,6 @@ export class PersonsService extends BaseService {
|
||||
public searchPersons(
|
||||
authorId?: string,
|
||||
query?: string,
|
||||
include?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
@@ -446,7 +432,6 @@ export class PersonsService extends BaseService {
|
||||
public searchPersons(
|
||||
authorId?: string,
|
||||
query?: string,
|
||||
include?: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
@@ -466,11 +451,6 @@ export class PersonsService extends BaseService {
|
||||
<any>query,
|
||||
'query',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>include,
|
||||
'include',
|
||||
);
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ export interface AuthorTopicProfile {
|
||||
*/
|
||||
matched_works: number;
|
||||
/**
|
||||
* Matched works where one of the searched topics is the work\'s primary topic (only meaningful for filter_type \'topic\').
|
||||
* Matched works where one of the searched topics is the work\'s primary topic.
|
||||
*/
|
||||
primary_topic_matches: number;
|
||||
/**
|
||||
|
||||
@@ -70,14 +70,6 @@ export interface AuthorTopicStats {
|
||||
industry_works_count?: number;
|
||||
first_year?: number | null;
|
||||
last_year?: number | null;
|
||||
/**
|
||||
* Number of the author\'s topic works where the matched keyword\'s relevance score is above 0.8.
|
||||
*/
|
||||
relevance_above_80_count?: number;
|
||||
/**
|
||||
* Average matched-keyword relevance score (0-1) over the author\'s topic works.
|
||||
*/
|
||||
avg_relevance?: number;
|
||||
/**
|
||||
* Number of the author\'s topic works where they are the first author.
|
||||
*/
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export const FilterType = {
|
||||
Keyword: 'keyword',
|
||||
Topic: 'topic'
|
||||
} as const;
|
||||
export type FilterType = typeof FilterType[keyof typeof FilterType];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -11,31 +11,31 @@ import { InstitutionIds } from './institutionIds';
|
||||
import { AuthorCountsByYearInner } from './authorCountsByYearInner';
|
||||
import { AuthorSummaryStats } from './authorSummaryStats';
|
||||
import { InstitutionGeo } from './institutionGeo';
|
||||
|
||||
import { DehydratedInstitution } from './dehydratedInstitution';
|
||||
|
||||
/**
|
||||
* A university, research organization, or other affiliation
|
||||
*/
|
||||
export interface Institution {
|
||||
id?: string | null;
|
||||
ror?: string | null;
|
||||
display_name?: string | null;
|
||||
country_code?: string | null;
|
||||
type?: string | null;
|
||||
homepage_url?: string | null;
|
||||
image_url?: string | null;
|
||||
image_thumbnail_url?: string | null;
|
||||
display_name_acronyms?: Array<string> | null;
|
||||
display_name_alternatives?: Array<string> | null;
|
||||
works_count?: number | null;
|
||||
cited_by_count?: number | null;
|
||||
summary_stats?: AuthorSummaryStats | null;
|
||||
geo?: InstitutionGeo | null;
|
||||
lineage?: Array<string> | null;
|
||||
ids?: InstitutionIds | null;
|
||||
counts_by_year?: Array<AuthorCountsByYearInner> | null;
|
||||
works_api_url?: string | null;
|
||||
created_date?: string | null;
|
||||
updated_date?: string | null;
|
||||
export interface Institution {
|
||||
id?: string | null;
|
||||
ror?: string | null;
|
||||
display_name?: string | null;
|
||||
country_code?: string | null;
|
||||
type?: string | null;
|
||||
homepage_url?: string | null;
|
||||
image_url?: string | null;
|
||||
image_thumbnail_url?: string | null;
|
||||
display_name_acronyms?: Array<string> | null;
|
||||
display_name_alternatives?: Array<string> | null;
|
||||
works_count?: number | null;
|
||||
cited_by_count?: number | null;
|
||||
summary_stats?: AuthorSummaryStats | null;
|
||||
geo?: InstitutionGeo | null;
|
||||
lineage?: Array<string> | null;
|
||||
ids?: InstitutionIds | null;
|
||||
counts_by_year?: Array<AuthorCountsByYearInner> | null;
|
||||
works_api_url?: string | null;
|
||||
associated_institutions?: Array<DehydratedInstitution> | null;
|
||||
created_date?: string | null;
|
||||
updated_date?: string | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Timespan } from './timespan';
|
||||
import { FilterType } from './filterType';
|
||||
import { CareerStage } from './careerStage';
|
||||
import { KeywordOperator } from './keywordOperator';
|
||||
import { PublicationType } from './publicationType';
|
||||
@@ -25,9 +24,9 @@ export interface KeywordToAuthorRequest {
|
||||
*/
|
||||
operator?: KeywordOperator;
|
||||
/**
|
||||
* What the \'keywords\' values match against: \'keyword\' (OpenAlex keyword display names) or \'topic\' (OpenAlex topic display names). Defaults to \'keyword\'.
|
||||
* How the \'keywords\' values are matched: True means they are OpenAlex topic ids matched against the work\'s topics, False means they are raw keywords matched as phrases in the work\'s title, abstract, keywords and topic names. Defaults to False.
|
||||
*/
|
||||
filter_type?: FilterType;
|
||||
fuzzy?: boolean;
|
||||
/**
|
||||
* Weights for the ranking metrics. Required.
|
||||
*/
|
||||
|
||||
@@ -104,7 +104,6 @@ export * from './extractedKeywordsLLM';
|
||||
export * from './extractedKeywordsResponse';
|
||||
export * from './fieldNode';
|
||||
export * from './fileUpload';
|
||||
export * from './filterType';
|
||||
export * from './fp7EurosciVoc';
|
||||
export * from './fp7LegalBasis';
|
||||
export * from './fp7Organization';
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Timespan } from './timespan';
|
||||
import { FilterType } from './filterType';
|
||||
import { CareerStage } from './careerStage';
|
||||
import { KeywordOperator } from './keywordOperator';
|
||||
|
||||
@@ -22,9 +21,9 @@ export interface PublicationTypeCountsRequest {
|
||||
*/
|
||||
operator?: KeywordOperator;
|
||||
/**
|
||||
* What the \'keywords\' values match against: \'keyword\' (OpenAlex keyword display names) or \'topic\' (OpenAlex topic display names). Defaults to \'keyword\'.
|
||||
* How the \'keywords\' values are matched: True means they are OpenAlex topic ids matched against the work\'s topics, False means they are raw keywords matched as phrases in the work\'s title, abstract, keywords and topic names. Defaults to False.
|
||||
*/
|
||||
filter_type?: FilterType;
|
||||
fuzzy?: boolean;
|
||||
/**
|
||||
* Optional filter: only count works of authors in one of these career stages. Empty = no filter.
|
||||
*/
|
||||
|
||||
@@ -1,42 +1,37 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { Timespan } from './timespan';
|
||||
import { FilterType } from './filterType';
|
||||
import { KeywordOperator } from './keywordOperator';
|
||||
import { PublicationType } from './publicationType';
|
||||
|
||||
|
||||
export interface SelectedAuthorsRequest {
|
||||
/**
|
||||
* OpenAlex IDs of the authors to rank.
|
||||
*/
|
||||
author_ids: Array<string>;
|
||||
/**
|
||||
* One or more keywords defining the topic.
|
||||
*/
|
||||
keywords: Array<string>;
|
||||
/**
|
||||
* How to combine the keywords: \'and\' or \'or\'. Defaults to \'and\'.
|
||||
*/
|
||||
operator?: KeywordOperator;
|
||||
/**
|
||||
* What the \'keywords\' values match against: \'keyword\' (OpenAlex keyword display names) or \'topic\' (OpenAlex topic ids). Defaults to \'keyword\'.
|
||||
*/
|
||||
filter_type?: FilterType;
|
||||
/**
|
||||
* Optional filter: only count works of these publication types. Empty = no filter.
|
||||
*/
|
||||
publication_types?: Array<PublicationType>;
|
||||
timespan?: Timespan | null;
|
||||
export interface SelectedAuthorsRequest {
|
||||
/**
|
||||
* OpenAlex IDs of the authors to rank.
|
||||
*/
|
||||
author_ids: Array<string>;
|
||||
/**
|
||||
* One or more keywords defining the topic.
|
||||
*/
|
||||
keywords: Array<string>;
|
||||
/**
|
||||
* How to combine the keywords: \'and\' or \'or\'. Defaults to \'and\'.
|
||||
*/
|
||||
operator?: KeywordOperator;
|
||||
/**
|
||||
* How the \'keywords\' values are matched: True means they are OpenAlex topic ids matched against the work\'s topics, False means they are raw keywords matched as phrases in the work\'s title, abstract, keywords and topic names. Defaults to False.
|
||||
*/
|
||||
fuzzy?: boolean;
|
||||
/**
|
||||
* Optional filter: only count works of these publication types. Empty = no filter.
|
||||
*/
|
||||
publication_types?: Array<PublicationType>;
|
||||
timespan?: Timespan | null;
|
||||
}
|
||||
export namespace SelectedAuthorsRequest {
|
||||
}
|
||||
|
||||
|
||||
export namespace SelectedAuthorsRequest {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -24,48 +24,49 @@ import { WorkHasContent } from './workHasContent';
|
||||
import { Location } from './location';
|
||||
import { WorkBiblio } from './workBiblio';
|
||||
|
||||
|
||||
/**
|
||||
* A scholarly document (article, book, dataset, thesis, etc.)
|
||||
*/
|
||||
export interface Work {
|
||||
id?: string | null;
|
||||
doi?: string | null;
|
||||
title?: string | null;
|
||||
display_name?: string | null;
|
||||
publication_year?: number | null;
|
||||
publication_date?: string | null;
|
||||
type?: string | null;
|
||||
language?: string | null;
|
||||
cited_by_count?: number | null;
|
||||
is_retracted?: boolean | null;
|
||||
is_paratext?: boolean | null;
|
||||
primary_location?: Location | null;
|
||||
locations?: Array<Location> | null;
|
||||
best_oa_location?: Location | null;
|
||||
open_access?: OpenAccess | null;
|
||||
authorships?: Array<Authorship> | null;
|
||||
ids?: WorkIds | null;
|
||||
biblio?: WorkBiblio | null;
|
||||
abstract_inverted_index?: object | null;
|
||||
referenced_works?: Array<string> | null;
|
||||
referenced_works_count?: number | null;
|
||||
related_works?: Array<string> | null;
|
||||
topics?: Array<WorkTopic> | null;
|
||||
primary_topic?: WorkTopic | null;
|
||||
keywords?: Array<WorkKeyword> | null;
|
||||
funders?: Array<DehydratedFunder> | null;
|
||||
awards?: Array<Award> | null;
|
||||
fwci?: Fwci | null;
|
||||
citation_normalized_percentile?: WorkCitationNormalizedPercentile | null;
|
||||
cited_by_percentile_year?: WorkCitedByPercentileYear | null;
|
||||
counts_by_year?: Array<WorkCountsByYearInner> | null;
|
||||
sustainable_development_goals?: Array<WorkSustainableDevelopmentGoalsInner> | null;
|
||||
mesh?: Array<WorkMeshInner> | null;
|
||||
indexed_in?: Array<string> | null;
|
||||
has_content?: WorkHasContent | null;
|
||||
content_url?: string | null;
|
||||
created_date?: string | null;
|
||||
updated_date?: string | null;
|
||||
export interface Work {
|
||||
id?: string | null;
|
||||
doi?: string | null;
|
||||
title?: string | null;
|
||||
display_name?: string | null;
|
||||
publication_year?: number | null;
|
||||
publication_date?: string | null;
|
||||
type?: string | null;
|
||||
language?: string | null;
|
||||
cited_by_count?: number | null;
|
||||
is_retracted?: boolean | null;
|
||||
is_paratext?: boolean | null;
|
||||
primary_location?: Location | null;
|
||||
locations?: Array<Location> | null;
|
||||
best_oa_location?: Location | null;
|
||||
open_access?: OpenAccess | null;
|
||||
authorships?: Array<Authorship> | null;
|
||||
ids?: WorkIds | null;
|
||||
biblio?: WorkBiblio | null;
|
||||
abstract_inverted_index?: object | null;
|
||||
referenced_works?: Array<string> | null;
|
||||
referenced_works_count?: number | null;
|
||||
related_works?: Array<string> | null;
|
||||
topics?: Array<WorkTopic> | null;
|
||||
primary_topic?: WorkTopic | null;
|
||||
keywords?: Array<WorkKeyword> | null;
|
||||
funders?: Array<DehydratedFunder> | null;
|
||||
awards?: Array<Award> | null;
|
||||
fwci?: Fwci | null;
|
||||
citation_normalized_percentile?: WorkCitationNormalizedPercentile | null;
|
||||
cited_by_percentile_year?: WorkCitedByPercentileYear | null;
|
||||
counts_by_year?: Array<WorkCountsByYearInner> | null;
|
||||
sustainable_development_goals?: Array<WorkSustainableDevelopmentGoalsInner> | null;
|
||||
mesh?: Array<WorkMeshInner> | null;
|
||||
indexed_in?: Array<string> | null;
|
||||
has_content?: WorkHasContent | null;
|
||||
content_url?: string | null;
|
||||
created_date?: string | null;
|
||||
updated_date?: string | null;
|
||||
snippet?: string | null;
|
||||
snippet_field?: string | null;
|
||||
matched_via?: Array<string> | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,13 @@ export const routes: Routes = [
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'dashboard',
|
||||
},
|
||||
{
|
||||
path: 'icons',
|
||||
loadComponent: () =>
|
||||
import('./modules/icon-preview/icon-preview.component').then(
|
||||
(mod) => mod.IconPreviewComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
loadComponent: () =>
|
||||
|
||||
@@ -220,12 +220,6 @@ app-chip mat-icon {
|
||||
&.pos-last {
|
||||
color: var(--sg-primary);
|
||||
}
|
||||
&.rel-count {
|
||||
color: var(--sg-blue-highlight);
|
||||
}
|
||||
&.rel-avg {
|
||||
color: var(--sg-blue-highlight);
|
||||
}
|
||||
&.cit-total {
|
||||
color: var(--sg-error);
|
||||
}
|
||||
|
||||
@@ -66,9 +66,6 @@ interface AuthorSummary {
|
||||
// active years within the topic
|
||||
firstYear: number | null;
|
||||
lastYear: number | null;
|
||||
// topic-relevance (matched keyword score)
|
||||
relevanceAbove80: number | null;
|
||||
avgRelevance: number | null;
|
||||
// author-position split (first / middle / last)
|
||||
firstAuthor: number | null;
|
||||
middleAuthor: number | null;
|
||||
@@ -227,8 +224,6 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
: null,
|
||||
firstYear: t?.first_year ?? null,
|
||||
lastYear: t?.last_year ?? null,
|
||||
relevanceAbove80: t?.relevance_above_80_count ?? null,
|
||||
avgRelevance: t?.avg_relevance ?? null,
|
||||
firstAuthor: t?.first_author_count ?? null,
|
||||
middleAuthor: t?.middle_author_count ?? null,
|
||||
lastAuthor: t?.last_author_count ?? null,
|
||||
@@ -319,23 +314,6 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
},
|
||||
],
|
||||
),
|
||||
this.buildGroupRow(
|
||||
'Themen-Relevanz',
|
||||
'Match-Score der Keywords: Werke > 80% | Ø über alle',
|
||||
[
|
||||
{
|
||||
label: '> 80%',
|
||||
colorClass: 'rel-count',
|
||||
select: (a) => a.relevanceAbove80,
|
||||
},
|
||||
{
|
||||
label: 'Ø',
|
||||
colorClass: 'rel-avg',
|
||||
decimals: true,
|
||||
select: (a) => a.avgRelevance,
|
||||
},
|
||||
],
|
||||
),
|
||||
this.buildGroupRow(
|
||||
'Autor-Position',
|
||||
'Werke nach Position (Erst | Mittel | Letzt)',
|
||||
@@ -765,6 +743,8 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
const rawAuthors = this.route.snapshot.queryParamMap.get('authors') ?? '';
|
||||
const rawKeywords = this.route.snapshot.queryParamMap.get('keywords') ?? '';
|
||||
const rawOperator = this.route.snapshot.queryParamMap.get('operator');
|
||||
const rawTopics = this.route.snapshot.queryParamMap.get('topics') ?? '';
|
||||
const fuzzy = this.route.snapshot.queryParamMap.get('fuzzy') === 'true';
|
||||
const rawPubType = this.route.snapshot.queryParamMap.get('pubType');
|
||||
const rawTFrom = this.route.snapshot.queryParamMap.get('tFrom');
|
||||
const rawTTo = this.route.snapshot.queryParamMap.get('tTo');
|
||||
@@ -793,11 +773,13 @@ export class CompareAuthorsComponent implements OnInit {
|
||||
const fullIds = authorIds.map((id) => `https://openalex.org/${id}`);
|
||||
this.authorIds.set(fullIds);
|
||||
|
||||
// same two match modes as the persons list: topic ids when fuzzy, raw keywords otherwise
|
||||
const topicIds = this.parseList(rawTopics);
|
||||
const request: SelectedAuthorsRequest = {
|
||||
author_ids: fullIds,
|
||||
keywords: keywords,
|
||||
keywords: fuzzy && topicIds.length > 0 ? topicIds : keywords,
|
||||
operator: operator,
|
||||
filter_type: 'topic',
|
||||
fuzzy: fuzzy && topicIds.length > 0,
|
||||
publication_types: publication_types,
|
||||
timespan: timespan,
|
||||
};
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
[disabled]="!canScrollAnalyticalInstitutionTabsLeft"
|
||||
aria-label="Vorherige Institutionen anzeigen"
|
||||
(click)="scrollAnalyticalInstitutionTabs(-1)">
|
||||
<mat-icon>chevron_left</mat-icon>
|
||||
<mat-icon>{{ CHEVRON_LEFT_ICON }}</mat-icon>
|
||||
</button>
|
||||
<div
|
||||
#analyticalInstitutionTabList
|
||||
@@ -232,7 +232,7 @@
|
||||
[disabled]="!canScrollAnalyticalInstitutionTabsRight"
|
||||
aria-label="Weitere Institutionen anzeigen"
|
||||
(click)="scrollAnalyticalInstitutionTabs(1)">
|
||||
<mat-icon>chevron_right</mat-icon>
|
||||
<mat-icon>{{ CHEVRON_RIGHT_ICON }}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
@if (dashboardInstitutionsError) {
|
||||
@@ -243,334 +243,334 @@
|
||||
</section>
|
||||
|
||||
@if (selectedAnalyticalInstitutionId) {
|
||||
@if (
|
||||
euProjectStatusesLoading ||
|
||||
bmbfProjectStatusesLoading ||
|
||||
dfgProjectStatusesLoading ||
|
||||
euProjectStatusesError ||
|
||||
bmbfProjectStatusesError ||
|
||||
dfgProjectStatusesError ||
|
||||
(euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses)
|
||||
) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>Projektstatus nach Fördergeber</h2>
|
||||
<p>
|
||||
Laufende, kommende und abgeschlossene EU-, Bund- und DFG-Projekte
|
||||
Ihrer Organisation.
|
||||
</p>
|
||||
</div>
|
||||
@if (euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses) {
|
||||
<div class="project-status-summary">
|
||||
<span>
|
||||
EU:
|
||||
{{
|
||||
euProjectStatuses.ongoing +
|
||||
euProjectStatuses.upcoming +
|
||||
euProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
<span>
|
||||
Bund:
|
||||
{{
|
||||
bmbfProjectStatuses.ongoing +
|
||||
bmbfProjectStatuses.upcoming +
|
||||
bmbfProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
<span>
|
||||
DFG:
|
||||
{{
|
||||
dfgProjectStatuses.ongoing +
|
||||
dfgProjectStatuses.upcoming +
|
||||
dfgProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
@if (
|
||||
euProjectStatusesLoading ||
|
||||
bmbfProjectStatusesLoading ||
|
||||
dfgProjectStatusesLoading ||
|
||||
euProjectStatusesError ||
|
||||
bmbfProjectStatusesError ||
|
||||
dfgProjectStatusesError ||
|
||||
(euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses)
|
||||
) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>Projektstatus nach Fördergeber</h2>
|
||||
<p>
|
||||
Laufende, kommende und abgeschlossene EU-, Bund- und DFG-Projekte
|
||||
Ihrer Organisation.
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
</header>
|
||||
@if (euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses) {
|
||||
<div class="project-status-summary">
|
||||
<span>
|
||||
EU:
|
||||
{{
|
||||
euProjectStatuses.ongoing +
|
||||
euProjectStatuses.upcoming +
|
||||
euProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
<span>
|
||||
Bund:
|
||||
{{
|
||||
bmbfProjectStatuses.ongoing +
|
||||
bmbfProjectStatuses.upcoming +
|
||||
bmbfProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
<span>
|
||||
DFG:
|
||||
{{
|
||||
dfgProjectStatuses.ongoing +
|
||||
dfgProjectStatuses.upcoming +
|
||||
dfgProjectStatuses.completed | number
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</header>
|
||||
|
||||
@if (
|
||||
euProjectStatusesLoading ||
|
||||
bmbfProjectStatusesLoading ||
|
||||
dfgProjectStatusesLoading
|
||||
) {
|
||||
<div class="project-status-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="Projektstatus wird geladen …"
|
||||
[icon]="STACKED_BAR_CHART_ICON"
|
||||
size="64"
|
||||
diameter="64"></app-loading>
|
||||
</div>
|
||||
} @else if (
|
||||
euProjectStatusesError &&
|
||||
bmbfProjectStatusesError &&
|
||||
dfgProjectStatusesError
|
||||
) {
|
||||
<p class="statistics-error">
|
||||
Der Status der EU-, Bund- und DFG-Projekte konnte nicht geladen
|
||||
werden.
|
||||
</p>
|
||||
} @else if (
|
||||
euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses
|
||||
) {
|
||||
@if (
|
||||
euProjectStatusesError ||
|
||||
bmbfProjectStatusesError ||
|
||||
euProjectStatusesLoading ||
|
||||
bmbfProjectStatusesLoading ||
|
||||
dfgProjectStatusesLoading
|
||||
) {
|
||||
<div class="project-status-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="Projektstatus wird geladen …"
|
||||
[icon]="STACKED_BAR_CHART_ICON"
|
||||
size="64"
|
||||
diameter="64"></app-loading>
|
||||
</div>
|
||||
} @else if (
|
||||
euProjectStatusesError &&
|
||||
bmbfProjectStatusesError &&
|
||||
dfgProjectStatusesError
|
||||
) {
|
||||
<p class="statistics-error">
|
||||
Projektstatusdaten für {{ failedProjectStatusSources() }} konnten
|
||||
nicht geladen werden. Die übrigen Daten werden weiterhin
|
||||
angezeigt.
|
||||
Der Status der EU-, Bund- und DFG-Projekte konnte nicht geladen
|
||||
werden.
|
||||
</p>
|
||||
} @else if (
|
||||
euProjectStatuses && bmbfProjectStatuses && dfgProjectStatuses
|
||||
) {
|
||||
@if (
|
||||
euProjectStatusesError ||
|
||||
bmbfProjectStatusesError ||
|
||||
dfgProjectStatusesError
|
||||
) {
|
||||
<p class="statistics-error">
|
||||
Projektstatusdaten für {{ failedProjectStatusSources() }} konnten
|
||||
nicht geladen werden. Die übrigen Daten werden weiterhin
|
||||
angezeigt.
|
||||
</p>
|
||||
}
|
||||
<app-eu-project-status-chart
|
||||
[statuses]="euProjectStatuses"
|
||||
[bmbfStatuses]="bmbfProjectStatuses"
|
||||
[dfgStatuses]="dfgProjectStatuses"></app-eu-project-status-chart>
|
||||
}
|
||||
<app-eu-project-status-chart
|
||||
[statuses]="euProjectStatuses"
|
||||
[bmbfStatuses]="bmbfProjectStatuses"
|
||||
[dfgStatuses]="dfgProjectStatuses"></app-eu-project-status-chart>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (topicTreemapLoading || topicTreemapError || hasTopicTreemapData()) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>Field Treemap</h2>
|
||||
<p>Publikationen Ihrer Organisation nach Field.</p>
|
||||
</div>
|
||||
</header>
|
||||
@if (topicTreemapLoading || topicTreemapError || hasTopicTreemapData()) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>Field Treemap</h2>
|
||||
<p>Publikationen Ihrer Organisation nach Field.</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (topicTreemapLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="Treemap-Daten für den gewählten Zeitraum werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (topicTreemapError) {
|
||||
<p class="statistics-error">
|
||||
Die Field-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="topicTreemap"
|
||||
[selectedNodeId]="selectedTopicTreemapNode"
|
||||
(selectedNodeIdChange)="onTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (dfgTopicsLoading || dfgTopicsError || dfgProjectTopics) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>DFG-Projekt-Topics</h2>
|
||||
<p>
|
||||
Gematchte DFG-Projekte nach Field, Subfield und Topic. Ein Klick auf
|
||||
ein Topic zeigt die zugehörigen Keywords.
|
||||
</p>
|
||||
</div>
|
||||
@if (dfgProjectTopics) {
|
||||
<p class="dfg-topic-summary">
|
||||
{{ dfgProjectTopics.matched_project_count | number }} von
|
||||
{{ dfgProjectTopics.project_count | number }} Projekten gematcht
|
||||
@if (topicTreemapLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="Treemap-Daten für den gewählten Zeitraum werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (topicTreemapError) {
|
||||
<p class="statistics-error">
|
||||
Die Field-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="topicTreemap"
|
||||
[selectedNodeId]="selectedTopicTreemapNode"
|
||||
(selectedNodeIdChange)="onTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</header>
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (dfgTopicsLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="DFG-Topics werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (dfgTopicsError) {
|
||||
<p class="statistics-error">
|
||||
Die DFG-Topic-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="dfgTopicTreemap"
|
||||
[selectedNodeId]="selectedDfgTopicTreemapNode"
|
||||
countLabel="DFG-Projekte"
|
||||
[showCountInTooltip]="false"
|
||||
(selectedNodeIdChange)="onDfgTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onDfgTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@if (dfgTopicsLoading || dfgTopicsError || dfgProjectTopics) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>DFG-Projekt-Topics</h2>
|
||||
<p>
|
||||
Gematchte DFG-Projekte nach Field, Subfield und Topic. Ein Klick
|
||||
auf ein Topic zeigt die zugehörigen Keywords.
|
||||
</p>
|
||||
</div>
|
||||
@if (dfgProjectTopics) {
|
||||
<p class="dfg-topic-summary">
|
||||
{{ dfgProjectTopics.matched_project_count | number }} von
|
||||
{{ dfgProjectTopics.project_count | number }} Projekten gematcht
|
||||
</p>
|
||||
}
|
||||
</header>
|
||||
|
||||
@if (euTopicsLoading || euTopicsError || euProjectTopics) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>EU-Projekt-Topics</h2>
|
||||
<p>
|
||||
Gematchte EU-Projekte nach Field, Subfield und Topic. Ein Klick auf
|
||||
ein Topic zeigt die zugehörigen Keywords.
|
||||
</p>
|
||||
</div>
|
||||
@if (euProjectTopics) {
|
||||
<p class="dfg-topic-summary">
|
||||
{{ euProjectTopics.matched_project_count | number }} von
|
||||
{{ euProjectTopics.project_count | number }} Projekten gematcht
|
||||
@if (dfgTopicsLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="DFG-Topics werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (dfgTopicsError) {
|
||||
<p class="statistics-error">
|
||||
Die DFG-Topic-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="dfgTopicTreemap"
|
||||
[selectedNodeId]="selectedDfgTopicTreemapNode"
|
||||
countLabel="DFG-Projekte"
|
||||
[showCountInTooltip]="false"
|
||||
(selectedNodeIdChange)="onDfgTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onDfgTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</header>
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (euTopicsLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="EU-Topics werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (euTopicsError) {
|
||||
<p class="statistics-error">
|
||||
Die EU-Topic-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="euTopicTreemap"
|
||||
[selectedNodeId]="selectedEuTopicTreemapNode"
|
||||
countLabel="EU-Projekte"
|
||||
[showCountInTooltip]="false"
|
||||
(selectedNodeIdChange)="onEuTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onEuTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@if (euTopicsLoading || euTopicsError || euProjectTopics) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>EU-Projekt-Topics</h2>
|
||||
<p>
|
||||
Gematchte EU-Projekte nach Field, Subfield und Topic. Ein Klick
|
||||
auf ein Topic zeigt die zugehörigen Keywords.
|
||||
</p>
|
||||
</div>
|
||||
@if (euProjectTopics) {
|
||||
<p class="dfg-topic-summary">
|
||||
{{ euProjectTopics.matched_project_count | number }} von
|
||||
{{ euProjectTopics.project_count | number }} Projekten gematcht
|
||||
</p>
|
||||
}
|
||||
</header>
|
||||
|
||||
@if (bundTopicsLoading || bundTopicsError || bundProjectTopics) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>BUND-Projekt-Topics</h2>
|
||||
<p>
|
||||
Gematchte BUND-Projekte nach Field, Subfield und Topic. Ein Klick
|
||||
auf ein Topic zeigt die zugehörigen Keywords.
|
||||
</p>
|
||||
</div>
|
||||
@if (bundProjectTopics) {
|
||||
<p class="dfg-topic-summary">
|
||||
{{ bundProjectTopics.matched_project_count | number }} von
|
||||
{{ bundProjectTopics.project_count | number }} Projekten gematcht
|
||||
@if (euTopicsLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="EU-Topics werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (euTopicsError) {
|
||||
<p class="statistics-error">
|
||||
Die EU-Topic-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="euTopicTreemap"
|
||||
[selectedNodeId]="selectedEuTopicTreemapNode"
|
||||
countLabel="EU-Projekte"
|
||||
[showCountInTooltip]="false"
|
||||
(selectedNodeIdChange)="onEuTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onEuTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</header>
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (bundTopicsLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="BUND-Topics werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (bundTopicsError) {
|
||||
<p class="statistics-error">
|
||||
Die BUND-Topic-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="bundTopicTreemap"
|
||||
[selectedNodeId]="selectedBundTopicTreemapNode"
|
||||
countLabel="BUND-Projekte"
|
||||
[showCountInTooltip]="false"
|
||||
(selectedNodeIdChange)="onBundTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onBundTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
@if (bundTopicsLoading || bundTopicsError || bundProjectTopics) {
|
||||
<section class="topic-heatmap-section">
|
||||
<header class="topic-heatmap-header">
|
||||
<div>
|
||||
<h2>BUND-Projekt-Topics</h2>
|
||||
<p>
|
||||
Gematchte BUND-Projekte nach Field, Subfield und Topic. Ein Klick
|
||||
auf ein Topic zeigt die zugehörigen Keywords.
|
||||
</p>
|
||||
</div>
|
||||
@if (bundProjectTopics) {
|
||||
<p class="dfg-topic-summary">
|
||||
{{ bundProjectTopics.matched_project_count | number }} von
|
||||
{{ bundProjectTopics.project_count | number }} Projekten gematcht
|
||||
</p>
|
||||
}
|
||||
</header>
|
||||
|
||||
@if (topAuthorsLoading || topAuthorsError || hasTopAuthorData()) {
|
||||
<section class="top-authors-section">
|
||||
<header class="top-authors-header">
|
||||
<div>
|
||||
<h2>Top 10 Personen</h2>
|
||||
<p>
|
||||
Nach Anzahl der Works, DFG-Projekte, Patente und News Ihrer
|
||||
Organisation.
|
||||
@if (bundTopicsLoading) {
|
||||
<div class="topic-heatmap-loading" role="status" aria-live="polite">
|
||||
<app-loading
|
||||
text="BUND-Topics werden geladen …"
|
||||
[icon]="ACCOUNT_TREE_ICON"
|
||||
size="72"
|
||||
diameter="72"></app-loading>
|
||||
</div>
|
||||
} @else if (bundTopicsError) {
|
||||
<p class="statistics-error">
|
||||
Die BUND-Topic-Treemap konnte nicht geladen werden.
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
} @else {
|
||||
<app-topic-treemap
|
||||
[data]="bundTopicTreemap"
|
||||
[selectedNodeId]="selectedBundTopicTreemapNode"
|
||||
countLabel="BUND-Projekte"
|
||||
[showCountInTooltip]="false"
|
||||
(selectedNodeIdChange)="onBundTopicTreemapNodeChange($event)"
|
||||
(topicSelect)="onBundTopicTreemapTopicSelect($event)">
|
||||
</app-topic-treemap>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
|
||||
@if (topAuthorsError) {
|
||||
<p class="statistics-error">
|
||||
Die Autorenstatistiken konnten nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<div class="top-authors-grid" [class.loading]="topAuthorsLoading">
|
||||
@for (dataset of visibleTopAuthorDatasets(); track dataset.title) {
|
||||
<article class="top-authors-chart">
|
||||
<h3>
|
||||
<mat-icon>{{ dataset.icon }}</mat-icon
|
||||
>{{ dataset.title }}
|
||||
</h3>
|
||||
@for (
|
||||
entry of dataset.entries;
|
||||
track entry.id || entry.name;
|
||||
let rank = $index
|
||||
) {
|
||||
<div class="author-bar-row">
|
||||
<span class="author-rank">{{ rank + 1 }}</span>
|
||||
<div class="author-bar-content">
|
||||
<div class="author-bar-label">
|
||||
@if (entry.id) {
|
||||
<a
|
||||
class="author-name author-link"
|
||||
[routerLink]="authorLink(dataset, entry)"
|
||||
[queryParams]="authorQueryParams(dataset, entry)"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ authorId: entry.id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</a>
|
||||
} @else {
|
||||
@if (topAuthorsLoading || topAuthorsError || hasTopAuthorData()) {
|
||||
<section class="top-authors-section">
|
||||
<header class="top-authors-header">
|
||||
<div>
|
||||
<h2>Top 10 Personen</h2>
|
||||
<p>
|
||||
Nach Anzahl der Works, DFG-Projekte, Patente und News Ihrer
|
||||
Organisation.
|
||||
</p>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@if (topAuthorsError) {
|
||||
<p class="statistics-error">
|
||||
Die Autorenstatistiken konnten nicht geladen werden.
|
||||
</p>
|
||||
} @else {
|
||||
<div class="top-authors-grid" [class.loading]="topAuthorsLoading">
|
||||
@for (dataset of visibleTopAuthorDatasets(); track dataset.title) {
|
||||
<article class="top-authors-chart">
|
||||
<h3>
|
||||
<mat-icon>{{ dataset.icon }}</mat-icon
|
||||
>{{ dataset.title }}
|
||||
</h3>
|
||||
@for (
|
||||
entry of dataset.entries;
|
||||
track entry.id || entry.name;
|
||||
let rank = $index
|
||||
) {
|
||||
<div class="author-bar-row">
|
||||
<span class="author-rank">{{ rank + 1 }}</span>
|
||||
<div class="author-bar-content">
|
||||
<div class="author-bar-label">
|
||||
@if (entry.id) {
|
||||
<a
|
||||
class="author-name author-link"
|
||||
[routerLink]="authorLink(dataset, entry)"
|
||||
[queryParams]="authorQueryParams(dataset, entry)"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ authorId: entry.id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</a>
|
||||
} @else {
|
||||
<span
|
||||
class="author-name"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</span>
|
||||
}
|
||||
<strong>{{ entry.count | number }}</strong>
|
||||
</div>
|
||||
<div class="author-bar-track">
|
||||
<span
|
||||
class="author-name"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</span>
|
||||
}
|
||||
<strong>{{ entry.count | number }}</strong>
|
||||
</div>
|
||||
<div class="author-bar-track">
|
||||
<span
|
||||
class="author-bar-fill"
|
||||
[style.width.%]="
|
||||
authorBarWidth(dataset.entries, entry.count)
|
||||
"></span>
|
||||
class="author-bar-fill"
|
||||
[style.width.%]="
|
||||
authorBarWidth(dataset.entries, entry.count)
|
||||
"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
} @empty {
|
||||
<p class="empty-chart">
|
||||
{{
|
||||
topAuthorsLoading
|
||||
? 'Wird geladen …'
|
||||
: 'Keine Daten vorhanden.'
|
||||
}}
|
||||
</p>
|
||||
}
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
} @empty {
|
||||
<p class="empty-chart">
|
||||
{{
|
||||
topAuthorsLoading
|
||||
? 'Wird geladen …'
|
||||
: 'Keine Daten vorhanden.'
|
||||
}}
|
||||
</p>
|
||||
}
|
||||
</article>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -20,6 +20,8 @@ import {
|
||||
ACCOUNT_BALANCE_ICON,
|
||||
ACCOUNT_TREE_ICON,
|
||||
ARTICLE_ICON,
|
||||
CHEVRON_LEFT_ICON,
|
||||
CHEVRON_RIGHT_ICON,
|
||||
DESCRIPTION_ICON,
|
||||
GROUPS_ICON,
|
||||
MENU_BOOK_ICON,
|
||||
@@ -102,6 +104,9 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
||||
|
||||
readonly AuthorTooltipComponent = AppAuthorTooltipComponent;
|
||||
readonly patentIcon = PATENT_ICON;
|
||||
readonly PATENT_ICON = PATENT_ICON;
|
||||
readonly CHEVRON_LEFT_ICON = CHEVRON_LEFT_ICON;
|
||||
readonly CHEVRON_RIGHT_ICON = CHEVRON_RIGHT_ICON;
|
||||
readonly MENU_BOOK_ICON = MENU_BOOK_ICON;
|
||||
readonly GROUPS_ICON = GROUPS_ICON;
|
||||
readonly PUBLIC_ICON = PUBLIC_ICON;
|
||||
@@ -223,9 +228,11 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
||||
const restoredAnalyticalInstitution =
|
||||
restoredInstitution === 'all' ? '' : restoredInstitution;
|
||||
if (
|
||||
restoredAnalyticalInstitution !== this.selectedAnalyticalInstitutionId
|
||||
restoredAnalyticalInstitution !==
|
||||
this.selectedAnalyticalInstitutionId
|
||||
) {
|
||||
this.selectedAnalyticalInstitutionId = restoredAnalyticalInstitution;
|
||||
this.selectedAnalyticalInstitutionId =
|
||||
restoredAnalyticalInstitution;
|
||||
this.reloadAnalyticalData();
|
||||
}
|
||||
},
|
||||
@@ -1003,7 +1010,9 @@ export class DashboardComponent implements OnInit, AfterViewInit {
|
||||
};
|
||||
}
|
||||
|
||||
private loadTopicTreemap(analyticalRequestId = this.analyticalRequestId): void {
|
||||
private loadTopicTreemap(
|
||||
analyticalRequestId = this.analyticalRequestId,
|
||||
): void {
|
||||
if (this.dashboardFromYear > this.dashboardToYear) {
|
||||
this.topicTreemapLoading = false;
|
||||
this.topicTreemapError = true;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<div class="icon-container">
|
||||
@for (item of icons; track item.constName) {
|
||||
<div
|
||||
class="icon-item"
|
||||
[title]="item.constName + ' -> \'' + item.iconString + '\''">
|
||||
<mat-icon>{{ item.iconString }}</mat-icon>
|
||||
<span class="name">{{ item.iconString }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
.icon-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
||||
gap: 4px;
|
||||
padding: 8px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.icon-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 3px 6px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 4px;
|
||||
background: #ffffff;
|
||||
font-family: monospace;
|
||||
font-size: 11px;
|
||||
color: #1e293b;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
|
||||
mat-icon {
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import * as ALL_ICONS from '../../shared/ui/icons';
|
||||
|
||||
@Component({
|
||||
selector: 'app-icon-preview',
|
||||
standalone: true,
|
||||
imports: [MatIconModule],
|
||||
templateUrl: './icon-preview.component.html',
|
||||
styleUrl: './icon-preview.component.scss',
|
||||
})
|
||||
export class IconPreviewComponent {
|
||||
readonly icons = Object.entries(ALL_ICONS)
|
||||
.filter(([key, val]) => typeof val === 'string' && key.endsWith('_ICON'))
|
||||
.map(([constName, iconString]) => ({
|
||||
constName,
|
||||
iconString: iconString as string,
|
||||
}))
|
||||
.sort(
|
||||
(a, b) =>
|
||||
a.iconString.localeCompare(b.iconString) ||
|
||||
a.constName.localeCompare(b.constName),
|
||||
);
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix [fontIcon]="RULE_ICON"></mat-icon>
|
||||
<mat-icon matPrefix>{{ RULE_ICON }}</mat-icon>
|
||||
<mat-select
|
||||
[value]="activeMatchType"
|
||||
(selectionChange)="setMatchType($event.value)">
|
||||
@@ -42,7 +42,7 @@
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix [fontIcon]="SORT_ICON"></mat-icon>
|
||||
<mat-icon matPrefix>{{ SORT_ICON }}</mat-icon>
|
||||
<mat-select
|
||||
[value]="sortColumn"
|
||||
(selectionChange)="setSort($event.value)">
|
||||
|
||||
+166
@@ -0,0 +1,166 @@
|
||||
<div class="institution-overview">
|
||||
<mat-card class="institution-overview-card" appearance="outlined">
|
||||
<!-- Header Section -->
|
||||
<div class="overview-header">
|
||||
<div class="avatar-col">
|
||||
<div class="institution-avatar" [class]="typeInfo().badgeClass">
|
||||
<mat-icon>{{ typeInfo().icon }}</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="identity-col">
|
||||
<div class="title-row">
|
||||
<h1 class="institution-name">{{ displayName() }}</h1>
|
||||
<span [class]="'type-badge ' + typeInfo().badgeClass">
|
||||
<mat-icon class="badge-icon">{{ typeInfo().icon }}</mat-icon>
|
||||
{{ typeInfo().label }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="meta-row">
|
||||
@if (locationText()) {
|
||||
<div class="meta-item location-item">
|
||||
@if (countryCode()) {
|
||||
<app-country-flag
|
||||
[countryCode]="countryCode()!"
|
||||
[height]="14"
|
||||
[bordered]="false" />
|
||||
}
|
||||
<span>{{ locationText() }}</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (homepageUrl()) {
|
||||
<a
|
||||
class="meta-link"
|
||||
[href]="homepageUrl()!"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
matTooltip="Offizielle Webseite öffnen">
|
||||
<mat-icon>{{ LANGUAGE_ICON }}</mat-icon>
|
||||
<span>Webseite</span>
|
||||
<mat-icon class="external-icon">{{ OPEN_IN_NEW_ICON }}</mat-icon>
|
||||
</a>
|
||||
}
|
||||
|
||||
@if (rorUrl()) {
|
||||
<a
|
||||
class="meta-link ror-link"
|
||||
[href]="rorUrl()!"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
matTooltip="ROR-Register öffnen">
|
||||
<span class="ror-tag">ROR</span>
|
||||
<mat-icon class="external-icon">{{ OPEN_IN_NEW_ICON }}</mat-icon>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Key Metrics Section -->
|
||||
<div class="metrics-row">
|
||||
@if (worksCount() !== null && worksCount() !== undefined) {
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon-wrapper pub-icon">
|
||||
<mat-icon>{{ PUBLICATION_ICON }}</mat-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<span class="stat-value">{{
|
||||
worksCount() | number: undefined : 'de'
|
||||
}}</span>
|
||||
<span class="stat-label">Publikationen</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (citedByCount() !== null && citedByCount() !== undefined) {
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon-wrapper cite-icon">
|
||||
<mat-icon>{{ CITATION_ICON }}</mat-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<span class="stat-value">{{
|
||||
citedByCount() | number: undefined : 'de'
|
||||
}}</span>
|
||||
<span class="stat-label">Zitationen</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (hIndex() !== null && hIndex() !== undefined) {
|
||||
<div class="stat-card">
|
||||
<div class="stat-icon-wrapper hindex-icon">
|
||||
<mat-icon>{{ TRENDING_UP_ICON }}</mat-icon>
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<span class="stat-value">{{ hIndex() }}</span>
|
||||
<span class="stat-label">h-Index</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Alternative Names / Acronyms -->
|
||||
@if (alternatives().length > 0) {
|
||||
<mat-divider />
|
||||
<div class="details-section">
|
||||
<h4 class="section-title">Alternative Bezeichnungen</h4>
|
||||
<div class="alternatives-list">
|
||||
@for (alt of visibleAlternatives(); track alt) {
|
||||
<span class="alternative-chip">{{ alt }}</span>
|
||||
}
|
||||
@if (hasMoreAlternatives()) {
|
||||
<button
|
||||
mat-button
|
||||
class="expand-btn"
|
||||
(click)="toggleAlternatives()">
|
||||
{{
|
||||
showAllAlternatives()
|
||||
? 'Weniger anzeigen'
|
||||
: '+' + (alternatives().length - 4) + ' weitere'
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Associated Institutions -->
|
||||
@if (associatedInstitutions().length > 0) {
|
||||
<mat-divider />
|
||||
<div class="details-section">
|
||||
<h4 class="section-title">
|
||||
Assoziierte Institutionen
|
||||
<span class="section-count"
|
||||
>({{ associatedInstitutions().length }})</span
|
||||
>
|
||||
</h4>
|
||||
<div class="associated-chips-container">
|
||||
@for (
|
||||
assoc of visibleAssociatedInstitutions();
|
||||
track assoc.id ?? assoc.display_name ?? $index
|
||||
) {
|
||||
<div class="associated-chip-wrapper">
|
||||
<app-institution-chip
|
||||
[institution]="assoc"
|
||||
[showIcon]="true"
|
||||
size="normal"
|
||||
[isClickable]="true"
|
||||
(handleChipClick)="navigateToInstitution(assoc)" />
|
||||
</div>
|
||||
}
|
||||
@if (hasMoreAssociated()) {
|
||||
<button mat-button class="expand-btn" (click)="toggleAssociated()">
|
||||
{{
|
||||
showAllAssociated()
|
||||
? 'Weniger anzeigen'
|
||||
: '+' + (associatedInstitutions().length - 10) + ' weitere'
|
||||
}}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</mat-card>
|
||||
</div>
|
||||
+346
@@ -0,0 +1,346 @@
|
||||
.institution-overview {
|
||||
width: 100%;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.institution-overview-card {
|
||||
padding: 1.5rem;
|
||||
background: var(--sg-surface);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
/* --- Header & Avatar --- */
|
||||
.overview-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 1.25rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-col {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.institution-avatar {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--sg-surface-container-high, rgba(0, 0, 0, 0.04));
|
||||
border: 1px solid var(--sg-border);
|
||||
color: var(--sg-primary);
|
||||
|
||||
mat-icon {
|
||||
font-size: 34px;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
|
||||
&.type-education {
|
||||
background: rgba(33, 150, 243, 0.1);
|
||||
color: #1976d2;
|
||||
border-color: rgba(33, 150, 243, 0.25);
|
||||
}
|
||||
|
||||
&.type-healthcare {
|
||||
background: rgba(233, 30, 99, 0.1);
|
||||
color: #c2185b;
|
||||
border-color: rgba(233, 30, 99, 0.25);
|
||||
}
|
||||
|
||||
&.type-facility {
|
||||
background: rgba(156, 39, 176, 0.1);
|
||||
color: #7b1fa2;
|
||||
border-color: rgba(156, 39, 176, 0.25);
|
||||
}
|
||||
|
||||
&.type-company {
|
||||
background: rgba(255, 152, 0, 0.1);
|
||||
color: #f57c00;
|
||||
border-color: rgba(255, 152, 0, 0.25);
|
||||
}
|
||||
|
||||
&.type-government {
|
||||
background: rgba(0, 150, 136, 0.1);
|
||||
color: #00796b;
|
||||
border-color: rgba(0, 150, 136, 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
.identity-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.institution-name {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text-primary);
|
||||
margin: 0;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.type-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
padding: 0.25rem 0.65rem;
|
||||
border-radius: 9999px;
|
||||
background: var(--sg-surface-container-high, rgba(0, 0, 0, 0.05));
|
||||
color: var(--sg-text-secondary);
|
||||
border: 1px solid var(--sg-border);
|
||||
|
||||
.badge-icon {
|
||||
font-size: 14px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
&.type-education {
|
||||
background: rgba(33, 150, 243, 0.1);
|
||||
color: #1565c0;
|
||||
border-color: rgba(33, 150, 243, 0.3);
|
||||
}
|
||||
|
||||
&.type-healthcare {
|
||||
background: rgba(233, 30, 99, 0.1);
|
||||
color: #ad1457;
|
||||
border-color: rgba(233, 30, 99, 0.3);
|
||||
}
|
||||
|
||||
&.type-facility {
|
||||
background: rgba(156, 39, 176, 0.1);
|
||||
color: #6a1b9a;
|
||||
border-color: rgba(156, 39, 176, 0.3);
|
||||
}
|
||||
|
||||
&.type-company {
|
||||
background: rgba(255, 152, 0, 0.1);
|
||||
color: #e65100;
|
||||
border-color: rgba(255, 152, 0, 0.3);
|
||||
}
|
||||
|
||||
&.type-government {
|
||||
background: rgba(0, 150, 136, 0.1);
|
||||
color: #004d40;
|
||||
border-color: rgba(0, 150, 136, 0.3);
|
||||
}
|
||||
}
|
||||
|
||||
.meta-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
font-size: 0.875rem;
|
||||
color: var(--sg-text-secondary);
|
||||
|
||||
@media (max-width: 768px) {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.meta-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.meta-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
color: var(--sg-primary);
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
transition: opacity 0.2s;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.external-icon {
|
||||
font-size: 13px;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
.ror-tag {
|
||||
background: var(--sg-primary);
|
||||
color: #ffffff;
|
||||
font-size: 0.65rem;
|
||||
font-weight: 700;
|
||||
padding: 1px 4px;
|
||||
border-radius: 4px;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/* --- Metrics Grid --- */
|
||||
.metrics-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
gap: 0.85rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.85rem;
|
||||
padding: 0.85rem 1rem;
|
||||
background: var(--sg-surface-container-low, rgba(0, 0, 0, 0.02));
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.stat-icon-wrapper {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
|
||||
mat-icon {
|
||||
font-size: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
&.pub-icon {
|
||||
background: rgba(33, 150, 243, 0.12);
|
||||
color: #1976d2;
|
||||
}
|
||||
|
||||
&.cite-icon {
|
||||
background: rgba(156, 39, 176, 0.12);
|
||||
color: #7b1fa2;
|
||||
}
|
||||
|
||||
&.hindex-icon {
|
||||
background: rgba(76, 175, 80, 0.12);
|
||||
color: #2e7d32;
|
||||
}
|
||||
}
|
||||
|
||||
.stat-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 1.15rem;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text-primary);
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--sg-text-secondary);
|
||||
}
|
||||
|
||||
/* --- Section Lists --- */
|
||||
.details-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.65rem;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.45rem;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
color: var(--sg-text-secondary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
margin: 0;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: var(--sg-primary);
|
||||
}
|
||||
|
||||
.section-count {
|
||||
font-weight: normal;
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
|
||||
.alternatives-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.alternative-chip {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.3rem 0.7rem;
|
||||
background: var(--sg-surface-container-high, rgba(0, 0, 0, 0.04));
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 6px;
|
||||
color: var(--sg-text-primary);
|
||||
}
|
||||
|
||||
.expand-btn {
|
||||
font-size: 0.75rem;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
padding: 0 0.5rem;
|
||||
color: var(--sg-primary);
|
||||
}
|
||||
|
||||
.associated-chips-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.65rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.associated-chip-wrapper {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
+216
@@ -0,0 +1,216 @@
|
||||
import { Component, computed, inject, input, signal } from '@angular/core';
|
||||
import { Router, RouterModule } from '@angular/router';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { DehydratedInstitution, Institution } from '../../../../api';
|
||||
import { CountryFlagComponent } from '../../../../shared/ui/country-flag/country-flag.component';
|
||||
import { AppInstitutionChipComponent } from '../../../../shared/ui/app-institution-chip/app-institution-chip.component';
|
||||
import {
|
||||
APARTMENT_ICON,
|
||||
BUSINESS_ICON,
|
||||
CITATION_ICON,
|
||||
FUNDING_ICON,
|
||||
INSTITUTION_ICON,
|
||||
LANGUAGE_ICON,
|
||||
LIBRARY_BOOKS_ICON,
|
||||
LOCAL_HOSPITAL_ICON,
|
||||
OPEN_IN_NEW_ICON,
|
||||
PAID_ICON,
|
||||
PUBLICATION_ICON,
|
||||
SCHOOL_ICON,
|
||||
SCIENCE_ICON,
|
||||
TRENDING_UP_ICON,
|
||||
VOLUNTEER_ACTIVISM_ICON,
|
||||
} from '../../../../shared/ui/icons';
|
||||
|
||||
interface InstitutionTypeInfo {
|
||||
label: string;
|
||||
icon: string;
|
||||
badgeClass: string;
|
||||
}
|
||||
|
||||
const INSTITUTION_TYPE_MAP: Record<string, InstitutionTypeInfo> = {
|
||||
education: {
|
||||
label: 'Bildung / Hochschule',
|
||||
icon: SCHOOL_ICON,
|
||||
badgeClass: 'type-education',
|
||||
},
|
||||
healthcare: {
|
||||
label: 'Klinik / Gesundheit',
|
||||
icon: LOCAL_HOSPITAL_ICON,
|
||||
badgeClass: 'type-healthcare',
|
||||
},
|
||||
company: {
|
||||
label: 'Unternehmen',
|
||||
icon: BUSINESS_ICON,
|
||||
badgeClass: 'type-company',
|
||||
},
|
||||
facility: {
|
||||
label: 'Forschungseinrichtung',
|
||||
icon: SCIENCE_ICON,
|
||||
badgeClass: 'type-facility',
|
||||
},
|
||||
government: {
|
||||
label: 'Staatliche Einrichtung',
|
||||
icon: FUNDING_ICON,
|
||||
badgeClass: 'type-government',
|
||||
},
|
||||
nonprofit: {
|
||||
label: 'Gemeinnützige Organisation',
|
||||
icon: VOLUNTEER_ACTIVISM_ICON,
|
||||
badgeClass: 'type-nonprofit',
|
||||
},
|
||||
archive: {
|
||||
label: 'Archiv / Bibliothek',
|
||||
icon: LIBRARY_BOOKS_ICON,
|
||||
badgeClass: 'type-archive',
|
||||
},
|
||||
funder: {
|
||||
label: 'Förderorganisation',
|
||||
icon: PAID_ICON,
|
||||
badgeClass: 'type-funder',
|
||||
},
|
||||
other: {
|
||||
label: 'Sonstige Institution',
|
||||
icon: INSTITUTION_ICON,
|
||||
badgeClass: 'type-other',
|
||||
},
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution-overview',
|
||||
imports: [
|
||||
RouterModule,
|
||||
DecimalPipe,
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
MatChipsModule,
|
||||
MatDividerModule,
|
||||
MatTooltipModule,
|
||||
CountryFlagComponent,
|
||||
AppInstitutionChipComponent,
|
||||
],
|
||||
templateUrl: './institution-overview.component.html',
|
||||
styleUrl: './institution-overview.component.scss',
|
||||
})
|
||||
export class InstitutionOverviewComponent {
|
||||
private readonly router = inject(Router);
|
||||
|
||||
readonly PUBLICATION_ICON = PUBLICATION_ICON;
|
||||
readonly CITATION_ICON = CITATION_ICON;
|
||||
readonly TRENDING_UP_ICON = TRENDING_UP_ICON;
|
||||
readonly OPEN_IN_NEW_ICON = OPEN_IN_NEW_ICON;
|
||||
readonly LANGUAGE_ICON = LANGUAGE_ICON;
|
||||
|
||||
institution = input.required<Institution>();
|
||||
|
||||
showAllAlternatives = signal<boolean>(false);
|
||||
|
||||
displayName = computed(() => {
|
||||
const inst = this.institution();
|
||||
return (
|
||||
inst.display_name?.trim() ||
|
||||
inst.display_name_alternatives?.[0]?.trim() ||
|
||||
'Unbekannte Institution'
|
||||
);
|
||||
});
|
||||
|
||||
typeInfo = computed<InstitutionTypeInfo>(() => {
|
||||
const typeKey = this.institution().type?.toLowerCase() ?? 'other';
|
||||
return (
|
||||
INSTITUTION_TYPE_MAP[typeKey] ?? {
|
||||
label: 'Institution',
|
||||
icon: APARTMENT_ICON,
|
||||
badgeClass: 'type-other',
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
locationText = computed(() => {
|
||||
const geo = this.institution().geo;
|
||||
if (!geo) return null;
|
||||
const parts = [geo.city, geo.country].filter(Boolean);
|
||||
return parts.length > 0 ? parts.join(', ') : null;
|
||||
});
|
||||
|
||||
countryCode = computed(() => {
|
||||
return (
|
||||
this.institution().geo?.country_code ??
|
||||
this.institution().country_code ??
|
||||
null
|
||||
);
|
||||
});
|
||||
|
||||
alternatives = computed(() => {
|
||||
return this.institution().display_name_alternatives ?? [];
|
||||
});
|
||||
|
||||
visibleAlternatives = computed(() => {
|
||||
const alts = this.alternatives();
|
||||
if (this.showAllAlternatives()) return alts;
|
||||
return alts.slice(0, 4);
|
||||
});
|
||||
|
||||
hasMoreAlternatives = computed(() => {
|
||||
return this.alternatives().length > 4;
|
||||
});
|
||||
|
||||
worksCount = computed(() => this.institution().works_count);
|
||||
citedByCount = computed(() => this.institution().cited_by_count);
|
||||
hIndex = computed(() => this.institution().summary_stats?.h_index);
|
||||
|
||||
associatedInstitutions = computed<DehydratedInstitution[]>(() => {
|
||||
const list = this.institution().associated_institutions ?? [];
|
||||
const seen = new Set<string>();
|
||||
const unique: DehydratedInstitution[] = [];
|
||||
for (const item of list) {
|
||||
const key = item.id || item.display_name || JSON.stringify(item);
|
||||
if (!seen.has(key)) {
|
||||
seen.add(key);
|
||||
unique.push(item);
|
||||
}
|
||||
}
|
||||
return unique;
|
||||
});
|
||||
|
||||
showAllAssociated = signal<boolean>(false);
|
||||
|
||||
visibleAssociatedInstitutions = computed(() => {
|
||||
const list = this.associatedInstitutions();
|
||||
if (this.showAllAssociated()) return list;
|
||||
return list.slice(0, 10);
|
||||
});
|
||||
|
||||
hasMoreAssociated = computed(() => {
|
||||
return this.associatedInstitutions().length > 10;
|
||||
});
|
||||
|
||||
homepageUrl = computed(() => this.institution().homepage_url);
|
||||
rorUrl = computed(() => this.institution().ror);
|
||||
|
||||
toggleAlternatives(): void {
|
||||
this.showAllAlternatives.update((v) => !v);
|
||||
}
|
||||
|
||||
toggleAssociated(): void {
|
||||
this.showAllAssociated.update((v) => !v);
|
||||
}
|
||||
|
||||
navigateToInstitution(assoc: DehydratedInstitution): void {
|
||||
const cleanId = this.stripOpenAlexId(assoc.id);
|
||||
if (cleanId) {
|
||||
this.router.navigate(['/institution', cleanId]);
|
||||
}
|
||||
}
|
||||
|
||||
stripOpenAlexId(id: string | null | undefined): string | undefined {
|
||||
if (!id) return undefined;
|
||||
return id.replace('https://openalex.org/', '');
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,5 @@
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<h1>{{ institution().display_name }}</h1>
|
||||
<mat-card appearance="outlined">
|
||||
<mat-card-content>
|
||||
<p>{{ institution().homepage_url }}</p>
|
||||
<p>{{ institution().display_name_alternatives }}</p>
|
||||
<p>And many more useful details...</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div class="institution-container">
|
||||
<app-institution-overview [institution]="institution()" />
|
||||
<app-link-tab-nav-bar [links]="_links()" [tabPanel]="tabPanel" />
|
||||
</div>
|
||||
<mat-tab-nav-panel #tabPanel>
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
.container {
|
||||
.institution-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
margin: 0 1rem;
|
||||
margin: 1rem;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { Institution } from '../../api';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { InstitutionOverviewComponent } from './components/institution-overview/institution-overview.component';
|
||||
import {
|
||||
LinkTabNavBarComponent,
|
||||
LinkTabNavBarItem,
|
||||
@@ -15,7 +15,12 @@ import {
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution',
|
||||
imports: [MatCardModule, MatTabsModule, RouterModule, LinkTabNavBarComponent],
|
||||
imports: [
|
||||
InstitutionOverviewComponent,
|
||||
LinkTabNavBarComponent,
|
||||
MatTabsModule,
|
||||
RouterModule,
|
||||
],
|
||||
templateUrl: './institution.component.html',
|
||||
styleUrl: './institution.component.scss',
|
||||
})
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix [fontIcon]="SORT_ICON"></mat-icon>
|
||||
<mat-icon matPrefix>{{ SORT_ICON }}</mat-icon>
|
||||
<mat-select
|
||||
[value]="sortColumn()"
|
||||
(selectionChange)="setSort($event.value)">
|
||||
|
||||
@@ -623,7 +623,11 @@ export class KeywordsSearchComponent {
|
||||
}
|
||||
|
||||
isSearchDisabled(): boolean {
|
||||
return this.selectedKeywords().length === 0 || this.isExtracting();
|
||||
return (
|
||||
this.selectedKeywords().length === 0 ||
|
||||
this.isExtracting() ||
|
||||
this.loadingNewKeyword()
|
||||
);
|
||||
}
|
||||
|
||||
onExtractKeywordsClick(): void {
|
||||
|
||||
+85
-92
@@ -1,102 +1,96 @@
|
||||
<div class="content">
|
||||
<div class="filters">
|
||||
<app-filter-card>
|
||||
<app-query-param-selector
|
||||
class="relevance-field"
|
||||
[options]="relevanceOptions"
|
||||
[queryParamKey]="keywordsNewsQueryParamKeys.relevance"
|
||||
label="Relevanz"
|
||||
[icon]="CHECK_CIRCLE_ICON"
|
||||
[multiple]="true" />
|
||||
<app-query-param-input
|
||||
class="title-field"
|
||||
[queryParamKey]="keywordsNewsQueryParamKeys.title"
|
||||
[queryParamPageKey]="keywordsNewsQueryParamKeys.page"
|
||||
label="Suchen nach Titel"
|
||||
[debounceTime]="300" />
|
||||
|
||||
<app-query-param-selector
|
||||
class="sort-order-field"
|
||||
[options]="sortOrderOptions"
|
||||
[queryParamKey]="keywordsNewsQueryParamKeys.sortOrder"
|
||||
label="Sortierung"
|
||||
[icon]="SORT_ICON" />
|
||||
</app-filter-card>
|
||||
<div class="filter-row">
|
||||
<app-filter-card>
|
||||
<app-query-param-selector
|
||||
class="relevance-field"
|
||||
[options]="relevanceOptions"
|
||||
[queryParamKey]="keywordsNewsQueryParamKeys.relevance"
|
||||
label="Relevanz"
|
||||
[icon]="CHECK_CIRCLE_ICON"
|
||||
[multiple]="true" />
|
||||
|
||||
<app-year-range-slider
|
||||
[minYear]="minYear"
|
||||
[maxYear]="maxYear"
|
||||
[(startYear)]="yearFrom"
|
||||
[(endYear)]="yearTo"
|
||||
(startYearChange)="applyYearFilter()"
|
||||
(endYearChange)="applyYearFilter()">
|
||||
</app-year-range-slider>
|
||||
<app-query-param-selector
|
||||
class="sort-order-field"
|
||||
[options]="sortOrderOptions"
|
||||
[queryParamKey]="keywordsNewsQueryParamKeys.sortOrder"
|
||||
label="Sortierung"
|
||||
[icon]="SORT_ICON" />
|
||||
</app-filter-card>
|
||||
|
||||
@if (hasActiveFilters()) {
|
||||
<button
|
||||
class="reset-filter-btn"
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
(click)="resetFilters()"
|
||||
aria-label="Filter zurücksetzen">
|
||||
<mat-icon>{{ FILTER_OFF_ICON }}</mat-icon>
|
||||
<span>Zurücksetzen</span>
|
||||
</button>
|
||||
}
|
||||
<app-year-range-slider
|
||||
[minYear]="minYear"
|
||||
[maxYear]="maxYear"
|
||||
[(startYear)]="yearFrom"
|
||||
[(endYear)]="yearTo"
|
||||
(startYearChange)="applyYearFilter()"
|
||||
(endYearChange)="applyYearFilter()">
|
||||
</app-year-range-slider>
|
||||
|
||||
@if (hasActiveFilters()) {
|
||||
<button
|
||||
class="reset-filter-btn"
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
(click)="resetFilters()"
|
||||
aria-label="Filter zurücksetzen">
|
||||
<mat-icon>{{ FILTER_OFF_ICON }}</mat-icon>
|
||||
<span>Zurücksetzen</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-template #expandTmp let-article>
|
||||
@if (article.snippet) {
|
||||
@let expanded = isSnippetExpanded(article);
|
||||
<button
|
||||
mat-icon-button
|
||||
class="expand-toggle"
|
||||
[attr.aria-expanded]="expanded"
|
||||
[matTooltip]="
|
||||
expanded ? 'Textstelle ausblenden' : 'Textstelle anzeigen'
|
||||
"
|
||||
[attr.aria-label]="
|
||||
expanded ? 'Textstelle ausblenden' : 'Textstelle anzeigen'
|
||||
">
|
||||
<mat-icon class="expand-icon" [class.is-expanded]="expanded">
|
||||
{{ EXPAND_MORE_ICON }}
|
||||
</mat-icon>
|
||||
</button>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #titleTmp let-article>
|
||||
<div class="title-cell">
|
||||
<a
|
||||
class="title"
|
||||
[routerLink]="['/news', article.id]"
|
||||
(click)="$event.stopPropagation()">
|
||||
{{ article.maintitle || 'Kein Titel' }}
|
||||
</a>
|
||||
<span class="title">
|
||||
<app-highlighted-text
|
||||
[content]="article.maintitle || 'Kein Titel'"
|
||||
[highlights]="titleHighlights().get(article.id) ?? []" />
|
||||
</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #snippetTmp let-article>
|
||||
<div class="snippet-detail">
|
||||
@if (snippetSegments().get(article.id); as segments) {
|
||||
<span class="snippet-label">Fundstelle im Artikel</span>
|
||||
<p class="snippet">
|
||||
@for (segment of segments; track $index) {
|
||||
@if (segment.isSearchMatch) {
|
||||
<mark
|
||||
class="snippet-mark"
|
||||
[class.has-topic]="!!segment.color"
|
||||
[style.--t]="segment.color"
|
||||
[matTooltip]="segment.tooltip ?? ''"
|
||||
matTooltipPosition="above"
|
||||
>{{ segment.text }}</mark
|
||||
>
|
||||
} @else {
|
||||
<span>{{ segment.text }}</span>
|
||||
}
|
||||
}
|
||||
</p>
|
||||
} @else {
|
||||
<span class="empty-text">
|
||||
Für diesen Artikel liegt keine Textstelle zu den gesuchten Keywords
|
||||
vor.
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
<app-table-detail-row>
|
||||
<div table-detail-header>
|
||||
<h4 class="panel-field__label">Fundstelle im Artikel</h4>
|
||||
</div>
|
||||
|
||||
<ng-container table-detail-body>
|
||||
@if (titleHighlights().get(article.id); as titleTerms) {
|
||||
<article class="panel-field panel-field--full">
|
||||
<h4 class="panel-field__label">Titel</h4>
|
||||
<app-highlighted-text
|
||||
class="panel-field__text"
|
||||
[content]="article.maintitle"
|
||||
[highlights]="titleTerms" />
|
||||
</article>
|
||||
}
|
||||
|
||||
@if (snippetHighlights().get(article.id); as snippet) {
|
||||
<article class="panel-field panel-field--full">
|
||||
<h4 class="panel-field__label">Artikeltext</h4>
|
||||
<app-highlighted-text
|
||||
class="panel-field__text"
|
||||
[content]="snippet.content"
|
||||
[highlights]="snippet.terms" />
|
||||
</article>
|
||||
} @else {
|
||||
<span class="empty-text">
|
||||
Für diesen Artikel liegt keine Textstelle zu den gesuchten Keywords
|
||||
vor.
|
||||
</span>
|
||||
}
|
||||
</ng-container>
|
||||
</app-table-detail-row>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #dateTmp let-article>
|
||||
@@ -193,12 +187,11 @@
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="table-wrap">
|
||||
<app-data-table
|
||||
[columns]="columns()"
|
||||
[data]="elements()"
|
||||
[detailTemplate]="snippetTmp" />
|
||||
</div>
|
||||
<app-data-table
|
||||
[columns]="columns()"
|
||||
[data]="elements()"
|
||||
[detailTemplate]="fuzzySearch() ? null : snippetTmp"
|
||||
[canExpand]="hasSnippet" />
|
||||
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
|
||||
+18
-110
@@ -9,10 +9,20 @@
|
||||
============================================================ */
|
||||
.filters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
|
||||
.title-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.filter-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.relevance-field,
|
||||
.sort-order-field {
|
||||
min-width: 200px;
|
||||
@@ -43,54 +53,6 @@
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
TABLE
|
||||
============================================================ */
|
||||
.table-wrap {
|
||||
position: relative;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
::ng-deep .table-wrap table {
|
||||
width: 100%;
|
||||
min-width: 960px;
|
||||
border-collapse: collapse;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::ng-deep .table-wrap .mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
::ng-deep .table-wrap .mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
::ng-deep .table-wrap .mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
::ng-deep .table-wrap {
|
||||
.mat-column-topics {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.mat-column-expand {
|
||||
width: 48px;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.detail-row .mat-mdc-cell {
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
TABLE CELLS
|
||||
============================================================ */
|
||||
@@ -104,67 +66,13 @@
|
||||
|
||||
.title {
|
||||
display: inline-block;
|
||||
max-width: 520px;
|
||||
line-height: 1.35;
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
|
||||
&:hover {
|
||||
color: var(--sg-text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
color: var(--sg-text-muted);
|
||||
transition: transform 150ms ease-in-out;
|
||||
|
||||
&.is-expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
EXPANDED DETAIL ROW
|
||||
============================================================ */
|
||||
.snippet-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
padding: 0.875rem 1rem 1rem 3rem;
|
||||
background: var(--sg-surface-soft);
|
||||
}
|
||||
|
||||
.snippet-label {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.snippet {
|
||||
margin: 0;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.6;
|
||||
color: var(--sg-text-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.snippet-mark {
|
||||
background: transparent;
|
||||
color: var(--sg-blue-highlight);
|
||||
font-weight: 700;
|
||||
cursor: help;
|
||||
|
||||
&.has-topic {
|
||||
color: var(--t);
|
||||
text-decoration: underline;
|
||||
text-decoration-color: var(--t);
|
||||
text-decoration-thickness: 2px;
|
||||
text-underline-offset: 2px;
|
||||
app-highlighted-text {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,10 +124,10 @@
|
||||
.topic-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.25rem;
|
||||
gap: 6px;
|
||||
align-items: flex-start;
|
||||
padding: 0.5rem 0;
|
||||
max-width: 350px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.no-results {
|
||||
|
||||
+37
-90
@@ -21,6 +21,7 @@ import {
|
||||
GenericColumn,
|
||||
} from '../../../../shared/ui/data-table/data-table.component';
|
||||
import { QueryParamPaginatorComponent } from '../../../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { QueryParamInputComponent } from '../../../../shared/ui/query-param-input/query-param-input.component';
|
||||
import { AppTopicChipComponent } from '../../../../shared/ui/app-topic-chip/app-topic-chip.component';
|
||||
import { ChipOverflowToggleComponent } from '../../../../shared/ui/chip-overflow-toggle/chip-overflow-toggle.component';
|
||||
import { FilterCardComponent } from '../../../../shared/ui/filter-card/filter-card.component';
|
||||
@@ -30,32 +31,28 @@ import {
|
||||
} from '../../../../shared/ui/query-param-selector/query-param-selector.component';
|
||||
import { NEWS_MIN_YEAR } from '../../../../shared/ui/news-card/news-card.component';
|
||||
import { keywordsNewsQueryParamKeys } from '../../../../resolvers/keywords-news-page.resolver';
|
||||
import { SearchResultsStateService } from '../search-results-state.service';
|
||||
import {
|
||||
SearchResultsStateService,
|
||||
SnippetHighlight,
|
||||
} from '../search-results-state.service';
|
||||
import { YearRangeSliderComponent } from '../../../../shared/ui/year-range-slider/year-range-slider.component';
|
||||
import {
|
||||
CANCEL_ICON,
|
||||
CHECK_CIRCLE_ICON,
|
||||
EXPAND_MORE_ICON,
|
||||
FILTER_OFF_ICON,
|
||||
HELP_ICON,
|
||||
OPEN_IN_NEW_ICON,
|
||||
SORT_ICON,
|
||||
} from '../../../../shared/ui/icons';
|
||||
import {
|
||||
keywordTooltip,
|
||||
splitByKeywords,
|
||||
topicKeywordColors,
|
||||
} from '../../../../resolvers/utils/keyword-highlight';
|
||||
containsHighlightTerm,
|
||||
HighlightedTextComponent,
|
||||
HighlightTerm,
|
||||
} from '../../../../shared/ui/highlighted-text/highlighted-text.component';
|
||||
import { TableDetailRowComponent } from '../../../../shared/ui/table-detail-row/table-detail-row.component';
|
||||
|
||||
type NewsResult = NewsPage['results'][number];
|
||||
|
||||
interface SnippetSegment {
|
||||
text: string;
|
||||
color: string | null;
|
||||
tooltip: string | null;
|
||||
isSearchMatch: boolean;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-news-results',
|
||||
imports: [
|
||||
@@ -64,10 +61,13 @@ interface SnippetSegment {
|
||||
MatIconModule,
|
||||
MatTooltipModule,
|
||||
DataTableComponent,
|
||||
HighlightedTextComponent,
|
||||
TableDetailRowComponent,
|
||||
AppTopicChipComponent,
|
||||
ChipOverflowToggleComponent,
|
||||
FilterCardComponent,
|
||||
QueryParamPaginatorComponent,
|
||||
QueryParamInputComponent,
|
||||
QueryParamSelectorComponent,
|
||||
YearRangeSliderComponent,
|
||||
],
|
||||
@@ -78,7 +78,6 @@ export class KeywordsToNewsResultsComponent {
|
||||
readonly CHECK_CIRCLE_ICON = CHECK_CIRCLE_ICON;
|
||||
readonly SORT_ICON = SORT_ICON;
|
||||
readonly FILTER_OFF_ICON = FILTER_OFF_ICON;
|
||||
readonly EXPAND_MORE_ICON = EXPAND_MORE_ICON;
|
||||
readonly CANCEL_ICON = CANCEL_ICON;
|
||||
readonly HELP_ICON = HELP_ICON;
|
||||
readonly OPEN_IN_NEW_ICON = OPEN_IN_NEW_ICON;
|
||||
@@ -141,6 +140,7 @@ export class KeywordsToNewsResultsComponent {
|
||||
!!params.get(keywordsNewsQueryParamKeys.yearFrom) ||
|
||||
!!params.get(keywordsNewsQueryParamKeys.yearTo) ||
|
||||
!!params.get(keywordsNewsQueryParamKeys.sortOrder) ||
|
||||
!!params.get(keywordsNewsQueryParamKeys.title) ||
|
||||
this.selectedTopicIds().length > 0
|
||||
);
|
||||
});
|
||||
@@ -151,6 +151,7 @@ export class KeywordsToNewsResultsComponent {
|
||||
!!params.get(keywordsNewsQueryParamKeys.relevance) ||
|
||||
!!params.get(keywordsNewsQueryParamKeys.yearFrom) ||
|
||||
!!params.get(keywordsNewsQueryParamKeys.yearTo) ||
|
||||
!!params.get(keywordsNewsQueryParamKeys.title) ||
|
||||
this.selectedTopicIds().length > 0
|
||||
);
|
||||
});
|
||||
@@ -165,22 +166,13 @@ export class KeywordsToNewsResultsComponent {
|
||||
return baseTopicIds.length > 0 || this.selectedTopicIds().length > 0;
|
||||
});
|
||||
|
||||
expandTmp = viewChild.required<TemplateRef<any>>('expandTmp');
|
||||
titleTmp = viewChild.required<TemplateRef<any>>('titleTmp');
|
||||
dateTmp = viewChild.required<TemplateRef<any>>('dateTmp');
|
||||
relevanceTmp = viewChild.required<TemplateRef<any>>('relevanceTmp');
|
||||
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
|
||||
actionsTmp = viewChild.required<TemplateRef<any>>('actionsTmp');
|
||||
|
||||
private readonly dataTable = viewChild(DataTableComponent);
|
||||
|
||||
readonly columns = computed<GenericColumn<NewsResult>[]>(() => [
|
||||
{
|
||||
id: 'expand',
|
||||
header: '',
|
||||
type: 'display',
|
||||
cellTemplate: this.expandTmp(),
|
||||
},
|
||||
{
|
||||
id: 'maintitle',
|
||||
header: 'Titel',
|
||||
@@ -260,84 +252,38 @@ export class KeywordsToNewsResultsComponent {
|
||||
return !!topic.id && this.selectedTopicIds().includes(topic.id);
|
||||
}
|
||||
|
||||
isSnippetExpanded(article: NewsResult): boolean {
|
||||
return this.dataTable()?.expandedElement() === article;
|
||||
}
|
||||
|
||||
readonly snippetSegments = computed(() => {
|
||||
const byArticleId = new Map<string, SnippetSegment[]>();
|
||||
readonly snippetHighlights = computed(() => {
|
||||
const byArticleId = new Map<string, SnippetHighlight>();
|
||||
|
||||
for (const article of this.elements()) {
|
||||
const segments = this.buildSnippetSegments(article);
|
||||
if (segments.length) {
|
||||
byArticleId.set(article.id, segments);
|
||||
if (article.snippet) {
|
||||
byArticleId.set(
|
||||
article.id,
|
||||
this.state.snippetHighlight(article.snippet),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return byArticleId;
|
||||
});
|
||||
|
||||
private buildSnippetSegments(article: NewsResult): SnippetSegment[] {
|
||||
const snippet = article.snippet;
|
||||
if (!snippet) {
|
||||
return [];
|
||||
readonly titleHighlights = computed(() => {
|
||||
const byArticleId = new Map<string, HighlightTerm[]>();
|
||||
const keywords = this.state.keywords();
|
||||
|
||||
for (const article of this.elements()) {
|
||||
const found = keywords.filter((keyword) =>
|
||||
containsHighlightTerm(article.maintitle, [keyword]),
|
||||
);
|
||||
if (found.length) {
|
||||
byArticleId.set(article.id, this.state.highlightTerms(found));
|
||||
}
|
||||
}
|
||||
|
||||
const keywordColors = topicKeywordColors(article.topics);
|
||||
const searchMatch = /<em>([\s\S]*?)<\/em>/g;
|
||||
return byArticleId;
|
||||
});
|
||||
|
||||
const segments: SnippetSegment[] = [];
|
||||
let lastIndex = 0;
|
||||
let match: RegExpExecArray | null;
|
||||
|
||||
const pushPlain = (raw: string) => {
|
||||
const text = this.decodeHtml(raw);
|
||||
if (text) {
|
||||
segments.push({
|
||||
text,
|
||||
color: null,
|
||||
tooltip: null,
|
||||
isSearchMatch: false,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
while ((match = searchMatch.exec(snippet)) !== null) {
|
||||
pushPlain(snippet.slice(lastIndex, match.index));
|
||||
|
||||
const term = this.decodeHtml(match[1]);
|
||||
const parts = splitByKeywords(term, keywordColors);
|
||||
const hasTopic = parts.some((part) => part.match);
|
||||
|
||||
for (const part of parts) {
|
||||
segments.push({
|
||||
text: part.text,
|
||||
color: part.match?.color ?? null,
|
||||
tooltip: part.match
|
||||
? keywordTooltip(part.match.keyword, part.match.topicNames)
|
||||
: hasTopic
|
||||
? null
|
||||
: keywordTooltip(term, []),
|
||||
isSearchMatch: true,
|
||||
});
|
||||
}
|
||||
|
||||
lastIndex = searchMatch.lastIndex;
|
||||
}
|
||||
|
||||
pushPlain(snippet.slice(lastIndex));
|
||||
|
||||
return segments;
|
||||
}
|
||||
|
||||
private decodeHtml(value: string): string {
|
||||
return value
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/&#(?:39|x27);/g, "'")
|
||||
.replace(/&/g, '&');
|
||||
}
|
||||
readonly hasSnippet = (article: NewsResult): boolean => !!article.snippet;
|
||||
|
||||
isTopicsExpanded(article: NewsResult): boolean {
|
||||
return this.expandedTopicsIds().has(article.id);
|
||||
@@ -388,6 +334,7 @@ export class KeywordsToNewsResultsComponent {
|
||||
[keywordsNewsQueryParamKeys.yearTo]: null,
|
||||
[keywordsNewsQueryParamKeys.topicId]: null,
|
||||
[keywordsNewsQueryParamKeys.sortOrder]: null,
|
||||
[keywordsNewsQueryParamKeys.title]: null,
|
||||
[keywordsNewsQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
<mat-checkbox
|
||||
class="author-select"
|
||||
[checked]="isSelected(author)"
|
||||
(change)="toggleSelect(author)" />
|
||||
(change)="toggleSelect(author, $event)" />
|
||||
<a
|
||||
class="author-name"
|
||||
[routerLink]="['/person', authorProfileId(author), 'overview']">
|
||||
|
||||
+65
-8
@@ -1,11 +1,15 @@
|
||||
import { Component, OnInit, computed, inject, signal } from '@angular/core';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
||||
import { distinctUntilChanged, map, skip } from 'rxjs';
|
||||
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import {
|
||||
MatCheckboxChange,
|
||||
MatCheckboxModule,
|
||||
} from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
@@ -98,6 +102,35 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
return p && p['size'] ? +p['size'] || 10 : 10;
|
||||
});
|
||||
|
||||
// The ranking matches the same two ways the works tab does: with fuzzy on,
|
||||
// the searched values are the OpenAlex topic ids; with fuzzy off, they are the
|
||||
// raw keywords. The url is authoritative for the ids (deep links, reload),
|
||||
// with the parent state as fallback.
|
||||
private readonly urlTopicIds = computed(() => {
|
||||
const raw = this.queryParams()?.['topics'];
|
||||
if (!raw) return [];
|
||||
const joined = Array.isArray(raw) ? raw.join(',') : raw;
|
||||
return joined
|
||||
.split(',')
|
||||
.map((id: string) => id.trim())
|
||||
.filter(Boolean);
|
||||
});
|
||||
|
||||
private readonly topicIds = computed(() => {
|
||||
const fromUrl = this.urlTopicIds();
|
||||
return fromUrl.length > 0 ? fromUrl : this.state.topicIds();
|
||||
});
|
||||
|
||||
// fuzzy only applies when topic ids are actually available; without them the
|
||||
// works tab falls back to matching the raw keywords, and so does this
|
||||
private readonly fuzzyMatch = computed(
|
||||
() => this.state.fuzzySearch() && this.topicIds().length > 0,
|
||||
);
|
||||
|
||||
private readonly searchTerms = computed(() =>
|
||||
this.fuzzyMatch() ? this.topicIds() : this.state.keywordsList(),
|
||||
);
|
||||
|
||||
readonly paginatedAuthors = computed(() => {
|
||||
const all = this.authors();
|
||||
const start = this.pageIndex() * this.pageSize();
|
||||
@@ -297,6 +330,23 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
|
||||
private hasLoadedInitial = false;
|
||||
|
||||
constructor() {
|
||||
// The Fuzzy Search toggle sits in the parent component and only writes to
|
||||
// the url, so the ranking has to be re-requested when the flag flips.
|
||||
// skip(1) drops the state at mount, which the initial load already covers.
|
||||
this.route.queryParamMap
|
||||
.pipe(
|
||||
map((params) => params.get('fuzzy') === 'true'),
|
||||
distinctUntilChanged(),
|
||||
skip(1),
|
||||
takeUntilDestroyed(),
|
||||
)
|
||||
.subscribe(() => {
|
||||
this.loadAuthors();
|
||||
this.loadPublicationTypeCounts();
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// restore the timespan from the URL so the range is shareable/bookmarkable
|
||||
this.timespanFrom.set(this.readYearParam('tFrom', this.minYear));
|
||||
@@ -419,7 +469,7 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
return this.selectedIds().includes(this.authorProfileId(author));
|
||||
}
|
||||
|
||||
toggleSelect(author: RankedAuthor): void {
|
||||
toggleSelect(author: RankedAuthor, event?: MatCheckboxChange): void {
|
||||
const id = this.authorProfileId(author);
|
||||
const current = this.selectedIds();
|
||||
|
||||
@@ -429,6 +479,11 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
}
|
||||
|
||||
if (current.length >= this.MAX_SELECTED) {
|
||||
// the checkbox already toggled itself, so revert it: the [checked] input
|
||||
// does not change here and would leave the box visually ticked
|
||||
if (event) {
|
||||
event.source.checked = false;
|
||||
}
|
||||
this.snackBar.open(
|
||||
`Es können maximal ${this.MAX_SELECTED} Autoren verglichen werden.`,
|
||||
'OK',
|
||||
@@ -449,7 +504,9 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
this.router.navigate(['/compare'], {
|
||||
queryParams: {
|
||||
authors: this.selectedIds().join(','),
|
||||
keywords: this.state.topicsList().join(','),
|
||||
keywords: this.state.keywordsList().join(','),
|
||||
topics: this.fuzzyMatch() ? this.topicIds().join(',') : null,
|
||||
fuzzy: this.fuzzyMatch(),
|
||||
operator: this.keywordOperator(),
|
||||
pubType:
|
||||
this.selectedPubTypes().length > 0
|
||||
@@ -465,9 +522,9 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
const rawWeights = this.currentWeights().raw;
|
||||
|
||||
const request: KeywordToAuthorRequest = {
|
||||
keywords: this.state.topicsList(),
|
||||
keywords: this.searchTerms(),
|
||||
operator: this.keywordOperator(),
|
||||
filter_type: 'topic',
|
||||
fuzzy: this.fuzzyMatch(),
|
||||
publication_types:
|
||||
this.selectedPubTypes().length > 0
|
||||
? this.selectedPubTypes()
|
||||
@@ -506,9 +563,9 @@ export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
// career-stage/timespan filters — drives the "Art der Work" filter options
|
||||
private loadPublicationTypeCounts(): void {
|
||||
const request: PublicationTypeCountsRequest = {
|
||||
keywords: this.state.topicsList(),
|
||||
keywords: this.searchTerms(),
|
||||
operator: this.keywordOperator(),
|
||||
filter_type: 'topic',
|
||||
fuzzy: this.fuzzyMatch(),
|
||||
career_stages:
|
||||
this.careerStages().length > 0 ? this.careerStages() : undefined,
|
||||
timespan: {
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { Injectable, computed, signal } from '@angular/core';
|
||||
import { KeywordEntryWithTopic } from '../../../api/model/keywordEntryWithTopic';
|
||||
import { Topic } from '../../../api';
|
||||
import { HighlightTerm } from '../../../shared/ui/highlighted-text/highlighted-text.component';
|
||||
import { TopicHierarchyColorInput } from '../../../resolvers/utils/topic-colors';
|
||||
export type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
|
||||
|
||||
export interface SnippetHighlight {
|
||||
content: string;
|
||||
terms: HighlightTerm[];
|
||||
}
|
||||
|
||||
export interface PatentKeywordEntry {
|
||||
entry: KeywordEntryWithTopic;
|
||||
level: KeywordPatentLevel;
|
||||
@@ -183,6 +189,41 @@ export class SearchResultsStateService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits an Elasticsearch snippet into the text to show and the terms to
|
||||
* mark in it: the searched keywords, plus whatever the search marked with
|
||||
* <em> that catches the inflected forms the analyzer found.
|
||||
*/
|
||||
public snippetHighlight(snippet: string): SnippetHighlight {
|
||||
const marked = [...snippet.matchAll(/<em>([\s\S]*?)<\/em>/g)].map((match) =>
|
||||
match[1].trim(),
|
||||
);
|
||||
|
||||
return {
|
||||
content: snippet.replace(/<\/?em>/g, ''),
|
||||
terms: this.highlightTerms([...this.keywords(), ...marked]),
|
||||
};
|
||||
}
|
||||
|
||||
/** Pairs each term with the topic it resolved to; the first spelling wins. */
|
||||
public highlightTerms(terms: readonly string[]): HighlightTerm[] {
|
||||
const seen = new Set<string>();
|
||||
const result: HighlightTerm[] = [];
|
||||
|
||||
for (const raw of terms) {
|
||||
const term = raw.trim();
|
||||
const key = term.toLowerCase();
|
||||
if (!term || seen.has(key)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(key);
|
||||
result.push({ term, topic: this.resolveTopicForTerm(term) });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Parallel topic-name list for trend dashboard strategies. Entries
|
||||
// without a resolvable keyword are skipped when building the lookup map
|
||||
// so they can never collide on an `undefined` key and shadow a real one.
|
||||
|
||||
+5
-30
@@ -22,14 +22,9 @@
|
||||
<span class="mode-badge">
|
||||
<mat-slide-toggle
|
||||
labelPosition="before"
|
||||
[matTooltip]="
|
||||
isPersonsTab()
|
||||
? 'Auf dem Personen-Tab wird immer nach Themen gerankt, daher ist Fuzzy Search hier fest aktiviert.'
|
||||
: 'Wenn aktiviert, werden die extrahierten Keywords auf bekannte Themenbereiche abgebildet, man kann dann nach Themen filtern. Wenn deaktiviert, werden die Keywords direkt für die Suche verwendet.'
|
||||
"
|
||||
matTooltip="Wenn aktiviert, werden die extrahierten Keywords auf bekannte Themenbereiche abgebildet, man kann dann nach Themen filtern. Wenn deaktiviert, werden die Keywords direkt für die Suche verwendet."
|
||||
(change)="onToggleFuzzySearch($event)"
|
||||
[checked]="state.fuzzySearch()"
|
||||
[disabled]="isPersonsTab()">
|
||||
[checked]="state.fuzzySearch()">
|
||||
Fuzzy Search
|
||||
</mat-slide-toggle>
|
||||
</span>
|
||||
@@ -64,29 +59,9 @@
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<nav
|
||||
mat-tab-nav-bar
|
||||
[tabPanel]="resultTabPanel"
|
||||
class="result-nav sg-tab-nav">
|
||||
@for (route of childRoutes; track route.path) {
|
||||
<a
|
||||
mat-tab-link
|
||||
[routerLink]="route.path"
|
||||
routerLinkActive
|
||||
#rla="routerLinkActive"
|
||||
[active]="rla.isActive"
|
||||
[queryParams]="{
|
||||
keywords: state.payload()?.keywords?.join(','),
|
||||
fuzzy: tabFuzzyValue(route),
|
||||
topics: tabFuzzyValue(route) ? state.topicIds() : null,
|
||||
topicId: null,
|
||||
}"
|
||||
queryParamsHandling="replace">
|
||||
<mat-icon>{{ route.icon }}</mat-icon>
|
||||
{{ route.label }}
|
||||
</a>
|
||||
}
|
||||
</nav>
|
||||
@if (resultTabPanel) {
|
||||
<app-link-tab-nav-bar [links]="_links()" [tabPanel]="resultTabPanel" />
|
||||
}
|
||||
|
||||
<mat-tab-nav-panel #resultTabPanel>
|
||||
<router-outlet />
|
||||
|
||||
@@ -101,13 +101,6 @@ $touch-target: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
CHILD ROUTE NAV
|
||||
============================================================ */
|
||||
.result-nav {
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
EMPTY STATE
|
||||
============================================================ */
|
||||
@@ -170,8 +163,4 @@ $touch-target: 44px;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.result-nav {
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import { Component, computed, inject, signal } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
Router,
|
||||
RouterLink,
|
||||
RouterLinkActive,
|
||||
RouterOutlet,
|
||||
} from '@angular/router';
|
||||
import { ActivatedRoute, Router, RouterOutlet } from '@angular/router';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
@@ -34,19 +28,21 @@ import {
|
||||
PERSONS_ICON,
|
||||
PROJECT_ICON,
|
||||
} from '../../../shared/ui/icons';
|
||||
|
||||
import {
|
||||
LinkTabNavBarComponent,
|
||||
LinkTabNavBarItem,
|
||||
} from '../../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||
@Component({
|
||||
selector: 'app-keywords-search-results',
|
||||
standalone: true,
|
||||
imports: [
|
||||
RouterLink,
|
||||
RouterLinkActive,
|
||||
RouterOutlet,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
TopicChipComponent,
|
||||
MatTabsModule,
|
||||
LinkTabNavBarComponent,
|
||||
MatSlideToggleModule,
|
||||
MatTooltipModule,
|
||||
],
|
||||
@@ -76,7 +72,93 @@ export class KeywordsSearchResultsComponent {
|
||||
{ path: 'trends', label: 'Visualisierung', icon: BAR_CHART_ICON },
|
||||
];
|
||||
|
||||
private readonly lastUserFuzzy = signal(false);
|
||||
_links = computed<LinkTabNavBarItem[]>(() => {
|
||||
const links: LinkTabNavBarItem[] = [
|
||||
{
|
||||
label: 'Personen',
|
||||
icon: PERSONS_ICON,
|
||||
path: 'persons',
|
||||
queryParams: {
|
||||
keywords: this.state.payload()?.keywords?.join(','),
|
||||
fuzzy: this.currentFuzzy(),
|
||||
topics: this.currentFuzzy() ? this.state.topicIds() : null,
|
||||
topicId: null,
|
||||
},
|
||||
queryParamsHandling: 'replace',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: 'Projekte',
|
||||
icon: PROJECT_ICON,
|
||||
path: 'projects',
|
||||
queryParams: {
|
||||
keywords: this.state.payload()?.keywords?.join(','),
|
||||
fuzzy: this.currentFuzzy(),
|
||||
topics: this.currentFuzzy() ? this.state.topicIds() : null,
|
||||
topicId: null,
|
||||
},
|
||||
queryParamsHandling: 'replace',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: 'Patente',
|
||||
icon: PATENT_ICON,
|
||||
path: 'patents',
|
||||
queryParams: {
|
||||
keywords: this.state.payload()?.keywords?.join(','),
|
||||
fuzzy: this.currentFuzzy(),
|
||||
topics: this.currentFuzzy() ? this.state.topicIds() : null,
|
||||
topicId: null,
|
||||
},
|
||||
queryParamsHandling: 'replace',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: 'Publikationen',
|
||||
icon: ARTICLE_ICON,
|
||||
path: 'works',
|
||||
queryParams: {
|
||||
keywords: this.state.payload()?.keywords?.join(','),
|
||||
fuzzy: this.currentFuzzy(),
|
||||
topics: this.currentFuzzy() ? this.state.topicIds() : null,
|
||||
topicId: null,
|
||||
},
|
||||
queryParamsHandling: 'replace',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: 'Nachrichten',
|
||||
icon: NEWS_ICON,
|
||||
path: 'news',
|
||||
queryParams: {
|
||||
keywords: this.state.payload()?.keywords?.join(','),
|
||||
fuzzy: this.currentFuzzy(),
|
||||
topics: this.currentFuzzy() ? this.state.topicIds() : null,
|
||||
topicId: null,
|
||||
},
|
||||
queryParamsHandling: 'replace',
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
label: 'Visualisierung',
|
||||
icon: BAR_CHART_ICON,
|
||||
path: 'trends',
|
||||
queryParams: {
|
||||
keywords: this.state.payload()?.keywords?.join(','),
|
||||
fuzzy: this.currentFuzzy(),
|
||||
topics: this.currentFuzzy() ? this.state.topicIds() : null,
|
||||
topicId: null,
|
||||
},
|
||||
queryParamsHandling: 'replace',
|
||||
disabled: false,
|
||||
},
|
||||
];
|
||||
return links;
|
||||
});
|
||||
|
||||
private currentFuzzy(): boolean {
|
||||
return this.route.snapshot.queryParamMap.get('fuzzy') === 'true';
|
||||
}
|
||||
|
||||
readonly selectedKeywordCount = computed(() => this.state.keywords().length);
|
||||
readonly allKeywordEntries = computed(() => {
|
||||
@@ -100,12 +182,7 @@ export class KeywordsSearchResultsComponent {
|
||||
// previous search never gets silently applied to a new one.
|
||||
this.route.queryParamMap.pipe(takeUntilDestroyed()).subscribe((params) => {
|
||||
const keywords = this.parseKeywordList(params.get('keywords'));
|
||||
const onPersonsTab = this.isPersonsTab();
|
||||
const fuzzySearch = onPersonsTab || params.get('fuzzy') === 'true';
|
||||
|
||||
if (!onPersonsTab) {
|
||||
this.lastUserFuzzy.set(params.get('fuzzy') === 'true');
|
||||
}
|
||||
const fuzzySearch = params.get('fuzzy') === 'true';
|
||||
|
||||
const cached = this.readHandoffCache();
|
||||
const cacheMatches =
|
||||
@@ -120,22 +197,9 @@ export class KeywordsSearchResultsComponent {
|
||||
? cached!.patentKeywordEntries
|
||||
: undefined,
|
||||
});
|
||||
|
||||
if (onPersonsTab && params.get('fuzzy') !== 'true') {
|
||||
this.updateQueryParams(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// the Fuzzy Search toggle is locked on while the Personen tab is active
|
||||
isPersonsTab(): boolean {
|
||||
return this.route.snapshot.firstChild?.routeConfig?.path === 'persons';
|
||||
}
|
||||
|
||||
tabFuzzyValue(route: { path: string }): boolean {
|
||||
if (route.path === 'persons') return true;
|
||||
return this.lastUserFuzzy();
|
||||
}
|
||||
goBackToSearch(): void {
|
||||
void this.router.navigate(['/keywords'], {
|
||||
queryParamsHandling: 'merge',
|
||||
|
||||
+40
-1
@@ -5,11 +5,50 @@
|
||||
[selectedAuthorsPage]="selectedAuthorsPage()"
|
||||
[showTopicFilter]="fuzzySearch()" />
|
||||
|
||||
<ng-template #snippetTmp let-work>
|
||||
<app-table-detail-row>
|
||||
<div table-detail-header>
|
||||
<h4 class="panel-field__label">Fundstelle in der Publikation</h4>
|
||||
</div>
|
||||
|
||||
<ng-container table-detail-body>
|
||||
@if (snippetHighlights().get(work.id); as snippet) {
|
||||
<article class="panel-field panel-field--full">
|
||||
<h4 class="panel-field__label">{{ snippetSourceLabel(work) }}</h4>
|
||||
<app-highlighted-text
|
||||
class="panel-field__text"
|
||||
[content]="snippet.content"
|
||||
[highlights]="snippet.terms" />
|
||||
</article>
|
||||
} @else if (work.matched_via?.length) {
|
||||
<article class="panel-field panel-field--full">
|
||||
<h4 class="panel-field__label">Kein Treffer im Text</h4>
|
||||
<p class="panel-field__text">
|
||||
Das gesuchte Keyword kommt weder im Titel noch im Abstract vor.
|
||||
Die Publikation wurde über
|
||||
{{ work.matched_via!.length === 1 ? 'das Thema' : 'die Themen' }}
|
||||
@for (name of work.matched_via; track name; let last = $last) {
|
||||
<span class="matched-topic">{{ name }}</span
|
||||
>{{ last ? '' : ', ' }}
|
||||
}
|
||||
gefunden.
|
||||
</p>
|
||||
</article>
|
||||
} @else {
|
||||
<span class="empty-text">
|
||||
Für diese Publikation liegt keine Fundstelle vor.
|
||||
</span>
|
||||
}
|
||||
</ng-container>
|
||||
</app-table-detail-row>
|
||||
</ng-template>
|
||||
|
||||
<app-publication-table
|
||||
[page]="workPage()"
|
||||
[authorFilterEnabled]="true"
|
||||
[institutionFilterEnabled]="true"
|
||||
[topicFilterEnabled]="fuzzySearch()" />
|
||||
[topicFilterEnabled]="fuzzySearch()"
|
||||
[detailTemplate]="fuzzySearch() ? null : snippetTmp" />
|
||||
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
|
||||
+9
@@ -82,3 +82,12 @@
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.matched-topic {
|
||||
color: var(--sg-text);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
+30
-2
@@ -11,8 +11,18 @@ import { PublicationTableComponent } from '../../../../shared/ui/publication-tab
|
||||
import { WorkPageV2 } from '../../../../api/model/workPageV2';
|
||||
import { PaginationService } from '../../../../shared/services/pagination.service';
|
||||
import { QueryParamPaginatorComponent } from '../../../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { AuthorPage, InstitutionPageV2, TopicPageV2 } from '../../../../api';
|
||||
import { SearchResultsStateService } from '../search-results-state.service';
|
||||
import {
|
||||
AuthorPage,
|
||||
InstitutionPageV2,
|
||||
TopicPageV2,
|
||||
Work,
|
||||
} from '../../../../api';
|
||||
import {
|
||||
SearchResultsStateService,
|
||||
SnippetHighlight,
|
||||
} from '../search-results-state.service';
|
||||
import { HighlightedTextComponent } from '../../../../shared/ui/highlighted-text/highlighted-text.component';
|
||||
import { TableDetailRowComponent } from '../../../../shared/ui/table-detail-row/table-detail-row.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-works-results',
|
||||
@@ -23,6 +33,8 @@ import { SearchResultsStateService } from '../search-results-state.service';
|
||||
PublicationTableComponent,
|
||||
PublicationFilterComponent,
|
||||
QueryParamPaginatorComponent,
|
||||
HighlightedTextComponent,
|
||||
TableDetailRowComponent,
|
||||
],
|
||||
templateUrl: './works-results.component.html',
|
||||
styleUrl: './works-results.component.scss',
|
||||
@@ -64,6 +76,22 @@ export class KeywordsToWorksResultsComponent implements OnInit {
|
||||
|
||||
fuzzySearch = computed(() => this.queryParamMap().get('fuzzy') === 'true');
|
||||
|
||||
readonly snippetHighlights = computed(() => {
|
||||
const byWorkId = new Map<string, SnippetHighlight>();
|
||||
|
||||
for (const work of this.elements()) {
|
||||
if (work.id && work.snippet) {
|
||||
byWorkId.set(work.id, this.state.snippetHighlight(work.snippet));
|
||||
}
|
||||
}
|
||||
|
||||
return byWorkId;
|
||||
});
|
||||
|
||||
snippetSourceLabel(work: Work): string {
|
||||
return work.snippet_field === 'title' ? 'Titel' : 'Abstract';
|
||||
}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
clearFilters(): void {
|
||||
|
||||
@@ -18,10 +18,6 @@ import {
|
||||
} from '../../shared/ui/highlighted-text/highlighted-text.component';
|
||||
import { WorksService } from '../../api';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import {
|
||||
highlightKeywords,
|
||||
topicKeywordColors,
|
||||
} from '../../resolvers/utils/keyword-highlight';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import {
|
||||
ARROW_BACK_ICON,
|
||||
|
||||
@@ -51,52 +51,13 @@
|
||||
<div class="card-body">
|
||||
@if (institution(); as inst) {
|
||||
<div class="institution-row" style="margin-bottom: 8px">
|
||||
<button
|
||||
type="button"
|
||||
class="institution-tag"
|
||||
[class.active]="isInstitutionActive()"
|
||||
[class.is-loading]="loading()"
|
||||
[matTooltip]="inst.display_name || ''"
|
||||
[matTooltipDisabled]="loading()"
|
||||
matTooltipPosition="above"
|
||||
(click)="institutionClick.emit(inst); $event.stopPropagation()">
|
||||
<mat-icon
|
||||
style="
|
||||
font-size: 12px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 4px;
|
||||
vertical-align: middle;
|
||||
"
|
||||
>{{ APARTMENT_ICON }}</mat-icon
|
||||
>
|
||||
<span
|
||||
[skText]="loading()"
|
||||
class="institution-name"
|
||||
style="vertical-align: middle"
|
||||
>{{ inst.display_name ?? '' }}</span
|
||||
>
|
||||
@if (inst.country_code && !loading()) {
|
||||
<app-country-flag
|
||||
[countryCode]="inst.country_code"
|
||||
[height]="10"
|
||||
[bordered]="false"
|
||||
style="margin-left: 6px" />
|
||||
<span
|
||||
class="country-code"
|
||||
style="font-size: 9px; margin-left: 2px; vertical-align: middle"
|
||||
>{{ inst.country_code.toUpperCase() }}</span
|
||||
>
|
||||
}
|
||||
@if (institutionPageId() && !loading()) {
|
||||
<mat-icon
|
||||
class="institution-open-icon"
|
||||
(click)="openInstitutionPage($event)"
|
||||
aria-label="Institutionsseite öffnen"
|
||||
>{{ OPEN_IN_NEW_ICON }}</mat-icon
|
||||
>
|
||||
}
|
||||
</button>
|
||||
<app-institution-chip
|
||||
[institution]="inst"
|
||||
size="mini"
|
||||
[showIcon]="true"
|
||||
[isClickable]="true"
|
||||
[isSelected]="isInstitutionActive()"
|
||||
(handleChipClick)="institutionClick.emit($event)" />
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -136,111 +136,6 @@
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.institution {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: var(--sg-text-muted);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.institution-tag {
|
||||
background: var(--sg-primary-soft);
|
||||
border: 1px solid var(--sg-primary-border, var(--sg-border));
|
||||
color: var(--sg-primary);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
transition: all 0.2s ease;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
line-height: normal;
|
||||
font-family: inherit;
|
||||
|
||||
.institution-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
app-country-flag {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.country-code {
|
||||
display: inline-block;
|
||||
flex-shrink: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: var(--sg-background);
|
||||
border-color: var(--sg-primary);
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--sg-background),
|
||||
0 0 0 4px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow:
|
||||
0 0 0 1px var(--sg-background),
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active:hover,
|
||||
&.active:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: var(--sg-background);
|
||||
}
|
||||
|
||||
&.is-loading {
|
||||
pointer-events: none;
|
||||
background: var(--sg-surface-soft);
|
||||
border-color: var(--sg-border);
|
||||
color: var(--sg-text-soft);
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
.person-id {
|
||||
margin: 2px 0 0;
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
import { Component, inject, input, computed, output } from '@angular/core';
|
||||
import { Component, input, computed, output } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api';
|
||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { CountryFlagComponent } from '../../shared/ui/country-flag/country-flag.component';
|
||||
import { AppInstitutionChipComponent } from '../../shared/ui/app-institution-chip/app-institution-chip.component';
|
||||
import { CareerStageChipComponent } from '../../shared/ui/career-stage-chip/career-stage-chip.component';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import {
|
||||
APARTMENT_ICON,
|
||||
BOOKMARK_BORDER_ICON,
|
||||
BOOKMARK_ICON,
|
||||
NETWORK_ICON,
|
||||
OPEN_IN_NEW_ICON,
|
||||
OVERVIEW_ICON,
|
||||
PUBLICATION_ICON,
|
||||
} from '../../shared/ui/icons';
|
||||
@@ -29,7 +27,7 @@ import {
|
||||
SkTextDirective,
|
||||
MatTooltipModule,
|
||||
TopicChipComponent,
|
||||
CountryFlagComponent,
|
||||
AppInstitutionChipComponent,
|
||||
CareerStageChipComponent,
|
||||
],
|
||||
templateUrl: './person-card.component.html',
|
||||
@@ -38,14 +36,10 @@ import {
|
||||
export class PersonCardComponent {
|
||||
readonly BOOKMARK_ICON = BOOKMARK_ICON;
|
||||
readonly BOOKMARK_BORDER_ICON = BOOKMARK_BORDER_ICON;
|
||||
readonly APARTMENT_ICON = APARTMENT_ICON;
|
||||
readonly OPEN_IN_NEW_ICON = OPEN_IN_NEW_ICON;
|
||||
readonly OVERVIEW_ICON = OVERVIEW_ICON;
|
||||
readonly PUBLICATION_ICON = PUBLICATION_ICON;
|
||||
readonly NETWORK_ICON = NETWORK_ICON;
|
||||
|
||||
private readonly router = inject(Router);
|
||||
|
||||
person = input.required<CustomAuthor>();
|
||||
isBookmarked = input<boolean>(false);
|
||||
loading = input<boolean>(false);
|
||||
@@ -89,20 +83,6 @@ export class PersonCardComponent {
|
||||
return newestInstitution;
|
||||
});
|
||||
|
||||
institutionPageId = computed<string | null>(
|
||||
() => this.institution()?.id?.split('/').pop() ?? null,
|
||||
);
|
||||
|
||||
openInstitutionPage(event: Event): void {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
const id = this.institutionPageId();
|
||||
if (!id) return;
|
||||
|
||||
void this.router.navigate(['/institution', id]);
|
||||
}
|
||||
|
||||
isInstitutionActive = computed<boolean>(() => {
|
||||
const active = this.normalizeInstitutionId(this.activeInstitutionId());
|
||||
if (!active) return false;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<mat-form-field
|
||||
class="funding-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix [fontIcon]="FILTER_ICON"></mat-icon>
|
||||
<mat-icon matPrefix>{{ FILTER_ICON }}</mat-icon>
|
||||
<mat-select
|
||||
[value]="activeFilter"
|
||||
(selectionChange)="setFilter($event.value)">
|
||||
@@ -31,7 +31,7 @@
|
||||
<mat-form-field
|
||||
class="funding-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix [fontIcon]="SORT_ICON"></mat-icon>
|
||||
<mat-icon matPrefix>{{ SORT_ICON }}</mat-icon>
|
||||
<mat-select
|
||||
[value]="sortColumn"
|
||||
(selectionChange)="setSort($event.value)">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix [fontIcon]="SORT_ICON"></mat-icon>
|
||||
<mat-icon matPrefix>{{ SORT_ICON }}</mat-icon>
|
||||
<mat-select
|
||||
[value]="sortColumn"
|
||||
(selectionChange)="setSort($event.value)">
|
||||
|
||||
@@ -122,7 +122,17 @@
|
||||
[size]="150"
|
||||
[diameter]="150"></app-loading>
|
||||
} @else if (personBio() != null) {
|
||||
<h3>Biografie</h3>
|
||||
<div class="bio-header">
|
||||
<h3>Biografie</h3>
|
||||
<span
|
||||
class="ai-badge"
|
||||
matTooltip="Diese Biografie wurde automatisch mit KI erstellt und kann Fehler enthalten."
|
||||
matTooltipPosition="above"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon>{{ AI_GENERATED_ICON }}</mat-icon>
|
||||
KI-generiert
|
||||
</span>
|
||||
</div>
|
||||
<p>{{ personBio() }}</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -217,12 +217,41 @@
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
}
|
||||
|
||||
.bio-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.bio-card h3 {
|
||||
margin: 0 0 18px;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.ai-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
background: var(--sg-warning-soft);
|
||||
color: var(--sg-warning);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
white-space: nowrap;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.ai-badge mat-icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.bio-card p {
|
||||
margin: 0;
|
||||
color: var(--sg-text);
|
||||
|
||||
@@ -49,6 +49,7 @@ import {
|
||||
LinkTabNavBarItem,
|
||||
} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||
import {
|
||||
AI_GENERATED_ICON,
|
||||
APARTMENT_ICON,
|
||||
BOOKMARK_BORDER_ICON,
|
||||
BOOKMARK_ICON,
|
||||
@@ -95,6 +96,7 @@ export class PersonComponent {
|
||||
readonly VERIFIED_ICON = VERIFIED_ICON;
|
||||
readonly DESCRIPTION_ICON = DESCRIPTION_ICON;
|
||||
readonly PERSON_ICON = PERSON_ICON;
|
||||
readonly AI_GENERATED_ICON = AI_GENERATED_ICON;
|
||||
|
||||
private readonly router = inject(Router);
|
||||
private readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<div
|
||||
echarts
|
||||
[options]="chartOption()"
|
||||
[autoResize]="true"
|
||||
class="chart-container"></div>
|
||||
@@ -1,4 +0,0 @@
|
||||
.chart-container {
|
||||
height: 500px;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
import {
|
||||
Component,
|
||||
ChangeDetectionStrategy,
|
||||
input,
|
||||
computed,
|
||||
} from '@angular/core';
|
||||
import { EChartsOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
import { UniversityTopicData } from '../../../api';
|
||||
|
||||
export type DashboardMetric = 'publications' | 'citations';
|
||||
|
||||
@Component({
|
||||
selector: 'app-university-line-chart',
|
||||
templateUrl: './uni-line-chart.component.html',
|
||||
styleUrl: './uni-line-chart.component.scss',
|
||||
imports: [NgxEchartsDirective],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class UniversityLineChartComponent {
|
||||
readonly data = input<UniversityTopicData[] | null>(null);
|
||||
readonly metric = input<DashboardMetric>('publications');
|
||||
|
||||
readonly chartOption = computed<EChartsOption>(() => {
|
||||
const rawData = this.data();
|
||||
if (!rawData || rawData.length === 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const years = rawData[0].yearly_data.map((d) => d.year);
|
||||
const chosenMetric = this.metric();
|
||||
|
||||
const series = rawData.map((uni) => ({
|
||||
name: uni.university,
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
emphasis: { focus: 'series' },
|
||||
animationDuration: 2000,
|
||||
data: uni.yearly_data.map((d) => {
|
||||
if (chosenMetric === 'citations') {
|
||||
return d.citations || 0;
|
||||
}
|
||||
return d.publications || 0;
|
||||
}),
|
||||
}));
|
||||
|
||||
return {
|
||||
title: {
|
||||
text: 'Research Output Over Time',
|
||||
left: 'center',
|
||||
textStyle: { fontWeight: 'lighter' },
|
||||
},
|
||||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||||
legend: { bottom: 0 },
|
||||
grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: years.map(String),
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name: chosenMetric === 'citations' ? 'Citations' : 'Publications',
|
||||
},
|
||||
dataZoom: [{ type: 'slider', show: true, bottom: 40 }],
|
||||
series: series as any,
|
||||
};
|
||||
});
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
<div class="ranking-card">
|
||||
<h4>Topic Rankings</h4>
|
||||
@if (loading) {
|
||||
<div class="skeleton-loader">Loading rankings...</div>
|
||||
} @else {
|
||||
<table class="ranking-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Rank</th>
|
||||
<th>University</th>
|
||||
<th>Latest</th>
|
||||
<th>5Y Growth</th>
|
||||
<th>Trend</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of rankings; track $index) {
|
||||
<tr [class.top-tier]="row.rank <= 3">
|
||||
<td>#{{ row.rank }}</td>
|
||||
<td>
|
||||
{{ row.university }}
|
||||
@if (row.is_top_mover) {
|
||||
<span class="mover-badge" title="Top mover last 3 years"
|
||||
>🔥</span
|
||||
>
|
||||
}
|
||||
</td>
|
||||
<td>{{ row.publications | number }}</td>
|
||||
<td
|
||||
[class.positive]="row.growth_rate > 0"
|
||||
[class.negative]="row.growth_rate < 0">
|
||||
{{ row.growth_rate | number: '1.0-1' }}%
|
||||
</td>
|
||||
<td class="trend-col" [attr.data-trend]="row.trend">
|
||||
{{ getTrendIcon(row.trend) }}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
// src/app/modules/university-ranking/components/ranking-table/university-ranking-table.component.ts
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { UniversityRanking } from '../../../api';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'app-university-ranking-table',
|
||||
templateUrl: './uni-ranking-table.component.html',
|
||||
styleUrls: ['./uni-ranking-table.component.scss'],
|
||||
imports: [DecimalPipe],
|
||||
})
|
||||
export class UniversityRankingTableComponent {
|
||||
@Input() rankings: UniversityRanking[] = [];
|
||||
@Input() loading: boolean = false;
|
||||
|
||||
getTrendIcon(trend: string): string {
|
||||
if (trend === 'up') return '↑';
|
||||
if (trend === 'down') return '↓';
|
||||
return '→';
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export const keywordsNewsQueryParamKeys = {
|
||||
yearTo: 'yearTo',
|
||||
topicId: 'topicId',
|
||||
sortOrder: 'sorting_order',
|
||||
title: 'title',
|
||||
} as const;
|
||||
|
||||
const emptyPage = (page: number, pageSize: number): NewsPage => ({
|
||||
@@ -47,6 +48,7 @@ export const keywordsNewsPageResolver: ResolveFn<NewsPage> = (route) => {
|
||||
const sortOrder = parseSortOrder(
|
||||
params.get(keywordsNewsQueryParamKeys.sortOrder),
|
||||
);
|
||||
const title = params.get(keywordsNewsQueryParamKeys.title) || undefined;
|
||||
|
||||
return inject(NewsService).getNewsByKeywords(
|
||||
keywords,
|
||||
@@ -59,6 +61,7 @@ export const keywordsNewsPageResolver: ResolveFn<NewsPage> = (route) => {
|
||||
yearFrom,
|
||||
yearTo,
|
||||
sortOrder,
|
||||
title,
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
import { MatchedTopic } from '../../api';
|
||||
import { topicHierarchyColor } from './topic-colors';
|
||||
|
||||
/** A keyword together with the colour and names of the topics it resolved to. */
|
||||
export interface KeywordColor {
|
||||
keyword: string;
|
||||
color: string;
|
||||
topicNames: string[];
|
||||
}
|
||||
|
||||
/** Pairs every keyword that resolved to a topic with that topic's colour. */
|
||||
export function topicKeywordColors(
|
||||
topics: readonly MatchedTopic[] | null | undefined,
|
||||
keywords?: readonly string[] | null,
|
||||
): KeywordColor[] {
|
||||
const byKeyword = new Map<string, Omit<KeywordColor, 'keyword'>>();
|
||||
|
||||
for (const topic of topics ?? []) {
|
||||
if (!topic.source_keyword) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const key = topic.source_keyword.toLowerCase();
|
||||
const topicName = topic.display_name?.trim();
|
||||
const existing = byKeyword.get(key);
|
||||
|
||||
if (existing) {
|
||||
if (topicName && !existing.topicNames.includes(topicName)) {
|
||||
existing.topicNames.push(topicName);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
byKeyword.set(key, {
|
||||
color: topicHierarchyColor({
|
||||
id: topic.id,
|
||||
name: topic.display_name,
|
||||
field_name: topic.field_name,
|
||||
domain_name: topic.domain_name,
|
||||
}),
|
||||
topicNames: topicName ? [topicName] : [],
|
||||
});
|
||||
}
|
||||
|
||||
const source =
|
||||
keywords ??
|
||||
(topics ?? [])
|
||||
.map((topic) => topic.source_keyword)
|
||||
.filter((keyword): keyword is string => !!keyword);
|
||||
|
||||
const seen = new Set<string>();
|
||||
const result: KeywordColor[] = [];
|
||||
|
||||
for (const keyword of source) {
|
||||
const key = keyword.toLowerCase();
|
||||
const entry = byKeyword.get(key);
|
||||
if (!entry || seen.has(key)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(key);
|
||||
result.push({ keyword, ...entry });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Explains, for a mark in the text, which topics its keyword is assigned to. */
|
||||
export function keywordTooltip(
|
||||
keyword: string,
|
||||
topicNames: readonly string[],
|
||||
): string {
|
||||
if (!topicNames.length) {
|
||||
return `„${keyword}“ ist keinem der aufgelisteten Themen zugeordnet.`;
|
||||
}
|
||||
|
||||
if (topicNames.length === 1) {
|
||||
return `„${keyword}“ ist dem Thema „${topicNames[0]}“ zugeordnet.`;
|
||||
}
|
||||
|
||||
const names = topicNames.map((name) => `„${name}“`).join(', ');
|
||||
return `„${keyword}“ ist den Themen ${names} zugeordnet.`;
|
||||
}
|
||||
|
||||
const WORD_CHAR = '[\\w\\u00C0-\\u024F]';
|
||||
|
||||
export const KW_MARK_CLASS = 'kw-mark';
|
||||
|
||||
export interface KeywordSegment {
|
||||
text: string;
|
||||
match: KeywordColor | null;
|
||||
}
|
||||
export function splitByKeywords(
|
||||
text: string,
|
||||
keywordColors: readonly KeywordColor[],
|
||||
): KeywordSegment[] {
|
||||
const sorted = [...keywordColors]
|
||||
.filter(({ keyword }) => keyword.trim())
|
||||
.sort((a, b) => b.keyword.length - a.keyword.length);
|
||||
|
||||
if (!sorted.length) {
|
||||
return text ? [{ text, match: null }] : [];
|
||||
}
|
||||
|
||||
// Acronyms are matched exactly, everything else may carry an inflection
|
||||
// ("Gründung" also marks "Gründungen").
|
||||
const alternatives = sorted.map(({ keyword }) =>
|
||||
isAcronymLike(keyword)
|
||||
? `${escapeRegex(keyword)}(?!${WORD_CHAR})`
|
||||
: `${escapeRegex(keyword)}${WORD_CHAR}*`,
|
||||
);
|
||||
const pattern = new RegExp(
|
||||
`(?<!${WORD_CHAR})(?:${alternatives.join('|')})`,
|
||||
'gi',
|
||||
);
|
||||
|
||||
const segments: KeywordSegment[] = [];
|
||||
let lastIndex = 0;
|
||||
let match: RegExpExecArray | null;
|
||||
|
||||
const pushPlain = (value: string) => {
|
||||
if (value) {
|
||||
segments.push({ text: value, match: null });
|
||||
}
|
||||
};
|
||||
|
||||
while ((match = pattern.exec(text)) !== null) {
|
||||
const matched = match[0];
|
||||
const entry = sorted.find(({ keyword }) =>
|
||||
matched.toLowerCase().startsWith(keyword.toLowerCase()),
|
||||
);
|
||||
if (!entry) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pushPlain(text.slice(lastIndex, match.index));
|
||||
segments.push({ text: matched, match: entry });
|
||||
|
||||
lastIndex = match.index + matched.length;
|
||||
}
|
||||
|
||||
pushPlain(text.slice(lastIndex));
|
||||
|
||||
return segments;
|
||||
}
|
||||
|
||||
export function highlightKeywords(
|
||||
text: string,
|
||||
keywordColors: readonly KeywordColor[],
|
||||
): string {
|
||||
return splitByKeywords(text, keywordColors)
|
||||
.map(({ text: value, match }) => {
|
||||
if (!match) {
|
||||
return escapeHtml(value);
|
||||
}
|
||||
|
||||
const tooltip = escapeHtml(
|
||||
keywordTooltip(match.keyword, match.topicNames),
|
||||
);
|
||||
|
||||
return (
|
||||
`<mark class="${KW_MARK_CLASS}" style="--t:${match.color}"` +
|
||||
` data-kw="${escapeHtml(match.keyword)}" title="${tooltip}">` +
|
||||
`${escapeHtml(value)}</mark>`
|
||||
);
|
||||
})
|
||||
.join('');
|
||||
}
|
||||
|
||||
export function escapeHtml(text: string): string {
|
||||
return text
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function escapeRegex(text: string): string {
|
||||
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
function isAcronymLike(keyword: string): boolean {
|
||||
return (
|
||||
keyword.length <= 3 ||
|
||||
(keyword === keyword.toUpperCase() && keyword !== keyword.toLowerCase())
|
||||
);
|
||||
}
|
||||
@@ -33,33 +33,35 @@
|
||||
}
|
||||
</mat-card-content>
|
||||
|
||||
<mat-divider />
|
||||
@if (this.rawOaAuthorId()) {
|
||||
<mat-divider />
|
||||
|
||||
<mat-card-footer>
|
||||
<mat-card-actions class="card-actions">
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/person', this.rawOaAuthorId()]"
|
||||
matButton="outlined">
|
||||
<mat-icon>{{ INFO_ICON }}</mat-icon>
|
||||
Übersicht
|
||||
</a>
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/person', this.rawOaAuthorId(), 'publications']"
|
||||
matButton="outlined">
|
||||
<mat-icon>{{ PUBLICATION_ICON }}</mat-icon>
|
||||
Publikationen
|
||||
</a>
|
||||
@if (this.showProjects()) {
|
||||
<mat-card-footer>
|
||||
<mat-card-actions class="card-actions">
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/person', this.rawOaAuthorId(), 'projects']"
|
||||
[routerLink]="['/person', this.rawOaAuthorId()]"
|
||||
matButton="outlined">
|
||||
<mat-icon>{{ PROJECT_ICON }}</mat-icon>
|
||||
Projekte
|
||||
<mat-icon>{{ INFO_ICON }}</mat-icon>
|
||||
Übersicht
|
||||
</a>
|
||||
}
|
||||
</mat-card-actions>
|
||||
</mat-card-footer>
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/person', this.rawOaAuthorId(), 'publications']"
|
||||
matButton="outlined">
|
||||
<mat-icon>{{ PUBLICATION_ICON }}</mat-icon>
|
||||
Publikationen
|
||||
</a>
|
||||
@if (this.showProjects()) {
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/person', this.rawOaAuthorId(), 'projects']"
|
||||
matButton="outlined">
|
||||
<mat-icon>{{ PROJECT_ICON }}</mat-icon>
|
||||
Projekte
|
||||
</a>
|
||||
}
|
||||
</mat-card-actions>
|
||||
</mat-card-footer>
|
||||
}
|
||||
</mat-card>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
class="author-chip"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ author: _author(), authorId: rawOaAuthorId() }"
|
||||
[tooltipDisabled]="isTooltipDisabled()"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(keydown)="_onChipClick($event)"
|
||||
(click)="_onChipClick($event)">
|
||||
|
||||
@@ -54,6 +54,20 @@ export class AppAuthorChipComponent {
|
||||
size = input<'normal' | 'mini'>('normal');
|
||||
isMiniSize = computed(() => this.size() === 'mini');
|
||||
|
||||
tooltipDisabled = input<boolean>(false);
|
||||
hasValidAuthor = computed(() => {
|
||||
const rawId = this.rawOaAuthorId();
|
||||
return Boolean(
|
||||
rawId &&
|
||||
rawId.trim().length > 0 &&
|
||||
rawId !== 'undefined' &&
|
||||
rawId !== 'null',
|
||||
);
|
||||
});
|
||||
isTooltipDisabled = computed(() => {
|
||||
return this.tooltipDisabled() || !this.hasValidAuthor();
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const author = this.author();
|
||||
@@ -73,6 +87,7 @@ export class AppAuthorChipComponent {
|
||||
}
|
||||
|
||||
_onChipClick(event: MouseEvent | KeyboardEvent) {
|
||||
event.stopPropagation();
|
||||
const author = this._author();
|
||||
if (this.handleChipClick && author) {
|
||||
this.handleChipClick.emit(author);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@let author = this._author();
|
||||
|
||||
@if (author) {
|
||||
@if (author && hasValidId()) {
|
||||
<app-author-card [author]="author" />
|
||||
}
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { Component, effect, inject, input, signal } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { Author, AuthorsV2Service } from '../../../api';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
@@ -27,9 +34,16 @@ export class AppAuthorTooltipComponent {
|
||||
author = input<Author | null | undefined>(undefined);
|
||||
|
||||
_author = signal<Author | undefined>(undefined);
|
||||
|
||||
_isLoading = signal<boolean>(false);
|
||||
|
||||
hasValidId = computed(() => {
|
||||
const a = this._author();
|
||||
const id = this.authorId() ?? a?.id;
|
||||
return Boolean(
|
||||
id && id.trim().length > 0 && id !== 'undefined' && id !== 'null',
|
||||
);
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const authorObj = this.author();
|
||||
|
||||
@@ -8,46 +8,76 @@
|
||||
">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ displayName() }}</mat-card-title>
|
||||
<mat-card-subtitle class="city-country">
|
||||
{{ institution().geo?.city }},
|
||||
{{ institution().geo?.country }}
|
||||
@if (institution().geo?.country_code) {
|
||||
<app-country-flag
|
||||
[countryCode]="institution().geo?.country_code"
|
||||
[height]="10"
|
||||
[bordered]="false"
|
||||
style="margin-left: 6px" />
|
||||
}
|
||||
</mat-card-subtitle>
|
||||
@if (locationText()) {
|
||||
<mat-card-subtitle class="city-country">
|
||||
<span>{{ locationText() }}</span>
|
||||
@if (countryCode()) {
|
||||
<app-country-flag
|
||||
[countryCode]="countryCode()!"
|
||||
[height]="10"
|
||||
[bordered]="false"
|
||||
style="margin-left: 6px" />
|
||||
}
|
||||
</mat-card-subtitle>
|
||||
}
|
||||
</mat-card-header>
|
||||
|
||||
<mat-divider />
|
||||
|
||||
<mat-card-content class="metrics">
|
||||
<div class="metric-item">
|
||||
<mat-icon>{{ PUBLICATION_ICON }}</mat-icon>
|
||||
<span
|
||||
>{{
|
||||
institution().works_count | number: undefined : 'de'
|
||||
}}
|
||||
Publikationen</span
|
||||
>
|
||||
</div>
|
||||
<div class="metric-item">
|
||||
<mat-icon>{{ CITATION_ICON }}</mat-icon>
|
||||
<span
|
||||
>{{
|
||||
institution().cited_by_count | number: undefined : 'de'
|
||||
}}
|
||||
Zitationen</span
|
||||
>
|
||||
</div>
|
||||
@if (
|
||||
institution().works_count !== null &&
|
||||
institution().works_count !== undefined
|
||||
) {
|
||||
<div class="metric-item">
|
||||
<mat-icon>{{ PUBLICATION_ICON }}</mat-icon>
|
||||
<span
|
||||
>{{
|
||||
institution().works_count | number: undefined : 'de'
|
||||
}}
|
||||
Publikationen</span
|
||||
>
|
||||
</div>
|
||||
}
|
||||
@if (
|
||||
institution().cited_by_count !== null &&
|
||||
institution().cited_by_count !== undefined
|
||||
) {
|
||||
<div class="metric-item">
|
||||
<mat-icon>{{ CITATION_ICON }}</mat-icon>
|
||||
<span
|
||||
>{{
|
||||
institution().cited_by_count | number: undefined : 'de'
|
||||
}}
|
||||
Zitationen</span
|
||||
>
|
||||
</div>
|
||||
}
|
||||
@if (
|
||||
institution().summary_stats?.h_index !== null &&
|
||||
institution().summary_stats?.h_index !== undefined
|
||||
) {
|
||||
<div class="metric-item">
|
||||
<mat-icon>{{ TRENDING_UP_ICON }}</mat-icon>
|
||||
<span>h-Index: {{ institution().summary_stats?.h_index }}</span>
|
||||
</div>
|
||||
}
|
||||
</mat-card-content>
|
||||
|
||||
<mat-divider />
|
||||
|
||||
<mat-card-footer>
|
||||
<mat-card-actions class="card-actions">
|
||||
@if (institution().id) {
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/institution', stripOpenAlexId(institution().id)]"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>{{ INFO_ICON }}</mat-icon>
|
||||
Übersicht
|
||||
</a>
|
||||
}
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="[
|
||||
|
||||
@@ -18,8 +18,10 @@ import { CountryFlagComponent } from '../country-flag/country-flag.component';
|
||||
|
||||
import {
|
||||
CITATION_ICON,
|
||||
INFO_ICON,
|
||||
PROJECT_ICON,
|
||||
PUBLICATION_ICON,
|
||||
TRENDING_UP_ICON,
|
||||
VERIFIED_ICON,
|
||||
} from '../icons';
|
||||
|
||||
@@ -42,6 +44,8 @@ export class AppInstitutionCardComponent {
|
||||
readonly CITATION_ICON = CITATION_ICON;
|
||||
readonly PROJECT_ICON = PROJECT_ICON;
|
||||
readonly VERIFIED_ICON = VERIFIED_ICON;
|
||||
readonly INFO_ICON = INFO_ICON;
|
||||
readonly TRENDING_UP_ICON = TRENDING_UP_ICON;
|
||||
|
||||
private readonly authService = inject(AuthService);
|
||||
private readonly patentsApi = inject(PatentsService);
|
||||
@@ -58,6 +62,21 @@ export class AppInstitutionCardComponent {
|
||||
return 'Unbekannte Institution';
|
||||
});
|
||||
|
||||
locationText = computed(() => {
|
||||
const geo = this.institution().geo;
|
||||
if (!geo) return null;
|
||||
const parts = [geo.city, geo.country].filter(Boolean);
|
||||
return parts.length > 0 ? parts.join(', ') : null;
|
||||
});
|
||||
|
||||
countryCode = computed(() => {
|
||||
return (
|
||||
this.institution().geo?.country_code ??
|
||||
this.institution().country_code ??
|
||||
null
|
||||
);
|
||||
});
|
||||
|
||||
private readonly isOwnInstitutionSignal = signal(false);
|
||||
isOwnInstitution = this.isOwnInstitutionSignal.asReadonly();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
institution: _institution(),
|
||||
institutionId: rawOaInstitutionId(),
|
||||
}"
|
||||
[tooltipDisabled]="isTooltipDisabled()"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(keydown)="_onChipClick($event)"
|
||||
(click)="_onChipClick($event)">
|
||||
|
||||
@@ -7,11 +7,16 @@ import {
|
||||
output,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { Institution, InstitutionsV2Service } from '../../../api';
|
||||
import {
|
||||
DehydratedInstitution,
|
||||
Institution,
|
||||
InstitutionsV2Service,
|
||||
} from '../../../api';
|
||||
import { AppInstitutionTooltipComponent } from '../app-institution-tooltip/app-institution-tooltip.component';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { ComponentTooltipDirective } from '../../../directives/component-tooltip.directive';
|
||||
import { INSTITUTION_ICON } from '../icons';
|
||||
|
||||
@Component({
|
||||
host: {
|
||||
@@ -33,22 +38,40 @@ export class AppInstitutionChipComponent {
|
||||
isSelected = input<boolean>(false);
|
||||
|
||||
isClickable = input<boolean>(false);
|
||||
handleChipClick = output<Institution>();
|
||||
handleChipClick = output<Institution | DehydratedInstitution>();
|
||||
|
||||
showIcon = input<boolean>(false);
|
||||
icon = input<string>('apartment');
|
||||
icon = input<string>(INSTITUTION_ICON);
|
||||
|
||||
institution = input<Institution | undefined>(undefined);
|
||||
institution = input<Institution | DehydratedInstitution | undefined>(
|
||||
undefined,
|
||||
);
|
||||
rawOaInstitutionId = computed(() => {
|
||||
return this.stripOpenAlexId(this.institution()?.id);
|
||||
});
|
||||
institutionId = input<string | undefined>(undefined);
|
||||
|
||||
_institution = signal<Institution | undefined>(undefined);
|
||||
_institution = signal<Institution | DehydratedInstitution | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
size = input<'normal' | 'mini'>('normal');
|
||||
isMiniSize = computed(() => this.size() === 'mini');
|
||||
|
||||
tooltipDisabled = input<boolean>(false);
|
||||
hasValidInstitution = computed(() => {
|
||||
const rawId = this.rawOaInstitutionId() ?? this.institutionId();
|
||||
return Boolean(
|
||||
rawId &&
|
||||
rawId.trim().length > 0 &&
|
||||
rawId !== 'undefined' &&
|
||||
rawId !== 'null',
|
||||
);
|
||||
});
|
||||
isTooltipDisabled = computed(() => {
|
||||
return this.tooltipDisabled() || !this.hasValidInstitution();
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const institution = this.institution();
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
@let institution = this._institution();
|
||||
|
||||
@if (institution) {
|
||||
@if (institution && hasValidId()) {
|
||||
<app-institution-card [institution]="institution" />
|
||||
}
|
||||
|
||||
+42
-10
@@ -1,5 +1,16 @@
|
||||
import { Component, effect, inject, input, signal } from '@angular/core';
|
||||
import { Institution, InstitutionsV2Service } from '../../../api';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import {
|
||||
DehydratedInstitution,
|
||||
Institution,
|
||||
InstitutionsV2Service,
|
||||
} from '../../../api';
|
||||
import { AppInstitutionCardComponent } from '../app-institution-card/app-institution-card.component';
|
||||
|
||||
@Component({
|
||||
@@ -12,24 +23,42 @@ export class AppInstitutionTooltipComponent {
|
||||
private readonly institutionsService = inject(InstitutionsV2Service);
|
||||
|
||||
institutionId = input<string | null | undefined>(undefined);
|
||||
institution = input<Institution | null | undefined>(undefined);
|
||||
institution = input<Institution | DehydratedInstitution | null | undefined>(
|
||||
undefined,
|
||||
);
|
||||
|
||||
_institution = signal<Institution | undefined>(undefined);
|
||||
|
||||
_isLoading = signal<boolean>(false);
|
||||
|
||||
hasValidId = computed(() => {
|
||||
const inst = this._institution();
|
||||
const id = this.institutionId() ?? inst?.id;
|
||||
return Boolean(
|
||||
id && id.trim().length > 0 && id !== 'undefined' && id !== 'null',
|
||||
);
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const institutionObj = this.institution();
|
||||
const institutionId = this.institutionId() ?? institutionObj?.id;
|
||||
|
||||
if (institutionObj) {
|
||||
this._institution.set(institutionObj);
|
||||
this._isLoading.set(false);
|
||||
}
|
||||
const hasCompleteMetrics = Boolean(
|
||||
institutionObj &&
|
||||
(institutionObj as Institution).works_count !== undefined &&
|
||||
(institutionObj as Institution).works_count !== null &&
|
||||
(institutionObj as Institution).cited_by_count !== undefined &&
|
||||
(institutionObj as Institution).cited_by_count !== null,
|
||||
);
|
||||
|
||||
if (institutionId) {
|
||||
if (hasCompleteMetrics && institutionObj) {
|
||||
this._institution.set(institutionObj as Institution);
|
||||
this._isLoading.set(false);
|
||||
} else if (institutionId) {
|
||||
const cleanId = institutionId.replace('https://openalex.org/', '');
|
||||
if (institutionObj) {
|
||||
this._institution.set(institutionObj as Institution);
|
||||
}
|
||||
this._isLoading.set(true);
|
||||
this.institutionsService.getInstitutionById2(cleanId).subscribe({
|
||||
next: (fetchedInst) => {
|
||||
@@ -43,7 +72,10 @@ export class AppInstitutionTooltipComponent {
|
||||
this._isLoading.set(false);
|
||||
},
|
||||
});
|
||||
} else if (!institutionObj) {
|
||||
} else if (institutionObj) {
|
||||
this._institution.set(institutionObj as Institution);
|
||||
this._isLoading.set(false);
|
||||
} else {
|
||||
this._institution.set(undefined);
|
||||
this._isLoading.set(false);
|
||||
}
|
||||
|
||||
+27
-10
@@ -11,23 +11,40 @@ import { AppPublicationCardComponent } from '../app-publication-card/app-publica
|
||||
export class AppPublicationTooltipComponent {
|
||||
private readonly worksService = inject(WorksV2Service);
|
||||
|
||||
workId = input.required<string>();
|
||||
workId = input<string | null | undefined>(undefined);
|
||||
work = input<Work | null | undefined>(undefined);
|
||||
|
||||
_work = signal<Work | undefined>(undefined);
|
||||
|
||||
_isLoading = signal<boolean>(false);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const workId = this.workId();
|
||||
if (!workId) {
|
||||
this._work.set(undefined);
|
||||
}
|
||||
this._isLoading.set(true);
|
||||
this.worksService.getWorkById(workId).subscribe((work) => {
|
||||
this._work.set(work);
|
||||
const workObj = this.work();
|
||||
const workId = this.workId() ?? workObj?.id;
|
||||
|
||||
if (workObj) {
|
||||
this._work.set(workObj);
|
||||
this._isLoading.set(false);
|
||||
});
|
||||
}
|
||||
|
||||
if (workId) {
|
||||
this._isLoading.set(true);
|
||||
this.worksService.getWorkById(workId).subscribe({
|
||||
next: (fetchedWork) => {
|
||||
this._work.set({
|
||||
...workObj,
|
||||
...fetchedWork,
|
||||
});
|
||||
this._isLoading.set(false);
|
||||
},
|
||||
error: () => {
|
||||
this._isLoading.set(false);
|
||||
},
|
||||
});
|
||||
} else if (!workObj) {
|
||||
this._work.set(undefined);
|
||||
this._isLoading.set(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,7 @@ export class AppTopicChipComponent {
|
||||
});
|
||||
|
||||
_onChipClick(event: MouseEvent | KeyboardEvent) {
|
||||
event.stopPropagation();
|
||||
const topic = this.topic();
|
||||
if (this.isClickable() && this.handleChipClick && topic) {
|
||||
this.handleChipClick.emit(topic);
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
[matTooltip]="getInstitutionTooltipText(institutions[0])"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getInstitutionTooltipText(institutions[0])"
|
||||
(click)="filterByInstitution(institutions[0])">
|
||||
(click)="filterByInstitution($event, institutions[0])">
|
||||
<mat-icon class="institution-icon">{{ APARTMENT_ICON }}</mat-icon>
|
||||
<span class="institution-name">{{
|
||||
institutions[0].name || institutions[0].recepient || '-'
|
||||
@@ -72,7 +72,7 @@
|
||||
[class.active]="isFundingTypeActive(project.funding_type)"
|
||||
matTooltip="Nach Typ filtern"
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleFundingTypeFilter(project.funding_type)">
|
||||
(click)="toggleFundingTypeFilter($event, project.funding_type)">
|
||||
<app-chip [color]="getFundingTypeColor(project.funding_type)">
|
||||
<span>{{ project.funding_type }}</span>
|
||||
</app-chip>
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:host ::ng-deep .mat-column-title {
|
||||
min-width: 280px;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Shared tags & chips
|
||||
// ------------------------
|
||||
@@ -164,48 +168,6 @@
|
||||
max-width: 200px;
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Data table overrides (applied via ::ng-deep)
|
||||
// ------------------------
|
||||
|
||||
::ng-deep {
|
||||
.mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
.mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
.mat-column-type,
|
||||
.mat-column-year,
|
||||
.mat-column-language,
|
||||
.mat-column-citations,
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mat-mdc-cell:not(:last-child),
|
||||
.mat-mdc-header-cell:not(:last-child) {
|
||||
border-right: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.mat-column-institutions,
|
||||
.mat-column-topics {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Responsive adjustments
|
||||
// ------------------------
|
||||
|
||||
@@ -203,7 +203,8 @@ export class BundProjectTableComponent implements OnInit {
|
||||
if (normalized == 'übrige indirekte projektförderung') return 'help';
|
||||
return 'info';
|
||||
}
|
||||
toggleFundingTypeFilter(type: string): void {
|
||||
toggleFundingTypeFilter(event: Event, type: string): void {
|
||||
event.stopPropagation();
|
||||
const selectedTypes = this.selectedFundingTypesQueryParams();
|
||||
if (selectedTypes.includes(type)) {
|
||||
this.router.navigate([], {
|
||||
@@ -271,7 +272,8 @@ export class BundProjectTableComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
filterByInstitution(institution: any): void {
|
||||
filterByInstitution(event: Event, institution: any): void {
|
||||
event.stopPropagation();
|
||||
const institutionName = institution.name ?? institution.recepient;
|
||||
|
||||
if (!institutionName || !this.institutionFilterEnabled()) return;
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
type="button"
|
||||
class="chip-overflow-toggle"
|
||||
[attr.aria-expanded]="expanded()"
|
||||
(click)="toggle.emit()">
|
||||
(click)="handleToggleClick($event)">
|
||||
{{ expanded() ? 'weniger' : '+' + hiddenCount() }}
|
||||
</button>
|
||||
|
||||
@@ -10,5 +10,9 @@ export class ChipOverflowToggleComponent {
|
||||
expanded = input<boolean>(false);
|
||||
hiddenCount = input<number>(0);
|
||||
|
||||
toggle = output<void>();
|
||||
toggle = output<MouseEvent>();
|
||||
handleToggleClick(event: MouseEvent): void {
|
||||
event.stopPropagation();
|
||||
this.toggle.emit(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,31 @@
|
||||
matSort
|
||||
(matSortChange)="_handleSortChange($event)"
|
||||
multiTemplateDataRows>
|
||||
@if (detailTemplate()) {
|
||||
<ng-container [matColumnDef]="expandColumnId">
|
||||
<th mat-header-cell *matHeaderCellDef class="expand-cell"></th>
|
||||
<td mat-cell *matCellDef="let row" class="expand-cell">
|
||||
@if (isExpandable(row)) {
|
||||
@let expanded = row === expandedElement();
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
[attr.aria-expanded]="expanded"
|
||||
[matTooltip]="
|
||||
expanded ? 'Details ausblenden' : 'Details anzeigen'
|
||||
"
|
||||
[attr.aria-label]="
|
||||
expanded ? 'Details ausblenden' : 'Details anzeigen'
|
||||
">
|
||||
<mat-icon class="expand-icon" [class.is-expanded]="expanded">
|
||||
expand_more
|
||||
</mat-icon>
|
||||
</button>
|
||||
}
|
||||
</td>
|
||||
</ng-container>
|
||||
}
|
||||
|
||||
@for (col of columns(); track col.id) {
|
||||
<ng-container [matColumnDef]="col.id">
|
||||
@if (col.headerTemplate) {
|
||||
@@ -61,6 +86,8 @@
|
||||
mat-row
|
||||
*matRowDef="let row; columns: displayedColumns()"
|
||||
class="element-row"
|
||||
[class.is-expandable]="isExpandable(row)"
|
||||
[class.is-expanded]="row === expandedElement()"
|
||||
(click)="toggleRow(row)"></tr>
|
||||
|
||||
<tr
|
||||
|
||||
@@ -18,12 +18,32 @@ tr.detail-row {
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
.detail-row .mat-mdc-cell {
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.detail-row-wrapper {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.element-row:hover {
|
||||
.element-row.is-expandable:hover {
|
||||
background: var(--sg-surface-soft);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.expand-cell {
|
||||
width: 1%;
|
||||
white-space: nowrap;
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
color: var(--sg-text-muted);
|
||||
transition: transform 150ms ease-in-out;
|
||||
|
||||
&.is-expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ import {
|
||||
SortDirection,
|
||||
} from '@angular/material/sort';
|
||||
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
|
||||
export interface BaseColumn<T> {
|
||||
@@ -43,7 +46,15 @@ export type GenericColumn<T> = AccessorColumn<T> | DisplayColumn<T>;
|
||||
@Component({
|
||||
selector: 'app-data-table',
|
||||
standalone: true,
|
||||
imports: [MatTableModule, NgTemplateOutlet, MatSortModule, SkTextDirective],
|
||||
imports: [
|
||||
MatTableModule,
|
||||
NgTemplateOutlet,
|
||||
MatSortModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatTooltipModule,
|
||||
SkTextDirective,
|
||||
],
|
||||
templateUrl: './data-table.component.html',
|
||||
styleUrl: './data-table.component.scss',
|
||||
})
|
||||
@@ -54,6 +65,7 @@ export class DataTableComponent<T> implements AfterViewInit {
|
||||
|
||||
detailTemplate = input<TemplateRef<any> | null>(null);
|
||||
expandedElement = signal<T | null>(null);
|
||||
canExpand = input<((row: T) => boolean) | null>(null);
|
||||
|
||||
maxHeight = input<string | null>(null);
|
||||
containerOverflow = computed(() => (this.maxHeight() ? 'auto' : 'visible'));
|
||||
@@ -78,7 +90,12 @@ export class DataTableComponent<T> implements AfterViewInit {
|
||||
|
||||
handleSortChange = output<Sort>();
|
||||
|
||||
displayedColumns = computed(() => this.columns().map((col) => col.id));
|
||||
readonly expandColumnId = 'expand';
|
||||
|
||||
displayedColumns = computed(() => {
|
||||
const ids = this.columns().map((col) => col.id);
|
||||
return this.detailTemplate() ? [this.expandColumnId, ...ids] : ids;
|
||||
});
|
||||
dataSource = new MatTableDataSource<T>([]);
|
||||
|
||||
sort = viewChild.required(MatSort);
|
||||
@@ -160,8 +177,13 @@ export class DataTableComponent<T> implements AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
isExpandable(row: T): boolean {
|
||||
if (!this.detailTemplate()) return false;
|
||||
return this.canExpand()?.(row) ?? true;
|
||||
}
|
||||
|
||||
toggleRow(row: T): void {
|
||||
if (!this.detailTemplate()) return;
|
||||
if (!this.isExpandable(row)) return;
|
||||
this.expandedElement.update((current) => (current === row ? null : row));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,7 @@
|
||||
@let isClassificationsExpanded = isProjectClassificationsExpanded(project);
|
||||
@let visibleClassifications =
|
||||
isClassificationsExpanded ? classifications : classifications.slice(0, 3);
|
||||
<div
|
||||
class="classification-tags"
|
||||
aria-label="Fachsystematik"
|
||||
style="padding: 0.5rem 0.5rem">
|
||||
<div class="classification-tags" aria-label="Fachsystematik">
|
||||
@for (classification of visibleClassifications; track $index) {
|
||||
<span
|
||||
class="publication-institution-tag classification-tag"
|
||||
@@ -183,7 +180,7 @@
|
||||
[matTooltip]="getAuthorTooltipText(author)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getAuthorTooltipText(author)"
|
||||
(click)="filterByAuthor(author.person_id!)">
|
||||
(click)="filterByAuthor($event, author.person_id!)">
|
||||
<mat-icon class="institution-icon">{{ PERSON_ICON }}</mat-icon>
|
||||
<span class="institution-name">{{ author.full_name }}</span>
|
||||
</button>
|
||||
@@ -219,7 +216,7 @@
|
||||
[matTooltip]="getInstitutionTooltipText(institution)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getInstitutionTooltipText(institution)"
|
||||
(click)="filterByInstitution(institution)">
|
||||
(click)="filterByInstitution($event, institution)">
|
||||
<mat-icon class="institution-icon">{{ APARTMENT_ICON }}</mat-icon>
|
||||
<span class="institution-name">{{
|
||||
institution.institute_name_de || institution.institute_name_en
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:host ::ng-deep {
|
||||
.mat-column-title {
|
||||
min-width: 280px;
|
||||
}
|
||||
|
||||
.mat-column-names {
|
||||
min-width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Shared tags & chips
|
||||
// ------------------------
|
||||
@@ -112,7 +122,9 @@
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.classification-tags {
|
||||
padding: 0.5rem 0.5rem;
|
||||
}
|
||||
.topic-chips {
|
||||
max-width: 320px;
|
||||
}
|
||||
@@ -152,48 +164,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Data table overrides (applied via ::ng-deep)
|
||||
// ------------------------
|
||||
|
||||
::ng-deep {
|
||||
.mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
.mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
.mat-column-type,
|
||||
.mat-column-year,
|
||||
.mat-column-language,
|
||||
.mat-column-citations,
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mat-mdc-cell:not(:last-child),
|
||||
.mat-mdc-header-cell:not(:last-child) {
|
||||
border-right: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.mat-column-institutions,
|
||||
.mat-column-topics {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Responsive adjustments
|
||||
// ------------------------
|
||||
|
||||
@@ -234,7 +234,8 @@ export class DfgProjectTableComponent implements OnInit {
|
||||
}
|
||||
return `Autor: ${author.full_name}`;
|
||||
}
|
||||
filterByAuthor(authorId: number): void {
|
||||
filterByAuthor(event: Event, authorId: number): void {
|
||||
event.stopPropagation();
|
||||
if (!authorId || !this.authorFilterEnabled()) return;
|
||||
const selectedAuthorIds = this.selectedAuthorIdsQueryParams();
|
||||
if (selectedAuthorIds.includes(String(authorId))) {
|
||||
@@ -317,7 +318,8 @@ export class DfgProjectTableComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
filterByInstitution(institution: any): void {
|
||||
filterByInstitution(event: Event, institution: any): void {
|
||||
event.stopPropagation();
|
||||
const institutionId = this.getProjectInstitutionId(institution);
|
||||
|
||||
if (!institutionId || !this.institutionFilterEnabled()) return;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
[class.active]="isTypeActive(project.project_type)"
|
||||
matTooltip="Nach Typ filtern"
|
||||
matTooltipPosition="above"
|
||||
(click)="toggleTypeFilter(project.project_type)">
|
||||
(click)="toggleTypeFilter($event, project.project_type)">
|
||||
<app-chip [color]="getProjectTypeColor(project.project_type)">
|
||||
<span>{{ getProjectTypeLabel(project) }}</span>
|
||||
</app-chip>
|
||||
@@ -92,7 +92,7 @@
|
||||
[matTooltip]="getOrganizationTooltipText(organization)"
|
||||
matTooltipPosition="above"
|
||||
[attr.aria-label]="getOrganizationTooltipText(organization)"
|
||||
(click)="filterByOrganization(organization)">
|
||||
(click)="filterByOrganization($event, organization)">
|
||||
<mat-icon class="institution-icon">{{ APARTMENT_ICON }}</mat-icon>
|
||||
<span class="institution-name">
|
||||
{{ getOrganizationName(organization) }}
|
||||
@@ -106,7 +106,7 @@
|
||||
<app-chip-overflow-toggle
|
||||
[expanded]="isExpanded"
|
||||
[hiddenCount]="organizations.length - 3"
|
||||
(toggle)="toggleProjectOrganizationsExpansion(project)" />
|
||||
(toggle)="toggleProjectOrganizationsExpansion($event, project)" />
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
@@ -133,7 +133,7 @@
|
||||
<app-chip-overflow-toggle
|
||||
[expanded]="isExpanded"
|
||||
[hiddenCount]="projectTopics.length - 3"
|
||||
(toggle)="toggleProjectTopicsExpansion(project)" />
|
||||
(toggle)="toggleProjectTopicsExpansion($event, project)" />
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -4,6 +4,16 @@
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:host ::ng-deep {
|
||||
.mat-column-title {
|
||||
min-width: 280px;
|
||||
}
|
||||
|
||||
.mat-column-authors {
|
||||
min-width: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------
|
||||
// Shared tags & chips
|
||||
// ------------------------
|
||||
@@ -142,47 +152,7 @@
|
||||
.classification-container {
|
||||
max-width: 200px;
|
||||
}
|
||||
// ------------------------
|
||||
// Data table overrides (applied via ::ng-deep)
|
||||
// ------------------------
|
||||
|
||||
::ng-deep {
|
||||
.mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
.mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
.mat-column-type,
|
||||
.mat-column-year,
|
||||
.mat-column-language,
|
||||
.mat-column-citations,
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mat-mdc-cell:not(:last-child),
|
||||
.mat-mdc-header-cell:not(:last-child) {
|
||||
border-right: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.mat-column-institutions,
|
||||
.mat-column-topics {
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
.type-filter-btn {
|
||||
display: inline-flex;
|
||||
margin: 0;
|
||||
|
||||
@@ -207,7 +207,8 @@ export class EuProjectTableComponent {
|
||||
isTypeActive(type: string): boolean {
|
||||
return this.selectedTypesQueryParams().includes(type);
|
||||
}
|
||||
toggleTypeFilter(type: string): void {
|
||||
toggleTypeFilter(event: Event, type: string): void {
|
||||
event.stopPropagation();
|
||||
const selectedTypes = this.selectedTypesQueryParams();
|
||||
if (selectedTypes.includes(type)) {
|
||||
this.router.navigate([], {
|
||||
@@ -427,7 +428,11 @@ export class EuProjectTableComponent {
|
||||
return `Organisation: ${name}`;
|
||||
}
|
||||
|
||||
filterByOrganization(organization: EuCordisOrganizationSummary | any): void {
|
||||
filterByOrganization(
|
||||
event: Event,
|
||||
organization: EuCordisOrganizationSummary | any,
|
||||
): void {
|
||||
event.stopPropagation();
|
||||
const organizationId = this.getOrganizationId(organization);
|
||||
|
||||
if (!organizationId || !this.institutionFilterEnabled()) return;
|
||||
@@ -452,7 +457,11 @@ export class EuProjectTableComponent {
|
||||
return this.expandedProjectOrganizationsIds.includes(projectId);
|
||||
}
|
||||
|
||||
toggleProjectOrganizationsExpansion(project: EuCordisProjectSummary): void {
|
||||
toggleProjectOrganizationsExpansion(
|
||||
event: Event,
|
||||
project: EuCordisProjectSummary,
|
||||
): void {
|
||||
event.stopPropagation();
|
||||
const projectId = this.getProjectId(project);
|
||||
if (!projectId) return;
|
||||
|
||||
@@ -523,7 +532,11 @@ export class EuProjectTableComponent {
|
||||
return this.expandedProjectTopicsIds.includes(projectId);
|
||||
}
|
||||
|
||||
toggleProjectTopicsExpansion(project: EuCordisProjectSummary): void {
|
||||
toggleProjectTopicsExpansion(
|
||||
event: Event,
|
||||
project: EuCordisProjectSummary,
|
||||
): void {
|
||||
event.stopPropagation();
|
||||
const projectId = this.getProjectId(project);
|
||||
if (!projectId) return;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user