Compare commits
66
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1a6c32e0c | ||
|
|
cf5a3e7d3d | ||
|
|
89f45082fb | ||
|
|
0ad6ac70ff | ||
|
|
e8e0decc6c | ||
|
|
57aaf77162 | ||
|
|
07ce24143b | ||
|
|
bf5e065520 | ||
|
|
08178e74d2 | ||
|
|
c66fcff906 | ||
|
|
b0dd0e509d | ||
|
|
719da6e921 | ||
|
|
e4b3d0a9a9 | ||
|
|
c0e231a32b | ||
|
|
af9f9a25da | ||
|
|
0a465bc7e1 | ||
|
|
aec735e09e | ||
|
|
9ce6d5f26e | ||
|
|
f4b4fb0562 | ||
|
|
aa22fad67d | ||
|
|
548bb4ce70 | ||
|
|
b6871b3618 | ||
|
|
fe5e816551 | ||
|
|
20d2a281b1 | ||
|
|
e2ae0c660a | ||
|
|
9e8ae16597 | ||
|
|
e5284a79c9 | ||
|
|
79dad5dfb0 | ||
|
|
a511c16fb1 | ||
|
|
98a1214a4d | ||
|
|
be459c45cf | ||
|
|
328ef2938c | ||
|
|
21f3f49078 | ||
|
|
882ad3b8cf | ||
|
|
d8b7d8bc2e | ||
|
|
c1692535a5 | ||
|
|
af0e326747 | ||
|
|
6cdaa9738a | ||
|
|
1e5d0c4517 | ||
|
|
127f5ca287 | ||
|
|
f51b775fd9 | ||
|
|
0015b92591 | ||
|
|
37e1f1811f | ||
|
|
daa4f79ea0 | ||
|
|
c70a566514 | ||
|
|
b99d3a7ff1 | ||
|
|
30cbb080b0 | ||
|
|
d8eec59d5d | ||
|
|
be89e2986b | ||
|
|
916af84651 | ||
|
|
4e5ab529de | ||
|
|
3b1ffda3b2 | ||
|
|
cdf58044a8 | ||
|
|
e9fdf7d538 | ||
|
|
57f221868d | ||
|
|
ae7d1a54cb | ||
|
|
71b075b365 | ||
|
|
fb40bc548e | ||
|
|
d06c1954a5 | ||
|
|
545d487fea | ||
|
|
62f0812aae | ||
|
|
e0dda3ea0c | ||
|
|
7628f219e2 | ||
|
|
1d7a54c866 | ||
|
|
6c55493acb | ||
|
|
42bcac251b |
@@ -622,7 +622,7 @@ async def get_dashboard_dfg_projects(
|
|||||||
) -> DashboardStatisticValue:
|
) -> DashboardStatisticValue:
|
||||||
normalized_id = _normalize_institution_id(institution_id)
|
normalized_id = _normalize_institution_id(institution_id)
|
||||||
period = _dashboard_period(from_year, to_year)
|
period = _dashboard_period(from_year, to_year)
|
||||||
projects = await projects_service.get_dfg_projects_by_author_id(
|
projects = await projects_service.get_dfg_projects(
|
||||||
institutions_search_client=InstitutionsSearchClient(),
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
raw_oa_institution_id=_raw_institution_id(normalized_id),
|
raw_oa_institution_id=_raw_institution_id(normalized_id),
|
||||||
author_id=None,
|
author_id=None,
|
||||||
@@ -871,7 +871,7 @@ async def _get_dfg_project_ids_from_projects_service(
|
|||||||
project_ids: set[str] = set()
|
project_ids: set[str] = set()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
projects = await projects_service.get_dfg_projects_by_author_id(
|
projects = await projects_service.get_dfg_projects(
|
||||||
institutions_search_client=InstitutionsSearchClient(),
|
institutions_search_client=InstitutionsSearchClient(),
|
||||||
raw_oa_institution_id=_raw_institution_id(institution_id),
|
raw_oa_institution_id=_raw_institution_id(institution_id),
|
||||||
author_id=None,
|
author_id=None,
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ async def test_dfg_topic_project_ids_use_paginated_projects_service():
|
|||||||
]
|
]
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"inse.dashboard.service.projects_service.get_dfg_projects_by_author_id",
|
"inse.dashboard.service.projects_service.get_dfg_projects",
|
||||||
new=AsyncMock(side_effect=pages),
|
new=AsyncMock(side_effect=pages),
|
||||||
) as mocked_get_projects:
|
) as mocked_get_projects:
|
||||||
project_ids = await _get_dfg_project_ids_from_projects_service(
|
project_ids = await _get_dfg_project_ids_from_projects_service(
|
||||||
@@ -144,7 +144,7 @@ async def test_dashboard_statistics_counts_organization_data_and_all_projects():
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
), patch(
|
), patch(
|
||||||
"inse.dashboard.service.projects_service.get_dfg_projects_by_author_id",
|
"inse.dashboard.service.projects_service.get_dfg_projects",
|
||||||
new=AsyncMock(
|
new=AsyncMock(
|
||||||
return_value=DfgProjectPage(elements=[], total=3, page=0, size=1)
|
return_value=DfgProjectPage(elements=[], total=3, page=0, size=1)
|
||||||
),
|
),
|
||||||
@@ -254,7 +254,7 @@ async def test_dashboard_dfg_projects_uses_projects_service_total():
|
|||||||
project_page = DfgProjectPage(elements=[], total=42, page=0, size=1)
|
project_page = DfgProjectPage(elements=[], total=42, page=0, size=1)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
"inse.dashboard.service.projects_service.get_dfg_projects_by_author_id",
|
"inse.dashboard.service.projects_service.get_dfg_projects",
|
||||||
new=AsyncMock(return_value=project_page),
|
new=AsyncMock(return_value=project_page),
|
||||||
) as mocked_get_projects:
|
) as mocked_get_projects:
|
||||||
result = await get_dashboard_dfg_projects(
|
result = await get_dashboard_dfg_projects(
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ def _index_to_cluster(index: ESIndex) -> ESCluster | None:
|
|||||||
ESIndex.OPENALEX_INSTITUTIONS,
|
ESIndex.OPENALEX_INSTITUTIONS,
|
||||||
ESIndex.OPENALEX_PUBLICATIONS,
|
ESIndex.OPENALEX_PUBLICATIONS,
|
||||||
ESIndex.WORK_CLASSIFICATIONS,
|
ESIndex.WORK_CLASSIFICATIONS,
|
||||||
|
ESIndex.CC_NEWS_WILDCARD,
|
||||||
}:
|
}:
|
||||||
return ESCluster.NES
|
return ESCluster.NES
|
||||||
elif index in {
|
elif index in {
|
||||||
@@ -260,11 +261,10 @@ async def search(
|
|||||||
payload["sort"] = sort
|
payload["sort"] = sort
|
||||||
if aggs is not None:
|
if aggs is not None:
|
||||||
payload["aggs"] = aggs
|
payload["aggs"] = aggs
|
||||||
if track_total_hits:
|
|
||||||
payload["track_total_hits"] = True
|
|
||||||
if highlight is not None:
|
if highlight is not None:
|
||||||
payload["highlight"] = highlight
|
payload["highlight"] = highlight
|
||||||
|
|
||||||
|
payload["track_total_hits"] = True # always track total hits for accurate pagination and counts
|
||||||
if len(payload) == 0:
|
if len(payload) == 0:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"At least one of 'query', 'body', 'source', 'size', 'offset', 'sort', 'aggs' must be provided"
|
"At least one of 'query', 'body', 'source', 'size', 'offset', 'sort', 'aggs' must be provided"
|
||||||
@@ -439,12 +439,16 @@ async def count(
|
|||||||
async def msearch(
|
async def msearch(
|
||||||
searches: list[tuple[ESIndex | str | list[str], dict[str, Any]]],
|
searches: list[tuple[ESIndex | str | list[str], dict[str, Any]]],
|
||||||
cluster: ESCluster = ESCluster.NES,
|
cluster: ESCluster = ESCluster.NES,
|
||||||
|
request_cache: bool = False,
|
||||||
) -> list[dict[str, Any]]:
|
) -> list[dict[str, Any]]:
|
||||||
"""Performs a multi-search request (_msearch) on Elasticsearch.
|
"""Performs a multi-search request (_msearch) on Elasticsearch.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
searches: A list of tuples, each containing (index, payload_dict).
|
searches: A list of tuples, each containing (index, payload_dict).
|
||||||
cluster: The Elasticsearch cluster to execute searches on.
|
cluster: The Elasticsearch cluster to execute searches on.
|
||||||
|
request_cache: Whether to enable the shard request cache for each search.
|
||||||
|
Elasticsearch rejects `request_cache` as an _msearch URL parameter, so
|
||||||
|
it goes into the per-search header line instead.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List[Dict[str, Any]]: List of response dictionaries for each search in order.
|
List[Dict[str, Any]]: List of response dictionaries for each search in order.
|
||||||
@@ -464,7 +468,9 @@ async def msearch(
|
|||||||
idx_str = ",".join(str(i) for i in idx)
|
idx_str = ",".join(str(i) for i in idx)
|
||||||
else:
|
else:
|
||||||
idx_str = str(idx)
|
idx_str = str(idx)
|
||||||
header_obj = {"index": idx_str}
|
header_obj: dict[str, Any] = {"index": idx_str}
|
||||||
|
if request_cache:
|
||||||
|
header_obj["request_cache"] = True
|
||||||
lines.append(json.dumps(header_obj))
|
lines.append(json.dumps(header_obj))
|
||||||
lines.append(json.dumps(body))
|
lines.append(json.dumps(body))
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ class ESIndex(StrEnum):
|
|||||||
OPENALEX_CONTINENTS = "openalex-continents"
|
OPENALEX_CONTINENTS = "openalex-continents"
|
||||||
OPENALEX_TOPICS = "openalex-topics"
|
OPENALEX_TOPICS = "openalex-topics"
|
||||||
OPENALEX_TOPIC_VECTORS = "topicvectors"
|
OPENALEX_TOPIC_VECTORS = "topicvectors"
|
||||||
|
OPENALEX_DOMAINS = "openalex-domains"
|
||||||
|
OPENALEX_FIELDS = "openalex-fields"
|
||||||
|
OPENALEX_SUBFIELDS = "openalex-subfields"
|
||||||
|
|
||||||
EPO_INDEX = "epo_index_1.0"
|
EPO_INDEX = "epo_index_1.0"
|
||||||
USPTO_INDEX = "uspto_patents_3.0"
|
USPTO_INDEX = "uspto_patents_3.0"
|
||||||
@@ -65,6 +68,7 @@ class ESIndex(StrEnum):
|
|||||||
AKTUELLES = "aktuell"
|
AKTUELLES = "aktuell"
|
||||||
AKTUELLES_POSTPROC = "aktuell_postproc"
|
AKTUELLES_POSTPROC = "aktuell_postproc"
|
||||||
AKTUELLES_OPENALEX_TOPICS = "aktuell_openalex_topics"
|
AKTUELLES_OPENALEX_TOPICS = "aktuell_openalex_topics"
|
||||||
|
CC_NEWS_WILDCARD = "cc-news-*"
|
||||||
|
|
||||||
|
|
||||||
CORDIS_EU_ORGANIZATIONS_WILDCARD = "cordis_eu_*_organizations"
|
CORDIS_EU_ORGANIZATIONS_WILDCARD = "cordis_eu_*_organizations"
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ TOPIC_NUM_CANDIDATES = 100
|
|||||||
TOPIC_SIMILARITY = 0.5
|
TOPIC_SIMILARITY = 0.5
|
||||||
|
|
||||||
TOPICS_INDEX = "aktuell_openalex_topics"
|
TOPICS_INDEX = "aktuell_openalex_topics"
|
||||||
TOPICS_INDEX_MAX_PAIRS = 100
|
|
||||||
|
|
||||||
_SESSION_TOPIC_CACHE: dict[str, list] = {}
|
_SESSION_TOPIC_CACHE: dict[str, list] = {}
|
||||||
|
|
||||||
@@ -48,6 +47,11 @@ RELATED_BLOCK_SIZE = 5
|
|||||||
RELATED_TOPIC_K = 1
|
RELATED_TOPIC_K = 1
|
||||||
EXACT_ID_CAP = 1000
|
EXACT_ID_CAP = 1000
|
||||||
|
|
||||||
|
KEYWORD_SEARCH_FIELDS = ["maintitle^3", "intro_content^2", "tags^2", "full_content"]
|
||||||
|
KEYWORD_SEARCH_SCAN_CAP = 50000
|
||||||
|
KEYWORD_SEARCH_ID_CAP = 2000
|
||||||
|
TOPIC_DOCS_PER_ARTICLE = 25
|
||||||
|
|
||||||
|
|
||||||
async def get_news_page(
|
async def get_news_page(
|
||||||
page: int,
|
page: int,
|
||||||
@@ -127,6 +131,206 @@ async def search_news(
|
|||||||
return news_page
|
return news_page
|
||||||
|
|
||||||
|
|
||||||
|
async def search_news_by_keywords(
|
||||||
|
keywords: list | None = None,
|
||||||
|
topic_ids: list | None = None,
|
||||||
|
filter_topic_ids: list | None = None,
|
||||||
|
fuzzy: bool = False,
|
||||||
|
page: int = 1,
|
||||||
|
page_size: int = 10,
|
||||||
|
year_from: int | None = None,
|
||||||
|
year_to: int | None = None,
|
||||||
|
relevance_values: list | None = None,
|
||||||
|
sort_order: str | None = None,
|
||||||
|
) -> NewsPage:
|
||||||
|
"""Searches the news for the keywords of a keywords-search run.
|
||||||
|
|
||||||
|
`fuzzy` resolves the keywords to OpenAlex topics (via the aktuell_openalex_topics index),
|
||||||
|
otherwise the raw keywords are matched as phrases against the article
|
||||||
|
text. The individual keywords are OR-ed rather than AND-ed.
|
||||||
|
An article carries at most KEYWORD_LIMIT keywords, so requiring all of them
|
||||||
|
would leave every multi-keyword search empty.
|
||||||
|
Articles matching more of them simply rank higher.
|
||||||
|
|
||||||
|
A fuzzy search without any resolved topic ids falls back to the raw
|
||||||
|
keywords. Once there are topic ids the fallback is off: a topic search that matches no article
|
||||||
|
stays empty instead of silently returning keyword hits.
|
||||||
|
|
||||||
|
By default results stay ranked by match strength (Elasticsearch's
|
||||||
|
`_score`). Passing `sort_order` ('asc'/'desc') overrides that with a
|
||||||
|
plain date sort, same as the plain news list.
|
||||||
|
"""
|
||||||
|
wanted_topic_ids: set = set()
|
||||||
|
if fuzzy:
|
||||||
|
wanted_topic_ids = {
|
||||||
|
topic_id
|
||||||
|
for topic_id in (topic_ids or []) + (filter_topic_ids or [])
|
||||||
|
if topic_id
|
||||||
|
}
|
||||||
|
|
||||||
|
if wanted_topic_ids:
|
||||||
|
should = await _topic_id_should_clauses(wanted_topic_ids)
|
||||||
|
else:
|
||||||
|
should = _keyword_should_clauses(keywords)
|
||||||
|
|
||||||
|
if not should:
|
||||||
|
return _empty_page(page, page_size)
|
||||||
|
|
||||||
|
clauses = await _filter_clauses(year_from, year_to, relevance_values)
|
||||||
|
query = {
|
||||||
|
"bool": {
|
||||||
|
"should": should,
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
"filter": clauses,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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(
|
||||||
|
query=query,
|
||||||
|
source=["date", "maintitle", "author", "url", "intro_content", "full_content"],
|
||||||
|
size=page_size,
|
||||||
|
offset=(page - 1) * page_size,
|
||||||
|
sort=sort,
|
||||||
|
highlight=None if wanted_topic_ids else highlight,
|
||||||
|
)
|
||||||
|
|
||||||
|
news_page = await _build_page(response, page, page_size)
|
||||||
|
await _attach_topics(news_page.results)
|
||||||
|
|
||||||
|
return news_page
|
||||||
|
|
||||||
|
|
||||||
|
def _keyword_should_clauses(keywords: list | None) -> list:
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
"multi_match": {
|
||||||
|
"query": keyword.strip(),
|
||||||
|
"fields": KEYWORD_SEARCH_FIELDS,
|
||||||
|
"type": "phrase",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for keyword in (keywords or [])
|
||||||
|
if keyword and keyword.strip()
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
async def _topic_id_should_clauses(topic_ids: set) -> list:
|
||||||
|
"""Turns matched OpenAlex topics into id clauses, boosted by hit count.
|
||||||
|
|
||||||
|
Articles that match several of the searched topics get a higher boost, so
|
||||||
|
Elasticsearch ranks them above articles that only match one.
|
||||||
|
"""
|
||||||
|
topics_per_article = await _news_ids_by_topic_ids(topic_ids)
|
||||||
|
if not topics_per_article:
|
||||||
|
return []
|
||||||
|
|
||||||
|
ranked = sorted(topics_per_article.items(), key=lambda item: -len(item[1]))
|
||||||
|
ids_by_hit_count: dict[int, list] = {}
|
||||||
|
for news_id, matched_topics in ranked[:KEYWORD_SEARCH_ID_CAP]:
|
||||||
|
ids_by_hit_count.setdefault(len(matched_topics), []).append(news_id)
|
||||||
|
|
||||||
|
return [
|
||||||
|
{"ids": {"values": news_ids, "boost": float(hit_count)}}
|
||||||
|
for hit_count, news_ids in ids_by_hit_count.items()
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
async def _news_ids_by_topic_ids(topic_ids: set) -> dict:
|
||||||
|
"""Returns news_id -> set of searched topic ids the article was mapped to."""
|
||||||
|
query = {"terms": {"topic_matches.topic_id.keyword": sorted(topic_ids)}}
|
||||||
|
|
||||||
|
topics_per_article: dict[str, set] = {}
|
||||||
|
scanned = 0
|
||||||
|
try:
|
||||||
|
async for hit in elasticsearch.scan(
|
||||||
|
index=TOPICS_INDEX,
|
||||||
|
query=query,
|
||||||
|
source=["news_id", "topic_matches.topic_id"],
|
||||||
|
cluster="inse",
|
||||||
|
):
|
||||||
|
scanned += 1
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
news_id = source.get("news_id")
|
||||||
|
if news_id:
|
||||||
|
matched = topics_per_article.setdefault(news_id, set())
|
||||||
|
for match in source.get("topic_matches") or []:
|
||||||
|
topic_id = match.get("topic_id")
|
||||||
|
if topic_id in topic_ids:
|
||||||
|
matched.add(topic_id)
|
||||||
|
if scanned >= KEYWORD_SEARCH_SCAN_CAP:
|
||||||
|
logger.warning(
|
||||||
|
f"Topic lookup hit the scan cap of {KEYWORD_SEARCH_SCAN_CAP} documents."
|
||||||
|
)
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Topic lookup for the keyword news search failed.")
|
||||||
|
return {}
|
||||||
|
|
||||||
|
return {news_id: matched for news_id, matched in topics_per_article.items() if matched}
|
||||||
|
|
||||||
|
|
||||||
|
async def _attach_topics(articles: list) -> None:
|
||||||
|
news_ids = [article.id for article in articles if article.id]
|
||||||
|
if not news_ids:
|
||||||
|
return
|
||||||
|
|
||||||
|
topics_per_article = await _topics_for_news_ids(news_ids)
|
||||||
|
for article in articles:
|
||||||
|
article.topics = topics_per_article.get(article.id, [])
|
||||||
|
|
||||||
|
|
||||||
|
async def _topics_for_news_ids(news_ids: list) -> dict[str, list[MatchedTopic]]:
|
||||||
|
"""Reads the indexed OpenAlex topic matches for the given articles."""
|
||||||
|
try:
|
||||||
|
response = await elasticsearch.search(
|
||||||
|
index=TOPICS_INDEX,
|
||||||
|
query={"terms": {"news_id.keyword": news_ids}},
|
||||||
|
source=["news_id", "keyword", "topic_matches"],
|
||||||
|
size=min(len(news_ids) * TOPIC_DOCS_PER_ARTICLE, 10000),
|
||||||
|
cluster="inse",
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Batched topic lookup for the news result page failed.")
|
||||||
|
return {}
|
||||||
|
|
||||||
|
topics_per_article: dict[str, list[MatchedTopic]] = {}
|
||||||
|
seen_per_article: dict[str, set] = {}
|
||||||
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
news_id = source.get("news_id")
|
||||||
|
if not news_id:
|
||||||
|
continue
|
||||||
|
keyword = source.get("keyword")
|
||||||
|
matched = topics_per_article.setdefault(news_id, [])
|
||||||
|
seen_ids = seen_per_article.setdefault(news_id, set())
|
||||||
|
for match in source.get("topic_matches") or []:
|
||||||
|
topic_id = match.get("topic_id")
|
||||||
|
if not topic_id or topic_id in seen_ids:
|
||||||
|
continue
|
||||||
|
seen_ids.add(topic_id)
|
||||||
|
matched.append(
|
||||||
|
MatchedTopic(
|
||||||
|
id=topic_id,
|
||||||
|
display_name=match.get("topic_display_name"),
|
||||||
|
subfield_name=match.get("subfield"),
|
||||||
|
field_name=match.get("field"),
|
||||||
|
domain_name=match.get("domain"),
|
||||||
|
source_keyword=keyword,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return topics_per_article
|
||||||
|
|
||||||
|
|
||||||
async def get_news_by_author(
|
async def get_news_by_author(
|
||||||
author_id: str,
|
author_id: str,
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
@@ -321,7 +525,7 @@ async def _get_article_keywords(
|
|||||||
|
|
||||||
|
|
||||||
async def _get_article_topics(news_id: str, keywords: list) -> list:
|
async def _get_article_topics(news_id: str, keywords: list) -> list:
|
||||||
indexed = await get_article_topics_from_index(news_id)
|
indexed = (await _topics_for_news_ids([news_id])).get(news_id, [])
|
||||||
if indexed:
|
if indexed:
|
||||||
return indexed
|
return indexed
|
||||||
|
|
||||||
@@ -336,42 +540,6 @@ async def _get_article_topics(news_id: str, keywords: list) -> list:
|
|||||||
return topics
|
return topics
|
||||||
|
|
||||||
|
|
||||||
async def get_article_topics_from_index(news_id: str) -> list:
|
|
||||||
try:
|
|
||||||
response = await elasticsearch.search(
|
|
||||||
index=TOPICS_INDEX,
|
|
||||||
query={"term": {"news_id.keyword": news_id}},
|
|
||||||
source=["keyword", "topic_matches"],
|
|
||||||
size=TOPICS_INDEX_MAX_PAIRS,
|
|
||||||
cluster="inse",
|
|
||||||
)
|
|
||||||
except Exception:
|
|
||||||
logger.exception(f"Topic-index lookup for {news_id} failed.")
|
|
||||||
return []
|
|
||||||
|
|
||||||
matched = []
|
|
||||||
seen_ids = set()
|
|
||||||
for hit in response.get("hits", {}).get("hits", []):
|
|
||||||
source = hit.get("_source", {})
|
|
||||||
keyword = source.get("keyword")
|
|
||||||
for match in source.get("topic_matches") or []:
|
|
||||||
topic_id = match.get("topic_id")
|
|
||||||
if not topic_id or topic_id in seen_ids:
|
|
||||||
continue
|
|
||||||
seen_ids.add(topic_id)
|
|
||||||
matched.append(
|
|
||||||
MatchedTopic(
|
|
||||||
id=topic_id,
|
|
||||||
display_name=match.get("topic_display_name"),
|
|
||||||
subfield_name=match.get("subfield"),
|
|
||||||
field_name=match.get("field"),
|
|
||||||
domain_name=match.get("domain"),
|
|
||||||
source_keyword=keyword,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return matched
|
|
||||||
|
|
||||||
|
|
||||||
def _normalize_keywords(candidates: list) -> list:
|
def _normalize_keywords(candidates: list) -> list:
|
||||||
"""Trims, dedups (case-insensitive) and caps the keywords from the LLM."""
|
"""Trims, dedups (case-insensitive) and caps the keywords from the LLM."""
|
||||||
seen = set()
|
seen = set()
|
||||||
@@ -516,7 +684,7 @@ async def _get_postproc_labels(news_id: str) -> tuple[bool | None, list, list, s
|
|||||||
return relevant, authors, keywords, hit.get("_id")
|
return relevant, authors, keywords, hit.get("_id")
|
||||||
|
|
||||||
|
|
||||||
async def _run_search(query: dict, source: list, size: int, offset: int, sort, highlight: dict = None) -> dict:
|
async def _run_search(query: dict, source: list, size: int, offset: int, sort, highlight: dict | None = None) -> dict:
|
||||||
try:
|
try:
|
||||||
return await elasticsearch.search(
|
return await elasticsearch.search(
|
||||||
index="aktuell",
|
index="aktuell",
|
||||||
|
|||||||
@@ -8,17 +8,6 @@ class NewsKeywords(BaseModel):
|
|||||||
keywords: list[str] = Field(description="The extracted keywords from the article.")
|
keywords: list[str] = Field(description="The extracted keywords from the article.")
|
||||||
|
|
||||||
|
|
||||||
class NewsArticle(BaseModel):
|
|
||||||
id: str
|
|
||||||
date: str | None = None
|
|
||||||
maintitle: str | None = None
|
|
||||||
author: str | None = None
|
|
||||||
url: str | None = None
|
|
||||||
relevant: bool | None = None
|
|
||||||
snippet: str | None = None
|
|
||||||
related: bool | None = None
|
|
||||||
|
|
||||||
|
|
||||||
class MentionedPerson(BaseModel):
|
class MentionedPerson(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
is_ude: bool = False
|
is_ude: bool = False
|
||||||
@@ -34,6 +23,18 @@ class MatchedTopic(BaseModel):
|
|||||||
source_keyword: str | None = None
|
source_keyword: str | None = None
|
||||||
|
|
||||||
|
|
||||||
|
class NewsArticle(BaseModel):
|
||||||
|
id: str
|
||||||
|
date: str | None = None
|
||||||
|
maintitle: str | None = None
|
||||||
|
author: str | None = None
|
||||||
|
url: str | None = None
|
||||||
|
relevant: bool | None = None
|
||||||
|
snippet: str | None = None
|
||||||
|
related: bool | None = None
|
||||||
|
topics: list[MatchedTopic] | None = None
|
||||||
|
|
||||||
|
|
||||||
class NewsArticleDetail(NewsArticle):
|
class NewsArticleDetail(NewsArticle):
|
||||||
full_content: str | None = None
|
full_content: str | None = None
|
||||||
relevant: bool | None = None
|
relevant: bool | None = None
|
||||||
|
|||||||
@@ -100,6 +100,68 @@ async def search_news(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/keyword/search",
|
||||||
|
operation_id="getNewsByKeywords",
|
||||||
|
response_model=NewsPage,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Searches news articles by the keywords or matched topics of a keywords search.",
|
||||||
|
tags=[Tags.NEWS],
|
||||||
|
)
|
||||||
|
async def search_news_by_keywords(
|
||||||
|
keywords: Annotated[
|
||||||
|
list[str] | None, Query(description="Raw keywords to match against title/content.")
|
||||||
|
] = None,
|
||||||
|
topic_ids: Annotated[
|
||||||
|
list[str] | None,
|
||||||
|
Query(alias="topicIds", description="OpenAlex topic ids the keywords resolved to."),
|
||||||
|
] = None,
|
||||||
|
filter_topic_ids: Annotated[
|
||||||
|
list[str] | None,
|
||||||
|
Query(alias="filterTopicIds", description="Additional topic ids to narrow the results by."),
|
||||||
|
] = None,
|
||||||
|
fuzzy: Annotated[
|
||||||
|
bool,
|
||||||
|
Query(description="Search by resolved topics if True, otherwise by raw keywords."),
|
||||||
|
] = False,
|
||||||
|
page: Annotated[
|
||||||
|
int, Query(description="Page number (1-based).", ge=1)
|
||||||
|
] = 1,
|
||||||
|
page_size: Annotated[
|
||||||
|
int, Query(alias="pageSize", description="Articles per page.", ge=1, le=100)
|
||||||
|
] = 10,
|
||||||
|
relevance: Annotated[
|
||||||
|
str | None, Query(description="Comma-separated relevance filter: 'relevant', 'not_relevant'.")
|
||||||
|
] = None,
|
||||||
|
year_from: Annotated[
|
||||||
|
int | None, Query(alias="yearFrom", description="Earliest publication year (inclusive).", ge=0)
|
||||||
|
] = None,
|
||||||
|
year_to: Annotated[
|
||||||
|
int | None, Query(alias="yearTo", description="Latest publication year (inclusive).", ge=0)
|
||||||
|
] = None,
|
||||||
|
sort_order: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(
|
||||||
|
alias="sortOrder",
|
||||||
|
description="Overrides relevance ranking with a date sort: 'desc' (newest first) or 'asc' (oldest first).",
|
||||||
|
pattern="^(asc|desc)$",
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
):
|
||||||
|
return await logic.search_news_by_keywords(
|
||||||
|
keywords=keywords or [],
|
||||||
|
topic_ids=topic_ids or [],
|
||||||
|
filter_topic_ids=filter_topic_ids or [],
|
||||||
|
fuzzy=fuzzy,
|
||||||
|
page=page,
|
||||||
|
page_size=page_size,
|
||||||
|
sort_order=sort_order,
|
||||||
|
year_from=year_from,
|
||||||
|
year_to=year_to,
|
||||||
|
relevance_values=_parse_relevance(relevance),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/by-author",
|
"/by-author",
|
||||||
operation_id="getNewsByAuthor",
|
operation_id="getNewsByAuthor",
|
||||||
|
|||||||
@@ -1133,10 +1133,6 @@ async def get_eu_cordis_projects_funding_data(
|
|||||||
"track_total_hits": False,
|
"track_total_hits": False,
|
||||||
"_source": ["id", "startDate", "endDate", "ecMaxContribution"],
|
"_source": ["id", "startDate", "endDate", "ecMaxContribution"],
|
||||||
"query": query,
|
"query": query,
|
||||||
# "id" is unique per project and used elsewhere as a term-filter
|
|
||||||
# field, so it's mapped as keyword - safe + deterministic sort
|
|
||||||
# key for search_after pagination across an arbitrarily large
|
|
||||||
# result set.
|
|
||||||
"sort": [{"id": {"order": "asc", "unmapped_type": "keyword"}}],
|
"sort": [{"id": {"order": "asc", "unmapped_type": "keyword"}}],
|
||||||
}
|
}
|
||||||
if search_after is not None:
|
if search_after is not None:
|
||||||
@@ -1256,68 +1252,6 @@ async def get_openalex_author_ids_by_dois(
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
async def get_openalex_authors_for_cordis_project_ids(
|
|
||||||
project_ids: list[str],
|
|
||||||
) -> dict[str, AuthorPage]:
|
|
||||||
"""Returns a mapping of project_id -> AuthorPage for a batch of projects."""
|
|
||||||
if not project_ids:
|
|
||||||
return {}
|
|
||||||
|
|
||||||
query = {"bool": {"filter": [{"terms": {"projectID": project_ids}}]}}
|
|
||||||
response = await elasticsearch.search(
|
|
||||||
query=query,
|
|
||||||
index=ESIndex.CORDIS_EU_PUBLICATIONS_WILDCARD,
|
|
||||||
cluster=ESCluster.INSE,
|
|
||||||
source=["projectID", "doi","qaProcessedDoi"],
|
|
||||||
size=10000,
|
|
||||||
)
|
|
||||||
dois_by_project: dict[str, set[str]] = {}
|
|
||||||
for hit in response.get("hits", {}).get("hits", []):
|
|
||||||
source = hit.get("_source", {})
|
|
||||||
pid = source.get("projectID")
|
|
||||||
doi = source.get("doi")
|
|
||||||
qa_processed_doi = source.get("qaProcessedDoi")
|
|
||||||
if pid:
|
|
||||||
dois_by_project.setdefault(pid, set())
|
|
||||||
if doi:
|
|
||||||
dois_by_project[pid].add(doi)
|
|
||||||
elif qa_processed_doi:
|
|
||||||
dois_by_project[pid].add(qa_processed_doi)
|
|
||||||
|
|
||||||
all_dois = list({doi for dois in dois_by_project.values() for doi in dois})
|
|
||||||
|
|
||||||
# single ES call for the whole batch, keyed by raw DOI
|
|
||||||
author_ids_by_doi = await get_openalex_author_ids_by_dois(dois=all_dois)
|
|
||||||
|
|
||||||
# aggregate per project, dedupe author_ids within a project
|
|
||||||
author_ids_by_project: dict[str, list[str]] = {}
|
|
||||||
for pid, dois in dois_by_project.items():
|
|
||||||
project_author_ids: set[str] = set()
|
|
||||||
for doi in dois:
|
|
||||||
project_author_ids.update(author_ids_by_doi.get(doi, []))
|
|
||||||
author_ids_by_project[pid] = list(project_author_ids)
|
|
||||||
|
|
||||||
# single ES call to fetch all Author objects across every project
|
|
||||||
all_author_ids = list({aid for ids in author_ids_by_project.values() for aid in ids})
|
|
||||||
|
|
||||||
author_page = await get_authors_by_ids(author_ids=all_author_ids)
|
|
||||||
authors_by_id = {author.id: author for author in author_page.elements}
|
|
||||||
|
|
||||||
# split the fetched authors back out per project
|
|
||||||
result: dict[str, AuthorPage] = {}
|
|
||||||
for pid in project_ids:
|
|
||||||
ids_for_project = author_ids_by_project.get(pid, [])
|
|
||||||
authors_for_project = [
|
|
||||||
authors_by_id[aid] for aid in ids_for_project if aid in authors_by_id
|
|
||||||
]
|
|
||||||
result[pid] = AuthorPage(
|
|
||||||
elements=authors_for_project,
|
|
||||||
total=len(authors_for_project),
|
|
||||||
page=0,
|
|
||||||
size=len(authors_for_project),
|
|
||||||
)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
async def get_openalex_authors_for_projects_ids(
|
async def get_openalex_authors_for_projects_ids(
|
||||||
project_ids_by_type: dict[EuCordisProjectType, list[str]],
|
project_ids_by_type: dict[EuCordisProjectType, list[str]],
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import logging
|
import logging
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
import inse.authors.v2.service as author_service
|
||||||
|
from inse.auth.model import AccessTokenMetadata
|
||||||
from inse.integrations import elasticsearch
|
from inse.integrations import elasticsearch
|
||||||
from inse.model import ESCluster, ESIndex
|
from inse.model import ESCluster, ESIndex
|
||||||
from inse.projects.model import EuCordisProjectType
|
from inse.projects.model import EuCordisProjectType
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ async def get_cordis_eu_publications_by_dois(dois: list[str]):
|
|||||||
_type_: The retrieved publications.
|
_type_: The retrieved publications.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
query_dois = list({
|
query_dois = set({
|
||||||
variant
|
variant
|
||||||
for doi in dois
|
for doi in dois
|
||||||
for variant in (
|
for variant in (
|
||||||
@@ -211,8 +211,8 @@ async def get_cordis_eu_publications_by_dois(dois: list[str]):
|
|||||||
{
|
{
|
||||||
"bool": {
|
"bool": {
|
||||||
"should": [
|
"should": [
|
||||||
{"terms": {"doi": query_dois}},
|
{"terms": {"doi": list(query_dois)}},
|
||||||
{"terms": {"qaProcessedDoi": query_dois}},
|
{"terms": {"qaProcessedDoi": list(query_dois)}},
|
||||||
],
|
],
|
||||||
"minimum_should_match": 1,
|
"minimum_should_match": 1,
|
||||||
}
|
}
|
||||||
@@ -223,6 +223,7 @@ async def get_cordis_eu_publications_by_dois(dois: list[str]):
|
|||||||
|
|
||||||
response = await elasticsearch.search(
|
response = await elasticsearch.search(
|
||||||
query=query,
|
query=query,
|
||||||
|
size=10000,
|
||||||
index=ESIndex.CORDIS_EU_PUBLICATIONS_WILDCARD,
|
index=ESIndex.CORDIS_EU_PUBLICATIONS_WILDCARD,
|
||||||
cluster=ESCluster.INSE,
|
cluster=ESCluster.INSE,
|
||||||
)
|
)
|
||||||
@@ -264,7 +265,7 @@ async def get_dfg_publications_by_dois(dois: list[str]):
|
|||||||
_type_: The retrieved publications.
|
_type_: The retrieved publications.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
query_dois = list({
|
query_dois = set({
|
||||||
variant
|
variant
|
||||||
for doi in dois
|
for doi in dois
|
||||||
for variant in (
|
for variant in (
|
||||||
@@ -281,7 +282,7 @@ async def get_dfg_publications_by_dois(dois: list[str]):
|
|||||||
"query": {
|
"query": {
|
||||||
"terms": {
|
"terms": {
|
||||||
"publications.doi":
|
"publications.doi":
|
||||||
query_dois
|
list(query_dois)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,7 +292,7 @@ async def get_dfg_publications_by_dois(dois: list[str]):
|
|||||||
}
|
}
|
||||||
|
|
||||||
response = await elasticsearch.search(
|
response = await elasticsearch.search(
|
||||||
size=1000,
|
size=10000,
|
||||||
query=query,
|
query=query,
|
||||||
index=ESIndex.DFG_PROJECTS,
|
index=ESIndex.DFG_PROJECTS,
|
||||||
cluster=ESCluster.INSE,
|
cluster=ESCluster.INSE,
|
||||||
@@ -318,7 +319,7 @@ async def get_dfg_project_ids_by_names(names: list[str]) -> list[str]:
|
|||||||
|
|
||||||
response = await elasticsearch.search(
|
response = await elasticsearch.search(
|
||||||
source=["projects.project_id"],
|
source=["projects.project_id"],
|
||||||
size=1000,
|
size=10000,
|
||||||
query=query,
|
query=query,
|
||||||
index=ESIndex.DFG_PERSONS,
|
index=ESIndex.DFG_PERSONS,
|
||||||
cluster=ESCluster.INSE,
|
cluster=ESCluster.INSE,
|
||||||
@@ -647,7 +648,7 @@ async def search_dfg_projects(
|
|||||||
# person["institute_name_en"] = institute.get("institute_name_en")
|
# person["institute_name_en"] = institute.get("institute_name_en")
|
||||||
# person["address_country_de"] = institute.get("address_country_de")
|
# person["address_country_de"] = institute.get("address_country_de")
|
||||||
# person["address_country_en"] = institute.get("address_country_en")
|
# person["address_country_en"] = institute.get("address_country_en")
|
||||||
print("ENRIECHED",source.get("institutions", []))
|
|
||||||
return _complete_response_to_dfg_project_page(response, page, size)
|
return _complete_response_to_dfg_project_page(response, page, size)
|
||||||
|
|
||||||
def _complete_response_to_dfg_project_page(
|
def _complete_response_to_dfg_project_page(
|
||||||
@@ -1150,11 +1151,13 @@ async def search_all_projects(
|
|||||||
page = projects_filtering_properties.page
|
page = projects_filtering_properties.page
|
||||||
offset = page * size
|
offset = page * size
|
||||||
response = await elasticsearch.search(
|
response = await elasticsearch.search(
|
||||||
|
|
||||||
index=index,
|
index=index,
|
||||||
size=size,
|
size=size,
|
||||||
offset=offset,
|
offset=offset,
|
||||||
query=query,
|
query=query,
|
||||||
sort=sort,
|
sort=sort,
|
||||||
|
track_total_hits=True,
|
||||||
)
|
)
|
||||||
return _response_to_funding_project_page(response=response, page=page, size=size)
|
return _response_to_funding_project_page(response=response, page=page, size=size)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import logging
|
|||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends, Path, Query, status
|
from fastapi import APIRouter, Body, Depends, Path, Query, status
|
||||||
|
from inse.auth.model import AccessTokenMetadata
|
||||||
|
from inse.auth.service import CurrentUserAccessTokenPayloadDep
|
||||||
from inse.institutions.institutions_search_client import (
|
from inse.institutions.institutions_search_client import (
|
||||||
InstitutionsSearchClient,
|
InstitutionsSearchClient,
|
||||||
)
|
)
|
||||||
@@ -28,6 +30,8 @@ from inse.projects.model import (
|
|||||||
SortDirection,
|
SortDirection,
|
||||||
)
|
)
|
||||||
from inse.tags import Tags
|
from inse.tags import Tags
|
||||||
|
from inse.auth.service import can_fetch_gdpr_relevant_data
|
||||||
|
from fastapi import HTTPException as HttpException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -63,6 +67,109 @@ async def search_bund_projects(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/dfg/search",
|
||||||
|
summary="Get DFG projects.",
|
||||||
|
description="Returns a page of DFG projects based on the provided pagination parameters and optional institution filter.",
|
||||||
|
operation_id="getDfgProjects",
|
||||||
|
responses={
|
||||||
|
status.HTTP_200_OK: {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"model": DfgProjectPage,
|
||||||
|
},
|
||||||
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
|
status.HTTP_403_FORBIDDEN: {"description": "Access denied for the provided institution ID"},
|
||||||
|
},
|
||||||
|
response_model_by_alias=False,
|
||||||
|
)
|
||||||
|
async def get_dfg_projects(
|
||||||
|
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
||||||
|
institutions_search_client: Annotated[
|
||||||
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
|
],
|
||||||
|
raw_oa_institution_id: Annotated[
|
||||||
|
str | None, Query(description="The openalex institution ID to filter by.")
|
||||||
|
] = None,
|
||||||
|
author_id: Annotated[str | None, Query(description="The openalex author ID to filter by.")] = None,
|
||||||
|
author_filter_ids: Annotated[list[str] | None, Query(description="The dfg author IDs to filter by.")] = None,
|
||||||
|
institution_ids: Annotated[list[str] | None, Query(description="The institution IDs to filter by.")] = None,
|
||||||
|
title: Annotated[
|
||||||
|
str | None, Query(description="The title to filter by.")
|
||||||
|
] = None,
|
||||||
|
keywords: Annotated[
|
||||||
|
list[str] | None, Query(description="Raw keywords to search in title/abstract/subject fields.")
|
||||||
|
] = None,
|
||||||
|
topic_ids: Annotated[
|
||||||
|
list[str] | None, Query(description="The openalex topic IDs to filter by.")
|
||||||
|
] = None,
|
||||||
|
filter_topic_ids: Annotated[
|
||||||
|
list[str] | None,
|
||||||
|
Query(
|
||||||
|
description="Additional topic IDs to merge into the fuzzy topic-id resolution "
|
||||||
|
"(union with topic_ids). Only used when fuzzy=True."
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
funding_start_years: Annotated[list[str] | None, Query(description="The funding start years to filter by.")] = None,
|
||||||
|
funding_end_years: Annotated[list[str] | None, Query(description="The funding end years to filter by.")] = None,
|
||||||
|
|
||||||
|
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
||||||
|
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
||||||
|
sort_by: Annotated[str, Query(description="The field to sort by.")] = "title",
|
||||||
|
sort_direction: Annotated[
|
||||||
|
str, Query(description="The sort direction (asc or desc).")
|
||||||
|
] = "asc",
|
||||||
|
fuzzy: Annotated[
|
||||||
|
bool,
|
||||||
|
Query(description="Use topic_id resolution if True, otherwise use raw keyword search."),
|
||||||
|
] = False,
|
||||||
|
|
||||||
|
) -> DfgProjectPage:
|
||||||
|
logger.debug(
|
||||||
|
"Received request to get DFG projects for author_id=%s, author_filter_ids=%s, "
|
||||||
|
"institution_ids=%s, keywords=%s, topic_ids=%s, filter_topic_ids=%s, title=%s, "
|
||||||
|
"funding_start_years=%s, funding_end_years=%s, page=%d, size=%d, sort_by=%s, "
|
||||||
|
"sort_direction=%s, fuzzy=%s",
|
||||||
|
author_id,
|
||||||
|
author_filter_ids,
|
||||||
|
institution_ids,
|
||||||
|
keywords,
|
||||||
|
topic_ids,
|
||||||
|
filter_topic_ids,
|
||||||
|
title,
|
||||||
|
funding_start_years,
|
||||||
|
funding_end_years,
|
||||||
|
page,
|
||||||
|
size,
|
||||||
|
sort_by,
|
||||||
|
sort_direction,
|
||||||
|
fuzzy,
|
||||||
|
)
|
||||||
|
if (author_id or raw_oa_institution_id):
|
||||||
|
is_allowed = await can_fetch_gdpr_relevant_data(access_token = access_token_metadata, raw_oa_author_id = author_id, raw_oa_institution_id = raw_oa_institution_id)
|
||||||
|
if not is_allowed:
|
||||||
|
raise HttpException(
|
||||||
|
status_code=403,
|
||||||
|
detail="Access denied for the provided author ID or institution ID",
|
||||||
|
)
|
||||||
|
return await projects_service.get_dfg_projects(
|
||||||
|
institutions_search_client=institutions_search_client,
|
||||||
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
|
author_id=author_id,
|
||||||
|
author_filter_ids=author_filter_ids,
|
||||||
|
institution_ids=institution_ids,
|
||||||
|
funding_start_years=funding_start_years,
|
||||||
|
funding_end_years=funding_end_years,
|
||||||
|
title=title,
|
||||||
|
keywords=keywords,
|
||||||
|
topic_ids=topic_ids,
|
||||||
|
filter_topic_ids=filter_topic_ids,
|
||||||
|
page=page,
|
||||||
|
size=size,
|
||||||
|
sort_by=sort_by,
|
||||||
|
sort_direction=sort_direction,
|
||||||
|
fuzzy=fuzzy,
|
||||||
|
)
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/dfg/{id}",
|
"/dfg/{id}",
|
||||||
summary="Get a single DFG project.",
|
summary="Get a single DFG project.",
|
||||||
@@ -96,10 +203,13 @@ async def get_single_dfg_project(
|
|||||||
"description": "Successful Response",
|
"description": "Successful Response",
|
||||||
"model": BundProjectPage,
|
"model": BundProjectPage,
|
||||||
},
|
},
|
||||||
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
|
status.HTTP_403_FORBIDDEN: {"description": "Access denied for the provided institution ID"},
|
||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def search_bund_projects(
|
async def search_bund_projects(
|
||||||
|
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -155,6 +265,13 @@ async def search_bund_projects(
|
|||||||
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
||||||
] = False,
|
] = False,
|
||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
|
if (raw_oa_institution_id):
|
||||||
|
is_allowed = await can_fetch_gdpr_relevant_data(access_token = access_token_metadata, raw_oa_author_id = None, raw_oa_institution_id = raw_oa_institution_id)
|
||||||
|
if not is_allowed:
|
||||||
|
raise HttpException(
|
||||||
|
status_code=403,
|
||||||
|
detail="Access denied for the provided author ID or institution ID",
|
||||||
|
)
|
||||||
return await projects_service.search_bund_projects_with_filters(
|
return await projects_service.search_bund_projects_with_filters(
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
executing_agency=executing_agency,
|
executing_agency=executing_agency,
|
||||||
@@ -217,10 +334,12 @@ from inse.projects.service import search_eu_cordis_projects
|
|||||||
"model": EuCordisProjectSearchPage,
|
"model": EuCordisProjectSearchPage,
|
||||||
},
|
},
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
|
status.HTTP_403_FORBIDDEN: {"description": "Access denied for the provided institution ID"},
|
||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def search_eu_cordis_projects_endpoint(
|
async def search_eu_cordis_projects_endpoint(
|
||||||
|
access_token_metadata: Annotated[AccessTokenMetadata, CurrentUserAccessTokenPayloadDep],
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -299,6 +418,7 @@ async def search_eu_cordis_projects_endpoint(
|
|||||||
bool,
|
bool,
|
||||||
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
Query(description="Use OpenAlex topic-id resolution if true, otherwise raw keyword search."),
|
||||||
] = False,
|
] = False,
|
||||||
|
|
||||||
) -> EuCordisProjectSearchPage:
|
) -> EuCordisProjectSearchPage:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Received EU CORDIS search request: raw_oa_institution_id=%s, "
|
"Received EU CORDIS search request: raw_oa_institution_id=%s, "
|
||||||
@@ -330,7 +450,13 @@ async def search_eu_cordis_projects_endpoint(
|
|||||||
sort_direction,
|
sort_direction,
|
||||||
fuzzy,
|
fuzzy,
|
||||||
)
|
)
|
||||||
|
if (author_id or raw_oa_institution_id):
|
||||||
|
is_allowed = await can_fetch_gdpr_relevant_data(access_token = access_token_metadata, raw_oa_author_id = author_id, raw_oa_institution_id = raw_oa_institution_id)
|
||||||
|
if not is_allowed:
|
||||||
|
raise HttpException(
|
||||||
|
status_code=403,
|
||||||
|
detail="Access denied for the provided author ID or institution ID",
|
||||||
|
)
|
||||||
return await search_eu_cordis_projects(
|
return await search_eu_cordis_projects(
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
raw_oa_institution_id=raw_oa_institution_id,
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
@@ -629,102 +755,6 @@ async def get_institution_cordis_eu_projects_funding_over_time(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
|
||||||
"/person/dfg/search",
|
|
||||||
summary="Get DFG projects.",
|
|
||||||
description="Returns a page of DFG projects based on the provided pagination parameters and optional institution filter.",
|
|
||||||
operation_id="getDfgProjects",
|
|
||||||
responses={
|
|
||||||
status.HTTP_200_OK: {
|
|
||||||
"description": "Successful Response",
|
|
||||||
"model": DfgProjectPage,
|
|
||||||
},
|
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
|
||||||
},
|
|
||||||
response_model_by_alias=False,
|
|
||||||
)
|
|
||||||
async def get_dfg_projects(
|
|
||||||
institutions_search_client: Annotated[
|
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
|
||||||
],
|
|
||||||
raw_oa_institution_id: Annotated[
|
|
||||||
str | None, Query(description="The openalex institution ID to filter by.")
|
|
||||||
] = None,
|
|
||||||
author_id: Annotated[str | None, Query(description="The openalex author ID to filter by.")] = None,
|
|
||||||
author_filter_ids: Annotated[list[int] | None, Query(description="The dfg author IDs to filter by.")] = None,
|
|
||||||
institution_ids: Annotated[
|
|
||||||
list[int] | None, Query(description="The institution IDs to filter by.")
|
|
||||||
] = None,
|
|
||||||
title: Annotated[
|
|
||||||
str | None, Query(description="The title to filter by.")
|
|
||||||
] = None,
|
|
||||||
keywords: Annotated[
|
|
||||||
list[str] | None, Query(description="Raw keywords to search in title/abstract/subject fields.")
|
|
||||||
] = None,
|
|
||||||
topic_ids: Annotated[
|
|
||||||
list[str] | None, Query(description="The openalex topic IDs to filter by.")
|
|
||||||
] = None,
|
|
||||||
filter_topic_ids: Annotated[
|
|
||||||
list[str] | None,
|
|
||||||
Query(
|
|
||||||
description="Additional topic IDs to merge into the fuzzy topic-id resolution "
|
|
||||||
"(union with topic_ids). Only used when fuzzy=True."
|
|
||||||
),
|
|
||||||
] = None,
|
|
||||||
funding_start_years: Annotated[list[str] | None, Query(description="The funding start years to filter by.")] = None,
|
|
||||||
funding_end_years: Annotated[list[str] | None, Query(description="The funding end years to filter by.")] = None,
|
|
||||||
|
|
||||||
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
|
||||||
size: Annotated[int, Query(description="The page size.", ge=1)] = 20,
|
|
||||||
sort_by: Annotated[str, Query(description="The field to sort by.")] = "title",
|
|
||||||
sort_direction: Annotated[
|
|
||||||
str, Query(description="The sort direction (asc or desc).")
|
|
||||||
] = "asc",
|
|
||||||
fuzzy: Annotated[
|
|
||||||
bool,
|
|
||||||
Query(description="Use topic_id resolution if True, otherwise use raw keyword search."),
|
|
||||||
] = False,
|
|
||||||
|
|
||||||
) -> DfgProjectPage:
|
|
||||||
logger.debug(
|
|
||||||
"Received request to get DFG projects for author_id=%s, author_filter_ids=%s, "
|
|
||||||
"institution_ids=%s, keywords=%s, topic_ids=%s, filter_topic_ids=%s, title=%s, "
|
|
||||||
"funding_start_years=%s, funding_end_years=%s, page=%d, size=%d, sort_by=%s, "
|
|
||||||
"sort_direction=%s, fuzzy=%s",
|
|
||||||
author_id,
|
|
||||||
author_filter_ids,
|
|
||||||
institution_ids,
|
|
||||||
keywords,
|
|
||||||
topic_ids,
|
|
||||||
filter_topic_ids,
|
|
||||||
title,
|
|
||||||
funding_start_years,
|
|
||||||
funding_end_years,
|
|
||||||
page,
|
|
||||||
size,
|
|
||||||
sort_by,
|
|
||||||
sort_direction,
|
|
||||||
fuzzy,
|
|
||||||
)
|
|
||||||
return await projects_service.get_dfg_projects_by_author_id(
|
|
||||||
institutions_search_client=institutions_search_client,
|
|
||||||
raw_oa_institution_id=raw_oa_institution_id,
|
|
||||||
author_id=author_id,
|
|
||||||
author_filter_ids=author_filter_ids,
|
|
||||||
institution_ids=institution_ids,
|
|
||||||
funding_start_years=funding_start_years,
|
|
||||||
funding_end_years=funding_end_years,
|
|
||||||
title=title,
|
|
||||||
keywords=keywords,
|
|
||||||
topic_ids=topic_ids,
|
|
||||||
filter_topic_ids=filter_topic_ids,
|
|
||||||
page=page,
|
|
||||||
size=size,
|
|
||||||
sort_by=sort_by,
|
|
||||||
sort_direction=sort_direction,
|
|
||||||
fuzzy=fuzzy,
|
|
||||||
)
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/search",
|
"/search",
|
||||||
summary="Search projects across all funders.",
|
summary="Search projects across all funders.",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import logging
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from inse.exceptions import NotFoundException
|
from inse.exceptions import NotFoundException
|
||||||
|
from inse.auth.model import AccessTokenMetadata
|
||||||
from inse.institutions.institutions_search_client import (
|
from inse.institutions.institutions_search_client import (
|
||||||
InstitutionsSearchClient,
|
InstitutionsSearchClient,
|
||||||
)
|
)
|
||||||
@@ -26,9 +27,7 @@ from inse.projects.eu_cordis_projects_client import (
|
|||||||
from inse.projects.eu_cordis_projects_client import (
|
from inse.projects.eu_cordis_projects_client import (
|
||||||
search_eu_cordis_projects as _search_eu_cordis_projects_es,
|
search_eu_cordis_projects as _search_eu_cordis_projects_es,
|
||||||
)
|
)
|
||||||
from inse.projects.logic import (
|
|
||||||
get_dfg_author_names_by_ids,
|
|
||||||
)
|
|
||||||
from inse.projects.model import (
|
from inse.projects.model import (
|
||||||
BundProjectPage,
|
BundProjectPage,
|
||||||
DfgProjectPage,
|
DfgProjectPage,
|
||||||
@@ -41,8 +40,9 @@ from inse.projects.model import (
|
|||||||
ProjectType,
|
ProjectType,
|
||||||
SortDirection,
|
SortDirection,
|
||||||
)
|
)
|
||||||
|
from inse.projects.logic import get_dfg_author_names_by_ids
|
||||||
from inse.works.logic import get_publication_dois_of_author
|
from inse.works.logic import get_publication_dois_of_author
|
||||||
|
from fastapi import HTTPException as HttpException
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -157,12 +157,25 @@ async def _get_dfg_project_ids_for_openalex_authors(
|
|||||||
|
|
||||||
return list(set.intersection(*project_sets))
|
return list(set.intersection(*project_sets))
|
||||||
|
|
||||||
async def get_dfg_projects_by_author_id(
|
def _is_number_list(values: list[str] | None) -> bool:
|
||||||
|
if not values:
|
||||||
|
return True # nothing to validate, treat as valid/empty
|
||||||
|
for value in values:
|
||||||
|
if value is None or value == "":
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
float(value)
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
async def get_dfg_projects(
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
institutions_search_client: InstitutionsSearchClient,
|
||||||
raw_oa_institution_id: str | None,
|
raw_oa_institution_id: str | None,
|
||||||
author_id: str | None,
|
author_id: str | None,
|
||||||
author_filter_ids: list[int] | None,
|
author_filter_ids: list[str] | None,
|
||||||
institution_ids: list[int] | None,
|
institution_ids: list[str] | None,
|
||||||
keywords: list[str] | None,
|
keywords: list[str] | None,
|
||||||
topic_ids: list[str] | None,
|
topic_ids: list[str] | None,
|
||||||
filter_topic_ids: list[str] | None,
|
filter_topic_ids: list[str] | None,
|
||||||
@@ -196,6 +209,23 @@ async def get_dfg_projects_by_author_id(
|
|||||||
sort_direction,
|
sort_direction,
|
||||||
fuzzy,
|
fuzzy,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Validate author_filter_ids / institution_ids. Return an empty page
|
||||||
|
if not _is_number_list(author_filter_ids) or not _is_number_list(institution_ids):
|
||||||
|
logger.debug(
|
||||||
|
"Invalid author_filter_ids=%s or institution_ids=%s, returning empty page",
|
||||||
|
author_filter_ids,
|
||||||
|
institution_ids,
|
||||||
|
)
|
||||||
|
return DfgProjectPage(elements=[], page=page, size=size, total=0)
|
||||||
|
|
||||||
|
author_filter_ids_int = (
|
||||||
|
[int(float(v)) for v in author_filter_ids] if author_filter_ids else None
|
||||||
|
)
|
||||||
|
institution_ids_int = (
|
||||||
|
[int(float(v)) for v in institution_ids] if institution_ids else None
|
||||||
|
)
|
||||||
|
|
||||||
filter_names = []
|
filter_names = []
|
||||||
author_project_ids = []
|
author_project_ids = []
|
||||||
if author_id:
|
if author_id:
|
||||||
@@ -208,19 +238,23 @@ async def get_dfg_projects_by_author_id(
|
|||||||
size=size,
|
size=size,
|
||||||
total=0)
|
total=0)
|
||||||
|
|
||||||
if author_filter_ids:
|
if author_filter_ids_int:
|
||||||
filter_names = (
|
filter_names = (
|
||||||
await get_dfg_author_names_by_ids(author_ids=author_filter_ids)
|
await get_dfg_author_names_by_ids(author_ids=author_filter_ids_int)
|
||||||
if author_filter_ids
|
if author_filter_ids_int
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
if author_filter_ids and not filter_names:
|
if author_filter_ids_int and not filter_names:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"No author names found for author_filter_ids=%s",
|
"No author names found for author_filter_ids=%s",
|
||||||
author_filter_ids,
|
author_filter_ids_int,
|
||||||
)
|
)
|
||||||
institution_aliases = []
|
institution_aliases = []
|
||||||
if raw_oa_institution_id:
|
if raw_oa_institution_id:
|
||||||
|
if institutions_search_client is None:
|
||||||
|
raise ValueError(
|
||||||
|
"institutions_search_client must be provided when raw_oa_institution_id is set"
|
||||||
|
)
|
||||||
institution_aliases = (
|
institution_aliases = (
|
||||||
await institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
await institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
||||||
raw_oa_institution_id
|
raw_oa_institution_id
|
||||||
@@ -239,7 +273,7 @@ async def get_dfg_projects_by_author_id(
|
|||||||
institution_aliases=institution_aliases,
|
institution_aliases=institution_aliases,
|
||||||
project_ids=author_project_ids,
|
project_ids=author_project_ids,
|
||||||
names=filter_names or [],
|
names=filter_names or [],
|
||||||
institution_ids=institution_ids,
|
institution_ids=institution_ids_int,
|
||||||
keywords=keywords,
|
keywords=keywords,
|
||||||
topic_ids=topic_ids,
|
topic_ids=topic_ids,
|
||||||
filter_topic_ids=filter_topic_ids,
|
filter_topic_ids=filter_topic_ids,
|
||||||
@@ -428,6 +462,10 @@ async def search_bund_projects_with_filters(
|
|||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
institution_aliases = []
|
institution_aliases = []
|
||||||
if raw_oa_institution_id:
|
if raw_oa_institution_id:
|
||||||
|
if institutions_search_client is None:
|
||||||
|
raise ValueError(
|
||||||
|
"institutions_search_client must be provided when raw_oa_institution_id is set"
|
||||||
|
)
|
||||||
institution_aliases = (
|
institution_aliases = (
|
||||||
await institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
await institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
||||||
raw_oa_institution_id
|
raw_oa_institution_id
|
||||||
@@ -642,7 +680,6 @@ async def search_eu_cordis_projects(
|
|||||||
eu_cordis_projects_client.search_eu_cordis_projects.
|
eu_cordis_projects_client.search_eu_cordis_projects.
|
||||||
"""
|
"""
|
||||||
resolved_organization_names: list[str] = list(organization_names or [])
|
resolved_organization_names: list[str] = list(organization_names or [])
|
||||||
|
|
||||||
if raw_oa_institution_id:
|
if raw_oa_institution_id:
|
||||||
if institutions_search_client is None:
|
if institutions_search_client is None:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ from typing import Annotated
|
|||||||
import inse.topics.v2.service as topics_service
|
import inse.topics.v2.service as topics_service
|
||||||
from fastapi import APIRouter, Path, Query
|
from fastapi import APIRouter, Path, Query
|
||||||
from inse.model import SortDirection
|
from inse.model import SortDirection
|
||||||
|
from inse.models.openalex.domain import Domain
|
||||||
|
from inse.models.openalex.model_field import ModelField
|
||||||
|
from inse.models.openalex.subfield import Subfield
|
||||||
from inse.models.openalex.topic import Topic
|
from inse.models.openalex.topic import Topic
|
||||||
from inse.router_prefixes import RouterPrefixes
|
from inse.router_prefixes import RouterPrefixes
|
||||||
from inse.tags import Tags
|
from inse.tags import Tags
|
||||||
@@ -78,6 +81,48 @@ async def get_topic_by_id(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/domains/single/{domain_id}",
|
||||||
|
operation_id="getDomainById",
|
||||||
|
summary="Returns a domain for a given domain ID.",
|
||||||
|
)
|
||||||
|
async def get_domain_by_id(
|
||||||
|
domain_id: Annotated[
|
||||||
|
str,
|
||||||
|
Path(description="The ID of the domain to retrieve."),
|
||||||
|
],
|
||||||
|
) -> Domain:
|
||||||
|
return await topics_service.get_domain_by_id_or_raise(domain_id=domain_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/fields/single/{field_id}",
|
||||||
|
operation_id="getFieldById",
|
||||||
|
summary="Returns a field for a given field ID.",
|
||||||
|
)
|
||||||
|
async def get_field_by_id(
|
||||||
|
field_id: Annotated[
|
||||||
|
str,
|
||||||
|
Path(description="The ID of the field to retrieve."),
|
||||||
|
],
|
||||||
|
) -> ModelField:
|
||||||
|
return await topics_service.get_field_by_id_or_raise(field_id=field_id)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/subfields/single/{subfield_id}",
|
||||||
|
operation_id="getSubfieldById",
|
||||||
|
summary="Returns a subfield for a given subfield ID.",
|
||||||
|
)
|
||||||
|
async def get_subfield_by_id(
|
||||||
|
subfield_id: Annotated[
|
||||||
|
str,
|
||||||
|
Path(description="The ID of the subfield to retrieve."),
|
||||||
|
],
|
||||||
|
) -> Subfield:
|
||||||
|
return await topics_service.get_subfield_by_id_or_raise(subfield_id=subfield_id)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/topics/id",
|
"/topics/id",
|
||||||
operation_id="getTopicsByIds",
|
operation_id="getTopicsByIds",
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
from inse.exceptions import NotFoundException
|
from inse.exceptions import NotFoundException
|
||||||
from inse.integrations import elasticsearch
|
from inse.integrations import elasticsearch
|
||||||
from inse.model import ESIndex, SortDirection
|
from inse.model import ESIndex, SortDirection
|
||||||
|
from inse.models.openalex.domain import Domain
|
||||||
|
from inse.models.openalex.model_field import ModelField
|
||||||
|
from inse.models.openalex.subfield import Subfield
|
||||||
from inse.models.openalex.topic import Topic
|
from inse.models.openalex.topic import Topic
|
||||||
from inse.topics.v2.model import TopicPageV2, TopicSortBy
|
from inse.topics.v2.model import TopicPageV2, TopicSortBy
|
||||||
|
|
||||||
@@ -184,6 +187,117 @@ async def get_topic_by_id_or_raise(raw_oa_topic_id: str) -> Topic:
|
|||||||
return topic
|
return topic
|
||||||
|
|
||||||
|
|
||||||
|
async def get_domain_by_id(domain_id: str) -> Domain | None:
|
||||||
|
"""Retrieves a domain based on its ID.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
domain_id (str): The numeric OpenAlex ID of the domain to retrieve (e.g. "4").
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Domain | None: The domain matching the provided ID, or None if not found.
|
||||||
|
"""
|
||||||
|
response = await elasticsearch.get(
|
||||||
|
index=ESIndex.OPENALEX_DOMAINS,
|
||||||
|
doc_id=domain_id,
|
||||||
|
source=["id", "display_name", "description"],
|
||||||
|
)
|
||||||
|
if response.get("found"):
|
||||||
|
return Domain.from_dict(response.get("_source", {}))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
async def get_domain_by_id_or_raise(domain_id: str) -> Domain:
|
||||||
|
"""Retrieves a domain based on its ID, raising an exception if not found.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
domain_id (str): The ID of the domain to retrieve.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotFoundException: If the domain with the specified ID is not found.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Domain: The domain matching the provided ID.
|
||||||
|
"""
|
||||||
|
domain = await get_domain_by_id(domain_id)
|
||||||
|
if domain is None:
|
||||||
|
raise NotFoundException(f"Domain with ID {domain_id} not found.")
|
||||||
|
return domain
|
||||||
|
|
||||||
|
|
||||||
|
async def get_field_by_id(field_id: str) -> ModelField | None:
|
||||||
|
"""Retrieves a field based on its ID.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
field_id (str): The numeric OpenAlex ID of the field to retrieve (e.g. "27").
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ModelField | None: The field matching the provided ID, or None if not found.
|
||||||
|
"""
|
||||||
|
response = await elasticsearch.get(
|
||||||
|
index=ESIndex.OPENALEX_FIELDS,
|
||||||
|
doc_id=field_id,
|
||||||
|
source=["id", "display_name", "description"],
|
||||||
|
)
|
||||||
|
if response.get("found"):
|
||||||
|
return ModelField.from_dict(response.get("_source", {}))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
async def get_field_by_id_or_raise(field_id: str) -> ModelField:
|
||||||
|
"""Retrieves a field based on its ID, raising an exception if not found.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
field_id (str): The ID of the field to retrieve.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotFoundException: If the field with the specified ID is not found.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ModelField: The field matching the provided ID.
|
||||||
|
"""
|
||||||
|
field = await get_field_by_id(field_id)
|
||||||
|
if field is None:
|
||||||
|
raise NotFoundException(f"Field with ID {field_id} not found.")
|
||||||
|
return field
|
||||||
|
|
||||||
|
|
||||||
|
async def get_subfield_by_id(subfield_id: str) -> Subfield | None:
|
||||||
|
"""Retrieves a subfield based on its ID.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
subfield_id (str): The numeric OpenAlex ID of the subfield to retrieve (e.g. "2743").
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Subfield | None: The subfield matching the provided ID, or None if not found.
|
||||||
|
"""
|
||||||
|
response = await elasticsearch.get(
|
||||||
|
index=ESIndex.OPENALEX_SUBFIELDS,
|
||||||
|
doc_id=subfield_id,
|
||||||
|
source=["id", "display_name", "description"],
|
||||||
|
)
|
||||||
|
if response.get("found"):
|
||||||
|
return Subfield.from_dict(response.get("_source", {}))
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
async def get_subfield_by_id_or_raise(subfield_id: str) -> Subfield:
|
||||||
|
"""Retrieves a subfield based on its ID, raising an exception if not found.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
subfield_id (str): The ID of the subfield to retrieve.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotFoundException: If the subfield with the specified ID is not found.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Subfield: The subfield matching the provided ID.
|
||||||
|
"""
|
||||||
|
subfield = await get_subfield_by_id(subfield_id)
|
||||||
|
if subfield is None:
|
||||||
|
raise NotFoundException(f"Subfield with ID {subfield_id} not found.")
|
||||||
|
return subfield
|
||||||
|
|
||||||
|
|
||||||
async def get_topics_by_ids(topic_ids: list[str]) -> TopicPageV2:
|
async def get_topics_by_ids(topic_ids: list[str]) -> TopicPageV2:
|
||||||
"""Retrieves topics based on a list of topic IDs.
|
"""Retrieves topics based on a list of topic IDs.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from inse.integrations import elasticsearch
|
from inse.integrations import elasticsearch
|
||||||
@@ -11,6 +12,17 @@ logger = logging.getLogger(__name__)
|
|||||||
DEFAULT_INSTITUTION_ID = "https://openalex.org/I62318514"
|
DEFAULT_INSTITUTION_ID = "https://openalex.org/I62318514"
|
||||||
DEFAULT_INSTITUTION_NAME = "University of Duisburg-Essen"
|
DEFAULT_INSTITUTION_NAME = "University of Duisburg-Essen"
|
||||||
|
|
||||||
|
# Reserved characters and boolean operators of the Lucene query_string syntax
|
||||||
|
_LUCENE_SPECIAL_CHARS = re.compile(r'([+\-=&|><!(){}\[\]^"~*?:\\/])')
|
||||||
|
_LUCENE_BOOL_OPERATORS = re.compile(r"\b(AND|OR|NOT)\b")
|
||||||
|
|
||||||
|
|
||||||
|
def escape_lucene_query(term: str) -> str:
|
||||||
|
"""Escapes a free-text search term so it is safe inside a ``query_string`` query."""
|
||||||
|
if not term:
|
||||||
|
return ""
|
||||||
|
escaped = _LUCENE_SPECIAL_CHARS.sub(r"\\\1", term)
|
||||||
|
return _LUCENE_BOOL_OPERATORS.sub(lambda m: f'"{m.group(1)}"', escaped)
|
||||||
|
|
||||||
|
|
||||||
def clean_inst_id(id_str: str) -> str:
|
def clean_inst_id(id_str: str) -> str:
|
||||||
@@ -407,6 +419,56 @@ class TrendQueryBuilder:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def build_cc_news_year_agg_body(
|
||||||
|
term: str,
|
||||||
|
start_year: int,
|
||||||
|
end_year: int,
|
||||||
|
languages: list[str] | None = None,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""Builds a size=0 yearly-count aggregation over the Common Crawl News indices. Buckets
|
||||||
|
by year with a `date_histogram`, since cc-news has a real `content_date` date field rather than
|
||||||
|
the integer `date_year` of `aktuell`.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
"size": 0,
|
||||||
|
"track_total_hits": False,
|
||||||
|
"_source": False,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{
|
||||||
|
"query_string": {
|
||||||
|
"query": escape_lucene_query(term),
|
||||||
|
"fields": CC_NEWS_SEARCH_FIELDS,
|
||||||
|
"default_operator": "AND",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{"terms": {"language_code": languages or CC_NEWS_LANGUAGES}},
|
||||||
|
{
|
||||||
|
"range": {
|
||||||
|
"content_date": {
|
||||||
|
"gte": f"{start_year}-01-01",
|
||||||
|
"lte": f"{end_year}-12-31",
|
||||||
|
"format": "yyyy-MM-dd",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"by_year": {
|
||||||
|
"date_histogram": {
|
||||||
|
"field": "content_date",
|
||||||
|
"calendar_interval": "year",
|
||||||
|
"format": "yyyy",
|
||||||
|
"min_doc_count": 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def build_bund_receiver_clause(aliases: list[str]) -> dict[str, Any]:
|
def build_bund_receiver_clause(aliases: list[str]) -> dict[str, Any]:
|
||||||
"""Builds Zuwendungsempfänger matching clause for BUND projects."""
|
"""Builds Zuwendungsempfänger matching clause for BUND projects."""
|
||||||
@@ -443,4 +505,7 @@ DFG_PROJECT_TEXT_FIELDS = [
|
|||||||
|
|
||||||
CORDIS_PROJECT_TEXT_FIELDS = ["title", "objective"]
|
CORDIS_PROJECT_TEXT_FIELDS = ["title", "objective"]
|
||||||
AKTUELLES_SEARCH_FIELDS = ["main_content", "full_content", "maintitle", "subtitle", "intro_content"]
|
AKTUELLES_SEARCH_FIELDS = ["main_content", "full_content", "maintitle", "subtitle", "intro_content"]
|
||||||
|
CC_NEWS_SEARCH_FIELDS = ["title", "body"]
|
||||||
|
CC_NEWS_LANGUAGES = ["de", "en"]
|
||||||
|
CC_NEWS_START_YEAR = 2017
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,13 @@ from .model import (
|
|||||||
)
|
)
|
||||||
from .trend_query_builder import (
|
from .trend_query_builder import (
|
||||||
AKTUELLES_SEARCH_FIELDS,
|
AKTUELLES_SEARCH_FIELDS,
|
||||||
|
CC_NEWS_START_YEAR,
|
||||||
DEFAULT_INSTITUTION_ID,
|
DEFAULT_INSTITUTION_ID,
|
||||||
DEFAULT_INSTITUTION_NAME,
|
DEFAULT_INSTITUTION_NAME,
|
||||||
TrendMetadataResolver,
|
TrendMetadataResolver,
|
||||||
TrendQueryBuilder,
|
TrendQueryBuilder,
|
||||||
clean_inst_id,
|
clean_inst_id,
|
||||||
|
escape_lucene_query,
|
||||||
to_full_inst_url,
|
to_full_inst_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -47,6 +49,13 @@ EPO_PATENT_FIELDS = [
|
|||||||
"openalex_topics.topic_id",
|
"openalex_topics.topic_id",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Synthetic entity id prefixes for the news trend series. The webapp keys colouring, chip
|
||||||
|
# visibility and pie filtering off these, so keep them in sync with uni-trend-parent.component.ts.
|
||||||
|
NEWS_ENTITY_PREFIX = "news_topic_"
|
||||||
|
CC_NEWS_ENTITY_PREFIX = "ccnews_topic_"
|
||||||
|
# Entity id of the collapsed CC-News series in the cross-domain ("all") view.
|
||||||
|
CC_NEWS_COMPOSITE_ID = "ccnews"
|
||||||
|
|
||||||
DFG_INSTITUTION_FIELDS = [
|
DFG_INSTITUTION_FIELDS = [
|
||||||
"Antragstellende Institution",
|
"Antragstellende Institution",
|
||||||
"Mitantragstellende Institution",
|
"Mitantragstellende Institution",
|
||||||
@@ -1042,6 +1051,18 @@ class ProjectsTrendStrategy(TrendStrategy):
|
|||||||
|
|
||||||
|
|
||||||
class NewsTrendStrategy(TrendStrategy):
|
class NewsTrendStrategy(TrendStrategy):
|
||||||
|
"""Yearly news counts per topic.
|
||||||
|
|
||||||
|
Produces one series per topic from the UDE-internal `aktuell` index (entity id
|
||||||
|
``news_topic_<topic>``). When keyword matching is active (``fuzzy=False``) it additionally
|
||||||
|
produces an external Common Crawl News baseline per topic (``ccnews_topic_<topic>``) so the
|
||||||
|
internal coverage can be compared against the wider web. CC-News has no OpenAlex topic
|
||||||
|
mapping, so it is skipped entirely in topic-mapping mode.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, include_cc_news: bool = True):
|
||||||
|
self.include_cc_news = include_cc_news
|
||||||
|
|
||||||
async def get_trend(
|
async def get_trend(
|
||||||
self,
|
self,
|
||||||
topics: list[str],
|
topics: list[str],
|
||||||
@@ -1054,20 +1075,40 @@ class NewsTrendStrategy(TrendStrategy):
|
|||||||
) -> TrendResponse:
|
) -> TrendResponse:
|
||||||
years_range = self._get_years_range()
|
years_range = self._get_years_range()
|
||||||
start_year, end_year = years_range[0], years_range[-1]
|
start_year, end_year = years_range[0], years_range[-1]
|
||||||
|
years_set = set(years_range)
|
||||||
|
|
||||||
|
cc_news_enabled = self.include_cc_news and not fuzzy
|
||||||
|
|
||||||
accumulated_data = {
|
accumulated_data = {
|
||||||
f"news_topic_{t}": {top: {yr: (0, 1) for yr in years_range} for top in topics}
|
f"{NEWS_ENTITY_PREFIX}{t}": {top: {yr: (0, 1) for yr in years_range} for top in topics}
|
||||||
for t in topics
|
for t in topics
|
||||||
}
|
}
|
||||||
|
if cc_news_enabled:
|
||||||
|
accumulated_data.update({
|
||||||
|
f"{CC_NEWS_ENTITY_PREFIX}{t}": {top: {yr: (0, 1) for yr in years_range} for top in topics}
|
||||||
|
for t in topics
|
||||||
|
})
|
||||||
|
|
||||||
STOP_WORDS = {"in", "and", "or", "und", "oder", "der", "die", "das", "von", "mit", "zu", "at", "by", "on", "for", "to", "a", "an", "the"}
|
STOP_WORDS = {"in", "and", "or", "und", "oder", "der", "die", "das", "von", "mit", "zu", "at", "by", "on", "for", "to", "a", "an", "the"}
|
||||||
|
|
||||||
|
def resolve_keyword_term(idx: int, t_name: str) -> str:
|
||||||
|
"""Picks the raw keyword for a topic, falling back to the topic name itself."""
|
||||||
|
if keywords and idx < len(keywords) and keywords[idx]:
|
||||||
|
raw_kw = keywords[idx]
|
||||||
|
term = raw_kw.split(",")[0].strip() if isinstance(raw_kw, str) else raw_kw
|
||||||
|
if term:
|
||||||
|
return term
|
||||||
|
return t_name
|
||||||
|
|
||||||
|
def is_searchable_term(term: str) -> bool:
|
||||||
|
return bool(term) and term.lower() not in STOP_WORDS and len(term.strip()) > 1
|
||||||
|
|
||||||
# Scan UDE news OpenAlex topics index to get matching news IDs without size limit cutoffs
|
# Scan UDE news OpenAlex topics index to get matching news IDs without size limit cutoffs
|
||||||
async def fetch_news_ids_for_term(idx: int, t_name: str) -> list[str]:
|
async def fetch_news_ids_for_term(idx: int, t_name: str) -> list[str]:
|
||||||
news_ids: Set[str] = set()
|
news_ids: Set[str] = set()
|
||||||
if fuzzy:
|
if fuzzy:
|
||||||
term = t_name
|
term = t_name
|
||||||
es_query = {"term": {"topic_matches.topic_display_name.keyword": term}}
|
es_query = {"match_phrase": {"topic_matches.topic_display_name": term}}
|
||||||
try:
|
try:
|
||||||
async for hit in elasticsearch.scan(
|
async for hit in elasticsearch.scan(
|
||||||
index=ESIndex.AKTUELLES_OPENALEX_TOPICS.value,
|
index=ESIndex.AKTUELLES_OPENALEX_TOPICS.value,
|
||||||
@@ -1081,20 +1122,14 @@ class NewsTrendStrategy(TrendStrategy):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Failed to scan UDE news OpenAlex topics index %s: %s", ESIndex.AKTUELLES_OPENALEX_TOPICS.value, e)
|
logger.warning("Failed to scan UDE news OpenAlex topics index %s: %s", ESIndex.AKTUELLES_OPENALEX_TOPICS.value, e)
|
||||||
else:
|
else:
|
||||||
if keywords and idx < len(keywords) and keywords[idx]:
|
term = resolve_keyword_term(idx, t_name)
|
||||||
raw_kw = keywords[idx]
|
|
||||||
term = raw_kw.split(",")[0].strip() if isinstance(raw_kw, str) else raw_kw
|
|
||||||
if not term:
|
|
||||||
term = t_name
|
|
||||||
else:
|
|
||||||
term = t_name
|
|
||||||
|
|
||||||
# If non-fuzzy keyword search, search article content fields in 'aktuell' index
|
# If non-fuzzy keyword search, search article content fields in 'aktuell' index
|
||||||
if term and term.lower() not in STOP_WORDS and len(term.strip()) > 1:
|
if is_searchable_term(term):
|
||||||
try:
|
try:
|
||||||
content_query = {
|
content_query = {
|
||||||
"query_string": {
|
"query_string": {
|
||||||
"query": term,
|
"query": escape_lucene_query(term),
|
||||||
"fields": AKTUELLES_SEARCH_FIELDS,
|
"fields": AKTUELLES_SEARCH_FIELDS,
|
||||||
"default_operator": "AND",
|
"default_operator": "AND",
|
||||||
}
|
}
|
||||||
@@ -1113,12 +1148,59 @@ class NewsTrendStrategy(TrendStrategy):
|
|||||||
|
|
||||||
return list(news_ids)
|
return list(news_ids)
|
||||||
|
|
||||||
matching_ids_list = await asyncio.gather(*(fetch_news_ids_for_term(idx, t) for idx, t in enumerate(topics)))
|
async def fetch_cc_news_counts() -> dict[int, dict[int, int]]:
|
||||||
|
"""Yearly CC-News counts per topic index, from a single _msearch over cc-news-*.
|
||||||
|
The year buckets are read straight off a size=0 date_histogram instead.
|
||||||
|
"""
|
||||||
|
searchable = [
|
||||||
|
(idx, term)
|
||||||
|
for idx, t_name in enumerate(topics)
|
||||||
|
if is_searchable_term(term := resolve_keyword_term(idx, t_name))
|
||||||
|
]
|
||||||
|
if not searchable:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
searches = [
|
||||||
|
(
|
||||||
|
ESIndex.CC_NEWS_WILDCARD.value,
|
||||||
|
TrendQueryBuilder.build_cc_news_year_agg_body(term, CC_NEWS_START_YEAR, end_year),
|
||||||
|
)
|
||||||
|
for _, term in searchable
|
||||||
|
]
|
||||||
|
try:
|
||||||
|
responses = await elasticsearch.msearch(
|
||||||
|
searches, cluster=ESCluster.NES, request_cache=True
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning("Failed to aggregate CC-News years via msearch: %s", e)
|
||||||
|
return {}
|
||||||
|
|
||||||
|
counts: dict[int, dict[int, int]] = {}
|
||||||
|
for (topic_idx, term), res in zip(searchable, responses):
|
||||||
|
if not isinstance(res, dict) or "error" in res:
|
||||||
|
logger.warning("CC-News msearch entry for %r failed: %s", term, (res or {}).get("error"))
|
||||||
|
continue
|
||||||
|
by_year: dict[int, int] = {}
|
||||||
|
for b in res.get("aggregations", {}).get("by_year", {}).get("buckets", []):
|
||||||
|
try:
|
||||||
|
yr = int(b.get("key_as_string"))
|
||||||
|
except (TypeError, ValueError):
|
||||||
|
continue
|
||||||
|
if yr in years_set:
|
||||||
|
by_year[yr] = int(b.get("doc_count", 0))
|
||||||
|
counts[topic_idx] = by_year
|
||||||
|
return counts
|
||||||
|
|
||||||
|
news_ids_future = asyncio.gather(*(fetch_news_ids_for_term(idx, t) for idx, t in enumerate(topics)))
|
||||||
|
if cc_news_enabled:
|
||||||
|
matching_ids_list, cc_news_counts = await asyncio.gather(news_ids_future, fetch_cc_news_counts())
|
||||||
|
else:
|
||||||
|
matching_ids_list, cc_news_counts = await news_ids_future, {}
|
||||||
|
|
||||||
async def count_by_year(t_name: str, news_ids: list[str]):
|
async def count_by_year(t_name: str, news_ids: list[str]):
|
||||||
if not news_ids:
|
if not news_ids:
|
||||||
return
|
return
|
||||||
entity_key = f"news_topic_{t_name}"
|
entity_key = f"{NEWS_ENTITY_PREFIX}{t_name}"
|
||||||
|
|
||||||
# Prepare multi-search payloads for chunks of news_ids to avoid payload limits
|
# Prepare multi-search payloads for chunks of news_ids to avoid payload limits
|
||||||
chunk_queries = []
|
chunk_queries = []
|
||||||
@@ -1164,13 +1246,15 @@ class NewsTrendStrategy(TrendStrategy):
|
|||||||
|
|
||||||
await asyncio.gather(*(count_by_year(t, ids) for t, ids in zip(topics, matching_ids_list)))
|
await asyncio.gather(*(count_by_year(t, ids) for t, ids in zip(topics, matching_ids_list)))
|
||||||
|
|
||||||
|
for topic_idx, t_name in enumerate(topics):
|
||||||
|
entity_key = f"{CC_NEWS_ENTITY_PREFIX}{t_name}"
|
||||||
|
for yr, count in cc_news_counts.get(topic_idx, {}).items():
|
||||||
|
prev_count, _ = accumulated_data[entity_key][t_name][yr]
|
||||||
|
accumulated_data[entity_key][t_name][yr] = (prev_count + count, 1)
|
||||||
|
|
||||||
normalized_lookup = self._normalize_series(years_range, accumulated_data, topics)
|
normalized_lookup = self._normalize_series(years_range, accumulated_data, topics)
|
||||||
|
|
||||||
series_list: list[TrendSeries] = []
|
def build_series(entity_key: str, t_name: str, entity_name: str) -> TrendSeries:
|
||||||
for t_name in topics:
|
|
||||||
entity_key = f"news_topic_{t_name}"
|
|
||||||
topic_data_map: dict[str, list[TopicYearlyData]] = {}
|
|
||||||
|
|
||||||
lookup = normalized_lookup.get((entity_key, t_name), {})
|
lookup = normalized_lookup.get((entity_key, t_name), {})
|
||||||
norm_vals = lookup.get("normalized", [0.0] * len(years_range))
|
norm_vals = lookup.get("normalized", [0.0] * len(years_range))
|
||||||
cum_vals = lookup.get("cumulative", [0.0] * len(years_range))
|
cum_vals = lookup.get("cumulative", [0.0] * len(years_range))
|
||||||
@@ -1188,16 +1272,22 @@ class NewsTrendStrategy(TrendStrategy):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
for topic in topics:
|
topic_data_map: dict[str, list[TopicYearlyData]] = {topic: yearly_data_items for topic in topics}
|
||||||
topic_data_map[topic] = yearly_data_items
|
|
||||||
|
|
||||||
series_list.append(
|
return TrendSeries(
|
||||||
TrendSeries(
|
entity_id=entity_key,
|
||||||
entity_id=entity_key,
|
entity_name=entity_name,
|
||||||
entity_name=t_name,
|
entity_type="institution",
|
||||||
entity_type="institution",
|
topic_data=topic_data_map,
|
||||||
topic_data=topic_data_map,
|
)
|
||||||
)
|
|
||||||
|
series_list: list[TrendSeries] = [
|
||||||
|
build_series(f"{NEWS_ENTITY_PREFIX}{t_name}", t_name, t_name) for t_name in topics
|
||||||
|
]
|
||||||
|
if cc_news_enabled:
|
||||||
|
series_list.extend(
|
||||||
|
build_series(f"{CC_NEWS_ENTITY_PREFIX}{t_name}", t_name, f"{t_name} (CC-News)")
|
||||||
|
for t_name in topics
|
||||||
)
|
)
|
||||||
|
|
||||||
return TrendResponse(series=series_list, years=years_range)
|
return TrendResponse(series=series_list, years=years_range)
|
||||||
@@ -1269,25 +1359,40 @@ class AllTrendStrategy(TrendStrategy):
|
|||||||
add_composite(pat_series, "patents", "Patentanmeldungen")
|
add_composite(pat_series, "patents", "Patentanmeldungen")
|
||||||
add_composite(proj_series, "projects", "Drittmittelförderung")
|
add_composite(proj_series, "projects", "Drittmittelförderung")
|
||||||
|
|
||||||
if is_ude and news_res:
|
def merge_news_composite(prefix: str, c_id: str, c_name: str) -> bool:
|
||||||
merged_news_topic_data: dict[str, list[TopicYearlyData]] = {}
|
"""Collapses the per-topic news series of one source into a single composite.
|
||||||
|
|
||||||
|
Returns False when the source produced no series at all.
|
||||||
|
"""
|
||||||
|
if not news_res or not any(s.entity_id.startswith(prefix) for s in news_res.series):
|
||||||
|
return False
|
||||||
|
|
||||||
|
merged_topic_data: dict[str, list[TopicYearlyData]] = {}
|
||||||
for topic in topics:
|
for topic in topics:
|
||||||
term_key = f"news_topic_{topic}"
|
term_key = f"{prefix}{topic}"
|
||||||
matching_series = next((s for s in news_res.series if s.entity_id == term_key), None)
|
matching_series = next((s for s in news_res.series if s.entity_id == term_key), None)
|
||||||
if matching_series and topic in matching_series.topic_data:
|
if matching_series and topic in matching_series.topic_data:
|
||||||
merged_news_topic_data[topic] = matching_series.topic_data[topic]
|
merged_topic_data[topic] = matching_series.topic_data[topic]
|
||||||
else:
|
else:
|
||||||
merged_news_topic_data[topic] = [
|
merged_topic_data[topic] = [
|
||||||
TopicYearlyData(year=yr, raw=0, normalized=0.0, cumulative=0.0, institutions_count=1)
|
TopicYearlyData(year=yr, raw=0, normalized=0.0, cumulative=0.0, institutions_count=1)
|
||||||
for yr in years_range
|
for yr in years_range
|
||||||
]
|
]
|
||||||
|
|
||||||
news_series = TrendSeries(
|
add_composite(
|
||||||
entity_id="news",
|
TrendSeries(
|
||||||
entity_name="UDE Campus Aktuell Beiträge",
|
entity_id=c_id,
|
||||||
entity_type="institution",
|
entity_name=c_name,
|
||||||
topic_data=merged_news_topic_data,
|
entity_type="institution",
|
||||||
|
topic_data=merged_topic_data,
|
||||||
|
),
|
||||||
|
c_id,
|
||||||
|
c_name,
|
||||||
)
|
)
|
||||||
add_composite(news_series, "news", "UDE Campus Aktuell Beiträge")
|
return True
|
||||||
|
|
||||||
|
if is_ude:
|
||||||
|
merge_news_composite(NEWS_ENTITY_PREFIX, "news", "UDE Campus Aktuell Beiträge")
|
||||||
|
merge_news_composite(CC_NEWS_ENTITY_PREFIX, CC_NEWS_COMPOSITE_ID, "Web-Nachrichten (CC-News)")
|
||||||
|
|
||||||
return TrendResponse(series=composite_series, years=years_range)
|
return TrendResponse(series=composite_series, years=years_range)
|
||||||
|
|||||||
@@ -654,6 +654,7 @@ async def _search_works(
|
|||||||
size=size,
|
size=size,
|
||||||
offset=page * size,
|
offset=page * size,
|
||||||
sort=sort,
|
sort=sort,
|
||||||
|
track_total_hits=True
|
||||||
)
|
)
|
||||||
|
|
||||||
hits_block = response.get("hits", {})
|
hits_block = response.get("hits", {})
|
||||||
|
|||||||
+1529
-527
File diff suppressed because it is too large
Load Diff
@@ -66,7 +66,7 @@ export class ProjectsService extends BaseService {
|
|||||||
/**
|
/**
|
||||||
* Get DFG projects.
|
* Get DFG projects.
|
||||||
* Returns a page of DFG projects based on the provided pagination parameters and optional institution filter.
|
* Returns a page of DFG projects based on the provided pagination parameters and optional institution filter.
|
||||||
* @endpoint get /api/projects/person/dfg/search
|
* @endpoint get /api/projects/dfg/search
|
||||||
* @param rawOaInstitutionId The openalex institution ID to filter by.
|
* @param rawOaInstitutionId The openalex institution ID to filter by.
|
||||||
* @param authorId The openalex author ID to filter by.
|
* @param authorId The openalex author ID to filter by.
|
||||||
* @param authorFilterIds The dfg author IDs to filter by.
|
* @param authorFilterIds The dfg author IDs to filter by.
|
||||||
@@ -82,13 +82,14 @@ export class ProjectsService extends BaseService {
|
|||||||
* @param sortBy The field to sort by.
|
* @param sortBy The field to sort by.
|
||||||
* @param sortDirection The sort direction (asc or desc).
|
* @param sortDirection The sort direction (asc or desc).
|
||||||
* @param fuzzy Use topic_id resolution if True, otherwise use raw keyword search.
|
* @param fuzzy Use topic_id resolution if True, otherwise use raw keyword search.
|
||||||
|
* @param secureFgpAcc
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
* @param 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.
|
* @param reportProgress flag to report request and response progress.
|
||||||
*/
|
*/
|
||||||
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<number>, institutionIds?: Array<number>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgProjectPage>;
|
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<string>, institutionIds?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgProjectPage>;
|
||||||
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<number>, institutionIds?: Array<number>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgProjectPage>>;
|
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<string>, institutionIds?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgProjectPage>>;
|
||||||
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<number>, institutionIds?: Array<number>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgProjectPage>>;
|
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<string>, institutionIds?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgProjectPage>>;
|
||||||
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<number>, institutionIds?: Array<number>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
public getDfgProjects(rawOaInstitutionId?: string, authorId?: string, authorFilterIds?: Array<string>, institutionIds?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
@@ -152,6 +153,9 @@ export class ProjectsService extends BaseService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
'application/json'
|
'application/json'
|
||||||
]);
|
]);
|
||||||
@@ -175,7 +179,7 @@ export class ProjectsService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/projects/person/dfg/search`;
|
let localVarPath = `/api/projects/dfg/search`;
|
||||||
const { basePath, withCredentials } = this.configuration;
|
const { basePath, withCredentials } = this.configuration;
|
||||||
return this.httpClient.request<DfgProjectPage>('get', `${basePath}${localVarPath}`,
|
return this.httpClient.request<DfgProjectPage>('get', `${basePath}${localVarPath}`,
|
||||||
{
|
{
|
||||||
@@ -846,13 +850,14 @@ export class ProjectsService extends BaseService {
|
|||||||
* @param sortBy Sort field.
|
* @param sortBy Sort field.
|
||||||
* @param sortDirection Sort direction: asc or desc.
|
* @param sortDirection Sort direction: asc or desc.
|
||||||
* @param fuzzy Use OpenAlex topic-id resolution if true, otherwise raw keyword search.
|
* @param fuzzy Use OpenAlex topic-id resolution if true, otherwise raw keyword search.
|
||||||
|
* @param secureFgpAcc
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
* @param 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.
|
* @param reportProgress flag to report request and response progress.
|
||||||
*/
|
*/
|
||||||
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<BundProjectPage>;
|
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<BundProjectPage>;
|
||||||
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<BundProjectPage>>;
|
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<BundProjectPage>>;
|
||||||
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<BundProjectPage>>;
|
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<BundProjectPage>>;
|
||||||
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
public searchBundProjectsWithFilters(executingAgency?: Array<string>, fundingArts?: Array<string>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, rawOaInstitutionId?: string, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
if (executingAgency) {
|
if (executingAgency) {
|
||||||
@@ -920,6 +925,9 @@ export class ProjectsService extends BaseService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
'application/json'
|
'application/json'
|
||||||
]);
|
]);
|
||||||
@@ -984,13 +992,14 @@ export class ProjectsService extends BaseService {
|
|||||||
* @param sortBy Sort field.
|
* @param sortBy Sort field.
|
||||||
* @param sortDirection Sort direction: asc or desc.
|
* @param sortDirection Sort direction: asc or desc.
|
||||||
* @param fuzzy Use OpenAlex topic-id resolution if true, otherwise raw keyword search.
|
* @param fuzzy Use OpenAlex topic-id resolution if true, otherwise raw keyword search.
|
||||||
|
* @param secureFgpAcc
|
||||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
* @param 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.
|
* @param reportProgress flag to report request and response progress.
|
||||||
*/
|
*/
|
||||||
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<EuCordisProjectSearchPage>;
|
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<EuCordisProjectSearchPage>;
|
||||||
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<EuCordisProjectSearchPage>>;
|
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<EuCordisProjectSearchPage>>;
|
||||||
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<EuCordisProjectSearchPage>>;
|
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<EuCordisProjectSearchPage>>;
|
||||||
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
public searchEuCordisProjects(rawOaInstitutionId?: string, authorId?: string, authorIds?: Array<string>, organizationIds?: Array<string>, organizationNames?: Array<string>, projectTypes?: Array<EuCordisProjectType>, title?: string, keywords?: Array<string>, topicIds?: Array<string>, filterTopicIds?: Array<string>, fundingStartYears?: Array<string>, fundingEndYears?: Array<string>, countries?: Array<string>, frameworkProgrammes?: Array<string>, fundingSchemes?: Array<string>, statuses?: Array<string>, page?: number, size?: number, sortBy?: string, sortDirection?: string, fuzzy?: boolean, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
|
||||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||||
@@ -1090,6 +1099,9 @@ export class ProjectsService extends BaseService {
|
|||||||
|
|
||||||
let localVarHeaders = this.defaultHeaders;
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
// authentication (HTTPBearer) required
|
||||||
|
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||||
|
|
||||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
'application/json'
|
'application/json'
|
||||||
]);
|
]);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -19,4 +19,3 @@ export interface DfgProjectTopic {
|
|||||||
project_count: number;
|
project_count: number;
|
||||||
keywords: Array<DfgProjectKeyword>;
|
keywords: Array<DfgProjectKeyword>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* 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 { DomainFieldsInner } from './domainFieldsInner';
|
||||||
|
import { DomainIds } from './domainIds';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Top-level category in the topic hierarchy (4 total)
|
||||||
|
*/
|
||||||
|
export interface Domain {
|
||||||
|
id?: string | null;
|
||||||
|
display_name?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
display_name_alternatives?: Array<string> | null;
|
||||||
|
fields?: Array<DomainFieldsInner> | null;
|
||||||
|
siblings?: Array<DomainFieldsInner> | null;
|
||||||
|
ids?: DomainIds | null;
|
||||||
|
works_count?: number | null;
|
||||||
|
cited_by_count?: number | null;
|
||||||
|
works_api_url?: string | null;
|
||||||
|
created_date?: string | null;
|
||||||
|
updated_date?: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DomainFieldsInner
|
||||||
|
*/
|
||||||
|
export interface DomainFieldsInner {
|
||||||
|
id?: string | null;
|
||||||
|
display_name?: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External identifiers:
|
||||||
|
*/
|
||||||
|
export interface DomainIds {
|
||||||
|
openalex?: string | null;
|
||||||
|
wikidata?: string | null;
|
||||||
|
wikipedia?: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { DomainFieldsInner } from './domainFieldsInner';
|
||||||
|
import { DomainIds } from './domainIds';
|
||||||
|
import { WorkTopicDomain } from './workTopicDomain';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Second-level category in the topic hierarchy (26 total)
|
||||||
|
*/
|
||||||
|
export interface ModelField {
|
||||||
|
id?: string | null;
|
||||||
|
display_name?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
display_name_alternatives?: Array<string> | null;
|
||||||
|
domain?: WorkTopicDomain | null;
|
||||||
|
subfields?: Array<DomainFieldsInner> | null;
|
||||||
|
siblings?: Array<DomainFieldsInner> | null;
|
||||||
|
ids?: DomainIds | null;
|
||||||
|
works_count?: number | null;
|
||||||
|
cited_by_count?: number | null;
|
||||||
|
works_api_url?: string | null;
|
||||||
|
created_date?: string | null;
|
||||||
|
updated_date?: string | null;
|
||||||
|
}
|
||||||
@@ -78,6 +78,9 @@ export * from './dfgProjectSummary';
|
|||||||
export * from './dfgProjectTopic';
|
export * from './dfgProjectTopic';
|
||||||
export * from './dfgProjectTopics';
|
export * from './dfgProjectTopics';
|
||||||
export * from './dockerHealth';
|
export * from './dockerHealth';
|
||||||
|
export * from './domain';
|
||||||
|
export * from './domainFieldsInner';
|
||||||
|
export * from './domainIds';
|
||||||
export * from './edge';
|
export * from './edge';
|
||||||
export * from './euCordisEurosciVocSummary';
|
export * from './euCordisEurosciVocSummary';
|
||||||
export * from './euCordisOrganizationSelectorPage';
|
export * from './euCordisOrganizationSelectorPage';
|
||||||
@@ -172,6 +175,7 @@ export * from './matchedTopic';
|
|||||||
export * from './mentionedPerson';
|
export * from './mentionedPerson';
|
||||||
export * from './meta';
|
export * from './meta';
|
||||||
export * from './model2YrMeanCitedness';
|
export * from './model2YrMeanCitedness';
|
||||||
|
export * from './modelField';
|
||||||
export * from './newsArticle';
|
export * from './newsArticle';
|
||||||
export * from './newsArticleDetail';
|
export * from './newsArticleDetail';
|
||||||
export * from './newsPage';
|
export * from './newsPage';
|
||||||
@@ -206,6 +210,9 @@ export * from './score';
|
|||||||
export * from './selectedAuthorsRequest';
|
export * from './selectedAuthorsRequest';
|
||||||
export * from './sortDirection';
|
export * from './sortDirection';
|
||||||
export * from './startCollaborationGraphResponse';
|
export * from './startCollaborationGraphResponse';
|
||||||
|
export * from './subfield';
|
||||||
|
export * from './subfieldDomain';
|
||||||
|
export * from './subfieldField';
|
||||||
export * from './subfieldShare';
|
export * from './subfieldShare';
|
||||||
export * from './timespan';
|
export * from './timespan';
|
||||||
export * from './tokenType';
|
export * from './tokenType';
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
* Do not edit the class manually.
|
* Do not edit the class manually.
|
||||||
*/
|
*/
|
||||||
|
import { MatchedTopic } from './matchedTopic';
|
||||||
|
|
||||||
|
export interface NewsArticle {
|
||||||
export interface NewsArticle {
|
id: string;
|
||||||
id: string;
|
date?: string | null;
|
||||||
date?: string | null;
|
maintitle?: string | null;
|
||||||
maintitle?: string | null;
|
author?: string | null;
|
||||||
author?: string | null;
|
url?: string | null;
|
||||||
url?: string | null;
|
relevant?: boolean | null;
|
||||||
relevant?: boolean | null;
|
snippet?: string | null;
|
||||||
snippet?: string | null;
|
related?: boolean | null;
|
||||||
related?: boolean | null;
|
topics?: Array<MatchedTopic> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* Innovation Search Engine API
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@@ -10,19 +10,17 @@
|
|||||||
import { MatchedTopic } from './matchedTopic';
|
import { MatchedTopic } from './matchedTopic';
|
||||||
import { MentionedPerson } from './mentionedPerson';
|
import { MentionedPerson } from './mentionedPerson';
|
||||||
|
|
||||||
|
export interface NewsArticleDetail {
|
||||||
export interface NewsArticleDetail {
|
id: string;
|
||||||
id: string;
|
date?: string | null;
|
||||||
date?: string | null;
|
maintitle?: string | null;
|
||||||
maintitle?: string | null;
|
author?: string | null;
|
||||||
author?: string | null;
|
url?: string | null;
|
||||||
url?: string | null;
|
relevant?: boolean | null;
|
||||||
relevant?: boolean | null;
|
snippet?: string | null;
|
||||||
snippet?: string | null;
|
related?: boolean | null;
|
||||||
related?: boolean | null;
|
topics?: Array<MatchedTopic>;
|
||||||
full_content?: string | null;
|
full_content?: string | null;
|
||||||
authors?: Array<MentionedPerson>;
|
authors?: Array<MentionedPerson>;
|
||||||
keywords?: Array<string>;
|
keywords?: Array<string>;
|
||||||
topics?: Array<MatchedTopic>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* 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 { DomainFieldsInner } from './domainFieldsInner';
|
||||||
|
import { DomainIds } from './domainIds';
|
||||||
|
import { SubfieldDomain } from './subfieldDomain';
|
||||||
|
import { SubfieldField } from './subfieldField';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Third-level category in the topic hierarchy (254 total)
|
||||||
|
*/
|
||||||
|
export interface Subfield {
|
||||||
|
id?: string | null;
|
||||||
|
display_name?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
display_name_alternatives?: Array<string> | null;
|
||||||
|
field?: SubfieldField | null;
|
||||||
|
domain?: SubfieldDomain | null;
|
||||||
|
topics?: Array<DomainFieldsInner> | null;
|
||||||
|
siblings?: Array<DomainFieldsInner> | null;
|
||||||
|
ids?: DomainIds | null;
|
||||||
|
works_count?: number | null;
|
||||||
|
cited_by_count?: number | null;
|
||||||
|
works_api_url?: string | null;
|
||||||
|
created_date?: string | null;
|
||||||
|
updated_date?: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The domain containing this subfield (top level of hierarchy).
|
||||||
|
*/
|
||||||
|
export interface SubfieldDomain {
|
||||||
|
id?: string | null;
|
||||||
|
display_name?: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The field containing this subfield (parent level).
|
||||||
|
*/
|
||||||
|
export interface SubfieldField {
|
||||||
|
id?: string | null;
|
||||||
|
display_name?: string | null;
|
||||||
|
}
|
||||||
@@ -36,6 +36,7 @@ import {
|
|||||||
workPageResolver,
|
workPageResolver,
|
||||||
workQueryParamKeys,
|
workQueryParamKeys,
|
||||||
} from './resolvers/work-page.resolver';
|
} from './resolvers/work-page.resolver';
|
||||||
|
import { keywordsNewsPageResolver } from './resolvers/keywords-news-page.resolver';
|
||||||
import { selectedTopicsResolver } from './resolvers/selected-topics.resolver';
|
import { selectedTopicsResolver } from './resolvers/selected-topics.resolver';
|
||||||
import { selectedInstitutionsResolver } from './resolvers/selected-institutions.resolver';
|
import { selectedInstitutionsResolver } from './resolvers/selected-institutions.resolver';
|
||||||
import { selectedBundInstitutionsResolver } from './resolvers/selected-bund-institutions.resolver';
|
import { selectedBundInstitutionsResolver } from './resolvers/selected-bund-institutions.resolver';
|
||||||
@@ -273,7 +274,14 @@ export const routes: Routes = [
|
|||||||
resolvingFor: RESOLVING_WORK_PAGE_FOR.KEYWORDS_SEARCH,
|
resolvingFor: RESOLVING_WORK_PAGE_FOR.KEYWORDS_SEARCH,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ path: 'news', component: KeywordsToNewsResultsComponent },
|
{
|
||||||
|
path: 'news',
|
||||||
|
component: KeywordsToNewsResultsComponent,
|
||||||
|
runGuardsAndResolvers: 'always',
|
||||||
|
resolve: {
|
||||||
|
newsPage: keywordsNewsPageResolver,
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'trends',
|
path: 'trends',
|
||||||
component: UniTrendParentComponent,
|
component: UniTrendParentComponent,
|
||||||
@@ -693,7 +701,9 @@ export const routes: Routes = [
|
|||||||
bundProjectsFunding: bundProjectsFundingResolver,
|
bundProjectsFunding: bundProjectsFundingResolver,
|
||||||
cordisEuProjectsFunding: cordisEuProjectsFundingResolver,
|
cordisEuProjectsFunding: cordisEuProjectsFundingResolver,
|
||||||
},
|
},
|
||||||
runGuardsAndResolvers: 'always',
|
data: {
|
||||||
|
enableFilters: false,
|
||||||
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
@@ -743,18 +753,6 @@ export const routes: Routes = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
// resolve: {
|
|
||||||
// bundProjectPage: bundProjectPageResolver,
|
|
||||||
// bundProjectsFunding: bundProjectsFundingResolver,
|
|
||||||
// cordisEuProjectPage: euCordisProjectsResolver,
|
|
||||||
// cordisEuProjectsFunding: cordisEuProjectsFundingResolver,
|
|
||||||
// },
|
|
||||||
// runGuardsAndResolvers: (from, to) => {
|
|
||||||
// const keys = ['page', 'size', 'sort_by', 'sort_direction', 'search'];
|
|
||||||
// return keys.some(
|
|
||||||
// (key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'patents',
|
path: 'patents',
|
||||||
|
|||||||
@@ -1,76 +1,80 @@
|
|||||||
import {
|
import {
|
||||||
Directive,
|
Directive,
|
||||||
OnChanges,
|
|
||||||
Input,
|
|
||||||
ElementRef,
|
ElementRef,
|
||||||
|
Input,
|
||||||
|
OnChanges,
|
||||||
Renderer2,
|
Renderer2,
|
||||||
|
SimpleChanges,
|
||||||
|
effect,
|
||||||
|
inject,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { SimpleChanges } from '@angular/core';
|
import { ResolverStateService } from '../../app/shared/services/resolver-state.service';
|
||||||
@Directive({ selector: '[skText]', standalone: true })
|
|
||||||
|
@Directive({
|
||||||
|
selector: 'span, [skText]',
|
||||||
|
standalone: true,
|
||||||
|
})
|
||||||
export class SkTextDirective implements OnChanges {
|
export class SkTextDirective implements OnChanges {
|
||||||
@Input() skText = false;
|
@Input() skText = false;
|
||||||
|
|
||||||
private originalText = '';
|
private readonly el = inject(ElementRef<HTMLElement>);
|
||||||
private originalColor = '';
|
private readonly renderer = inject(Renderer2);
|
||||||
|
private readonly resolverStateService = inject(ResolverStateService);
|
||||||
|
|
||||||
constructor(
|
constructor() {
|
||||||
private el: ElementRef,
|
effect(() => {
|
||||||
private renderer: Renderer2,
|
const loading = this.skText || this.resolverStateService.isResolving();
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
if (loading) {
|
||||||
const change = changes['skText'];
|
this.showSkeleton();
|
||||||
|
} else {
|
||||||
// skip if value didn't actually change, or is undefined
|
this.hideSkeleton();
|
||||||
if (!change) return;
|
}
|
||||||
|
});
|
||||||
this.skText ? this.showSkeleton() : this.hideSkeleton();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private showSkeleton() {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
const el: HTMLElement = this.el.nativeElement;
|
if (!changes['skText']) {
|
||||||
this.originalText = el.textContent ?? '';
|
return;
|
||||||
this.originalColor = el.style.color;
|
}
|
||||||
|
|
||||||
// measure natural width before blanking text
|
if (this.skText || this.resolverStateService.isResolving()) {
|
||||||
const width = Math.min(Math.max(this.originalText.length * 7.5, 48), 60);
|
this.showSkeleton();
|
||||||
const height = 20;
|
} else {
|
||||||
this.renderer.addClass(el, 'sk-text-loading');
|
this.hideSkeleton();
|
||||||
this.renderer.setStyle(el, 'color', 'transparent');
|
}
|
||||||
this.renderer.setStyle(
|
}
|
||||||
el,
|
|
||||||
'background',
|
|
||||||
'linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%)',
|
|
||||||
);
|
|
||||||
this.renderer.setStyle(el, 'background-size', '600px 100%');
|
|
||||||
this.renderer.setStyle(el, 'animation', 'sk-shimmer 1.6s infinite linear');
|
|
||||||
this.renderer.setStyle(el, 'border-radius', '4px');
|
|
||||||
this.renderer.setStyle(el, 'min-width', `${width}px`);
|
|
||||||
this.renderer.setStyle(el, 'max-height', `${height}px`);
|
|
||||||
this.renderer.setStyle(el, 'display', 'inline-block');
|
|
||||||
this.renderer.setStyle(el, 'overflow', 'hidden');
|
|
||||||
this.renderer.setStyle(el, 'pointer-events', 'none');
|
|
||||||
|
|
||||||
Array.from(el.children).forEach((child) => {
|
private showSkeleton(): void {
|
||||||
|
const element = this.el.nativeElement;
|
||||||
|
|
||||||
|
if (element.classList.contains('sk-text-loading')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = element.textContent?.trim() ?? '';
|
||||||
|
|
||||||
|
// For ordinary text elements only. Table cells use CSS width naturally.
|
||||||
|
if (element.tagName.toLowerCase() !== 'td') {
|
||||||
|
this.renderer.setStyle(element, 'min-width', `${20}px`);
|
||||||
|
this.renderer.setStyle(element, 'height', '20px');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.renderer.addClass(element, 'sk-text-loading');
|
||||||
|
|
||||||
|
Array.from(element.children).forEach((child) => {
|
||||||
this.renderer.setStyle(child, 'visibility', 'hidden');
|
this.renderer.setStyle(child, 'visibility', 'hidden');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private hideSkeleton() {
|
private hideSkeleton(): void {
|
||||||
const el: HTMLElement = this.el.nativeElement;
|
const element = this.el.nativeElement;
|
||||||
this.renderer.removeClass(el, 'sk-text-loading');
|
|
||||||
this.renderer.removeStyle(el, 'color');
|
|
||||||
this.renderer.removeStyle(el, 'background');
|
|
||||||
this.renderer.removeStyle(el, 'background-size');
|
|
||||||
this.renderer.removeStyle(el, 'animation');
|
|
||||||
this.renderer.removeStyle(el, 'border-radius');
|
|
||||||
this.renderer.removeStyle(el, 'min-width');
|
|
||||||
this.renderer.removeStyle(el, 'max-height');
|
|
||||||
this.renderer.removeStyle(el, 'display');
|
|
||||||
this.renderer.removeStyle(el, 'overflow');
|
|
||||||
this.renderer.removeStyle(el, 'pointer-events');
|
|
||||||
|
|
||||||
Array.from(el.children).forEach((child) => {
|
this.renderer.removeClass(element, 'sk-text-loading');
|
||||||
|
this.renderer.removeStyle(element, 'min-width');
|
||||||
|
this.renderer.removeStyle(element, 'height');
|
||||||
|
|
||||||
|
Array.from(element.children).forEach((child) => {
|
||||||
this.renderer.removeStyle(child, 'visibility');
|
this.renderer.removeStyle(child, 'visibility');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,12 +130,14 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
|||||||
.flexibleConnectedTo(this.elementRef)
|
.flexibleConnectedTo(this.elementRef)
|
||||||
.withPositions(positions)
|
.withPositions(positions)
|
||||||
.withFlexibleDimensions(false)
|
.withFlexibleDimensions(false)
|
||||||
|
.withViewportMargin(12)
|
||||||
.withPush(true);
|
.withPush(true);
|
||||||
|
|
||||||
this.overlayRef = this.overlay.create({
|
this.overlayRef = this.overlay.create({
|
||||||
positionStrategy,
|
positionStrategy,
|
||||||
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
||||||
panelClass: 'app-tooltip-panel',
|
panelClass: 'app-tooltip-panel',
|
||||||
|
maxWidth: this.tooltipMaxWidth() ?? 'calc(100vw - 24px)',
|
||||||
});
|
});
|
||||||
|
|
||||||
const portal = new ComponentPortal(this.component(), null, this.injector);
|
const portal = new ComponentPortal(this.component(), null, this.injector);
|
||||||
|
|||||||
@@ -54,11 +54,13 @@
|
|||||||
subscriptSizing="dynamic">
|
subscriptSizing="dynamic">
|
||||||
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
||||||
<mat-select
|
<mat-select
|
||||||
[value]="sortMode"
|
[value]="sortColumn"
|
||||||
(selectionChange)="setSortMode($event.value)">
|
(selectionChange)="setSort($event.value)">
|
||||||
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
||||||
<mat-option value="date">Datum</mat-option>
|
<mat-option value="year">Jahr</mat-option>
|
||||||
<mat-option value="title">Titel</mat-option>
|
<mat-option value="title">Titel</mat-option>
|
||||||
|
<mat-option value="source">Quelle</mat-option>
|
||||||
|
<mat-option value="matchType">Match-Typ</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,11 +69,41 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Patent</th>
|
<th>Patent</th>
|
||||||
<th>Quelle</th>
|
<th
|
||||||
<th>Jahr</th>
|
class="sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'source'"
|
||||||
|
(click)="setSort('source')">
|
||||||
|
Quelle
|
||||||
|
@if (sortColumn === 'source') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'year'"
|
||||||
|
(click)="setSort('year')">
|
||||||
|
Jahr
|
||||||
|
@if (sortColumn === 'year') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
<th>Erfinder</th>
|
<th>Erfinder</th>
|
||||||
<th>Applicant/Assignee</th>
|
<th>Applicant/Assignee</th>
|
||||||
<th>Match-Typ</th>
|
<th
|
||||||
|
class="sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'matchType'"
|
||||||
|
(click)="setSort('matchType')">
|
||||||
|
Match-Typ
|
||||||
|
@if (sortColumn === 'matchType') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
<th>Personen</th>
|
<th>Personen</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -94,9 +126,86 @@
|
|||||||
{{ patent.source }}
|
{{ patent.source }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ patent.publication_year ?? '-' }}</td>
|
<td>
|
||||||
<td class="cell-preview">{{ getInventorsPreview(patent) }}</td>
|
@if (patent.publication_year) {
|
||||||
<td class="cell-preview">{{ getAssigneesPreview(patent) }}</td>
|
<span class="year-badge">{{
|
||||||
|
patent.publication_year
|
||||||
|
}}</span>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="patent-people">
|
||||||
|
@if (patent.inventors && patent.inventors.length) {
|
||||||
|
<div class="person-chips">
|
||||||
|
@for (
|
||||||
|
inventor of patent.inventors.slice(0, 2);
|
||||||
|
track inventor
|
||||||
|
) {
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>person</mat-icon>
|
||||||
|
{{ inventor }}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
@if (patent.inventors.length > 2) {
|
||||||
|
<span class="person-chip-row">
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>person</mat-icon>
|
||||||
|
{{ patent.inventors[2] }}
|
||||||
|
</span>
|
||||||
|
@if (patent.inventors.length > 3) {
|
||||||
|
<span class="person-chip person-chip--more"
|
||||||
|
>+{{ patent.inventors.length - 3 }}</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="patent-people">
|
||||||
|
@if (patent.assignees && patent.assignees.length) {
|
||||||
|
<div class="person-chips">
|
||||||
|
@for (
|
||||||
|
assignee of patent.assignees.slice(0, 2);
|
||||||
|
track assignee
|
||||||
|
) {
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>{{
|
||||||
|
isAssigneeLikelyPerson(assignee, patent)
|
||||||
|
? 'person'
|
||||||
|
: 'apartment'
|
||||||
|
}}</mat-icon>
|
||||||
|
{{ assignee }}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
@if (patent.assignees.length > 2) {
|
||||||
|
<span class="person-chip-row">
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>{{
|
||||||
|
isAssigneeLikelyPerson(
|
||||||
|
patent.assignees[2],
|
||||||
|
patent
|
||||||
|
)
|
||||||
|
? 'person'
|
||||||
|
: 'apartment'
|
||||||
|
}}</mat-icon>
|
||||||
|
{{ patent.assignees[2] }}
|
||||||
|
</span>
|
||||||
|
@if (patent.assignees.length > 3) {
|
||||||
|
<span class="person-chip person-chip--more"
|
||||||
|
>+{{ patent.assignees.length - 3 }}</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span
|
<span
|
||||||
class="match-badge match-badge--{{ patent.match_type }}">
|
class="match-badge match-badge--{{ patent.match_type }}">
|
||||||
@@ -118,6 +227,10 @@
|
|||||||
'/person',
|
'/person',
|
||||||
author.openalex_author_id,
|
author.openalex_author_id,
|
||||||
]"
|
]"
|
||||||
|
[appComponentTooltip]="AuthorTooltipComponent"
|
||||||
|
[tooltipInputs]="{
|
||||||
|
authorId: author.openalex_author_id,
|
||||||
|
}"
|
||||||
(click)="$event.stopPropagation()">
|
(click)="$event.stopPropagation()">
|
||||||
{{ author.author_name }}
|
{{ author.author_name }}
|
||||||
</a>
|
</a>
|
||||||
@@ -197,7 +310,11 @@
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="tag author-link"
|
class="tag author-link"
|
||||||
[routerLink]="['/person', author.openalex_author_id]">
|
[routerLink]="['/person', author.openalex_author_id]"
|
||||||
|
[appComponentTooltip]="AuthorTooltipComponent"
|
||||||
|
[tooltipInputs]="{
|
||||||
|
authorId: author.openalex_author_id,
|
||||||
|
}">
|
||||||
{{ author.author_name }}
|
{{ author.author_name }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -66,9 +66,24 @@ app-query-param-paginator {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
border-bottom: 1px solid var(--sg-border);
|
border-bottom: 1px solid var(--sg-border);
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: var(--sg-text-muted);
|
color: var(--sg-text-muted);
|
||||||
|
|
||||||
|
&.sortable {
|
||||||
|
display: table-cell;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 2px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
@@ -101,13 +116,8 @@ app-query-param-paginator {
|
|||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-preview {
|
.patent-people {
|
||||||
max-width: 160px;
|
max-width: 220px;
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
color: var(--sg-text-muted);
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-authors {
|
.cell-authors {
|
||||||
@@ -119,6 +129,64 @@ app-query-param-paginator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.year-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 26px;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chips {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chip-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: var(--sg-surface-soft);
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--sg-text-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--more {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.match-badge {
|
.match-badge {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -13,8 +13,11 @@ import {
|
|||||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||||
import { PageEvent } from '@angular/material/paginator';
|
import { PageEvent } from '@angular/material/paginator';
|
||||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||||
|
import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive';
|
||||||
|
import { AppAuthorTooltipComponent } from '../../shared/ui/app-author-tooltip/app-author-tooltip.component';
|
||||||
|
|
||||||
type SortMode = 'date' | 'title';
|
type SortColumn = 'title' | 'year' | 'source' | 'matchType';
|
||||||
|
type SortDirection = 'asc' | 'desc';
|
||||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||||
type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
|
type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
|
||||||
|
|
||||||
@@ -28,11 +31,13 @@ type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
|
|||||||
MatSelectModule,
|
MatSelectModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
QueryParamPaginatorComponent,
|
QueryParamPaginatorComponent,
|
||||||
|
ComponentTooltipDirective,
|
||||||
],
|
],
|
||||||
templateUrl: './institution-patents.component.html',
|
templateUrl: './institution-patents.component.html',
|
||||||
styleUrl: './institution-patents.component.scss',
|
styleUrl: './institution-patents.component.scss',
|
||||||
})
|
})
|
||||||
export class InstitutionPatentsComponent implements OnInit {
|
export class InstitutionPatentsComponent implements OnInit {
|
||||||
|
readonly AuthorTooltipComponent = AppAuthorTooltipComponent;
|
||||||
private route = inject(ActivatedRoute);
|
private route = inject(ActivatedRoute);
|
||||||
private router = inject(Router);
|
private router = inject(Router);
|
||||||
private patentsApi = inject(PatentsService);
|
private patentsApi = inject(PatentsService);
|
||||||
@@ -48,7 +53,8 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
|
|
||||||
activeFilter: SourceFilter = 'all';
|
activeFilter: SourceFilter = 'all';
|
||||||
activeMatchType: OrgPatentMatchTypeFilter = 'all';
|
activeMatchType: OrgPatentMatchTypeFilter = 'all';
|
||||||
sortMode: SortMode = 'date';
|
sortColumn: SortColumn = 'year';
|
||||||
|
sortDirection: SortDirection = 'desc';
|
||||||
|
|
||||||
pageIndex = 0;
|
pageIndex = 0;
|
||||||
pageSize = 20;
|
pageSize = 20;
|
||||||
@@ -59,7 +65,8 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
const institutionId = params.get('institutionId') ?? '';
|
const institutionId = params.get('institutionId') ?? '';
|
||||||
|
|
||||||
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
const sortByFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||||
|
const sortDirFromUrl = this.route.snapshot.queryParamMap.get('sortDir');
|
||||||
const matchTypeFromUrl =
|
const matchTypeFromUrl =
|
||||||
this.route.snapshot.queryParamMap.get('matchType');
|
this.route.snapshot.queryParamMap.get('matchType');
|
||||||
this.pageIndex = this.parsePageIndexParam(
|
this.pageIndex = this.parsePageIndexParam(
|
||||||
@@ -72,8 +79,11 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
if (this.isValidFilter(filterFromUrl)) {
|
if (this.isValidFilter(filterFromUrl)) {
|
||||||
this.activeFilter = filterFromUrl;
|
this.activeFilter = filterFromUrl;
|
||||||
}
|
}
|
||||||
if (this.isValidSortMode(sortFromUrl)) {
|
if (this.isValidSortColumn(sortByFromUrl)) {
|
||||||
this.sortMode = sortFromUrl;
|
this.sortColumn = sortByFromUrl;
|
||||||
|
}
|
||||||
|
if (this.isValidSortDirection(sortDirFromUrl)) {
|
||||||
|
this.sortDirection = sortDirFromUrl;
|
||||||
}
|
}
|
||||||
if (this.isValidMatchType(matchTypeFromUrl)) {
|
if (this.isValidMatchType(matchTypeFromUrl)) {
|
||||||
this.activeMatchType = matchTypeFromUrl;
|
this.activeMatchType = matchTypeFromUrl;
|
||||||
@@ -101,8 +111,13 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
this.reloadPatents();
|
this.reloadPatents();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSortMode(sortMode: SortMode): void {
|
setSort(column: SortColumn): void {
|
||||||
this.sortMode = sortMode;
|
if (this.sortColumn === column) {
|
||||||
|
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||||
|
} else {
|
||||||
|
this.sortColumn = column;
|
||||||
|
this.sortDirection = column === 'year' ? 'desc' : 'asc';
|
||||||
|
}
|
||||||
this.filteredPatents = this.sortPatents(this.patents);
|
this.filteredPatents = this.sortPatents(this.patents);
|
||||||
this.updateQueryParams();
|
this.updateQueryParams();
|
||||||
}
|
}
|
||||||
@@ -168,14 +183,27 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private sortPatents(patents: OrgPatentEntry[]): OrgPatentEntry[] {
|
private sortPatents(patents: OrgPatentEntry[]): OrgPatentEntry[] {
|
||||||
if (this.sortMode === 'title') {
|
const direction = this.sortDirection === 'asc' ? 1 : -1;
|
||||||
return [...patents].sort((a, b) =>
|
return [...patents].sort((a, b) => {
|
||||||
(a.title ?? '').localeCompare(b.title ?? '', 'de', {
|
switch (this.sortColumn) {
|
||||||
sensitivity: 'base',
|
case 'year': {
|
||||||
}),
|
const yearA = a.publication_date ?? String(a.publication_year ?? '');
|
||||||
);
|
const yearB = b.publication_date ?? String(b.publication_year ?? '');
|
||||||
}
|
return direction * yearA.localeCompare(yearB);
|
||||||
return [...patents];
|
}
|
||||||
|
case 'source':
|
||||||
|
return direction * a.source.localeCompare(b.source);
|
||||||
|
case 'matchType':
|
||||||
|
return direction * a.match_type.localeCompare(b.match_type);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
direction *
|
||||||
|
(a.title ?? '').localeCompare(b.title ?? '', 'de', {
|
||||||
|
sensitivity: 'base',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateQueryParams(): void {
|
private updateQueryParams(): void {
|
||||||
@@ -183,7 +211,8 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
relativeTo: this.route,
|
relativeTo: this.route,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
filter: this.activeFilter,
|
filter: this.activeFilter,
|
||||||
sortBy: this.sortMode,
|
sortBy: this.sortColumn,
|
||||||
|
sortDir: this.sortDirection,
|
||||||
matchType: this.activeMatchType,
|
matchType: this.activeMatchType,
|
||||||
page: this.pageIndex,
|
page: this.pageIndex,
|
||||||
size: this.pageSize,
|
size: this.pageSize,
|
||||||
@@ -207,8 +236,17 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
return value === 'all' || value === 'EPO' || value === 'USPTO';
|
return value === 'all' || value === 'EPO' || value === 'USPTO';
|
||||||
}
|
}
|
||||||
|
|
||||||
private isValidSortMode(value: string | null): value is SortMode {
|
private isValidSortColumn(value: string | null): value is SortColumn {
|
||||||
return value === 'date' || value === 'title';
|
return (
|
||||||
|
value === 'title' ||
|
||||||
|
value === 'year' ||
|
||||||
|
value === 'source' ||
|
||||||
|
value === 'matchType'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private isValidSortDirection(value: string | null): value is SortDirection {
|
||||||
|
return value === 'asc' || value === 'desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
private isValidMatchType(
|
private isValidMatchType(
|
||||||
@@ -287,18 +325,40 @@ export class InstitutionPatentsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getInventorsPreview(patent: OrgPatentEntry): string {
|
private static readonly ORG_SUFFIX_PATTERN =
|
||||||
if (!patent.inventors?.length) {
|
/\b(Inc|Ltd|LLC|LLP|GmbH|Corp(oration)?|Co|KG|AG|SE|S\.?A\.?|N\.?V\.?|B\.?V\.?|PLC|Universit(y|ät|é)|Institut(e)?|Foundation|Laborator(y|ies)|Labs?|Group|Holdings?|Company|Gesellschaft)\b\.?/i;
|
||||||
return '-';
|
private static readonly PERSON_SUFFIX_PATTERN =
|
||||||
}
|
/\b(Dr|Prof|PhD|Ph\.D|M\.D|Jr|Sr)\b\.?/i;
|
||||||
return patent.inventors.slice(0, 2).join(', ');
|
|
||||||
|
private normalizeNameForComparison(name: string): string {
|
||||||
|
return name
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[̀-ͯ]/g, '')
|
||||||
|
.replace(/[.,]/g, '')
|
||||||
|
.toUpperCase()
|
||||||
|
.split(/\s+/)
|
||||||
|
.filter(Boolean)
|
||||||
|
.sort()
|
||||||
|
.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
getAssigneesPreview(patent: OrgPatentEntry): string {
|
isAssigneeLikelyPerson(assignee: string, patent: OrgPatentEntry): boolean {
|
||||||
if (!patent.assignees?.length) {
|
if (InstitutionPatentsComponent.ORG_SUFFIX_PATTERN.test(assignee)) {
|
||||||
return '-';
|
return false;
|
||||||
}
|
}
|
||||||
return patent.assignees.slice(0, 2).join(', ');
|
|
||||||
|
const normalizedAssignee = this.normalizeNameForComparison(
|
||||||
|
assignee.replace(InstitutionPatentsComponent.PERSON_SUFFIX_PATTERN, ''),
|
||||||
|
);
|
||||||
|
const matchesInventor = (patent.inventors ?? []).some(
|
||||||
|
(inventor) =>
|
||||||
|
this.normalizeNameForComparison(inventor) === normalizedAssignee,
|
||||||
|
);
|
||||||
|
if (matchesInventor) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return InstitutionPatentsComponent.PERSON_SUFFIX_PATTERN.test(assignee);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMatchedAuthorsPreview(patent: OrgPatentEntry): string {
|
getMatchedAuthorsPreview(patent: OrgPatentEntry): string {
|
||||||
|
|||||||
@@ -1,30 +1,15 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<h3>Projekte</h3>
|
<div>
|
||||||
|
<h6>Projekte</h6>
|
||||||
|
<p>Übersicht der Projekte, die von der Institution durchgeführt werden.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="funding-area">
|
<mat-accordion multi>
|
||||||
<div class="person-projects">
|
<mat-expansion-panel class="mat-elevation-z1">
|
||||||
<nav mat-tab-nav-bar [tabPanel]="resultTabPanel" class="result-nav">
|
<mat-expansion-panel-header>
|
||||||
@for (route of childRoutes; track route.path) {
|
<mat-panel-title>Förderung über Zeit</mat-panel-title>
|
||||||
<a
|
</mat-expansion-panel-header>
|
||||||
matTabLink
|
|
||||||
[routerLink]="[route.path]"
|
|
||||||
[queryParams]="{
|
|
||||||
authorId: null,
|
|
||||||
institutionId: null,
|
|
||||||
agency: null,
|
|
||||||
}"
|
|
||||||
queryParamsHandling="merge"
|
|
||||||
routerLinkActive
|
|
||||||
#rla="routerLinkActive"
|
|
||||||
[active]="rla.isActive">
|
|
||||||
{{ route.label }}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<mat-tab-nav-panel #resultTabPanel>
|
|
||||||
<router-outlet />
|
|
||||||
</mat-tab-nav-panel>
|
|
||||||
<div class="funding-info-section">
|
<div class="funding-info-section">
|
||||||
<mat-card appearance="outlined">
|
<mat-card appearance="outlined">
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
@@ -56,15 +41,35 @@
|
|||||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
||||||
" />
|
" />
|
||||||
<app-info-card
|
<app-info-card
|
||||||
[description]="'Durchschnittliche jährliche Förderung durch die Europäische Union'"
|
[description]="
|
||||||
|
'Durchschnittliche jährliche Förderung durch die Europäische Union'
|
||||||
|
"
|
||||||
[value]="
|
[value]="
|
||||||
(euAverageAnnualFunding()
|
(euAverageAnnualFunding()
|
||||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
||||||
" />
|
" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</mat-expansion-panel>
|
||||||
</div>
|
|
||||||
|
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
|
||||||
|
<mat-expansion-panel-header>
|
||||||
|
<mat-panel-title>Projektliste</mat-panel-title>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
|
||||||
|
<div class="person-projects">
|
||||||
|
@if (resultTabPanel) {
|
||||||
|
<app-link-tab-nav-bar
|
||||||
|
[links]="_links()"
|
||||||
|
[tabPanel]="resultTabPanel" />
|
||||||
|
}
|
||||||
|
|
||||||
|
<mat-tab-nav-panel #resultTabPanel>
|
||||||
|
<router-outlet />
|
||||||
|
</mat-tab-nav-panel>
|
||||||
|
</div>
|
||||||
|
</mat-expansion-panel>
|
||||||
|
</mat-accordion>
|
||||||
|
|
||||||
<ng-template #fundingStartTmp let-row>
|
<ng-template #fundingStartTmp let-row>
|
||||||
{{ row.funding_start | date: 'dd.MM.yyyy' }}
|
{{ row.funding_start | date: 'dd.MM.yyyy' }}
|
||||||
@@ -79,8 +84,8 @@
|
|||||||
<ng-template #euProjectActionsTmp let-row>
|
<ng-template #euProjectActionsTmp let-row>
|
||||||
<a mat-icon-button color="primary" [routerLink]="['/projects/eu', row.id]">
|
<a mat-icon-button color="primary" [routerLink]="['/projects/eu', row.id]">
|
||||||
<mat-icon>open_in_new</mat-icon>
|
<mat-icon>open_in_new</mat-icon>
|
||||||
</a></ng-template
|
</a>
|
||||||
>
|
</ng-template>
|
||||||
|
|
||||||
<ng-template #bundProjectActionsTmp let-row>
|
<ng-template #bundProjectActionsTmp let-row>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
.content {
|
.content {
|
||||||
padding: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-card,
|
|
||||||
mat-paginator {
|
|
||||||
background-color: var(--sg-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
.funding-area {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
padding: 2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.funding-info-section {
|
mat-expansion-panel {
|
||||||
display: flex;
|
border: 1px solid var(--sg-border);
|
||||||
flex-direction: column;
|
border-radius: var(--sg-radius-sm);
|
||||||
gap: 1rem;
|
background: var(--sg-none);
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-expansion-panel-header {
|
||||||
|
padding: 0 16px;
|
||||||
|
min-height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-panel-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-panel-description {
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.funding-info-cards {
|
.funding-info-cards {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
import { BundProjectSummary } from '../../api/model/bundProjectSummary';
|
import { BundProjectSummary } from '../../api/model/bundProjectSummary';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatExpansionModule } from '@angular/material/expansion';
|
||||||
import { MatTabChangeEvent, MatTabsModule } from '@angular/material/tabs';
|
import { MatTabChangeEvent, MatTabsModule } from '@angular/material/tabs';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
@@ -27,7 +28,10 @@ import { MatIconModule } from '@angular/material/icon';
|
|||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
|
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
|
||||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||||
|
import {
|
||||||
|
LinkTabNavBarComponent,
|
||||||
|
LinkTabNavBarItem,
|
||||||
|
} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||||
type BundProjectRow = {
|
type BundProjectRow = {
|
||||||
id: string;
|
id: string;
|
||||||
topic: string;
|
topic: string;
|
||||||
@@ -51,6 +55,7 @@ type EuProjectRow = {
|
|||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
|
MatExpansionModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
DatePipe,
|
DatePipe,
|
||||||
@@ -59,6 +64,7 @@ type EuProjectRow = {
|
|||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
InstitutionProjectsFundingGraphComponent,
|
InstitutionProjectsFundingGraphComponent,
|
||||||
AppInfoCardComponent,
|
AppInfoCardComponent,
|
||||||
|
LinkTabNavBarComponent,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
],
|
],
|
||||||
templateUrl: './institution-projects.component.html',
|
templateUrl: './institution-projects.component.html',
|
||||||
@@ -122,6 +128,27 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
label: 'BUND-Projekte',
|
label: 'BUND-Projekte',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
_links = computed<LinkTabNavBarItem[]>(() => {
|
||||||
|
const links: LinkTabNavBarItem[] = [
|
||||||
|
{
|
||||||
|
label: 'DFG-Projekte',
|
||||||
|
path: 'dfg',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'EU-Projekte',
|
||||||
|
path: 'eu',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'BUND-Projekte',
|
||||||
|
path: 'bund',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return links;
|
||||||
|
});
|
||||||
constructor(
|
constructor(
|
||||||
private readonly activatedRoute: ActivatedRoute,
|
private readonly activatedRoute: ActivatedRoute,
|
||||||
private readonly router: Router,
|
private readonly router: Router,
|
||||||
@@ -275,12 +302,4 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
selectedTabChange(event: MatTabChangeEvent): void {
|
|
||||||
const tab = ['eu', 'bund'][event.index];
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { project_tab: tab, page: 0, size: 10 },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -16,8 +16,7 @@
|
|||||||
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
|
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
|
||||||
<mat-expansion-panel-header>
|
<mat-expansion-panel-header>
|
||||||
<mat-panel-title>Publikationsliste</mat-panel-title>
|
<mat-panel-title>Publikationsliste</mat-panel-title>
|
||||||
<mat-panel-description
|
<mat-panel-description>
|
||||||
>{{ total() >= 10000 ? 'mehr als' : '' }}
|
|
||||||
{{ total() }} Publikationen</mat-panel-description
|
{{ total() }} Publikationen</mat-panel-description
|
||||||
>
|
>
|
||||||
</mat-expansion-panel-header>
|
</mat-expansion-panel-header>
|
||||||
|
|||||||
@@ -1,27 +1,15 @@
|
|||||||
<div class="content">
|
<div class="container">
|
||||||
<h1>{{ institution().display_name }}</h1>
|
<div class="content">
|
||||||
<mat-card appearance="outlined">
|
<h1>{{ institution().display_name }}</h1>
|
||||||
<mat-card-content>
|
<mat-card appearance="outlined">
|
||||||
<p>{{ institution().homepage_url }}</p>
|
<mat-card-content>
|
||||||
<p>{{ institution().display_name_alternatives }}</p>
|
<p>{{ institution().homepage_url }}</p>
|
||||||
<p>And many more useful details...</p>
|
<p>{{ institution().display_name_alternatives }}</p>
|
||||||
</mat-card-content>
|
<p>And many more useful details...</p>
|
||||||
</mat-card>
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
</div>
|
||||||
@for (link of _links(); track link.path) {
|
<app-link-tab-nav-bar [links]="_links()" [tabPanel]="tabPanel" />
|
||||||
<a
|
|
||||||
mat-tab-link
|
|
||||||
[routerLink]="link.path"
|
|
||||||
[queryParams]="link.queryParams"
|
|
||||||
routerLinkActive
|
|
||||||
#rla="routerLinkActive"
|
|
||||||
[active]="rla.isActive"
|
|
||||||
[disabled]="link.disabled">
|
|
||||||
{{ link.label }}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</nav>
|
|
||||||
</div>
|
</div>
|
||||||
<mat-tab-nav-panel #tabPanel>
|
<mat-tab-nav-panel #tabPanel>
|
||||||
<router-outlet />
|
<router-outlet />
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
.content {
|
.container {
|
||||||
padding: 16px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 16px;
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
margin: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
import { Component, computed, input } from '@angular/core';
|
import { Component, computed, input } from '@angular/core';
|
||||||
import { RouterLink, RouterOutlet, RouterLinkActive } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { Institution } from '../../api';
|
import { Institution } from '../../api';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { MatTabsModule } from '@angular/material/tabs';
|
import { MatTabsModule } from '@angular/material/tabs';
|
||||||
|
import {
|
||||||
type TabLink = {
|
LinkTabNavBarComponent,
|
||||||
label: string;
|
LinkTabNavBarItem,
|
||||||
path: string;
|
} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||||
disabled: boolean;
|
import {
|
||||||
queryParams?: Record<string, any>;
|
PATENT_ICON,
|
||||||
};
|
PROJECT_ICON,
|
||||||
|
PUBLICATION_ICON,
|
||||||
|
} from '../../shared/ui/icons';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-institution',
|
selector: 'app-institution',
|
||||||
imports: [
|
imports: [MatCardModule, MatTabsModule, RouterModule, LinkTabNavBarComponent],
|
||||||
MatCardModule,
|
|
||||||
MatTabsModule,
|
|
||||||
RouterLink,
|
|
||||||
RouterOutlet,
|
|
||||||
RouterLinkActive,
|
|
||||||
],
|
|
||||||
templateUrl: './institution.component.html',
|
templateUrl: './institution.component.html',
|
||||||
styleUrl: './institution.component.scss',
|
styleUrl: './institution.component.scss',
|
||||||
})
|
})
|
||||||
@@ -27,14 +23,20 @@ export class InstitutionComponent {
|
|||||||
institution = input.required<Institution>();
|
institution = input.required<Institution>();
|
||||||
canFetchGdprRelevantData = input.required<boolean>();
|
canFetchGdprRelevantData = input.required<boolean>();
|
||||||
|
|
||||||
_links = computed<TabLink[]>(() => {
|
_links = computed<LinkTabNavBarItem[]>(() => {
|
||||||
const links: TabLink[] = [
|
const links: LinkTabNavBarItem[] = [
|
||||||
{ label: 'Publikationen', path: 'publications', disabled: false },
|
{
|
||||||
|
label: 'Publikationen',
|
||||||
|
icon: PUBLICATION_ICON,
|
||||||
|
path: 'publications',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
if (this.canFetchGdprRelevantData()) {
|
if (this.canFetchGdprRelevantData()) {
|
||||||
links.push(
|
links.push(
|
||||||
{
|
{
|
||||||
label: 'Projekte',
|
label: 'Projekte',
|
||||||
|
icon: PROJECT_ICON,
|
||||||
path: 'projects',
|
path: 'projects',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@@ -46,7 +48,12 @@ export class InstitutionComponent {
|
|||||||
sort_direction: 'asc',
|
sort_direction: 'asc',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ label: 'Patente', path: 'patents', disabled: false },
|
{
|
||||||
|
label: 'Patente',
|
||||||
|
icon: PATENT_ICON,
|
||||||
|
path: 'patents',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return links;
|
return links;
|
||||||
|
|||||||
+108
-14
@@ -31,11 +31,12 @@
|
|||||||
subscriptSizing="dynamic">
|
subscriptSizing="dynamic">
|
||||||
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
||||||
<mat-select
|
<mat-select
|
||||||
[value]="sortMode()"
|
[value]="sortColumn()"
|
||||||
(selectionChange)="setSortMode($event.value)">
|
(selectionChange)="setSort($event.value)">
|
||||||
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
||||||
<mat-option value="date">Datum</mat-option>
|
<mat-option value="year">Jahr</mat-option>
|
||||||
<mat-option value="title">Titel</mat-option>
|
<mat-option value="title">Titel</mat-option>
|
||||||
|
<mat-option value="source">Quelle</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,8 +45,32 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Patent</th>
|
<th>Patent</th>
|
||||||
<th>Quelle</th>
|
<th
|
||||||
<th>Jahr</th>
|
class="sortable"
|
||||||
|
[class.sort-active]="sortColumn() === 'source'"
|
||||||
|
(click)="setSort('source')">
|
||||||
|
Quelle
|
||||||
|
@if (sortColumn() === 'source') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection() === 'asc'
|
||||||
|
? 'arrow_upward'
|
||||||
|
: 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="sortable"
|
||||||
|
[class.sort-active]="sortColumn() === 'year'"
|
||||||
|
(click)="setSort('year')">
|
||||||
|
Jahr
|
||||||
|
@if (sortColumn() === 'year') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection() === 'asc'
|
||||||
|
? 'arrow_upward'
|
||||||
|
: 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
<th>Erfinder</th>
|
<th>Erfinder</th>
|
||||||
<th>Anmelder</th>
|
<th>Anmelder</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -66,16 +91,85 @@
|
|||||||
{{ item.patent.source }}
|
{{ item.patent.source }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ item.patent.publication_year ?? '-' }}</td>
|
<td>
|
||||||
<td
|
@if (item.patent.publication_year) {
|
||||||
class="patent-people"
|
<span class="year-badge">{{
|
||||||
[title]="getInventorsLabel(item.patent)">
|
item.patent.publication_year
|
||||||
{{ getInventorsLabel(item.patent) }}
|
}}</span>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
<td
|
<td class="patent-people">
|
||||||
class="patent-people"
|
@if (item.patent.inventors && item.patent.inventors.length) {
|
||||||
[title]="getAssigneesLabel(item.patent)">
|
<div class="person-chips">
|
||||||
{{ getAssigneesLabel(item.patent) }}
|
@for (
|
||||||
|
inventor of item.patent.inventors.slice(0, 2);
|
||||||
|
track inventor
|
||||||
|
) {
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>person</mat-icon>
|
||||||
|
{{ inventor }}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
@if (item.patent.inventors.length > 2) {
|
||||||
|
<span class="person-chip-row">
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>person</mat-icon>
|
||||||
|
{{ item.patent.inventors[2] }}
|
||||||
|
</span>
|
||||||
|
@if (item.patent.inventors.length > 3) {
|
||||||
|
<span class="person-chip person-chip--more"
|
||||||
|
>+{{ item.patent.inventors.length - 3 }}</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="patent-people">
|
||||||
|
@if (item.patent.assignees && item.patent.assignees.length) {
|
||||||
|
<div class="person-chips">
|
||||||
|
@for (
|
||||||
|
assignee of item.patent.assignees.slice(0, 2);
|
||||||
|
track assignee
|
||||||
|
) {
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>{{
|
||||||
|
isAssigneeLikelyPerson(assignee, item.patent)
|
||||||
|
? 'person'
|
||||||
|
: 'apartment'
|
||||||
|
}}</mat-icon>
|
||||||
|
{{ assignee }}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
@if (item.patent.assignees.length > 2) {
|
||||||
|
<span class="person-chip-row">
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>{{
|
||||||
|
isAssigneeLikelyPerson(
|
||||||
|
item.patent.assignees[2],
|
||||||
|
item.patent
|
||||||
|
)
|
||||||
|
? 'person'
|
||||||
|
: 'apartment'
|
||||||
|
}}</mat-icon>
|
||||||
|
{{ item.patent.assignees[2] }}
|
||||||
|
</span>
|
||||||
|
@if (item.patent.assignees.length > 3) {
|
||||||
|
<span class="person-chip person-chip--more"
|
||||||
|
>+{{ item.patent.assignees.length - 3 }}</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
+73
-33
@@ -97,9 +97,24 @@ app-query-param-paginator {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
border-bottom: 1px solid var(--sg-border);
|
border-bottom: 1px solid var(--sg-border);
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: var(--sg-text-muted);
|
color: var(--sg-text-muted);
|
||||||
|
|
||||||
|
&.sortable {
|
||||||
|
display: table-cell;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 2px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
@@ -133,41 +148,66 @@ app-query-param-paginator {
|
|||||||
|
|
||||||
.patent-people {
|
.patent-people {
|
||||||
max-width: 220px;
|
max-width: 220px;
|
||||||
color: var(--sg-text-muted);
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
th {
|
|
||||||
text-align: left;
|
|
||||||
padding: 10px 12px;
|
|
||||||
border-bottom: 2px solid var(--sg-border);
|
|
||||||
color: var(--sg-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
tr {
|
|
||||||
cursor: pointer;
|
|
||||||
color: var(--sg-text);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: var(--sg-surface-soft);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.selected {
|
|
||||||
background: var(--sg-surface-muted);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
padding: 10px 12px;
|
|
||||||
border-bottom: 1px solid var(--sg-border);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.patent-title {
|
.year-badge {
|
||||||
font-weight: 500;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 26px;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chips {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chip-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: var(--sg-surface-soft);
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--sg-text-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--more {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.source-badge {
|
.source-badge {
|
||||||
|
|||||||
+68
-20
@@ -16,7 +16,8 @@ import {
|
|||||||
import { KeywordPatentMappingStatus } from '../../../api';
|
import { KeywordPatentMappingStatus } from '../../../api';
|
||||||
|
|
||||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||||
type SortMode = 'date' | 'title';
|
type SortColumn = 'title' | 'year' | 'source';
|
||||||
|
type SortDirection = 'asc' | 'desc';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-keywords-patents',
|
selector: 'app-keywords-patents',
|
||||||
@@ -44,7 +45,8 @@ export class KeywordsPatentsComponent {
|
|||||||
readonly reload = output<void>();
|
readonly reload = output<void>();
|
||||||
|
|
||||||
activeFilter = signal<SourceFilter>('all');
|
activeFilter = signal<SourceFilter>('all');
|
||||||
sortMode = signal<SortMode>('date');
|
sortColumn = signal<SortColumn>('year');
|
||||||
|
sortDirection = signal<SortDirection>('desc');
|
||||||
selectedMatch = signal<KeywordPatentMatch | null>(null);
|
selectedMatch = signal<KeywordPatentMatch | null>(null);
|
||||||
|
|
||||||
readonly pageIndex = computed(() => {
|
readonly pageIndex = computed(() => {
|
||||||
@@ -86,12 +88,53 @@ export class KeywordsPatentsComponent {
|
|||||||
this.resetPage();
|
this.resetPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSortMode(sortMode: SortMode): void {
|
setSort(column: SortColumn): void {
|
||||||
this.sortMode.set(sortMode);
|
if (this.sortColumn() === column) {
|
||||||
|
this.sortDirection.set(this.sortDirection() === 'asc' ? 'desc' : 'asc');
|
||||||
|
} else {
|
||||||
|
this.sortColumn.set(column);
|
||||||
|
this.sortDirection.set(column === 'year' ? 'desc' : 'asc');
|
||||||
|
}
|
||||||
this.selectedMatch.set(null);
|
this.selectedMatch.set(null);
|
||||||
this.resetPage();
|
this.resetPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isAssigneeLikelyPerson(assignee: string, patent: PatentEntry): boolean {
|
||||||
|
if (KeywordsPatentsComponent.ORG_SUFFIX_PATTERN.test(assignee)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalizedAssignee = this.normalizeNameForComparison(
|
||||||
|
assignee.replace(KeywordsPatentsComponent.PERSON_SUFFIX_PATTERN, ''),
|
||||||
|
);
|
||||||
|
const matchesInventor = (patent.inventors ?? []).some(
|
||||||
|
(inventor) =>
|
||||||
|
this.normalizeNameForComparison(inventor) === normalizedAssignee,
|
||||||
|
);
|
||||||
|
if (matchesInventor) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return KeywordsPatentsComponent.PERSON_SUFFIX_PATTERN.test(assignee);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static readonly ORG_SUFFIX_PATTERN =
|
||||||
|
/\b(Inc|Ltd|LLC|LLP|GmbH|Corp(oration)?|Co|KG|AG|SE|S\.?A\.?|N\.?V\.?|B\.?V\.?|PLC|Universit(y|ät|é)|Institut(e)?|Foundation|Laborator(y|ies)|Labs?|Group|Holdings?|Company|Gesellschaft)\b\.?/i;
|
||||||
|
private static readonly PERSON_SUFFIX_PATTERN =
|
||||||
|
/\b(Dr|Prof|PhD|Ph\.D|M\.D|Jr|Sr)\b\.?/i;
|
||||||
|
|
||||||
|
private normalizeNameForComparison(name: string): string {
|
||||||
|
return name
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[̀-ͯ]/g, '')
|
||||||
|
.replace(/[.,]/g, '')
|
||||||
|
.toUpperCase()
|
||||||
|
.split(/\s+/)
|
||||||
|
.filter(Boolean)
|
||||||
|
.sort()
|
||||||
|
.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
onPatentPageChange(_event: PageEvent): void {
|
onPatentPageChange(_event: PageEvent): void {
|
||||||
this.selectedMatch.set(null);
|
this.selectedMatch.set(null);
|
||||||
}
|
}
|
||||||
@@ -124,14 +167,6 @@ export class KeywordsPatentsComponent {
|
|||||||
.length;
|
.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
getInventorsLabel(patent: PatentEntry): string {
|
|
||||||
return patent.inventors?.length ? patent.inventors.join(', ') : '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
getAssigneesLabel(patent: PatentEntry): string {
|
|
||||||
return patent.assignees?.length ? patent.assignees.join(', ') : '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
formatDate(date: string | null | undefined): string {
|
formatDate(date: string | null | undefined): string {
|
||||||
return formatPatentDate(date);
|
return formatPatentDate(date);
|
||||||
}
|
}
|
||||||
@@ -163,16 +198,29 @@ export class KeywordsPatentsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private sortMatches(items: KeywordPatentMatch[]): KeywordPatentMatch[] {
|
private sortMatches(items: KeywordPatentMatch[]): KeywordPatentMatch[] {
|
||||||
const mode = this.sortMode();
|
const column = this.sortColumn();
|
||||||
|
const direction = this.sortDirection() === 'asc' ? 1 : -1;
|
||||||
return [...items].sort((a, b) => {
|
return [...items].sort((a, b) => {
|
||||||
if (mode === 'date') {
|
switch (column) {
|
||||||
return (b.patent.publication_date ?? '').localeCompare(
|
case 'year': {
|
||||||
a.patent.publication_date ?? '',
|
const yearA =
|
||||||
);
|
a.patent.publication_date ??
|
||||||
|
String(a.patent.publication_year ?? '');
|
||||||
|
const yearB =
|
||||||
|
b.patent.publication_date ??
|
||||||
|
String(b.patent.publication_year ?? '');
|
||||||
|
return direction * yearA.localeCompare(yearB);
|
||||||
|
}
|
||||||
|
case 'source':
|
||||||
|
return direction * a.patent.source.localeCompare(b.patent.source);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
direction *
|
||||||
|
(a.patent.title ?? '').localeCompare(b.patent.title ?? '', 'de', {
|
||||||
|
sensitivity: 'base',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return (a.patent.title ?? '').localeCompare(b.patent.title ?? '', 'de', {
|
|
||||||
sensitivity: 'base',
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,6 +179,8 @@
|
|||||||
<div class="keyword-chip-stack">
|
<div class="keyword-chip-stack">
|
||||||
@for (keyword of keywords; track keyword.llm_keyword.keyword) {
|
@for (keyword of keywords; track keyword.llm_keyword.keyword) {
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topic]="keyword.topic_mapping?.topic"
|
||||||
|
[topicId]="keyword.topic_mapping?.topic?.id"
|
||||||
[label]="getChipLabel(keyword)"
|
[label]="getChipLabel(keyword)"
|
||||||
[count]="
|
[count]="
|
||||||
keywordView() === 'topic' ? getChipCount(keyword) : null
|
keywordView() === 'topic' ? getChipCount(keyword) : null
|
||||||
@@ -209,6 +211,8 @@
|
|||||||
) {
|
) {
|
||||||
<div class="manual-chip-row">
|
<div class="manual-chip-row">
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topic]="keyword.topic_mapping?.topic"
|
||||||
|
[topicId]="keyword.topic_mapping?.topic?.id"
|
||||||
[label]="getChipLabel(keyword)"
|
[label]="getChipLabel(keyword)"
|
||||||
[count]="
|
[count]="
|
||||||
keywordView() === 'topic' ? getChipCount(keyword) : null
|
keywordView() === 'topic' ? getChipCount(keyword) : null
|
||||||
|
|||||||
+150
-29
@@ -1,31 +1,152 @@
|
|||||||
<div class="result-layout">
|
<div class="content">
|
||||||
<mat-card class="results-card">
|
<div class="filters">
|
||||||
<mat-card-content class="results-placeholder">
|
<app-filter-card>
|
||||||
<mat-icon>groups</mat-icon>
|
<app-query-param-selector
|
||||||
<h2>Newsliste</h2>
|
class="relevance-field"
|
||||||
<p>
|
[options]="relevanceOptions"
|
||||||
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
|
[queryParamKey]="keywordsNewsQueryParamKeys.relevance"
|
||||||
</p>
|
label="Relevanz"
|
||||||
</mat-card-content>
|
icon="check_circle"
|
||||||
</mat-card>
|
[multiple]="true" />
|
||||||
|
|
||||||
<mat-card class="weights-card">
|
<app-query-param-selector
|
||||||
<mat-card-content>
|
class="sort-order-field"
|
||||||
<app-weights-sliders
|
[options]="sortOrderOptions"
|
||||||
[options]="weightOptions"
|
[queryParamKey]="keywordsNewsQueryParamKeys.sortOrder"
|
||||||
[initialWeights]="defaultWeights"
|
label="Sortierung"
|
||||||
title="News-Gewichtung"
|
icon="sort" />
|
||||||
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
|
</app-filter-card>
|
||||||
resetLabel="Ausgewogen"
|
|
||||||
applyLabel="Neu gewichten"
|
<app-year-range-slider
|
||||||
normalizedTitle="Normalisiert"
|
[minYear]="minYear"
|
||||||
queryParamPrefix="newsW_"
|
[maxYear]="maxYear"
|
||||||
[persistInQueryParams]="true"
|
[(startYear)]="yearFrom"
|
||||||
[showApplyButton]="true"
|
[(endYear)]="yearTo"
|
||||||
[showResetButton]="true"
|
(startYearChange)="applyYearFilter()"
|
||||||
[showNormalizedPreview]="true"
|
(endYearChange)="applyYearFilter()">
|
||||||
(weightsChange)="onWeightsChange($event)"
|
</app-year-range-slider>
|
||||||
(applyWeights)="onApplyWeights($event)" />
|
|
||||||
</mat-card-content>
|
@if (hasActiveFilters()) {
|
||||||
</mat-card>
|
<button
|
||||||
|
class="reset-filter-btn"
|
||||||
|
mat-stroked-button
|
||||||
|
type="button"
|
||||||
|
(click)="resetFilters()"
|
||||||
|
aria-label="Filter zurücksetzen">
|
||||||
|
<mat-icon>filter_alt_off</mat-icon>
|
||||||
|
<span>Zurücksetzen</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-template #titleTmp let-article>
|
||||||
|
<div class="title-cell">
|
||||||
|
<a class="title" [routerLink]="['/news', article.id]">
|
||||||
|
{{ article.maintitle || 'Kein Titel' }}
|
||||||
|
</a>
|
||||||
|
@if (article.snippet) {
|
||||||
|
<span class="snippet" [innerHTML]="article.snippet"></span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #dateTmp let-article>
|
||||||
|
@if (article.date) {
|
||||||
|
<span class="date-text">{{ article.date }}</span>
|
||||||
|
} @else {
|
||||||
|
<span class="empty-text">-</span>
|
||||||
|
}
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #relevanceTmp let-article>
|
||||||
|
@if (article.relevant === true) {
|
||||||
|
<span class="relevance-badge is-relevant">
|
||||||
|
<mat-icon>check_circle</mat-icon>
|
||||||
|
Relevant
|
||||||
|
</span>
|
||||||
|
} @else if (article.relevant === false) {
|
||||||
|
<span class="relevance-badge not-relevant">
|
||||||
|
<mat-icon>cancel</mat-icon>
|
||||||
|
Nicht relevant
|
||||||
|
</span>
|
||||||
|
} @else {
|
||||||
|
<span
|
||||||
|
class="relevance-badge undetermined"
|
||||||
|
[matTooltip]="relevanceHelp"
|
||||||
|
matTooltipPosition="above">
|
||||||
|
<mat-icon>help</mat-icon>
|
||||||
|
Nicht bestimmt
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #topicsTmp let-article>
|
||||||
|
@let topics = article.topics ?? [];
|
||||||
|
@let topicsExpanded = isTopicsExpanded(article);
|
||||||
|
@let visibleTopics =
|
||||||
|
topicsExpanded ? topics : topics.slice(0, topicPreviewCount);
|
||||||
|
|
||||||
|
<div class="topic-chips" aria-label="Themen">
|
||||||
|
@for (topic of visibleTopics; track topic.id ?? topic.display_name) {
|
||||||
|
<app-topic-chip-2
|
||||||
|
size="mini"
|
||||||
|
[topic]="toTopic(topic)"
|
||||||
|
[showIcon]="false"
|
||||||
|
[isSelected]="isTopicActive(topic)"
|
||||||
|
[isClickable]="fuzzySearch()"
|
||||||
|
(handleChipClick)="toggleTopicFilter($event)" />
|
||||||
|
} @empty {
|
||||||
|
<span class="empty-text">-</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (topics.length > topicPreviewCount) {
|
||||||
|
<app-chip-overflow-toggle
|
||||||
|
[expanded]="topicsExpanded"
|
||||||
|
[hiddenCount]="topics.length - topicPreviewCount"
|
||||||
|
(toggle)="toggleTopicsExpansion(article)" />
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #actionsTmp let-article>
|
||||||
|
<a
|
||||||
|
mat-icon-button
|
||||||
|
color="primary"
|
||||||
|
[routerLink]="['/news', article.id]"
|
||||||
|
matTooltip="Details anzeigen">
|
||||||
|
<mat-icon>open_in_new</mat-icon>
|
||||||
|
</a>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
@if (!hasSearchInput()) {
|
||||||
|
<div class="no-results">
|
||||||
|
<span>Keine Keywords ausgewählt.</span>
|
||||||
|
</div>
|
||||||
|
} @else if (total() === 0) {
|
||||||
|
<div class="no-results">
|
||||||
|
@if (hasNarrowingFilters()) {
|
||||||
|
<span>Keine Nachrichten für die aktuellen Filter.</span>
|
||||||
|
<span class="no-results__hint">
|
||||||
|
Setzen Sie die Filter zurück, um mehr Ergebnisse zu sehen.
|
||||||
|
</span>
|
||||||
|
} @else if (searchedByTopics()) {
|
||||||
|
<span>Zu diesen Themen gibt es keine Nachrichten.</span>
|
||||||
|
<span class="no-results__hint">
|
||||||
|
Campus Aktuell deckt nicht jedes Forschungsthema ab. Schalten Sie die
|
||||||
|
Fuzzy Search aus, um direkt nach den Keywords zu suchen.
|
||||||
|
</span>
|
||||||
|
} @else {
|
||||||
|
<span>Keine Nachrichten zu diesen Keywords gefunden.</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="table-wrap">
|
||||||
|
<app-data-table [columns]="columns()" [data]="elements()" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<app-query-param-paginator
|
||||||
|
[total]="total()"
|
||||||
|
queryParamPageKey="page"
|
||||||
|
queryParamSizeKey="size" />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+190
-20
@@ -1,29 +1,199 @@
|
|||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
/* ============================================================
|
/* ============================================================
|
||||||
RESULT LAYOUT
|
FILTERS
|
||||||
============================================================ */
|
============================================================ */
|
||||||
.result-layout {
|
.filters {
|
||||||
display: grid;
|
display: flex;
|
||||||
grid-template-columns: minmax(300px, 420px) 1fr;
|
flex-wrap: wrap;
|
||||||
grid-template-areas: 'summary results';
|
align-items: stretch;
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
align-items: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-summary-card {
|
.relevance-field,
|
||||||
grid-area: summary;
|
.sort-order-field {
|
||||||
}
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
.results-card {
|
app-year-range-slider {
|
||||||
grid-area: results;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-summary-card,
|
::ng-deep app-year-range-slider .year-filter {
|
||||||
.results-card {
|
height: 100%;
|
||||||
background: var(--sg-surface);
|
}
|
||||||
border: 1px solid var(--sg-border);
|
|
||||||
box-shadow: none;
|
|
||||||
|
|
||||||
.mat-mdc-card-content {
|
::ng-deep .mat-mdc-form-field-subscript-wrapper {
|
||||||
padding: 0.75rem;
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-form-field-icon-prefix {
|
||||||
|
padding: 0 4px 0 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.reset-filter-btn {
|
||||||
|
display: flex;
|
||||||
|
align-self: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.25rem;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
TABLE
|
||||||
|
============================================================ */
|
||||||
|
.table-wrap {
|
||||||
|
position: relative;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .table-wrap table {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 960px;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0 10px;
|
||||||
|
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-date,
|
||||||
|
.mat-column-relevant,
|
||||||
|
.mat-mdc-header-cell {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-column-topics {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ============================================================
|
||||||
|
TABLE CELLS
|
||||||
|
============================================================ */
|
||||||
|
.title-cell {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
max-width: 32rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.snippet {
|
||||||
|
font-size: 12.5px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--sg-text-secondary);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
|
||||||
|
::ng-deep em {
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--sg-blue-highlight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.date-text {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.relevance-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-relevant {
|
||||||
|
background: var(--sg-success-soft);
|
||||||
|
border: 1px solid var(--sg-success);
|
||||||
|
color: var(--sg-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.not-relevant {
|
||||||
|
background: var(--sg-surface-muted);
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.undetermined {
|
||||||
|
background: var(--sg-warning-soft);
|
||||||
|
border: 1px solid var(--sg-warning);
|
||||||
|
color: var(--sg-warning);
|
||||||
|
cursor: help;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-chips {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.25rem;
|
||||||
|
align-items: flex-start;
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
max-width: 350px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-results {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 2rem;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&__hint {
|
||||||
|
max-width: 34rem;
|
||||||
|
color: var(--sg-text-soft);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+256
-87
@@ -1,115 +1,284 @@
|
|||||||
import { Component, inject, signal } from '@angular/core';
|
|
||||||
|
|
||||||
import { MatCardModule } from '@angular/material/card';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
WeightMap,
|
Component,
|
||||||
WeightSliderOption,
|
DestroyRef,
|
||||||
WeightsSlidersComponent,
|
computed,
|
||||||
WeightsSlidersValue,
|
inject,
|
||||||
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
|
input,
|
||||||
|
signal,
|
||||||
|
TemplateRef,
|
||||||
|
viewChild,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
|
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
|
||||||
|
import { MatchedTopic, NewsPage, Topic } from '../../../../api';
|
||||||
|
import {
|
||||||
|
DataTableComponent,
|
||||||
|
GenericColumn,
|
||||||
|
} from '../../../../shared/ui/data-table/data-table.component';
|
||||||
|
import { QueryParamPaginatorComponent } from '../../../../shared/ui/query-param-paginator/query-param-paginator.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';
|
||||||
|
import {
|
||||||
|
QueryParamSelectorComponent,
|
||||||
|
SelectorOption,
|
||||||
|
} 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 } from '../search-results-state.service';
|
||||||
|
import { YearRangeSliderComponent } from '../../../../shared/ui/year-range-slider/year-range-slider.component';
|
||||||
|
|
||||||
|
type NewsResult = NewsPage['results'][number];
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-news-results',
|
selector: 'app-news-results',
|
||||||
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
|
imports: [
|
||||||
|
RouterModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatTooltipModule,
|
||||||
|
DataTableComponent,
|
||||||
|
AppTopicChipComponent,
|
||||||
|
ChipOverflowToggleComponent,
|
||||||
|
FilterCardComponent,
|
||||||
|
QueryParamPaginatorComponent,
|
||||||
|
QueryParamSelectorComponent,
|
||||||
|
YearRangeSliderComponent,
|
||||||
|
],
|
||||||
templateUrl: './news-results.component.html',
|
templateUrl: './news-results.component.html',
|
||||||
styleUrl: './news-results.component.scss',
|
styleUrl: './news-results.component.scss',
|
||||||
})
|
})
|
||||||
export class KeywordsToNewsResultsComponent {
|
export class KeywordsToNewsResultsComponent {
|
||||||
// injects the state set by the parent route — no duplicate parsing here
|
protected readonly keywordsNewsQueryParamKeys = keywordsNewsQueryParamKeys;
|
||||||
|
|
||||||
private readonly state = inject(SearchResultsStateService);
|
private readonly state = inject(SearchResultsStateService);
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
readonly defaultWeights: WeightMap = {
|
newsPage = input.required<NewsPage>();
|
||||||
param1: 0.33,
|
|
||||||
param2: 0.33,
|
|
||||||
param3: 0.34,
|
|
||||||
};
|
|
||||||
|
|
||||||
readonly weightOptions: WeightSliderOption[] = [
|
readonly minYear = NEWS_MIN_YEAR;
|
||||||
{
|
readonly maxYear = new Date().getFullYear();
|
||||||
key: 'param1',
|
|
||||||
label: 'Parameter 1',
|
readonly relevanceHelp =
|
||||||
icon: 'workspace_premium',
|
'Ein Artikel gilt als relevant, wenn er für Gründungsforschende interessante Inhalte enthält.';
|
||||||
description: 'Gewichtet Parameter 1.',
|
|
||||||
defaultValue: 0.5,
|
readonly sortOrderOptions: SelectorOption[] = [
|
||||||
queryParamName: 'wParam1',
|
{ value: 'desc', display_name: 'Neueste zuerst' },
|
||||||
},
|
{ value: 'asc', display_name: 'Älteste zuerst' },
|
||||||
{
|
|
||||||
key: 'param2',
|
|
||||||
label: 'Parameter 2',
|
|
||||||
icon: 'workspace_premium',
|
|
||||||
description: 'Gewichtet Parameter 2.',
|
|
||||||
defaultValue: 0.5,
|
|
||||||
queryParamName: 'wParam2',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'param3',
|
|
||||||
label: 'Parameter 3',
|
|
||||||
icon: 'workspace_premium',
|
|
||||||
description: 'Gewichtet Parameter 3.',
|
|
||||||
defaultValue: 0.5,
|
|
||||||
queryParamName: 'wParam3',
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
readonly currentWeights = signal<WeightsSlidersValue>({
|
readonly relevanceOptions: SelectorOption[] = [
|
||||||
raw: this.defaultWeights,
|
{ value: 'relevant', display_name: 'Relevant' },
|
||||||
normalized: {
|
{ value: 'not_relevant', display_name: 'Nicht relevant' },
|
||||||
param1: 0.33,
|
];
|
||||||
param2: 0.33,
|
|
||||||
param3: 0.34,
|
readonly yearFrom = signal<number>(this.minYear);
|
||||||
},
|
readonly yearTo = signal<number>(this.maxYear);
|
||||||
rawSum: 2.5,
|
|
||||||
normalizedSum: 1,
|
protected readonly topicPreviewCount = 3;
|
||||||
valid: true,
|
private readonly expandedTopicsIds = signal<ReadonlySet<string>>(new Set());
|
||||||
|
|
||||||
|
private readonly queryParamMap = toSignal(this.route.queryParamMap, {
|
||||||
|
initialValue: this.route.snapshot.queryParamMap,
|
||||||
});
|
});
|
||||||
|
|
||||||
readonly projects = signal<unknown[]>([]); // placeholder until the results service lands
|
readonly total = computed(() => this.newsPage().total ?? 0);
|
||||||
|
readonly elements = computed(() => this.newsPage().results ?? []);
|
||||||
|
readonly fuzzySearch = computed(
|
||||||
|
() => this.queryParamMap().get('fuzzy') === 'true',
|
||||||
|
);
|
||||||
|
|
||||||
private hasLoadedInitial = false;
|
readonly hasSearchInput = computed(() =>
|
||||||
constructor() {
|
this.fuzzySearch()
|
||||||
console.log('check', this.state.payload());
|
? this.state.topicIds().length > 0 || this.state.keywords().length > 0
|
||||||
}
|
: this.state.keywords().length > 0,
|
||||||
onWeightsChange(value: WeightsSlidersValue): void {
|
);
|
||||||
this.currentWeights.set(value);
|
|
||||||
|
|
||||||
// fires once with the query-param-aware initial state — use it to load
|
readonly selectedTopicIds = computed(() =>
|
||||||
if (!this.hasLoadedInitial) {
|
this.queryParamMap().getAll(keywordsNewsQueryParamKeys.topicId),
|
||||||
this.hasLoadedInitial = true;
|
);
|
||||||
this.loadprojects();
|
|
||||||
|
readonly hasActiveFilters = computed(() => {
|
||||||
|
const params = this.queryParamMap();
|
||||||
|
return (
|
||||||
|
!!params.get(keywordsNewsQueryParamKeys.relevance) ||
|
||||||
|
!!params.get(keywordsNewsQueryParamKeys.yearFrom) ||
|
||||||
|
!!params.get(keywordsNewsQueryParamKeys.yearTo) ||
|
||||||
|
!!params.get(keywordsNewsQueryParamKeys.sortOrder) ||
|
||||||
|
this.selectedTopicIds().length > 0
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
readonly hasNarrowingFilters = computed(() => {
|
||||||
|
const params = this.queryParamMap();
|
||||||
|
return (
|
||||||
|
!!params.get(keywordsNewsQueryParamKeys.relevance) ||
|
||||||
|
!!params.get(keywordsNewsQueryParamKeys.yearFrom) ||
|
||||||
|
!!params.get(keywordsNewsQueryParamKeys.yearTo) ||
|
||||||
|
this.selectedTopicIds().length > 0
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
readonly searchedByTopics = computed(() => {
|
||||||
|
if (!this.fuzzySearch()) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
const baseTopicIds = (this.queryParamMap().get('topics') ?? '')
|
||||||
|
.split(',')
|
||||||
|
.filter((value) => value.trim());
|
||||||
|
return baseTopicIds.length > 0 || this.selectedTopicIds().length > 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
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');
|
||||||
|
|
||||||
|
readonly columns = computed<GenericColumn<NewsResult>[]>(() => [
|
||||||
|
{
|
||||||
|
id: 'maintitle',
|
||||||
|
header: 'Titel',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.titleTmp(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'date',
|
||||||
|
header: 'Datum',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.dateTmp(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'relevant',
|
||||||
|
header: 'Relevanz',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.relevanceTmp(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'topics',
|
||||||
|
header: 'Themen',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.topicsTmp(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'actions',
|
||||||
|
header: 'Aktionen',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.actionsTmp(),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.route.queryParamMap
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe((params) => {
|
||||||
|
this.yearFrom.set(
|
||||||
|
this.parseYear(params.get(keywordsNewsQueryParamKeys.yearFrom)) ??
|
||||||
|
this.minYear,
|
||||||
|
);
|
||||||
|
this.yearTo.set(
|
||||||
|
this.parseYear(params.get(keywordsNewsQueryParamKeys.yearTo)) ??
|
||||||
|
this.maxYear,
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onApplyWeights(value: WeightsSlidersValue): void {
|
applyYearFilter(): void {
|
||||||
this.currentWeights.set(value);
|
this.router.navigate([], {
|
||||||
this.loadprojects();
|
relativeTo: this.route,
|
||||||
}
|
queryParams: {
|
||||||
|
[keywordsNewsQueryParamKeys.yearFrom]:
|
||||||
private loadprojects(): void {
|
this.yearFrom() > this.minYear ? this.yearFrom() : null,
|
||||||
const weights = this.currentWeights();
|
[keywordsNewsQueryParamKeys.yearTo]:
|
||||||
|
this.yearTo() < this.maxYear ? this.yearTo() : null,
|
||||||
const requestPayload = {
|
[keywordsNewsQueryParamKeys.page]: 0,
|
||||||
manualKeywords: this.state.manualKeywords(),
|
|
||||||
extractedKeywords: this.state.extractedKeywords(),
|
|
||||||
keywords: this.state.keywords(),
|
|
||||||
fuzzy: this.state.fuzzySearch(),
|
|
||||||
weights: {
|
|
||||||
raw: weights.raw,
|
|
||||||
normalized: weights.normalized,
|
|
||||||
},
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
toTopic(matched: MatchedTopic): Topic {
|
||||||
|
return {
|
||||||
|
id: matched.id,
|
||||||
|
display_name: matched.display_name,
|
||||||
|
subfield: matched.subfield_name
|
||||||
|
? { display_name: matched.subfield_name }
|
||||||
|
: null,
|
||||||
|
field: matched.field_name ? { display_name: matched.field_name } : null,
|
||||||
|
domain: matched.domain_name
|
||||||
|
? { display_name: matched.domain_name }
|
||||||
|
: null,
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
console.log(requestPayload);
|
isTopicActive(topic: MatchedTopic): boolean {
|
||||||
|
return !!topic.id && this.selectedTopicIds().includes(topic.id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
isTopicsExpanded(article: NewsResult): boolean {
|
||||||
* TODO:
|
return this.expandedTopicsIds().has(article.id);
|
||||||
* this.projectsService.searchprojects(requestPayload).subscribe({
|
}
|
||||||
* next: results => this.projects.set(results),
|
|
||||||
* error: error => console.error(error),
|
toggleTopicsExpansion(article: NewsResult): void {
|
||||||
* });
|
if (!article.id) {
|
||||||
*/
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expandedTopicsIds.update((ids) => {
|
||||||
|
const next = new Set(ids);
|
||||||
|
if (next.has(article.id)) {
|
||||||
|
next.delete(article.id);
|
||||||
|
} else {
|
||||||
|
next.add(article.id);
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleTopicFilter(topic: Topic): void {
|
||||||
|
if (!topic.id || !this.fuzzySearch()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selected = this.selectedTopicIds();
|
||||||
|
const next = selected.includes(topic.id)
|
||||||
|
? selected.filter((id) => id !== topic.id)
|
||||||
|
: [...selected, topic.id];
|
||||||
|
|
||||||
|
this.router.navigate([], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: {
|
||||||
|
[keywordsNewsQueryParamKeys.topicId]: next.length ? next : null,
|
||||||
|
[keywordsNewsQueryParamKeys.page]: 0,
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
resetFilters(): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: {
|
||||||
|
[keywordsNewsQueryParamKeys.relevance]: null,
|
||||||
|
[keywordsNewsQueryParamKeys.yearFrom]: null,
|
||||||
|
[keywordsNewsQueryParamKeys.yearTo]: null,
|
||||||
|
[keywordsNewsQueryParamKeys.topicId]: null,
|
||||||
|
[keywordsNewsQueryParamKeys.sortOrder]: null,
|
||||||
|
[keywordsNewsQueryParamKeys.page]: 0,
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseYear(raw: string | null): number | null {
|
||||||
|
const year = Number.parseInt(raw ?? '', 10);
|
||||||
|
return Number.isNaN(year) ? null : year;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-18
@@ -4,24 +4,9 @@
|
|||||||
<p>Übersicht der durchgeführten Projekte.</p>
|
<p>Übersicht der durchgeführten Projekte.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<nav mat-tab-nav-bar [tabPanel]="resultTabPanel" class="result-nav">
|
@if (resultTabPanel) {
|
||||||
@for (route of childRoutes; track route.path) {
|
<app-link-tab-nav-bar [links]="_links()" [tabPanel]="resultTabPanel" />
|
||||||
<a
|
}
|
||||||
matTabLink
|
|
||||||
[routerLink]="[route.path]"
|
|
||||||
[queryParams]="{
|
|
||||||
authorId: null,
|
|
||||||
institutionId: null,
|
|
||||||
agency: null,
|
|
||||||
}"
|
|
||||||
queryParamsHandling="merge"
|
|
||||||
routerLinkActive
|
|
||||||
#rla="routerLinkActive"
|
|
||||||
[active]="rla.isActive">
|
|
||||||
{{ route.label }}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<mat-tab-nav-panel #resultTabPanel>
|
<mat-tab-nav-panel #resultTabPanel>
|
||||||
<router-outlet />
|
<router-outlet />
|
||||||
|
|||||||
+31
-22
@@ -6,16 +6,13 @@ import { MatTabsModule } from '@angular/material/tabs';
|
|||||||
import { OnInit, computed } from '@angular/core';
|
import { OnInit, computed } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { toSignal } from '@angular/core/rxjs-interop';
|
import { toSignal } from '@angular/core/rxjs-interop';
|
||||||
|
import {
|
||||||
|
LinkTabNavBarComponent,
|
||||||
|
LinkTabNavBarItem,
|
||||||
|
} from '../../../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-projects-results',
|
selector: 'app-projects-results',
|
||||||
imports: [
|
imports: [MatCardModule, MatTabsModule, RouterOutlet, LinkTabNavBarComponent],
|
||||||
MatCardModule,
|
|
||||||
MatTabsModule,
|
|
||||||
RouterLink,
|
|
||||||
RouterLinkActive,
|
|
||||||
RouterOutlet,
|
|
||||||
],
|
|
||||||
templateUrl: './projects-results.component.html',
|
templateUrl: './projects-results.component.html',
|
||||||
styleUrl: './projects-results.component.scss',
|
styleUrl: './projects-results.component.scss',
|
||||||
})
|
})
|
||||||
@@ -32,18 +29,30 @@ export class KeywordsToProjectsResultsComponent {
|
|||||||
() => this.queryParamMap().get('fuzzy') === 'true',
|
() => this.queryParamMap().get('fuzzy') === 'true',
|
||||||
);
|
);
|
||||||
|
|
||||||
readonly childRoutes = [
|
_links = computed<LinkTabNavBarItem[]>(() => {
|
||||||
{
|
const links: LinkTabNavBarItem[] = [
|
||||||
path: 'dfg',
|
{
|
||||||
label: 'DFG-Projekte',
|
label: 'DFG-Projekte',
|
||||||
},
|
path: 'dfg',
|
||||||
{
|
queryParams: { authorId: null, institutionId: null, agency: null },
|
||||||
path: 'eu',
|
queryParamsHandling: 'merge',
|
||||||
label: 'EU-Projekte',
|
disabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'bund',
|
label: 'EU-Projekte',
|
||||||
label: 'BUND-Projekte',
|
path: 'eu',
|
||||||
},
|
queryParams: { authorId: null, institutionId: null, agency: null },
|
||||||
];
|
queryParamsHandling: 'merge',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'BUND-Projekte',
|
||||||
|
path: 'bund',
|
||||||
|
queryParams: { authorId: null, institutionId: null, agency: null },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return links;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
track getEntryTrack(entry)
|
track getEntryTrack(entry)
|
||||||
) {
|
) {
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topic]="entry.topic_mapping?.topic"
|
||||||
|
[topicId]="entry.topic_mapping?.topic?.id"
|
||||||
[label]="getChipLabel(entry)"
|
[label]="getChipLabel(entry)"
|
||||||
[count]="getChipCount(entry)"
|
[count]="getChipCount(entry)"
|
||||||
[description]="getChipDescription(entry)"
|
[description]="getChipDescription(entry)"
|
||||||
|
|||||||
@@ -230,8 +230,8 @@
|
|||||||
»{{ topic.source_keyword }}«
|
»{{ topic.source_keyword }}«
|
||||||
</button>
|
</button>
|
||||||
<p class="kw-hint">
|
<p class="kw-hint">
|
||||||
Im Artikel hervorgehoben · klicken zum Suche zu
|
Im Artikel hervorgehoben - klicken, um zum
|
||||||
öffnen
|
ersten Vorkommen zu springen.
|
||||||
</p>
|
</p>
|
||||||
} @else {
|
} @else {
|
||||||
<p class="placeholder">
|
<p class="placeholder">
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
ViewChild,
|
ViewChild,
|
||||||
inject,
|
inject,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
@@ -66,7 +65,6 @@ export class NewsDetailComponent implements OnInit {
|
|||||||
private readonly route = inject(ActivatedRoute);
|
private readonly route = inject(ActivatedRoute);
|
||||||
private readonly httpClient = inject(HttpClient);
|
private readonly httpClient = inject(HttpClient);
|
||||||
private readonly worksService = inject(WorksService);
|
private readonly worksService = inject(WorksService);
|
||||||
private readonly location = inject(Location);
|
|
||||||
private readonly sanitizer = inject(DomSanitizer);
|
private readonly sanitizer = inject(DomSanitizer);
|
||||||
|
|
||||||
article: NewsArticleDetail | null = null;
|
article: NewsArticleDetail | null = null;
|
||||||
@@ -150,7 +148,7 @@ export class NewsDetailComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
navigateBack(): void {
|
navigateBack(): void {
|
||||||
this.location.back();
|
this.router.navigate(['/news']);
|
||||||
}
|
}
|
||||||
|
|
||||||
formatDate(dateStr?: string | null): string {
|
formatDate(dateStr?: string | null): string {
|
||||||
@@ -200,36 +198,30 @@ export class NewsDetailComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const orphanColors = [
|
|
||||||
'var(--sg-primary)',
|
|
||||||
'var(--sg-blue-highlight)',
|
|
||||||
'var(--sg-success)',
|
|
||||||
'var(--sg-warning)',
|
|
||||||
'var(--sg-error)',
|
|
||||||
];
|
|
||||||
let orphanIdx = 0;
|
|
||||||
|
|
||||||
let html = this.escapeHtml(text);
|
let html = this.escapeHtml(text);
|
||||||
if (keywords.length) {
|
[...keywords]
|
||||||
[...keywords]
|
.sort((a, b) => b.length - a.length)
|
||||||
.sort((a, b) => b.length - a.length)
|
.forEach((kw) => {
|
||||||
.forEach((kw) => {
|
const color = keywordColorMap.get(kw.toLowerCase());
|
||||||
let color = keywordColorMap.get(kw.toLowerCase());
|
if (!color) return;
|
||||||
if (!color) {
|
const kwHtml = this.escapeHtml(kw);
|
||||||
color = orphanColors[orphanIdx % orphanColors.length];
|
const escaped = this.escapeRegex(kwHtml);
|
||||||
orphanIdx++;
|
const before = '(?<![\\w\\u00C0-\\u024F])';
|
||||||
}
|
const acronymLike =
|
||||||
const kwHtml = this.escapeHtml(kw);
|
kw.length <= 3 ||
|
||||||
const re = new RegExp(
|
(kw === kw.toUpperCase() && kw !== kw.toLowerCase());
|
||||||
`(${this.escapeRegex(kwHtml)}[\\w\\u00C0-\\u024F]*)`,
|
const re = new RegExp(
|
||||||
'gi',
|
acronymLike
|
||||||
);
|
? `${before}(${escaped})(?![\\w\\u00C0-\\u024F])`
|
||||||
html = html.replace(
|
: `${before}(${escaped}[\\w\\u00C0-\\u024F]*)`,
|
||||||
re,
|
'gi',
|
||||||
`<mark class="kw-mark" style="--t:${color}" data-kw="${kwHtml}">$1</mark>`,
|
);
|
||||||
);
|
html = html.replace(
|
||||||
});
|
re,
|
||||||
}
|
`<mark class="kw-mark" style="--t:${color}" data-kw="${kwHtml}">$1</mark>`,
|
||||||
|
);
|
||||||
|
});
|
||||||
return this.sanitizer.bypassSecurityTrustHtml(html);
|
return this.sanitizer.bypassSecurityTrustHtml(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,18 +18,24 @@
|
|||||||
|
|
||||||
<ng-template #additionalFiltersTmp>
|
<ng-template #additionalFiltersTmp>
|
||||||
<div class="additional-filters">
|
<div class="additional-filters">
|
||||||
<mat-form-field
|
<app-filter-card>
|
||||||
appearance="outline"
|
<app-query-param-selector
|
||||||
subscriptSizing="dynamic"
|
class="relevance-field"
|
||||||
class="relevance-field">
|
[options]="relevanceOptions"
|
||||||
<mat-select
|
queryParamKey="relevance"
|
||||||
[formControl]="relevanceFilter"
|
label="Relevanz"
|
||||||
placeholder="Relevanz"
|
icon="check_circle"
|
||||||
multiple>
|
[multiple]="true" />
|
||||||
<mat-option value="relevant">Relevant</mat-option>
|
|
||||||
<mat-option value="not_relevant">Nicht relevant</mat-option>
|
@if (!isSearching()) {
|
||||||
</mat-select>
|
<app-query-param-selector
|
||||||
</mat-form-field>
|
class="sort-order-field"
|
||||||
|
[options]="sortingDirectionOptionsAll"
|
||||||
|
queryParamKey="sorting_order"
|
||||||
|
label="Sortierung"
|
||||||
|
icon="sort" />
|
||||||
|
}
|
||||||
|
</app-filter-card>
|
||||||
|
|
||||||
<app-year-range-slider
|
<app-year-range-slider
|
||||||
class="year-field"
|
class="year-field"
|
||||||
@@ -59,7 +65,5 @@
|
|||||||
[additionalFiltersTmp]="additionalFiltersTmp"
|
[additionalFiltersTmp]="additionalFiltersTmp"
|
||||||
[noResultsTmp]="noResultsTmp"
|
[noResultsTmp]="noResultsTmp"
|
||||||
[cardMinWidth]="380"
|
[cardMinWidth]="380"
|
||||||
[sortingDirectionOptions]="sortingDirectionOptions()"
|
|
||||||
sortingDirectionLabel="Sortierung"
|
|
||||||
searchLabel="Nachrichten durchsuchen" />
|
searchLabel="Nachrichten durchsuchen" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,20 +44,36 @@
|
|||||||
color: var(--sg-text-muted);
|
color: var(--sg-text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$card-min-width: 380px;
|
||||||
|
|
||||||
.additional-filters {
|
.additional-filters {
|
||||||
display: flex;
|
display: grid;
|
||||||
align-items: center;
|
grid-template-columns: repeat(auto-fill, minmax($card-min-width, 1fr));
|
||||||
flex-wrap: wrap;
|
align-items: stretch;
|
||||||
gap: 40px;
|
gap: 1.5rem;
|
||||||
padding: 0 1rem 1rem;
|
padding: 0 1rem 1rem;
|
||||||
|
|
||||||
|
app-year-range-slider {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep app-year-range-slider .year-filter {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-form-field-subscript-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-form-field-icon-prefix {
|
||||||
|
padding: 0 4px 0 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.relevance-field {
|
.relevance-field,
|
||||||
width: 180px;
|
.sort-order-field {
|
||||||
}
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
.year-field {
|
|
||||||
min-width: 280px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
@media (max-width: 600px) {
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ import {
|
|||||||
signal,
|
signal,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
import { FormControl } from '@angular/forms';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { debounceTime, merge } from 'rxjs';
|
import { debounceTime, merge } from 'rxjs';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
||||||
import { MatSelectModule } from '@angular/material/select';
|
|
||||||
|
|
||||||
import { WorksService } from '../../api';
|
import { WorksService } from '../../api';
|
||||||
import {
|
import {
|
||||||
@@ -24,7 +22,11 @@ import {
|
|||||||
NewsCardComponent,
|
NewsCardComponent,
|
||||||
NEWS_MIN_YEAR,
|
NEWS_MIN_YEAR,
|
||||||
} from '../../shared/ui/news-card/news-card.component';
|
} from '../../shared/ui/news-card/news-card.component';
|
||||||
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
|
import {
|
||||||
|
QueryParamSelectorComponent,
|
||||||
|
SelectorOption,
|
||||||
|
} from '../../shared/ui/query-param-selector/query-param-selector.component';
|
||||||
|
import { FilterCardComponent } from '../../shared/ui/filter-card/filter-card.component';
|
||||||
import { YearRangeSliderComponent } from '../../shared/ui/year-range-slider/year-range-slider.component';
|
import { YearRangeSliderComponent } from '../../shared/ui/year-range-slider/year-range-slider.component';
|
||||||
|
|
||||||
interface NewsArticle extends NewsArticleBase {
|
interface NewsArticle extends NewsArticleBase {
|
||||||
@@ -44,11 +46,10 @@ type SortOrder = 'desc' | 'asc';
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-news',
|
selector: 'app-news',
|
||||||
imports: [
|
imports: [
|
||||||
ReactiveFormsModule,
|
|
||||||
MatFormFieldModule,
|
|
||||||
MatSelectModule,
|
|
||||||
CardSearchComponent,
|
CardSearchComponent,
|
||||||
NewsCardComponent,
|
NewsCardComponent,
|
||||||
|
FilterCardComponent,
|
||||||
|
QueryParamSelectorComponent,
|
||||||
YearRangeSliderComponent,
|
YearRangeSliderComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './news.component.html',
|
templateUrl: './news.component.html',
|
||||||
@@ -64,11 +65,16 @@ export class NewsComponent implements OnInit {
|
|||||||
readonly minYear = NEWS_MIN_YEAR;
|
readonly minYear = NEWS_MIN_YEAR;
|
||||||
readonly maxYear = new Date().getFullYear();
|
readonly maxYear = new Date().getFullYear();
|
||||||
|
|
||||||
private readonly sortingDirectionOptionsAll: SelectorOption[] = [
|
readonly sortingDirectionOptionsAll: SelectorOption[] = [
|
||||||
{ value: 'desc', display_name: 'Neueste zuerst' },
|
{ value: 'desc', display_name: 'Neueste zuerst' },
|
||||||
{ value: 'asc', display_name: 'Älteste zuerst' },
|
{ value: 'asc', display_name: 'Älteste zuerst' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
readonly relevanceOptions: SelectorOption[] = [
|
||||||
|
{ value: 'relevant', display_name: 'Relevant' },
|
||||||
|
{ value: 'not_relevant', display_name: 'Nicht relevant' },
|
||||||
|
];
|
||||||
|
|
||||||
readonly relevanceFilter = new FormControl<string[]>([], {
|
readonly relevanceFilter = new FormControl<string[]>([], {
|
||||||
nonNullable: true,
|
nonNullable: true,
|
||||||
});
|
});
|
||||||
@@ -85,9 +91,6 @@ export class NewsComponent implements OnInit {
|
|||||||
readonly searchQuery = signal('');
|
readonly searchQuery = signal('');
|
||||||
|
|
||||||
readonly isSearching = computed(() => this.searchQuery().trim().length > 0);
|
readonly isSearching = computed(() => this.searchQuery().trim().length > 0);
|
||||||
readonly sortingDirectionOptions = computed<SelectorOption[]>(() =>
|
|
||||||
this.isSearching() ? [] : this.sortingDirectionOptionsAll,
|
|
||||||
);
|
|
||||||
|
|
||||||
readonly page = computed<Page>(() => ({
|
readonly page = computed<Page>(() => ({
|
||||||
page: this.currentPage,
|
page: this.currentPage,
|
||||||
|
|||||||
@@ -138,6 +138,7 @@
|
|||||||
track topic.topic_id ?? topic.topic_display_name
|
track topic.topic_id ?? topic.topic_display_name
|
||||||
) {
|
) {
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topicId]="topic.topic_id"
|
||||||
[label]="topic.topic_display_name"
|
[label]="topic.topic_display_name"
|
||||||
[fieldName]="topic.field_name"
|
[fieldName]="topic.field_name"
|
||||||
[domainName]="topic.domain_name"
|
[domainName]="topic.domain_name"
|
||||||
|
|||||||
@@ -111,6 +111,7 @@
|
|||||||
track topic.topic_id ?? topic.topic_display_name
|
track topic.topic_id ?? topic.topic_display_name
|
||||||
) {
|
) {
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topicId]="topic.topic_id"
|
||||||
[label]="topic.topic_display_name"
|
[label]="topic.topic_display_name"
|
||||||
[fieldName]="topic.field_name"
|
[fieldName]="topic.field_name"
|
||||||
[domainName]="topic.domain_name"
|
[domainName]="topic.domain_name"
|
||||||
|
|||||||
@@ -106,6 +106,8 @@
|
|||||||
[skText]="loading()"
|
[skText]="loading()"
|
||||||
class="person-topic-chip"
|
class="person-topic-chip"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
[topic]="topic"
|
||||||
|
[topicId]="topic.id"
|
||||||
[label]="topic.display_name || ''"
|
[label]="topic.display_name || ''"
|
||||||
[description]="topic.description"
|
[description]="topic.description"
|
||||||
[subfieldName]="topic.subfield?.display_name"
|
[subfieldName]="topic.subfield?.display_name"
|
||||||
|
|||||||
@@ -33,22 +33,75 @@
|
|||||||
subscriptSizing="dynamic">
|
subscriptSizing="dynamic">
|
||||||
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
||||||
<mat-select
|
<mat-select
|
||||||
[value]="sortMode"
|
[value]="sortColumn"
|
||||||
(selectionChange)="setSortMode($event.value)">
|
(selectionChange)="setSort($event.value)">
|
||||||
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
||||||
<mat-option value="name">Name</mat-option>
|
<mat-option value="name">Förderer</mat-option>
|
||||||
<mat-option value="top">Top Förderer</mat-option>
|
<mat-option value="publications">Publikationen</mat-option>
|
||||||
|
<mat-option value="first">Erstautor</mat-option>
|
||||||
|
<mat-option value="middle">Mitautor</mat-option>
|
||||||
|
<mat-option value="last">Letztautor</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Förderer</th>
|
<th
|
||||||
<th class="text-center">Publikationen</th>
|
class="sortable"
|
||||||
<th class="text-center">Erstautor</th>
|
[class.sort-active]="sortColumn === 'name'"
|
||||||
<th class="text-center">Mitautor</th>
|
(click)="setSort('name')">
|
||||||
<th class="text-center">Letztautor</th>
|
Förderer
|
||||||
|
@if (sortColumn === 'name') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="text-center sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'publications'"
|
||||||
|
(click)="setSort('publications')">
|
||||||
|
Publikationen
|
||||||
|
@if (sortColumn === 'publications') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="text-center sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'first'"
|
||||||
|
(click)="setSort('first')">
|
||||||
|
Erstautor
|
||||||
|
@if (sortColumn === 'first') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="text-center sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'middle'"
|
||||||
|
(click)="setSort('middle')">
|
||||||
|
Mitautor
|
||||||
|
@if (sortColumn === 'middle') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="text-center sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'last'"
|
||||||
|
(click)="setSort('last')">
|
||||||
|
Letztautor
|
||||||
|
@if (sortColumn === 'last') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|||||||
@@ -45,9 +45,24 @@ app-query-param-paginator {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
border-bottom: 1px solid var(--sg-border);
|
border-bottom: 1px solid var(--sg-border);
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: var(--sg-text-muted);
|
color: var(--sg-text-muted);
|
||||||
|
|
||||||
|
&.sortable {
|
||||||
|
display: table-cell;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 2px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
@@ -86,8 +101,11 @@ app-query-param-paginator {
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-width: 20px;
|
min-width: 26px;
|
||||||
font-size: 13px;
|
padding: 2px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
font-size: 0.8rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
||||||
&--first {
|
&--first {
|
||||||
@@ -157,9 +175,6 @@ app-query-param-paginator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.stat-first {
|
&.stat-first {
|
||||||
background: var(--sg-success-soft);
|
|
||||||
border-color: var(--sg-success);
|
|
||||||
|
|
||||||
.stat-label,
|
.stat-label,
|
||||||
.stat-value {
|
.stat-value {
|
||||||
color: var(--sg-success);
|
color: var(--sg-success);
|
||||||
@@ -167,9 +182,6 @@ app-query-param-paginator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.stat-middle {
|
&.stat-middle {
|
||||||
background: var(--sg-warning-soft);
|
|
||||||
border-color: var(--sg-warning);
|
|
||||||
|
|
||||||
.stat-label,
|
.stat-label,
|
||||||
.stat-value {
|
.stat-value {
|
||||||
color: var(--sg-warning);
|
color: var(--sg-warning);
|
||||||
@@ -177,9 +189,6 @@ app-query-param-paginator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.stat-last {
|
&.stat-last {
|
||||||
background: var(--sg-error-soft);
|
|
||||||
border-color: var(--sg-error);
|
|
||||||
|
|
||||||
.stat-label,
|
.stat-label,
|
||||||
.stat-value {
|
.stat-value {
|
||||||
color: var(--sg-error);
|
color: var(--sg-error);
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import { FundingService } from '../../api';
|
|||||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||||
|
|
||||||
type SortMode = 'name' | 'top';
|
type SortColumn = 'name' | 'publications' | 'first' | 'middle' | 'last';
|
||||||
|
type SortDirection = 'asc' | 'desc';
|
||||||
type AuthorPosition = 'first' | 'middle' | 'last' | 'unknown';
|
type AuthorPosition = 'first' | 'middle' | 'last' | 'unknown';
|
||||||
|
|
||||||
type FundingPublicationDetail = {
|
type FundingPublicationDetail = {
|
||||||
@@ -53,7 +54,8 @@ export class PersonFundingComponent implements OnInit {
|
|||||||
publicationPageIndex = 0;
|
publicationPageIndex = 0;
|
||||||
publicationPageSize = 10;
|
publicationPageSize = 10;
|
||||||
activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all';
|
activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all';
|
||||||
sortMode: SortMode = 'name';
|
sortColumn: SortColumn = 'name';
|
||||||
|
sortDirection: SortDirection = 'asc';
|
||||||
loading = true;
|
loading = true;
|
||||||
error = false;
|
error = false;
|
||||||
|
|
||||||
@@ -61,7 +63,8 @@ export class PersonFundingComponent implements OnInit {
|
|||||||
this.route.parent?.paramMap.subscribe((params) => {
|
this.route.parent?.paramMap.subscribe((params) => {
|
||||||
const authorId = params.get('id') ?? '';
|
const authorId = params.get('id') ?? '';
|
||||||
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
const sortByFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||||
|
const sortDirFromUrl = this.route.snapshot.queryParamMap.get('sortDir');
|
||||||
this.initialSelectedFunderKey =
|
this.initialSelectedFunderKey =
|
||||||
this.route.snapshot.queryParamMap.get('funder');
|
this.route.snapshot.queryParamMap.get('funder');
|
||||||
this.initialFunderPageIndex = this.parsePageIndexParam(
|
this.initialFunderPageIndex = this.parsePageIndexParam(
|
||||||
@@ -79,8 +82,11 @@ export class PersonFundingComponent implements OnInit {
|
|||||||
if (this.isValidFilter(filterFromUrl)) {
|
if (this.isValidFilter(filterFromUrl)) {
|
||||||
this.activeFilter = filterFromUrl;
|
this.activeFilter = filterFromUrl;
|
||||||
}
|
}
|
||||||
if (this.isValidSortMode(sortFromUrl)) {
|
if (this.isValidSortColumn(sortByFromUrl)) {
|
||||||
this.sortMode = sortFromUrl;
|
this.sortColumn = sortByFromUrl;
|
||||||
|
}
|
||||||
|
if (this.isValidSortDirection(sortDirFromUrl)) {
|
||||||
|
this.sortDirection = sortDirFromUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authorId) {
|
if (authorId) {
|
||||||
@@ -118,8 +124,13 @@ export class PersonFundingComponent implements OnInit {
|
|||||||
this.updateQueryParams();
|
this.updateQueryParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
setSortMode(sortMode: SortMode): void {
|
setSort(column: SortColumn): void {
|
||||||
this.sortMode = sortMode;
|
if (this.sortColumn === column) {
|
||||||
|
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||||
|
} else {
|
||||||
|
this.sortColumn = column;
|
||||||
|
this.sortDirection = column === 'name' ? 'asc' : 'desc';
|
||||||
|
}
|
||||||
this.applyFilter();
|
this.applyFilter();
|
||||||
this.updateQueryParams();
|
this.updateQueryParams();
|
||||||
}
|
}
|
||||||
@@ -185,7 +196,8 @@ export class PersonFundingComponent implements OnInit {
|
|||||||
relativeTo: this.route,
|
relativeTo: this.route,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
filter: this.activeFilter,
|
filter: this.activeFilter,
|
||||||
sortBy: this.sortMode,
|
sortBy: this.sortColumn,
|
||||||
|
sortDir: this.sortDirection,
|
||||||
funder: this.selectedFunder
|
funder: this.selectedFunder
|
||||||
? this.getFunderKey(this.selectedFunder)
|
? this.getFunderKey(this.selectedFunder)
|
||||||
: null,
|
: null,
|
||||||
@@ -214,8 +226,18 @@ export class PersonFundingComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private isValidSortMode(value: string | null): value is SortMode {
|
private isValidSortColumn(value: string | null): value is SortColumn {
|
||||||
return value === 'name' || value === 'top';
|
return (
|
||||||
|
value === 'name' ||
|
||||||
|
value === 'publications' ||
|
||||||
|
value === 'first' ||
|
||||||
|
value === 'middle' ||
|
||||||
|
value === 'last'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private isValidSortDirection(value: string | null): value is SortDirection {
|
||||||
|
return value === 'asc' || value === 'desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
getPublicationCount(funder: any): number {
|
getPublicationCount(funder: any): number {
|
||||||
@@ -294,24 +316,44 @@ export class PersonFundingComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private sortFunders(funders: any[]): any[] {
|
private sortFunders(funders: any[]): any[] {
|
||||||
|
const direction = this.sortDirection === 'asc' ? 1 : -1;
|
||||||
const sortedFunders = [...funders];
|
const sortedFunders = [...funders];
|
||||||
return sortedFunders.sort((first, second) => {
|
return sortedFunders.sort((first, second) => {
|
||||||
if (this.sortMode === 'top') {
|
if (this.sortColumn !== 'name') {
|
||||||
const publicationCountDifference =
|
const valueDifference =
|
||||||
this.getPublicationCount(second) - this.getPublicationCount(first);
|
direction *
|
||||||
if (publicationCountDifference !== 0) {
|
(this.getSortColumnValue(first) - this.getSortColumnValue(second));
|
||||||
return publicationCountDifference;
|
if (valueDifference !== 0) {
|
||||||
|
return valueDifference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getSortableFunderName(first).localeCompare(
|
return (
|
||||||
this.getSortableFunderName(second),
|
direction *
|
||||||
'de',
|
this.getSortableFunderName(first).localeCompare(
|
||||||
{ sensitivity: 'base' },
|
this.getSortableFunderName(second),
|
||||||
|
'de',
|
||||||
|
{ sensitivity: 'base' },
|
||||||
|
)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getSortColumnValue(funder: any): number {
|
||||||
|
switch (this.sortColumn) {
|
||||||
|
case 'publications':
|
||||||
|
return this.getPublicationCount(funder);
|
||||||
|
case 'first':
|
||||||
|
return funder.author_position_count?.first ?? 0;
|
||||||
|
case 'middle':
|
||||||
|
return funder.author_position_count?.middle ?? 0;
|
||||||
|
case 'last':
|
||||||
|
return funder.author_position_count?.last ?? 0;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private getSortableFunderName(funder: any): string {
|
private getSortableFunderName(funder: any): string {
|
||||||
return funder.funder_name ?? '';
|
return funder.funder_name ?? '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
} @else if (tags().length > 0) {
|
} @else if (tags().length > 0) {
|
||||||
@for (tag of tags(); track tag.label) {
|
@for (tag of tags(); track tag.label) {
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topicId]="tag.id"
|
||||||
[label]="tag.label"
|
[label]="tag.label"
|
||||||
[count]="tag.count"
|
[count]="tag.count"
|
||||||
[description]="tag.description"
|
[description]="tag.description"
|
||||||
|
|||||||
@@ -41,9 +41,9 @@
|
|||||||
<span
|
<span
|
||||||
class="filter-topic-chip"
|
class="filter-topic-chip"
|
||||||
[style.--topic-color]="getFilterTopicColor(filter.value)"
|
[style.--topic-color]="getFilterTopicColor(filter.value)"
|
||||||
[matTooltip]="getFilterTopicTooltip(filter.value)"
|
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||||
matTooltipClass="topic-chip-tooltip"
|
[tooltipInputs]="getFilterTopicInputs(filter.value)"
|
||||||
[matTooltipDisabled]="!getFilterTopicTooltip(filter.value)">
|
[tooltipMaxWidth]="'500px'">
|
||||||
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
|
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
|
||||||
<span class="filter-topic-chip__label">{{
|
<span class="filter-topic-chip__label">{{
|
||||||
filter.value
|
filter.value
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ import {
|
|||||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||||
|
|
||||||
|
import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive';
|
||||||
|
import { AppTopicTooltipComponent } from '../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
|
||||||
|
|
||||||
type InstitutionYearFilterMode = 'in' | 'from' | 'between';
|
type InstitutionYearFilterMode = 'in' | 'from' | 'between';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -62,17 +65,19 @@ type InstitutionYearFilterMode = 'in' | 'from' | 'between';
|
|||||||
MatCheckboxModule,
|
MatCheckboxModule,
|
||||||
MatRadioModule,
|
MatRadioModule,
|
||||||
MatTooltipModule,
|
MatTooltipModule,
|
||||||
|
MatAutocompleteModule,
|
||||||
TopicHierarchyComponent,
|
TopicHierarchyComponent,
|
||||||
PersonCardComponent,
|
PersonCardComponent,
|
||||||
SkTextDirective,
|
|
||||||
MatAutocompleteModule,
|
|
||||||
CountryFlagComponent,
|
CountryFlagComponent,
|
||||||
|
SkTextDirective,
|
||||||
|
ComponentTooltipDirective,
|
||||||
],
|
],
|
||||||
templateUrl: './person-list.component.html',
|
templateUrl: './person-list.component.html',
|
||||||
styleUrl: './person-list.component.scss',
|
styleUrl: './person-list.component.scss',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
})
|
})
|
||||||
export class PersonListComponent {
|
export class PersonListComponent {
|
||||||
|
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
|
||||||
private readonly router = inject(Router);
|
private readonly router = inject(Router);
|
||||||
private readonly route = inject(ActivatedRoute);
|
private readonly route = inject(ActivatedRoute);
|
||||||
private readonly personsService = inject(PersonsService);
|
private readonly personsService = inject(PersonsService);
|
||||||
@@ -477,6 +482,28 @@ export class PersonListComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getFilterTopicInputs(topicName: string): { topicId?: string; topic?: any } {
|
||||||
|
const topic = this.findPersonTopic(topicName);
|
||||||
|
if (topic?.id) {
|
||||||
|
return { topicId: topic.id };
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
topic: {
|
||||||
|
display_name: topicName,
|
||||||
|
description: this.getFilterTopicDescription(topicName) ?? undefined,
|
||||||
|
subfield: this.getFilterTopicSubfieldName(topicName)
|
||||||
|
? { display_name: this.getFilterTopicSubfieldName(topicName)! }
|
||||||
|
: undefined,
|
||||||
|
field: this.getFilterTopicFieldName(topicName)
|
||||||
|
? { display_name: this.getFilterTopicFieldName(topicName)! }
|
||||||
|
: undefined,
|
||||||
|
domain: this.getFilterTopicDomainName(topicName)
|
||||||
|
? { display_name: this.getFilterTopicDomainName(topicName)! }
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
clearAllFilters(): void {
|
clearAllFilters(): void {
|
||||||
this.selectedTopics.set(new Set<string>());
|
this.selectedTopics.set(new Set<string>());
|
||||||
this.institutionControl.setValue('', { emitEvent: false });
|
this.institutionControl.setValue('', { emitEvent: false });
|
||||||
|
|||||||
+9
-10
@@ -171,11 +171,9 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="main-topic-button"
|
class="main-topic-button"
|
||||||
[disabled]="!getMainTopicItem(item)?.id"
|
[disabled]="!getMainTopicItem(item)?.id"
|
||||||
[matTooltip]="getTopicTooltip(getMainTopicItem(item))"
|
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||||
matTooltipClass="topic-chip-tooltip"
|
[tooltipInputs]="{ topicId: getMainTopicItem(item)?.id }"
|
||||||
[matTooltipDisabled]="
|
[tooltipMaxWidth]="'500px'"
|
||||||
!hasTopicTooltip(getMainTopicItem(item))
|
|
||||||
"
|
|
||||||
(click)="
|
(click)="
|
||||||
selectTopic(getMainTopicItem(item), [item.year])
|
selectTopic(getMainTopicItem(item), [item.year])
|
||||||
">
|
">
|
||||||
@@ -208,6 +206,7 @@
|
|||||||
trackBy: trackByTopic
|
trackBy: trackByTopic
|
||||||
"
|
"
|
||||||
class="timeline-topic-chip"
|
class="timeline-topic-chip"
|
||||||
|
[topicId]="topic.id"
|
||||||
[label]="topic.name"
|
[label]="topic.name"
|
||||||
[count]="topic.count"
|
[count]="topic.count"
|
||||||
[description]="getTopicDescription(topic)"
|
[description]="getTopicDescription(topic)"
|
||||||
@@ -289,11 +288,9 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="main-topic-button"
|
class="main-topic-button"
|
||||||
[disabled]="!phase.primaryTopic.id"
|
[disabled]="!phase.primaryTopic.id"
|
||||||
[matTooltip]="getTopicTooltip(phase.primaryTopic)"
|
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||||
matTooltipClass="topic-chip-tooltip"
|
[tooltipInputs]="{ topicId: phase.primaryTopic.id }"
|
||||||
[matTooltipDisabled]="
|
[tooltipMaxWidth]="'500px'"
|
||||||
!hasTopicTooltip(phase.primaryTopic)
|
|
||||||
"
|
|
||||||
(click)="
|
(click)="
|
||||||
selectTopic(phase.primaryTopic, getPhaseYears(phase))
|
selectTopic(phase.primaryTopic, getPhaseYears(phase))
|
||||||
">
|
">
|
||||||
@@ -309,6 +306,7 @@
|
|||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
*ngFor="let topic of phase.topics; trackBy: trackByTopic"
|
*ngFor="let topic of phase.topics; trackBy: trackByTopic"
|
||||||
class="phase-topic-chip"
|
class="phase-topic-chip"
|
||||||
|
[topicId]="topic.id"
|
||||||
[label]="topic.name"
|
[label]="topic.name"
|
||||||
[count]="topic.count"
|
[count]="topic.count"
|
||||||
[description]="getTopicDescription(topic)"
|
[description]="getTopicDescription(topic)"
|
||||||
@@ -387,6 +385,7 @@
|
|||||||
trackBy: trackByTopic
|
trackBy: trackByTopic
|
||||||
"
|
"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
[topicId]="topic.id"
|
||||||
[label]="topic.name"
|
[label]="topic.name"
|
||||||
[count]="topic.count"
|
[count]="topic.count"
|
||||||
[description]="getTopicDescription(topic)"
|
[description]="getTopicDescription(topic)"
|
||||||
|
|||||||
+4
@@ -15,6 +15,8 @@ import {
|
|||||||
import { TopicChipComponent } from '../../../../shared/ui/topic-chip/topic-chip.component';
|
import { TopicChipComponent } from '../../../../shared/ui/topic-chip/topic-chip.component';
|
||||||
import { TopicLegendComponent } from '../../../../shared/ui/topic-legend/topic-legend.component';
|
import { TopicLegendComponent } from '../../../../shared/ui/topic-legend/topic-legend.component';
|
||||||
import { YearRangeSliderComponent } from '../../../../shared/ui/year-range-slider/year-range-slider.component';
|
import { YearRangeSliderComponent } from '../../../../shared/ui/year-range-slider/year-range-slider.component';
|
||||||
|
import { ComponentTooltipDirective } from '../../../../directives/component-tooltip.directive';
|
||||||
|
import { AppTopicTooltipComponent } from '../../../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
|
||||||
import { topicHierarchyColor } from '../../../../resolvers/utils/topic-colors';
|
import { topicHierarchyColor } from '../../../../resolvers/utils/topic-colors';
|
||||||
import {
|
import {
|
||||||
buildTopicLegendGroups,
|
buildTopicLegendGroups,
|
||||||
@@ -99,11 +101,13 @@ interface TimelineScrollAnchor {
|
|||||||
TopicChipComponent,
|
TopicChipComponent,
|
||||||
TopicLegendComponent,
|
TopicLegendComponent,
|
||||||
YearRangeSliderComponent,
|
YearRangeSliderComponent,
|
||||||
|
ComponentTooltipDirective,
|
||||||
],
|
],
|
||||||
templateUrl: './research-timeline.component.html',
|
templateUrl: './research-timeline.component.html',
|
||||||
styleUrl: './research-timeline.component.scss',
|
styleUrl: './research-timeline.component.scss',
|
||||||
})
|
})
|
||||||
export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||||
|
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
|
||||||
@ViewChild('timelineWrapper')
|
@ViewChild('timelineWrapper')
|
||||||
private readonly timelineWrapper?: ElementRef<HTMLDivElement>;
|
private readonly timelineWrapper?: ElementRef<HTMLDivElement>;
|
||||||
@Input() elements: TopicTimelineElement[] = [];
|
@Input() elements: TopicTimelineElement[] = [];
|
||||||
|
|||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
@if (loading) {
|
||||||
|
<div class="word-cloud-state">Forschungsthemen werden geladen ...</div>
|
||||||
|
} @else if (loadFailed) {
|
||||||
|
<div class="word-cloud-state">
|
||||||
|
Forschungsthemen konnten nicht geladen werden.
|
||||||
|
</div>
|
||||||
|
} @else if (words.length) {
|
||||||
|
<div class="word-cloud-chart">
|
||||||
|
@for (word of words; track word.name) {
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="word-cloud-word"
|
||||||
|
[style.color]="word.color"
|
||||||
|
[style.fontSize.px]="word.fontSize"
|
||||||
|
[style.fontWeight]="word.fontWeight"
|
||||||
|
[disabled]="!word.topicId"
|
||||||
|
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||||
|
[tooltipInputs]="{ topicId: word.rawTopicId }"
|
||||||
|
[tooltipDisabled]="!word.rawTopicId"
|
||||||
|
[tooltipMaxWidth]="'500px'"
|
||||||
|
(click)="selectWord(word)">
|
||||||
|
{{ word.name }}
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<p class="word-cloud-state">Keine Forschungsthemen gefunden.</p>
|
||||||
|
}
|
||||||
+50
@@ -0,0 +1,50 @@
|
|||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
min-height: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.word-cloud-chart {
|
||||||
|
width: 100%;
|
||||||
|
min-height: 420px;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-content: center;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.35em 1em;
|
||||||
|
padding: 1.5rem 1rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.word-cloud-word {
|
||||||
|
appearance: none;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
font-family: 'Open Sans', Arial, sans-serif;
|
||||||
|
line-height: 1.1;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.15s ease;
|
||||||
|
|
||||||
|
&:hover:not(:disabled),
|
||||||
|
&:focus-visible {
|
||||||
|
transform: scale(1.08);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.word-cloud-state {
|
||||||
|
margin: 0;
|
||||||
|
min-height: 420px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
+164
@@ -0,0 +1,164 @@
|
|||||||
|
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||||
|
|
||||||
|
import { ComponentTooltipDirective } from '../../../../directives/component-tooltip.directive';
|
||||||
|
import { AppTopicTooltipComponent } from '../../../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
|
||||||
|
import { topicHierarchyColor } from '../../../../resolvers/utils/topic-colors';
|
||||||
|
import { TopicLegendTopic } from '../../../../resolvers/utils/topic-legend';
|
||||||
|
|
||||||
|
export interface WordCloudTopicOccurrence {
|
||||||
|
name: string;
|
||||||
|
topicId: string;
|
||||||
|
year: number | undefined;
|
||||||
|
fieldId: string | undefined;
|
||||||
|
fieldName: string | undefined;
|
||||||
|
domainId: string | undefined;
|
||||||
|
domainName: string | undefined;
|
||||||
|
subfieldId: string | undefined;
|
||||||
|
subfieldName: string | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WordCloudWord {
|
||||||
|
name: string;
|
||||||
|
topicId: string;
|
||||||
|
rawTopicId: string;
|
||||||
|
color: string;
|
||||||
|
fontSize: number;
|
||||||
|
fontWeight: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ResearchWordcloud {
|
||||||
|
words: WordCloudWord[];
|
||||||
|
legendTopics: TopicLegendTopic[];
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayedWordLimit = 30;
|
||||||
|
const minimumFontSize = 12;
|
||||||
|
const maximumFontSize = 32;
|
||||||
|
|
||||||
|
export function buildResearchWordcloud(
|
||||||
|
occurrences: WordCloudTopicOccurrence[],
|
||||||
|
startYear: number | undefined,
|
||||||
|
endYear: number | undefined,
|
||||||
|
): ResearchWordcloud {
|
||||||
|
const counts = new Map<string, number>();
|
||||||
|
const legendTopicsByName = new Map<string, TopicLegendTopic>();
|
||||||
|
|
||||||
|
for (const occurrence of occurrences) {
|
||||||
|
if (!isWithinYearRange(occurrence.year, startYear, endYear)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
counts.set(occurrence.name, (counts.get(occurrence.name) ?? 0) + 1);
|
||||||
|
|
||||||
|
if (!legendTopicsByName.has(occurrence.name)) {
|
||||||
|
legendTopicsByName.set(occurrence.name, {
|
||||||
|
id: occurrence.topicId,
|
||||||
|
name: occurrence.name,
|
||||||
|
field_id: occurrence.fieldId,
|
||||||
|
field_name: occurrence.fieldName,
|
||||||
|
domain_id: occurrence.domainId,
|
||||||
|
domain_name: occurrence.domainName,
|
||||||
|
subfield_id: occurrence.subfieldId,
|
||||||
|
subfield_name: occurrence.subfieldName,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counts.size === 0) {
|
||||||
|
return { words: [], legendTopics: [] };
|
||||||
|
}
|
||||||
|
|
||||||
|
const values = Array.from(counts.values());
|
||||||
|
const minimumValue = Math.min(...values);
|
||||||
|
const maximumValue = Math.max(...values);
|
||||||
|
const intensity = (value: number): number =>
|
||||||
|
maximumValue === minimumValue
|
||||||
|
? 1
|
||||||
|
: (value - minimumValue) / (maximumValue - minimumValue);
|
||||||
|
|
||||||
|
const displayed = Array.from(counts.entries())
|
||||||
|
.sort((left, right) => right[1] - left[1])
|
||||||
|
.slice(0, displayedWordLimit);
|
||||||
|
|
||||||
|
const legendTopics = displayed
|
||||||
|
.map(([name]) => legendTopicsByName.get(name))
|
||||||
|
.filter((topic): topic is TopicLegendTopic => Boolean(topic));
|
||||||
|
|
||||||
|
const words = displayed.map(([name, value]): WordCloudWord => {
|
||||||
|
const legendTopic = legendTopicsByName.get(name);
|
||||||
|
const scale = intensity(value);
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
topicId: legendTopic?.id ?? '',
|
||||||
|
rawTopicId: stripOpenAlexId(legendTopic?.id),
|
||||||
|
color: topicHierarchyColor(legendTopic),
|
||||||
|
fontSize: Math.round(
|
||||||
|
minimumFontSize + scale * (maximumFontSize - minimumFontSize),
|
||||||
|
),
|
||||||
|
fontWeight: scale > 0.66 ? 800 : scale > 0.33 ? 600 : 400,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return { words: centreWords(words), legendTopics };
|
||||||
|
}
|
||||||
|
|
||||||
|
function isWithinYearRange(
|
||||||
|
year: number | undefined,
|
||||||
|
startYear: number | undefined,
|
||||||
|
endYear: number | undefined,
|
||||||
|
): boolean {
|
||||||
|
if (startYear !== undefined && (year === undefined || year < startYear)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endYear !== undefined && (year === undefined || year > endYear)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function centreWords(words: WordCloudWord[]): WordCloudWord[] {
|
||||||
|
const centred: WordCloudWord[] = [];
|
||||||
|
|
||||||
|
words.forEach((word, index) => {
|
||||||
|
if (index % 2 === 0) {
|
||||||
|
centred.push(word);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
centred.unshift(word);
|
||||||
|
});
|
||||||
|
|
||||||
|
return centred;
|
||||||
|
}
|
||||||
|
|
||||||
|
function stripOpenAlexId(id: string | null | undefined): string {
|
||||||
|
return (id ?? '').replace('https://openalex.org/', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-research-wordcloud',
|
||||||
|
standalone: true,
|
||||||
|
imports: [ComponentTooltipDirective],
|
||||||
|
templateUrl: './research-wordcloud.component.html',
|
||||||
|
styleUrl: './research-wordcloud.component.scss',
|
||||||
|
})
|
||||||
|
export class ResearchWordcloudComponent {
|
||||||
|
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
|
||||||
|
|
||||||
|
@Input() words: WordCloudWord[] = [];
|
||||||
|
@Input() loading = false;
|
||||||
|
@Input() loadFailed = false;
|
||||||
|
|
||||||
|
@Output() wordSelect = new EventEmitter<WordCloudWord>();
|
||||||
|
|
||||||
|
selectWord(word: WordCloudWord): void {
|
||||||
|
if (!word.topicId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.wordSelect.emit(word);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,30 +19,11 @@
|
|||||||
(topicSelect)="onTimelineTopicSelect($event)"
|
(topicSelect)="onTimelineTopicSelect($event)"
|
||||||
(yearSelect)="onTimelineYearSelect($event)"
|
(yearSelect)="onTimelineYearSelect($event)"
|
||||||
(loadEarlierYears)="onTimelineLoadEarlierYears()">
|
(loadEarlierYears)="onTimelineLoadEarlierYears()">
|
||||||
<div timeline-wordcloud-content class="word-cloud-view">
|
<app-research-wordcloud
|
||||||
@if (loadingWordCloud) {
|
timeline-wordcloud-content
|
||||||
<div class="word-cloud-state">Forschungsthemen werden geladen ...</div>
|
[words]="wordCloudWords"
|
||||||
} @else if (wordCloudWords.length) {
|
[loading]="loadingWordCloud"
|
||||||
<div class="word-cloud-chart">
|
[loadFailed]="wordCloudLoadFailed"
|
||||||
@for (word of wordCloudWords; track word.name) {
|
(wordSelect)="onWordClick($event)" />
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="word-cloud-word"
|
|
||||||
[style.color]="word.color"
|
|
||||||
[style.fontSize.px]="word.fontSize"
|
|
||||||
[style.fontWeight]="word.fontWeight"
|
|
||||||
[disabled]="!word.topicId"
|
|
||||||
[matTooltip]="word.tooltip"
|
|
||||||
[matTooltipDisabled]="!word.tooltip"
|
|
||||||
matTooltipClass="topic-chip-tooltip"
|
|
||||||
(click)="onWordClick(word)">
|
|
||||||
{{ word.name }}
|
|
||||||
</button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
} @else if (wordCloudEmpty) {
|
|
||||||
<p class="word-cloud-empty">Keine Forschungsthemen gefunden.</p>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</app-research-timeline>
|
</app-research-timeline>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -3,54 +3,3 @@
|
|||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.word-cloud-view {
|
|
||||||
min-height: 420px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.word-cloud-chart {
|
|
||||||
width: 100%;
|
|
||||||
min-height: 420px;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
align-content: center;
|
|
||||||
align-items: baseline;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 0.35em 1em;
|
|
||||||
padding: 1.5rem 1rem;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.word-cloud-word {
|
|
||||||
appearance: none;
|
|
||||||
border: none;
|
|
||||||
background: none;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Open Sans', Arial, sans-serif;
|
|
||||||
line-height: 1.1;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: transform 0.15s ease;
|
|
||||||
|
|
||||||
&:hover:not(:disabled),
|
|
||||||
&:focus-visible {
|
|
||||||
transform: scale(1.08);
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:disabled {
|
|
||||||
cursor: default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.word-cloud-state,
|
|
||||||
.word-cloud-empty {
|
|
||||||
margin: 0;
|
|
||||||
min-height: 420px;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: var(--sg-text-muted);
|
|
||||||
font-size: 14px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
||||||
import { combineLatest, distinctUntilChanged, map } from 'rxjs';
|
import { combineLatest, distinctUntilChanged, map } from 'rxjs';
|
||||||
|
|
||||||
import { TopicCount, TopicsByYear, WorksService } from '../../api';
|
import { TopicCount, TopicsByYear, WorksService } from '../../api';
|
||||||
@@ -14,27 +12,19 @@ import {
|
|||||||
TopicTimelineElement,
|
TopicTimelineElement,
|
||||||
TopicTimelineTopic,
|
TopicTimelineTopic,
|
||||||
} from './components/research-timeline/research-timeline.component';
|
} from './components/research-timeline/research-timeline.component';
|
||||||
|
import {
|
||||||
|
buildResearchWordcloud,
|
||||||
|
ResearchWordcloudComponent,
|
||||||
|
WordCloudTopicOccurrence,
|
||||||
|
WordCloudWord,
|
||||||
|
} from './components/research-wordcloud/research-wordcloud.component';
|
||||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||||
import { TopicLegendTopic } from '../../resolvers/utils/topic-legend';
|
import { TopicLegendTopic } from '../../resolvers/utils/topic-legend';
|
||||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
|
||||||
import { buildTopicHierarchyTooltip } from '../../resolvers/utils/topic-tooltip';
|
|
||||||
|
|
||||||
export interface WordCloudWord {
|
|
||||||
name: string;
|
|
||||||
value: number;
|
|
||||||
topicId: string | undefined;
|
|
||||||
fieldName: string | undefined;
|
|
||||||
domainName: string | undefined;
|
|
||||||
color: string;
|
|
||||||
fontSize: number;
|
|
||||||
fontWeight: number;
|
|
||||||
tooltip: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-person-overview',
|
selector: 'app-person-overview',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, ResearchTimelineComponent, MatTooltipModule],
|
imports: [ResearchTimelineComponent, ResearchWordcloudComponent],
|
||||||
templateUrl: './person-overview.component.html',
|
templateUrl: './person-overview.component.html',
|
||||||
styleUrl: './person-overview.component.scss',
|
styleUrl: './person-overview.component.scss',
|
||||||
})
|
})
|
||||||
@@ -73,19 +63,9 @@ export class PersonOverviewComponent implements OnInit {
|
|||||||
wordCloudWords: WordCloudWord[] = [];
|
wordCloudWords: WordCloudWord[] = [];
|
||||||
wordCloudLegendTopics: TopicLegendTopic[] = [];
|
wordCloudLegendTopics: TopicLegendTopic[] = [];
|
||||||
loadingWordCloud = false;
|
loadingWordCloud = false;
|
||||||
wordCloudEmpty = false;
|
wordCloudLoadFailed = false;
|
||||||
|
|
||||||
private rawTopicOccurrences: Array<{
|
private rawTopicOccurrences: WordCloudTopicOccurrence[] = [];
|
||||||
name: string;
|
|
||||||
topicId: string;
|
|
||||||
year: number | undefined;
|
|
||||||
fieldId: string | undefined;
|
|
||||||
fieldName: string | undefined;
|
|
||||||
domainId: string | undefined;
|
|
||||||
domainName: string | undefined;
|
|
||||||
subfieldId: string | undefined;
|
|
||||||
subfieldName: string | undefined;
|
|
||||||
}> = [];
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
combineLatest(this.route.pathFromRoot.map((route) => route.paramMap))
|
combineLatest(this.route.pathFromRoot.map((route) => route.paramMap))
|
||||||
@@ -351,14 +331,14 @@ export class PersonOverviewComponent implements OnInit {
|
|||||||
if (!authorId || authorId === '0') {
|
if (!authorId || authorId === '0') {
|
||||||
this.wordCloudWords = [];
|
this.wordCloudWords = [];
|
||||||
this.wordCloudLegendTopics = [];
|
this.wordCloudLegendTopics = [];
|
||||||
this.wordCloudEmpty = false;
|
this.wordCloudLoadFailed = false;
|
||||||
this.loadingWordCloud = false;
|
this.loadingWordCloud = false;
|
||||||
this.rawTopicOccurrences = [];
|
this.rawTopicOccurrences = [];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadingWordCloud = true;
|
this.loadingWordCloud = true;
|
||||||
this.wordCloudEmpty = false;
|
this.wordCloudLoadFailed = false;
|
||||||
this.wordCloudWords = [];
|
this.wordCloudWords = [];
|
||||||
this.wordCloudLegendTopics = [];
|
this.wordCloudLegendTopics = [];
|
||||||
|
|
||||||
@@ -389,104 +369,27 @@ export class PersonOverviewComponent implements OnInit {
|
|||||||
|
|
||||||
this.loadingWordCloud = false;
|
this.loadingWordCloud = false;
|
||||||
|
|
||||||
if (this.rawTopicOccurrences.length === 0) {
|
|
||||||
this.wordCloudLegendTopics = [];
|
|
||||||
this.wordCloudEmpty = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(() => this.rebuildWordCloud());
|
setTimeout(() => this.rebuildWordCloud());
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
console.error('Word cloud could not be loaded.', error);
|
console.error('Word cloud could not be loaded.', error);
|
||||||
this.loadingWordCloud = false;
|
this.loadingWordCloud = false;
|
||||||
|
this.rawTopicOccurrences = [];
|
||||||
this.wordCloudLegendTopics = [];
|
this.wordCloudLegendTopics = [];
|
||||||
this.wordCloudEmpty = true;
|
this.wordCloudLoadFailed = true;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private rebuildWordCloud(): void {
|
private rebuildWordCloud(): void {
|
||||||
const start = this.timelineStartYear;
|
const wordCloud = buildResearchWordcloud(
|
||||||
const end = this.timelineEndYear;
|
this.rawTopicOccurrences,
|
||||||
const counts = new Map<string, number>();
|
this.timelineStartYear,
|
||||||
const nameToId = new Map<string, string>();
|
this.timelineEndYear,
|
||||||
const nameToColorInput = new Map<string, TopicLegendTopic>();
|
);
|
||||||
|
|
||||||
for (const occ of this.rawTopicOccurrences) {
|
this.wordCloudWords = wordCloud.words;
|
||||||
if (start !== undefined && (occ.year === undefined || occ.year < start))
|
this.wordCloudLegendTopics = wordCloud.legendTopics;
|
||||||
continue;
|
|
||||||
if (end !== undefined && (occ.year === undefined || occ.year > end))
|
|
||||||
continue;
|
|
||||||
counts.set(occ.name, (counts.get(occ.name) ?? 0) + 1);
|
|
||||||
if (!nameToId.has(occ.name)) {
|
|
||||||
nameToId.set(occ.name, occ.topicId);
|
|
||||||
nameToColorInput.set(occ.name, {
|
|
||||||
id: occ.topicId,
|
|
||||||
name: occ.name,
|
|
||||||
field_id: occ.fieldId,
|
|
||||||
field_name: occ.fieldName,
|
|
||||||
domain_id: occ.domainId,
|
|
||||||
domain_name: occ.domainName,
|
|
||||||
subfield_id: occ.subfieldId,
|
|
||||||
subfield_name: occ.subfieldName,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (counts.size === 0) {
|
|
||||||
this.wordCloudWords = [];
|
|
||||||
this.wordCloudLegendTopics = [];
|
|
||||||
this.wordCloudEmpty = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.wordCloudEmpty = false;
|
|
||||||
|
|
||||||
const allValues = Array.from(counts.values());
|
|
||||||
const minVal = Math.min(...allValues);
|
|
||||||
const maxVal = Math.max(...allValues);
|
|
||||||
const intensity = (v: number): number =>
|
|
||||||
maxVal === minVal ? 1 : (v - minVal) / (maxVal - minVal);
|
|
||||||
|
|
||||||
const sorted = Array.from(counts.entries()).sort((a, b) => b[1] - a[1]);
|
|
||||||
const topNames = sorted.slice(0, 30).map(([name]) => name);
|
|
||||||
|
|
||||||
this.wordCloudLegendTopics = topNames
|
|
||||||
.map((name) => nameToColorInput.get(name))
|
|
||||||
.filter((topic): topic is TopicLegendTopic => Boolean(topic));
|
|
||||||
|
|
||||||
const words = sorted.slice(0, 30).map(([name, value]): WordCloudWord => {
|
|
||||||
const t = intensity(value);
|
|
||||||
const colorInput = nameToColorInput.get(name);
|
|
||||||
return {
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
topicId: nameToId.get(name),
|
|
||||||
fieldName: colorInput?.field_name ?? undefined,
|
|
||||||
domainName: colorInput?.domain_name ?? undefined,
|
|
||||||
color: topicHierarchyColor(colorInput),
|
|
||||||
fontSize: Math.round(12 + t * (32 - 12)),
|
|
||||||
fontWeight: t > 0.66 ? 800 : t > 0.33 ? 600 : 400,
|
|
||||||
tooltip: buildTopicHierarchyTooltip({
|
|
||||||
topicName: name,
|
|
||||||
subfieldName: colorInput?.subfield_name,
|
|
||||||
fieldName: colorInput?.field_name,
|
|
||||||
domainName: colorInput?.domain_name,
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const centred: WordCloudWord[] = [];
|
|
||||||
words.forEach((word, i) => {
|
|
||||||
if (i % 2 === 0) {
|
|
||||||
centred.push(word);
|
|
||||||
} else {
|
|
||||||
centred.unshift(word);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.wordCloudWords = centred;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapTimelineElements(
|
private mapTimelineElements(
|
||||||
|
|||||||
@@ -31,11 +31,12 @@
|
|||||||
subscriptSizing="dynamic">
|
subscriptSizing="dynamic">
|
||||||
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
<mat-icon matPrefix fontIcon="sort"></mat-icon>
|
||||||
<mat-select
|
<mat-select
|
||||||
[value]="sortMode"
|
[value]="sortColumn"
|
||||||
(selectionChange)="setSortMode($event.value)">
|
(selectionChange)="setSort($event.value)">
|
||||||
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
<mat-select-trigger>Sortieren nach</mat-select-trigger>
|
||||||
<mat-option value="date">Datum</mat-option>
|
<mat-option value="year">Jahr</mat-option>
|
||||||
<mat-option value="title">Titel</mat-option>
|
<mat-option value="title">Titel</mat-option>
|
||||||
|
<mat-option value="source">Quelle</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,8 +45,28 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Patent</th>
|
<th>Patent</th>
|
||||||
<th>Quelle</th>
|
<th
|
||||||
<th>Jahr</th>
|
class="sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'source'"
|
||||||
|
(click)="setSort('source')">
|
||||||
|
Quelle
|
||||||
|
@if (sortColumn === 'source') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
|
<th
|
||||||
|
class="sortable"
|
||||||
|
[class.sort-active]="sortColumn === 'year'"
|
||||||
|
(click)="setSort('year')">
|
||||||
|
Jahr
|
||||||
|
@if (sortColumn === 'year') {
|
||||||
|
<mat-icon class="sort-icon">{{
|
||||||
|
sortDirection === 'asc' ? 'arrow_upward' : 'arrow_downward'
|
||||||
|
}}</mat-icon>
|
||||||
|
}
|
||||||
|
</th>
|
||||||
<th>Erfinder</th>
|
<th>Erfinder</th>
|
||||||
<th>Anmelder</th>
|
<th>Anmelder</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -69,12 +90,85 @@
|
|||||||
{{ patent.source }}
|
{{ patent.source }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ patent.publication_year ?? '-' }}</td>
|
<td>
|
||||||
<td class="patent-people" [title]="getInventorsLabel(patent)">
|
@if (patent.publication_year) {
|
||||||
{{ getInventorsLabel(patent) }}
|
<span class="year-badge">{{
|
||||||
|
patent.publication_year
|
||||||
|
}}</span>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
<td class="patent-people" [title]="getAssigneesLabel(patent)">
|
<td class="patent-people">
|
||||||
{{ getAssigneesLabel(patent) }}
|
@if (patent.inventors && patent.inventors.length) {
|
||||||
|
<div class="person-chips">
|
||||||
|
@for (
|
||||||
|
inventor of patent.inventors.slice(0, 2);
|
||||||
|
track inventor
|
||||||
|
) {
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>person</mat-icon>
|
||||||
|
{{ inventor }}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
@if (patent.inventors.length > 2) {
|
||||||
|
<span class="person-chip-row">
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>person</mat-icon>
|
||||||
|
{{ patent.inventors[2] }}
|
||||||
|
</span>
|
||||||
|
@if (patent.inventors.length > 3) {
|
||||||
|
<span class="person-chip person-chip--more"
|
||||||
|
>+{{ patent.inventors.length - 3 }}</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td class="patent-people">
|
||||||
|
@if (patent.assignees && patent.assignees.length) {
|
||||||
|
<div class="person-chips">
|
||||||
|
@for (
|
||||||
|
assignee of patent.assignees.slice(0, 2);
|
||||||
|
track assignee
|
||||||
|
) {
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>{{
|
||||||
|
isAssigneeLikelyPerson(assignee, patent)
|
||||||
|
? 'person'
|
||||||
|
: 'apartment'
|
||||||
|
}}</mat-icon>
|
||||||
|
{{ assignee }}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
@if (patent.assignees.length > 2) {
|
||||||
|
<span class="person-chip-row">
|
||||||
|
<span class="person-chip">
|
||||||
|
<mat-icon>{{
|
||||||
|
isAssigneeLikelyPerson(
|
||||||
|
patent.assignees[2],
|
||||||
|
patent
|
||||||
|
)
|
||||||
|
? 'person'
|
||||||
|
: 'apartment'
|
||||||
|
}}</mat-icon>
|
||||||
|
{{ patent.assignees[2] }}
|
||||||
|
</span>
|
||||||
|
@if (patent.assignees.length > 3) {
|
||||||
|
<span class="person-chip person-chip--more"
|
||||||
|
>+{{ patent.assignees.length - 3 }}</span
|
||||||
|
>
|
||||||
|
}
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<span>-</span>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,24 @@ app-query-param-paginator {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
border-bottom: 1px solid var(--sg-border);
|
border-bottom: 1px solid var(--sg-border);
|
||||||
font-size: 13px;
|
font-size: 12px;
|
||||||
font-weight: 600;
|
font-weight: 700;
|
||||||
color: var(--sg-text-muted);
|
color: var(--sg-text-muted);
|
||||||
|
|
||||||
|
&.sortable {
|
||||||
|
display: table-cell;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-icon {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-left: 2px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
@@ -80,22 +95,75 @@ app-query-param-paginator {
|
|||||||
.patent-title {
|
.patent-title {
|
||||||
color: var(--sg-text);
|
color: var(--sg-text);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
max-width: 400px;
|
max-width: 320px;
|
||||||
white-space: nowrap;
|
white-space: normal;
|
||||||
overflow: hidden;
|
word-break: break-word;
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.patent-people {
|
.patent-people {
|
||||||
max-width: 220px;
|
max-width: 260px;
|
||||||
color: var(--sg-text-muted);
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.year-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 26px;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chips {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chip-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: var(--sg-surface-soft);
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--sg-text-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--more {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.match-badges {
|
.match-badges {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
|||||||
import { PageEvent } from '@angular/material/paginator';
|
import { PageEvent } from '@angular/material/paginator';
|
||||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||||
|
|
||||||
type SortMode = 'date' | 'title';
|
type SortColumn = 'title' | 'year' | 'source';
|
||||||
|
type SortDirection = 'asc' | 'desc';
|
||||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -46,14 +47,16 @@ export class PersonPatentsComponent {
|
|||||||
error = false;
|
error = false;
|
||||||
|
|
||||||
activeFilter: SourceFilter = 'all';
|
activeFilter: SourceFilter = 'all';
|
||||||
sortMode: SortMode = 'date';
|
sortColumn: SortColumn = 'year';
|
||||||
|
sortDirection: SortDirection = 'desc';
|
||||||
|
|
||||||
pageIndex = 0;
|
pageIndex = 0;
|
||||||
pageSize = 10;
|
pageSize = 10;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
const sortByFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||||
|
const sortDirFromUrl = this.route.snapshot.queryParamMap.get('sortDir');
|
||||||
this.pageIndex = this.parsePageIndexParam(
|
this.pageIndex = this.parsePageIndexParam(
|
||||||
this.route.snapshot.queryParamMap.get('page'),
|
this.route.snapshot.queryParamMap.get('page'),
|
||||||
);
|
);
|
||||||
@@ -64,8 +67,11 @@ export class PersonPatentsComponent {
|
|||||||
if (this.isValidFilter(filterFromUrl)) {
|
if (this.isValidFilter(filterFromUrl)) {
|
||||||
this.activeFilter = filterFromUrl;
|
this.activeFilter = filterFromUrl;
|
||||||
}
|
}
|
||||||
if (this.isValidSortMode(sortFromUrl)) {
|
if (this.isValidSortColumn(sortByFromUrl)) {
|
||||||
this.sortMode = sortFromUrl;
|
this.sortColumn = sortByFromUrl;
|
||||||
|
}
|
||||||
|
if (this.isValidSortDirection(sortDirFromUrl)) {
|
||||||
|
this.sortDirection = sortDirFromUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.route.parent?.data
|
this.route.parent?.data
|
||||||
@@ -113,8 +119,13 @@ export class PersonPatentsComponent {
|
|||||||
this.pageSize = event.pageSize;
|
this.pageSize = event.pageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSortMode(sortMode: SortMode): void {
|
setSort(column: SortColumn): void {
|
||||||
this.sortMode = sortMode;
|
if (this.sortColumn === column) {
|
||||||
|
this.sortDirection = this.sortDirection === 'asc' ? 'desc' : 'asc';
|
||||||
|
} else {
|
||||||
|
this.sortColumn = column;
|
||||||
|
this.sortDirection = column === 'year' ? 'desc' : 'asc';
|
||||||
|
}
|
||||||
this.applyFilter();
|
this.applyFilter();
|
||||||
this.updateQueryParams();
|
this.updateQueryParams();
|
||||||
}
|
}
|
||||||
@@ -140,15 +151,24 @@ export class PersonPatentsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
|
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
|
||||||
|
const direction = this.sortDirection === 'asc' ? 1 : -1;
|
||||||
return [...patents].sort((a, b) => {
|
return [...patents].sort((a, b) => {
|
||||||
if (this.sortMode === 'date') {
|
switch (this.sortColumn) {
|
||||||
return (b.publication_date ?? '').localeCompare(
|
case 'year': {
|
||||||
a.publication_date ?? '',
|
const yearA = a.publication_date ?? String(a.publication_year ?? '');
|
||||||
);
|
const yearB = b.publication_date ?? String(b.publication_year ?? '');
|
||||||
|
return direction * yearA.localeCompare(yearB);
|
||||||
|
}
|
||||||
|
case 'source':
|
||||||
|
return direction * a.source.localeCompare(b.source);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
direction *
|
||||||
|
(a.title ?? '').localeCompare(b.title ?? '', 'de', {
|
||||||
|
sensitivity: 'base',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return (a.title ?? '').localeCompare(b.title ?? '', 'de', {
|
|
||||||
sensitivity: 'base',
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +177,8 @@ export class PersonPatentsComponent {
|
|||||||
relativeTo: this.route,
|
relativeTo: this.route,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
filter: this.activeFilter,
|
filter: this.activeFilter,
|
||||||
sortBy: this.sortMode,
|
sortBy: this.sortColumn,
|
||||||
|
sortDir: this.sortDirection,
|
||||||
page: this.pageIndex,
|
page: this.pageIndex,
|
||||||
size: this.pageSize,
|
size: this.pageSize,
|
||||||
},
|
},
|
||||||
@@ -180,8 +201,12 @@ export class PersonPatentsComponent {
|
|||||||
return value === 'all' || value === 'EPO' || value === 'USPTO';
|
return value === 'all' || value === 'EPO' || value === 'USPTO';
|
||||||
}
|
}
|
||||||
|
|
||||||
private isValidSortMode(value: string | null): value is SortMode {
|
private isValidSortColumn(value: string | null): value is SortColumn {
|
||||||
return value === 'date' || value === 'title';
|
return value === 'title' || value === 'year' || value === 'source';
|
||||||
|
}
|
||||||
|
|
||||||
|
private isValidSortDirection(value: string | null): value is SortDirection {
|
||||||
|
return value === 'asc' || value === 'desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
getPagedPatents(): PatentEntry[] {
|
getPagedPatents(): PatentEntry[] {
|
||||||
@@ -189,12 +214,40 @@ export class PersonPatentsComponent {
|
|||||||
return this.filteredPatents.slice(start, start + this.pageSize);
|
return this.filteredPatents.slice(start, start + this.pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
getInventorsLabel(patent: PatentEntry): string {
|
private static readonly ORG_SUFFIX_PATTERN =
|
||||||
return patent.inventors?.length ? patent.inventors.join(', ') : '-';
|
/\b(Inc|Ltd|LLC|LLP|GmbH|Corp(oration)?|Co|KG|AG|SE|S\.?A\.?|N\.?V\.?|B\.?V\.?|PLC|Universit(y|ät|é)|Institut(e)?|Foundation|Laborator(y|ies)|Labs?|Group|Holdings?|Company|Gesellschaft)\b\.?/i;
|
||||||
|
private static readonly PERSON_SUFFIX_PATTERN =
|
||||||
|
/\b(Dr|Prof|PhD|Ph\.D|M\.D|Jr|Sr)\b\.?/i;
|
||||||
|
|
||||||
|
private normalizeNameForComparison(name: string): string {
|
||||||
|
return name
|
||||||
|
.normalize('NFD')
|
||||||
|
.replace(/[̀-ͯ]/g, '')
|
||||||
|
.replace(/[.,]/g, '')
|
||||||
|
.toUpperCase()
|
||||||
|
.split(/\s+/)
|
||||||
|
.filter(Boolean)
|
||||||
|
.sort()
|
||||||
|
.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
getAssigneesLabel(patent: PatentEntry): string {
|
isAssigneeLikelyPerson(assignee: string, patent: PatentEntry): boolean {
|
||||||
return patent.assignees?.length ? patent.assignees.join(', ') : '-';
|
if (PersonPatentsComponent.ORG_SUFFIX_PATTERN.test(assignee)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalizedAssignee = this.normalizeNameForComparison(
|
||||||
|
assignee.replace(PersonPatentsComponent.PERSON_SUFFIX_PATTERN, ''),
|
||||||
|
);
|
||||||
|
const matchesInventor = (patent.inventors ?? []).some(
|
||||||
|
(inventor) =>
|
||||||
|
this.normalizeNameForComparison(inventor) === normalizedAssignee,
|
||||||
|
);
|
||||||
|
if (matchesInventor) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PersonPatentsComponent.PERSON_SUFFIX_PATTERN.test(assignee);
|
||||||
}
|
}
|
||||||
|
|
||||||
formatDate(date: string | null | undefined): string {
|
formatDate(date: string | null | undefined): string {
|
||||||
|
|||||||
@@ -1,22 +1,7 @@
|
|||||||
<div class="person-projects">
|
<div class="person-projects">
|
||||||
<nav mat-tab-nav-bar [tabPanel]="resultTabPanel" class="result-nav">
|
@if (resultTabPanel) {
|
||||||
@for (route of childRoutes; track route.path) {
|
<app-link-tab-nav-bar [links]="_links()" [tabPanel]="resultTabPanel" />
|
||||||
<a
|
}
|
||||||
matTabLink
|
|
||||||
[routerLink]="[route.path]"
|
|
||||||
[queryParams]="{
|
|
||||||
authorId: null,
|
|
||||||
institutionId: null,
|
|
||||||
agency: null,
|
|
||||||
}"
|
|
||||||
queryParamsHandling="merge"
|
|
||||||
routerLinkActive
|
|
||||||
#rla="routerLinkActive"
|
|
||||||
[active]="rla.isActive">
|
|
||||||
{{ route.label }}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<mat-tab-nav-panel #resultTabPanel>
|
<mat-tab-nav-panel #resultTabPanel>
|
||||||
<router-outlet />
|
<router-outlet />
|
||||||
|
|||||||
@@ -1,31 +1,33 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, computed } from '@angular/core';
|
||||||
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
||||||
|
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { MatTabsModule } from '@angular/material/tabs';
|
import { MatTabsModule } from '@angular/material/tabs';
|
||||||
|
import {
|
||||||
|
LinkTabNavBarComponent,
|
||||||
|
LinkTabNavBarItem,
|
||||||
|
} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-person-projects',
|
selector: 'app-person-projects',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [
|
imports: [MatCardModule, MatTabsModule, RouterOutlet, LinkTabNavBarComponent],
|
||||||
MatCardModule,
|
|
||||||
MatTabsModule,
|
|
||||||
RouterOutlet,
|
|
||||||
RouterLink,
|
|
||||||
RouterLinkActive,
|
|
||||||
],
|
|
||||||
templateUrl: './person-projects.component.html',
|
templateUrl: './person-projects.component.html',
|
||||||
styleUrl: './person-projects.component.scss',
|
styleUrl: './person-projects.component.scss',
|
||||||
})
|
})
|
||||||
export class PersonProjectsComponent {
|
export class PersonProjectsComponent {
|
||||||
readonly childRoutes = [
|
_links = computed<LinkTabNavBarItem[]>(() => {
|
||||||
{
|
const links: LinkTabNavBarItem[] = [
|
||||||
path: 'dfg',
|
{
|
||||||
label: 'DFG-Projekte',
|
label: 'DFG-Projekte',
|
||||||
},
|
path: 'dfg',
|
||||||
{
|
disabled: false,
|
||||||
path: 'eu',
|
},
|
||||||
label: 'EU-Projekte',
|
{
|
||||||
},
|
label: 'EU-Projekte',
|
||||||
];
|
path: 'eu',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return links;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,20 +132,12 @@
|
|||||||
[loading]="isTopicsLoading()"
|
[loading]="isTopicsLoading()"
|
||||||
(tagClick)="onInterestingTagClick($event)"></app-person-interesting>
|
(tagClick)="onInterestingTagClick($event)"></app-person-interesting>
|
||||||
</section>
|
</section>
|
||||||
<nav class="person-tabs sg-tab-nav" mat-tab-nav-bar [tabPanel]="tabPanel">
|
@if (this.links()) {
|
||||||
@for (link of links(); track link.path) {
|
<app-link-tab-nav-bar
|
||||||
<a
|
#navBar
|
||||||
mat-tab-link
|
[links]="links()"
|
||||||
[routerLink]="link.path"
|
[tabPanel]="tabPanel"></app-link-tab-nav-bar>
|
||||||
[queryParams]="link.queryParams"
|
}
|
||||||
routerLinkActive
|
|
||||||
#rla="routerLinkActive"
|
|
||||||
[active]="rla.isActive"
|
|
||||||
[disabled]="link.disabled">
|
|
||||||
{{ link.label }}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</nav>
|
|
||||||
} @else {
|
} @else {
|
||||||
<app-loading
|
<app-loading
|
||||||
text="Person wird geladen..."
|
text="Person wird geladen..."
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
signal,
|
signal,
|
||||||
DestroyRef,
|
DestroyRef,
|
||||||
input,
|
input,
|
||||||
|
viewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import {
|
import {
|
||||||
toSignal,
|
toSignal,
|
||||||
@@ -33,14 +34,20 @@ import { PersonDataResolved } from '../../resolvers/person.resolver';
|
|||||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||||
import { collaborationGraphQueryParamKeys } from '../../resolvers/collaboration-graph.resolver';
|
import { collaborationGraphQueryParamKeys } from '../../resolvers/collaboration-graph.resolver';
|
||||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||||
|
import {
|
||||||
type PersonLink = {
|
LinkTabNavBarComponent,
|
||||||
label: string;
|
LinkTabNavBarItem,
|
||||||
description?: string;
|
} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||||
path: string;
|
import {
|
||||||
queryParams?: Record<string, any>;
|
COMPANY_CONNECTION_ICON,
|
||||||
disabled: boolean;
|
FUNDING_ICON,
|
||||||
};
|
NETWORK_ICON,
|
||||||
|
NEWS_ICON,
|
||||||
|
OVERVIEW_ICON,
|
||||||
|
PATENT_ICON,
|
||||||
|
PROJECT_ICON,
|
||||||
|
PUBLICATION_ICON,
|
||||||
|
} from '../../shared/ui/icons';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-person',
|
selector: 'app-person',
|
||||||
@@ -55,6 +62,7 @@ type PersonLink = {
|
|||||||
LoadingComponent,
|
LoadingComponent,
|
||||||
CountryFlagComponent,
|
CountryFlagComponent,
|
||||||
CareerStageChipComponent,
|
CareerStageChipComponent,
|
||||||
|
LinkTabNavBarComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './person.component.html',
|
templateUrl: './person.component.html',
|
||||||
styleUrl: './person.component.scss',
|
styleUrl: './person.component.scss',
|
||||||
@@ -69,6 +77,11 @@ export class PersonComponent {
|
|||||||
|
|
||||||
canFetchGdprRelevantData = input.required<boolean>();
|
canFetchGdprRelevantData = input.required<boolean>();
|
||||||
|
|
||||||
|
protected readonly navBar = viewChild<LinkTabNavBarComponent>('navBar');
|
||||||
|
protected readonly activeLink = computed(
|
||||||
|
() => this.navBar()?.activeLink() ?? null,
|
||||||
|
);
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.bookmarkService
|
this.bookmarkService
|
||||||
.load()
|
.load()
|
||||||
@@ -236,11 +249,12 @@ export class PersonComponent {
|
|||||||
{ initialValue: [] },
|
{ initialValue: [] },
|
||||||
);
|
);
|
||||||
|
|
||||||
readonly links = computed<PersonLink[]>(() => {
|
readonly links = computed<LinkTabNavBarItem[]>(() => {
|
||||||
const links = [
|
const links = [
|
||||||
{
|
{
|
||||||
label: 'Übersicht',
|
label: 'Übersicht',
|
||||||
description: 'Übersicht über die Person',
|
description: 'Übersicht über die Person',
|
||||||
|
icon: OVERVIEW_ICON,
|
||||||
path: 'overview',
|
path: 'overview',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
@@ -249,6 +263,7 @@ export class PersonComponent {
|
|||||||
{
|
{
|
||||||
label: 'Projekte',
|
label: 'Projekte',
|
||||||
description: 'Übersicht der durchgeführten Projekte der Person',
|
description: 'Übersicht der durchgeführten Projekte der Person',
|
||||||
|
icon: PROJECT_ICON,
|
||||||
path: 'projects',
|
path: 'projects',
|
||||||
queryParams: {
|
queryParams: {
|
||||||
page: 0,
|
page: 0,
|
||||||
@@ -264,12 +279,13 @@ export class PersonComponent {
|
|||||||
{
|
{
|
||||||
label: 'Publikationen',
|
label: 'Publikationen',
|
||||||
description: 'Übersicht der Publikationen der Person',
|
description: 'Übersicht der Publikationen der Person',
|
||||||
|
icon: PUBLICATION_ICON,
|
||||||
path: 'publications',
|
path: 'publications',
|
||||||
disabled: false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Netzwerk',
|
label: 'Netzwerk',
|
||||||
description: 'Kooperationsnetzwerk der Person',
|
description: 'Kooperationsnetzwerk der Person',
|
||||||
|
icon: NETWORK_ICON,
|
||||||
path: 'network',
|
path: 'network',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@@ -284,6 +300,7 @@ export class PersonComponent {
|
|||||||
{
|
{
|
||||||
label: 'Unternehmen',
|
label: 'Unternehmen',
|
||||||
description: 'Unternehmen, mit denen die Person verbunden ist',
|
description: 'Unternehmen, mit denen die Person verbunden ist',
|
||||||
|
icon: COMPANY_CONNECTION_ICON,
|
||||||
path: 'company-connections',
|
path: 'company-connections',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
@@ -292,18 +309,21 @@ export class PersonComponent {
|
|||||||
{
|
{
|
||||||
label: 'Förderungen',
|
label: 'Förderungen',
|
||||||
description: 'Übersicht der Förderungen der Person',
|
description: 'Übersicht der Förderungen der Person',
|
||||||
|
icon: FUNDING_ICON,
|
||||||
path: 'funding',
|
path: 'funding',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Nachrichten',
|
label: 'Nachrichten',
|
||||||
description: 'Nachrichten über die Person',
|
description: 'Nachrichten über die Person',
|
||||||
|
icon: NEWS_ICON,
|
||||||
path: 'news',
|
path: 'news',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Patente',
|
label: 'Patente',
|
||||||
description: 'Patente der Person',
|
description: 'Patente der Person',
|
||||||
|
icon: PATENT_ICON,
|
||||||
path: 'patents',
|
path: 'patents',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
@@ -311,25 +331,25 @@ export class PersonComponent {
|
|||||||
return links;
|
return links;
|
||||||
});
|
});
|
||||||
|
|
||||||
readonly activeLink = computed<PersonLink | null>(() => {
|
// readonly activeLink = computed<LinkTabNavBarItem | null>(() => {
|
||||||
const currentUrl = this.currentUrl();
|
// const currentUrl = this.currentUrl();
|
||||||
if (!currentUrl) {
|
// if (!currentUrl) {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
for (const link of this.links()) {
|
// for (const link of this.links()) {
|
||||||
const linkUrl = this.router
|
// const linkUrl = this.router
|
||||||
.createUrlTree([link.path], {
|
// .createUrlTree([link.path], {
|
||||||
relativeTo: this.activatedRoute,
|
// relativeTo: this.activatedRoute,
|
||||||
})
|
// })
|
||||||
.toString();
|
// .toString();
|
||||||
|
|
||||||
if (linkUrl.startsWith(currentUrl) || currentUrl.startsWith(linkUrl)) {
|
// if (linkUrl.startsWith(currentUrl) || currentUrl.startsWith(linkUrl)) {
|
||||||
return link;
|
// return link;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return null;
|
// return null;
|
||||||
});
|
// });
|
||||||
|
|
||||||
onInterestingTagClick(selection: {
|
onInterestingTagClick(selection: {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -37,8 +37,11 @@
|
|||||||
<mat-icon>circle</mat-icon>
|
<mat-icon>circle</mat-icon>
|
||||||
<span>{{ getStatusDisplay(dfgProject.funding_end) }}</span>
|
<span>{{ getStatusDisplay(dfgProject.funding_end) }}</span>
|
||||||
</div>
|
</div>
|
||||||
@if (dfgProject.link) {
|
@if (dfgProject.page_url) {
|
||||||
<a [href]="dfgProject.link" target="_blank" class="primary-action">
|
<a
|
||||||
|
[href]="dfgProject.page_url"
|
||||||
|
target="_blank"
|
||||||
|
class="primary-action">
|
||||||
<mat-icon>open_in_new</mat-icon>
|
<mat-icon>open_in_new</mat-icon>
|
||||||
<span>Zum Projekt</span>
|
<span>Zum Projekt</span>
|
||||||
</a>
|
</a>
|
||||||
@@ -218,10 +221,7 @@
|
|||||||
</div>
|
</div>
|
||||||
@if (getInstitutionsList().length > 0) {
|
@if (getInstitutionsList().length > 0) {
|
||||||
<div class="institution-grid">
|
<div class="institution-grid">
|
||||||
@for (
|
@for (institution of getInstitutionsList(); track $index) {
|
||||||
institution of getInstitutionsList();
|
|
||||||
track institution.institute_id + (institution.role_key || '')
|
|
||||||
) {
|
|
||||||
<div
|
<div
|
||||||
(click)="
|
(click)="
|
||||||
searchForInstitutionName(getInstitutionName(institution))
|
searchForInstitutionName(getInstitutionName(institution))
|
||||||
|
|||||||
@@ -245,6 +245,7 @@
|
|||||||
track keyword.id || keyword.label
|
track keyword.id || keyword.label
|
||||||
) {
|
) {
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topicId]="keyword.id"
|
||||||
[label]="keyword.label"
|
[label]="keyword.label"
|
||||||
[count]="keyword.count"
|
[count]="keyword.count"
|
||||||
[subfieldName]="keyword.subfieldName"
|
[subfieldName]="keyword.subfieldName"
|
||||||
|
|||||||
+4
-7
@@ -40,13 +40,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@if (authorList.length > 3) {
|
@if (authorList.length > 3) {
|
||||||
<button
|
<app-chip-overflow-toggle
|
||||||
type="button"
|
[expanded]="isExpanded"
|
||||||
class="publication-institution-more"
|
[hiddenCount]="authorList.length - 3"
|
||||||
[attr.aria-expanded]="isExpanded"
|
(toggle)="togglePublicationAuthorsExpansion(pub)" />
|
||||||
(click)="togglePublicationAuthorsExpansion(pub)">
|
|
||||||
{{ isExpanded ? 'weniger' : '+' + (authorList.length - 3) }}
|
|
||||||
</button>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
|
|||||||
-23
@@ -6,29 +6,6 @@
|
|||||||
background: var(--sg-card-bg);
|
background: var(--sg-card-bg);
|
||||||
border: 1px solid var(--sg-border);
|
border: 1px solid var(--sg-border);
|
||||||
}
|
}
|
||||||
.publication-institution-more {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 24px;
|
|
||||||
padding: 3px 8px;
|
|
||||||
border: 1px solid var(--sg-border);
|
|
||||||
border-radius: var(--sg-radius-sm);
|
|
||||||
background: var(--sg-surface);
|
|
||||||
color: var(--sg-text-muted);
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 1.2;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
|
|
||||||
&:hover,
|
|
||||||
&:focus-visible {
|
|
||||||
border-color: var(--sg-primary);
|
|
||||||
color: var(--sg-primary);
|
|
||||||
background: var(--sg-surface-soft);
|
|
||||||
outline: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.section-header {
|
.section-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
+2
@@ -20,10 +20,12 @@ import {
|
|||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
GenericColumn,
|
GenericColumn,
|
||||||
} from '../../../../shared/ui/data-table/data-table.component';
|
} from '../../../../shared/ui/data-table/data-table.component';
|
||||||
|
import { ChipOverflowToggleComponent } from '../../../../shared/ui/chip-overflow-toggle/chip-overflow-toggle.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-publications-table',
|
selector: 'app-publications-table',
|
||||||
imports: [
|
imports: [
|
||||||
|
ChipOverflowToggleComponent,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
MatIcon,
|
MatIcon,
|
||||||
MatCard,
|
MatCard,
|
||||||
|
|||||||
@@ -230,6 +230,8 @@
|
|||||||
<div class="tags">
|
<div class="tags">
|
||||||
@for (topic of publication.topics; track topic.id) {
|
@for (topic of publication.topics; track topic.id) {
|
||||||
<app-topic-chip
|
<app-topic-chip
|
||||||
|
[topic]="topic"
|
||||||
|
[topicId]="topic.id"
|
||||||
[label]="topic.display_name || ''"
|
[label]="topic.display_name || ''"
|
||||||
[description]="topic.description"
|
[description]="topic.description"
|
||||||
[subfieldName]="topic.subfield?.display_name"
|
[subfieldName]="topic.subfield?.display_name"
|
||||||
|
|||||||
@@ -31,21 +31,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-divider />
|
<mat-divider />
|
||||||
|
<app-link-tab-nav-bar [links]="links" [tabPanel]="tabPanel" />
|
||||||
<mat-tab-nav-panel #tabPanel>
|
<mat-tab-nav-panel #tabPanel>
|
||||||
<nav mat-tab-nav-bar [tabPanel]="tabPanel">
|
|
||||||
@for (link of links; track link.path) {
|
|
||||||
<a
|
|
||||||
mat-tab-link
|
|
||||||
[routerLink]="link.path"
|
|
||||||
[queryParams]="link.queryParams"
|
|
||||||
routerLinkActive
|
|
||||||
#rla="routerLinkActive"
|
|
||||||
[active]="rla.isActive"
|
|
||||||
[disabled]="link.disabled">
|
|
||||||
{{ link.label }}
|
|
||||||
</a>
|
|
||||||
}
|
|
||||||
</nav>
|
|
||||||
<div class="outlet-container">
|
<div class="outlet-container">
|
||||||
<router-outlet />
|
<router-outlet />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ import { MatDividerModule } from '@angular/material/divider';
|
|||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { DecimalPipe } from '@angular/common';
|
import { DecimalPipe } from '@angular/common';
|
||||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||||
|
import { PUBLICATION_ICON } from '../../shared/ui/icons';
|
||||||
|
import {
|
||||||
|
LinkTabNavBarComponent,
|
||||||
|
LinkTabNavBarItem,
|
||||||
|
} from '../../shared/ui/link-tab-nav-bar/link-tab-nav-bar.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
host: {
|
host: {
|
||||||
@@ -18,6 +23,7 @@ import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
|||||||
MatDividerModule,
|
MatDividerModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
DecimalPipe,
|
DecimalPipe,
|
||||||
|
LinkTabNavBarComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './topic.component.html',
|
templateUrl: './topic.component.html',
|
||||||
styleUrl: './topic.component.scss',
|
styleUrl: './topic.component.scss',
|
||||||
@@ -25,9 +31,10 @@ import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
|||||||
export class TopicComponent {
|
export class TopicComponent {
|
||||||
topic = input.required<Topic>();
|
topic = input.required<Topic>();
|
||||||
|
|
||||||
links = [
|
links: LinkTabNavBarItem[] = [
|
||||||
{
|
{
|
||||||
label: 'Publikationen',
|
label: 'Publikationen',
|
||||||
|
icon: PUBLICATION_ICON,
|
||||||
path: 'publications',
|
path: 'publications',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ export interface TrendStrategyConfig {
|
|||||||
|
|
||||||
export type TrendSeriesWithVisibility = TrendSeries & { visible?: boolean };
|
export type TrendSeriesWithVisibility = TrendSeries & { visible?: boolean };
|
||||||
|
|
||||||
|
export const NEWS_ENTITY_PREFIX = 'news_topic_';
|
||||||
|
export const CC_NEWS_ENTITY_PREFIX = 'ccnews_topic_';
|
||||||
|
export const CC_NEWS_COMPOSITE_ID = 'ccnews';
|
||||||
|
export const CC_NEWS_START_YEAR = 2017;
|
||||||
|
|
||||||
export const TREND_CONFIGS: Record<string, TrendStrategyConfig> = {
|
export const TREND_CONFIGS: Record<string, TrendStrategyConfig> = {
|
||||||
publications: {
|
publications: {
|
||||||
showInstitutionSelector: true,
|
showInstitutionSelector: true,
|
||||||
@@ -49,7 +54,7 @@ export const TREND_CONFIGS: Record<string, TrendStrategyConfig> = {
|
|||||||
showLocationSelector: false,
|
showLocationSelector: false,
|
||||||
showAuthorSelector: false,
|
showAuthorSelector: false,
|
||||||
yAxisLabel: 'Pressemitteilungen',
|
yAxisLabel: 'Pressemitteilungen',
|
||||||
chartTitle: 'Nachrichtentrends',
|
chartTitle: 'Nachrichtentrends (UDE vs. CC-News)',
|
||||||
},
|
},
|
||||||
all: {
|
all: {
|
||||||
showInstitutionSelector: false,
|
showInstitutionSelector: false,
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import { Injectable, inject, signal } from '@angular/core';
|
import { Injectable, inject, signal } from '@angular/core';
|
||||||
|
import { Subject, of } from 'rxjs';
|
||||||
|
import { catchError, map, switchMap } from 'rxjs/operators';
|
||||||
import {
|
import {
|
||||||
UniversityRankingsService,
|
UniversityRankingsService,
|
||||||
PersonsService,
|
PersonsService,
|
||||||
@@ -42,6 +44,124 @@ export class TrendDataService {
|
|||||||
|
|
||||||
private readonly cacheMap = new Map<string, TrendResponse>();
|
private readonly cacheMap = new Map<string, TrendResponse>();
|
||||||
|
|
||||||
|
// RxJS Subjects for cancellation of pending requests
|
||||||
|
private readonly topTopicsSubject = new Subject<{
|
||||||
|
cleanId: string;
|
||||||
|
entityType: string;
|
||||||
|
startYear: number;
|
||||||
|
endYear: number;
|
||||||
|
searchType: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
private readonly instSuggestionsSubject = new Subject<{
|
||||||
|
topic: string;
|
||||||
|
countryFilter?: string;
|
||||||
|
regionFilter?: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
private readonly recAuthorsSubject = new Subject<{
|
||||||
|
topic: string;
|
||||||
|
primaryInstId: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.topTopicsSubject
|
||||||
|
.pipe(
|
||||||
|
switchMap((params) => {
|
||||||
|
if (!params.cleanId || params.searchType === 'all') {
|
||||||
|
this.isTopTopicsLoading.set(false);
|
||||||
|
this.topTopicsData.set([]);
|
||||||
|
return of([]);
|
||||||
|
}
|
||||||
|
return this.apiService
|
||||||
|
.getTopTopicsApiInseServiceUniversityRankingsTopTopicsGet(
|
||||||
|
params.cleanId,
|
||||||
|
params.entityType,
|
||||||
|
params.startYear,
|
||||||
|
params.endYear,
|
||||||
|
params.searchType,
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
map((res) =>
|
||||||
|
(res.items || []).map((item) => ({
|
||||||
|
value: item.count,
|
||||||
|
name: item.name,
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
catchError((err) => {
|
||||||
|
console.error('Failed to load top topics:', err);
|
||||||
|
this.topTopicsError.set(true);
|
||||||
|
return of([]);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.subscribe((data) => {
|
||||||
|
this.topTopicsData.set(data);
|
||||||
|
this.isTopTopicsLoading.set(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.instSuggestionsSubject
|
||||||
|
.pipe(
|
||||||
|
switchMap((params) =>
|
||||||
|
this.apiService
|
||||||
|
.getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(
|
||||||
|
params.topic,
|
||||||
|
params.regionFilter,
|
||||||
|
params.countryFilter,
|
||||||
|
6,
|
||||||
|
)
|
||||||
|
.pipe(catchError(() => of([]))),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.subscribe((data: any) => {
|
||||||
|
this.topSuggestions.set(data || []);
|
||||||
|
this.isSuggestionsLoading.set(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.recAuthorsSubject
|
||||||
|
.pipe(
|
||||||
|
switchMap((params) => {
|
||||||
|
const cleanInst = cleanEntityId(params.primaryInstId) || 'I62318514';
|
||||||
|
return this.personsApiService
|
||||||
|
.searchPersonsList(
|
||||||
|
undefined,
|
||||||
|
cleanInst,
|
||||||
|
'cited_by_count',
|
||||||
|
'desc',
|
||||||
|
[params.topic],
|
||||||
|
1,
|
||||||
|
6,
|
||||||
|
undefined,
|
||||||
|
)
|
||||||
|
.pipe(
|
||||||
|
switchMap((res) => {
|
||||||
|
if (res.results && res.results.length > 0) {
|
||||||
|
return of(res.results);
|
||||||
|
}
|
||||||
|
return this.personsApiService
|
||||||
|
.searchPersonsList(
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
'cited_by_count',
|
||||||
|
'desc',
|
||||||
|
[params.topic],
|
||||||
|
1,
|
||||||
|
6,
|
||||||
|
undefined,
|
||||||
|
)
|
||||||
|
.pipe(map((gRes) => gRes.results || []));
|
||||||
|
}),
|
||||||
|
catchError(() => of([])),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.subscribe((authors) => {
|
||||||
|
this.recommendedAuthors.set(authors);
|
||||||
|
this.isSuggestionsLoading.set(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private getCacheKey(params: TrendRequestParams): string {
|
private getCacheKey(params: TrendRequestParams): string {
|
||||||
return JSON.stringify({
|
return JSON.stringify({
|
||||||
searchType: params.searchType,
|
searchType: params.searchType,
|
||||||
@@ -93,38 +213,19 @@ export class TrendDataService {
|
|||||||
): void {
|
): void {
|
||||||
if (!entityId || searchType === 'all') {
|
if (!entityId || searchType === 'all') {
|
||||||
this.topTopicsData.set([]);
|
this.topTopicsData.set([]);
|
||||||
|
this.isTopTopicsLoading.set(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isTopTopicsLoading.set(true);
|
this.isTopTopicsLoading.set(true);
|
||||||
this.topTopicsError.set(false);
|
this.topTopicsError.set(false);
|
||||||
|
this.topTopicsSubject.next({
|
||||||
const cleanId = cleanEntityId(entityId);
|
cleanId: cleanEntityId(entityId),
|
||||||
|
entityType,
|
||||||
this.apiService
|
startYear,
|
||||||
.getTopTopicsApiInseServiceUniversityRankingsTopTopicsGet(
|
endYear,
|
||||||
cleanId,
|
searchType,
|
||||||
entityType,
|
});
|
||||||
startYear,
|
|
||||||
endYear,
|
|
||||||
searchType,
|
|
||||||
)
|
|
||||||
.subscribe({
|
|
||||||
next: (res) => {
|
|
||||||
const mapped = (res.items || []).map((item) => ({
|
|
||||||
value: item.count,
|
|
||||||
name: item.name,
|
|
||||||
}));
|
|
||||||
this.topTopicsData.set(mapped);
|
|
||||||
this.isTopTopicsLoading.set(false);
|
|
||||||
},
|
|
||||||
error: (err) => {
|
|
||||||
console.error('Failed to load top topics:', err);
|
|
||||||
this.topTopicsError.set(true);
|
|
||||||
this.isTopTopicsLoading.set(false);
|
|
||||||
this.topTopicsData.set([]);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,24 +237,7 @@ export class TrendDataService {
|
|||||||
regionFilter?: string,
|
regionFilter?: string,
|
||||||
): void {
|
): void {
|
||||||
this.isSuggestionsLoading.set(true);
|
this.isSuggestionsLoading.set(true);
|
||||||
|
this.instSuggestionsSubject.next({ topic, countryFilter, regionFilter });
|
||||||
this.apiService
|
|
||||||
.getTopInstitutionsApiInseServiceUniversityRankingsTopInstitutionsGet(
|
|
||||||
topic,
|
|
||||||
regionFilter,
|
|
||||||
countryFilter,
|
|
||||||
6,
|
|
||||||
)
|
|
||||||
.subscribe({
|
|
||||||
next: (res: any) => {
|
|
||||||
this.topSuggestions.set(res || []);
|
|
||||||
this.isSuggestionsLoading.set(false);
|
|
||||||
},
|
|
||||||
error: () => {
|
|
||||||
this.topSuggestions.set([]);
|
|
||||||
this.isSuggestionsLoading.set(false);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -161,53 +245,6 @@ export class TrendDataService {
|
|||||||
*/
|
*/
|
||||||
loadRecommendedAuthors(topic: string, primaryInstId: string): void {
|
loadRecommendedAuthors(topic: string, primaryInstId: string): void {
|
||||||
this.isSuggestionsLoading.set(true);
|
this.isSuggestionsLoading.set(true);
|
||||||
const cleanInst = cleanEntityId(primaryInstId) || 'I62318514';
|
this.recAuthorsSubject.next({ topic, primaryInstId });
|
||||||
|
|
||||||
this.personsApiService
|
|
||||||
.searchPersonsList(
|
|
||||||
undefined,
|
|
||||||
cleanInst,
|
|
||||||
'cited_by_count',
|
|
||||||
'desc',
|
|
||||||
[topic],
|
|
||||||
1,
|
|
||||||
6,
|
|
||||||
undefined,
|
|
||||||
)
|
|
||||||
.subscribe({
|
|
||||||
next: (res) => {
|
|
||||||
if (res.results && res.results.length > 0) {
|
|
||||||
this.recommendedAuthors.set(res.results);
|
|
||||||
this.isSuggestionsLoading.set(false);
|
|
||||||
} else {
|
|
||||||
// Global fallback search across all institutions
|
|
||||||
this.personsApiService
|
|
||||||
.searchPersonsList(
|
|
||||||
undefined,
|
|
||||||
undefined,
|
|
||||||
'cited_by_count',
|
|
||||||
'desc',
|
|
||||||
[topic],
|
|
||||||
1,
|
|
||||||
6,
|
|
||||||
undefined,
|
|
||||||
)
|
|
||||||
.subscribe({
|
|
||||||
next: (globalRes) => {
|
|
||||||
this.recommendedAuthors.set(globalRes.results || []);
|
|
||||||
this.isSuggestionsLoading.set(false);
|
|
||||||
},
|
|
||||||
error: () => {
|
|
||||||
this.recommendedAuthors.set([]);
|
|
||||||
this.isSuggestionsLoading.set(false);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: () => {
|
|
||||||
this.recommendedAuthors.set([]);
|
|
||||||
this.isSuggestionsLoading.set(false);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-6
@@ -10,6 +10,8 @@ import { NgxEchartsDirective } from 'ngx-echarts';
|
|||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { TrendResponse, TrendSeries, TopicYearlyData } from '../../../api';
|
import { TrendResponse, TrendSeries, TopicYearlyData } from '../../../api';
|
||||||
import { ChartThemeService } from '../../../shared/services/chart-theme.service';
|
import { ChartThemeService } from '../../../shared/services/chart-theme.service';
|
||||||
|
import { CC_NEWS_START_YEAR } from '../models/trend.models';
|
||||||
|
import { isCcNewsSeries } from '../utils/trend.utils';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-uni-trend-chart',
|
selector: 'app-uni-trend-chart',
|
||||||
@@ -111,8 +113,9 @@ export class UniTrendChartComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const yrTopicData = entity.topic_data[selectedTopic] || [];
|
const yrTopicData = entity.topic_data[selectedTopic] || [];
|
||||||
|
const isCcNews = isCcNewsSeries(entity.entity_id);
|
||||||
const lineData = years.map((year) => {
|
const lineData = years.map((year) => {
|
||||||
|
if (isCcNews && year < CC_NEWS_START_YEAR) return null;
|
||||||
const yrData = yrTopicData.find((y) => y.year === year);
|
const yrData = yrTopicData.find((y) => y.year === year);
|
||||||
if (!yrData) return 0;
|
if (!yrData) return 0;
|
||||||
if (currentMode === 'cumulative') {
|
if (currentMode === 'cumulative') {
|
||||||
@@ -126,13 +129,14 @@ export class UniTrendChartComponent {
|
|||||||
type: 'line',
|
type: 'line',
|
||||||
xAxisIndex: 0,
|
xAxisIndex: 0,
|
||||||
yAxisIndex: 0,
|
yAxisIndex: 0,
|
||||||
areaStyle: {
|
areaStyle: { opacity: isCcNews ? 0.3 : 0.12 },
|
||||||
opacity: 0.12,
|
|
||||||
},
|
|
||||||
data: lineData,
|
data: lineData,
|
||||||
smooth: true,
|
smooth: true,
|
||||||
|
connectNulls: false,
|
||||||
|
showSymbol: !isCcNews,
|
||||||
|
z: isCcNews ? 1 : 2,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
width: 2.5,
|
width: isCcNews ? 1 : 2.5,
|
||||||
color: color,
|
color: color,
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
@@ -140,10 +144,14 @@ export class UniTrendChartComponent {
|
|||||||
},
|
},
|
||||||
emphasis: {
|
emphasis: {
|
||||||
focus: 'series',
|
focus: 'series',
|
||||||
lineStyle: { width: 3.5 },
|
lineStyle: { width: isCcNews ? 2 : 3.5 },
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (isCcNews) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const bars = years.map((year) => {
|
const bars = years.map((year) => {
|
||||||
const yrData = yrTopicData.find((y) => y.year === year);
|
const yrData = yrTopicData.find((y) => y.year === year);
|
||||||
const val = yrData ? yrData.raw : 0;
|
const val = yrData ? yrData.raw : 0;
|
||||||
|
|||||||
+19
-20
@@ -36,7 +36,7 @@
|
|||||||
[matTooltip]="
|
[matTooltip]="
|
||||||
!isUde()
|
!isUde()
|
||||||
? 'News-Trends sind nur für die Universität Duisburg-Essen verfügbar'
|
? 'News-Trends sind nur für die Universität Duisburg-Essen verfügbar'
|
||||||
: 'Zeigt Pressemitteilungstrends der UDE'
|
: 'Zeigt Pressemitteilungstrends der UDE im Vergleich zur Web-Berichterstattung (CC-News). Der CC-News-Vergleich erfordert deaktivierte Fuzzy-Suche.'
|
||||||
"
|
"
|
||||||
(click)="setSearchType('news')">
|
(click)="setSearchType('news')">
|
||||||
<mat-icon>campaign</mat-icon> News
|
<mat-icon>campaign</mat-icon> News
|
||||||
@@ -184,28 +184,27 @@
|
|||||||
<p>Daten werden geladen...</p>
|
<p>Daten werden geladen...</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@if (selectedSearchType() === 'news' && !hasCcNewsSeries()) {
|
||||||
|
<div class="cc-news-hint">
|
||||||
|
<mat-icon>info_outline</mat-icon>
|
||||||
|
<span>
|
||||||
|
Der CC-News-Vergleich (hinterlegte Fläche, ab 2017) ist aktuell
|
||||||
|
nur bei deaktivierter Fuzzy-Suche verfügbar, da für
|
||||||
|
Web-Nachrichten kein Themen-Mapping existiert.
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@if (selectedTrendTopics().length > 0) {
|
@if (selectedTrendTopics().length > 0) {
|
||||||
<div class="chart-topic-tabs">
|
<div class="chart-topic-tabs">
|
||||||
@for (topic of selectedTrendTopics(); track $index) {
|
@for (topic of selectedTrendTopics(); track $index) {
|
||||||
@if (selectedSearchType() === 'news') {
|
<app-topic-chip
|
||||||
<app-topic-chip
|
[topicId]="topic"
|
||||||
[label]="getMappedTopic(topic)"
|
[label]="getMappedTopic(topic)"
|
||||||
[active]="isVisible('news_topic_' + topic)"
|
[active]="activeChartTopic() === topic"
|
||||||
[color]="getTopicColor(topic)"
|
[color]="getTopicColor(topic)"
|
||||||
[disabled]="false"
|
[disabled]="isTopicEmpty(topic)"
|
||||||
[matTooltip]="getMappedTopic(topic)"
|
(chipClick)="updateActiveChartTopic(topic)">
|
||||||
(chipClick)="toggleVisibility('news_topic_' + topic)">
|
</app-topic-chip>
|
||||||
</app-topic-chip>
|
|
||||||
} @else {
|
|
||||||
<app-topic-chip
|
|
||||||
[label]="getMappedTopic(topic)"
|
|
||||||
[active]="activeChartTopic() === topic"
|
|
||||||
[color]="getTopicColor(topic)"
|
|
||||||
[disabled]="isTopicEmpty(topic)"
|
|
||||||
[matTooltip]="getMappedTopic(topic)"
|
|
||||||
(chipClick)="updateActiveChartTopic(topic)">
|
|
||||||
</app-topic-chip>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
+20
@@ -164,6 +164,26 @@
|
|||||||
border-bottom: 1px solid var(--sg-border);
|
border-bottom: 1px solid var(--sg-border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cc-news-hint {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.5rem;
|
||||||
|
padding: 0.75rem 1.25rem;
|
||||||
|
background: var(--sg-surface-muted);
|
||||||
|
border-bottom: 1px solid var(--sg-border);
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
flex: none;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
width: 1.1rem;
|
||||||
|
height: 1.1rem;
|
||||||
|
color: var(--sg-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.loader-overlay {
|
.loader-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
+85
-53
@@ -69,12 +69,19 @@ import {
|
|||||||
} from '../../../shared/ui/topic-treemap/topic-treemap.models';
|
} from '../../../shared/ui/topic-treemap/topic-treemap.models';
|
||||||
import { TopicsService } from '../../../api/api/topics.service';
|
import { TopicsService } from '../../../api/api/topics.service';
|
||||||
|
|
||||||
import { CompareItem, TREND_CONFIGS } from '../models/trend.models';
|
import {
|
||||||
|
CC_NEWS_COMPOSITE_ID,
|
||||||
|
CC_NEWS_ENTITY_PREFIX,
|
||||||
|
CompareItem,
|
||||||
|
NEWS_ENTITY_PREFIX,
|
||||||
|
TREND_CONFIGS,
|
||||||
|
} from '../models/trend.models';
|
||||||
import {
|
import {
|
||||||
cleanEntityId,
|
cleanEntityId,
|
||||||
isTopicEmptyForSeries,
|
isTopicEmptyForSeries,
|
||||||
findFirstNonEmptyTopic,
|
findFirstNonEmptyTopic,
|
||||||
buildEntityColorIndex,
|
buildEntityColorIndex,
|
||||||
|
newsSourceColor,
|
||||||
} from '../utils/trend.utils';
|
} from '../utils/trend.utils';
|
||||||
import { TrendDataService } from '../services/trend-data.service';
|
import { TrendDataService } from '../services/trend-data.service';
|
||||||
|
|
||||||
@@ -326,28 +333,37 @@ export class UniTrendParentComponent implements OnInit {
|
|||||||
readonly boundGetTopicColor = this.getTopicColor.bind(this);
|
readonly boundGetTopicColor = this.getTopicColor.bind(this);
|
||||||
|
|
||||||
readonly newsSelectedTopicsPieData = computed(() => {
|
readonly newsSelectedTopicsPieData = computed(() => {
|
||||||
const data = this.trendResponse();
|
const data = this.rawTrendResponse();
|
||||||
if (!data || !data.series || this.selectedSearchType() !== 'news') {
|
if (!data || !data.series || this.selectedSearchType() !== 'news') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const startYr = this.startYear();
|
const startYr = this.startYear();
|
||||||
const endYr = this.endYear();
|
const endYr = this.endYear();
|
||||||
|
|
||||||
return data.series.map((s) => {
|
return data.series
|
||||||
const topicName = s.entity_name;
|
.filter((s) => s.entity_id.startsWith(NEWS_ENTITY_PREFIX))
|
||||||
const yearlyItems =
|
.map((s) => {
|
||||||
s.topic_data[topicName] || Object.values(s.topic_data)[0] || [];
|
const topicName = s.entity_name;
|
||||||
const totalRaw = yearlyItems
|
const yearlyItems =
|
||||||
.filter((y) => y.year >= startYr && y.year <= endYr)
|
s.topic_data[topicName] || Object.values(s.topic_data)[0] || [];
|
||||||
.reduce((sum, item) => sum + (item.raw || 0), 0);
|
const totalRaw = yearlyItems
|
||||||
|
.filter((y) => y.year >= startYr && y.year <= endYr)
|
||||||
|
.reduce((sum, item) => sum + (item.raw || 0), 0);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: topicName,
|
name: topicName,
|
||||||
value: totalRaw,
|
value: totalRaw,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
readonly hasCcNewsSeries = computed(
|
||||||
|
() =>
|
||||||
|
this.rawTrendResponse()?.series?.some((s) =>
|
||||||
|
s.entity_id.startsWith(CC_NEWS_ENTITY_PREFIX),
|
||||||
|
) ?? false,
|
||||||
|
);
|
||||||
|
|
||||||
readonly activeTreemapData = computed<TopicTreemapData | null>(() => {
|
readonly activeTreemapData = computed<TopicTreemapData | null>(() => {
|
||||||
const data = this.trendResponse();
|
const data = this.trendResponse();
|
||||||
const searchType = this.selectedSearchType();
|
const searchType = this.selectedSearchType();
|
||||||
@@ -530,45 +546,44 @@ export class UniTrendParentComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
isTopicEmpty(topic: string): boolean {
|
seriesTopicName(entityId: string): string {
|
||||||
const series = this.rawTrendResponse()?.series || [];
|
if (entityId.startsWith(NEWS_ENTITY_PREFIX)) {
|
||||||
if (!series || series.length === 0) return true;
|
return entityId.slice(NEWS_ENTITY_PREFIX.length);
|
||||||
|
|
||||||
const mapped = this.getMappedTopic(topic);
|
|
||||||
const startYr = this.startYear();
|
|
||||||
const endYr = this.endYear();
|
|
||||||
const cId = cleanEntityId(topic);
|
|
||||||
|
|
||||||
for (const s of series) {
|
|
||||||
if (!s.topic_data) continue;
|
|
||||||
const keys = [
|
|
||||||
topic,
|
|
||||||
mapped,
|
|
||||||
cId ? `https://openalex.org/${cId}` : '',
|
|
||||||
cId,
|
|
||||||
].filter(Boolean);
|
|
||||||
|
|
||||||
for (const k of keys) {
|
|
||||||
const topicItems = s.topic_data[k];
|
|
||||||
if (topicItems && topicItems.length > 0) {
|
|
||||||
const sumRaw = topicItems
|
|
||||||
.filter((y) => y.year >= startYr && y.year <= endYr)
|
|
||||||
.reduce((acc, curr) => acc + (curr.raw || 0), 0);
|
|
||||||
if (sumRaw > 0) return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
if (entityId.startsWith(CC_NEWS_ENTITY_PREFIX)) {
|
||||||
|
return entityId.slice(CC_NEWS_ENTITY_PREFIX.length);
|
||||||
|
}
|
||||||
|
return entityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
isTopicEmpty(topic: string): boolean {
|
||||||
|
const allSeries =
|
||||||
|
this.trendResponse()?.series || this.rawTrendResponse()?.series || [];
|
||||||
|
if (allSeries.length === 0) return true;
|
||||||
|
const series =
|
||||||
|
this.selectedSearchType() === 'news'
|
||||||
|
? allSeries.filter((s) => this.seriesTopicName(s.entity_id) === topic)
|
||||||
|
: allSeries;
|
||||||
|
return isTopicEmptyForSeries(
|
||||||
|
topic,
|
||||||
|
series,
|
||||||
|
this.startYear(),
|
||||||
|
this.endYear(),
|
||||||
|
(t) => this.getMappedTopic(t),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
findFirstNonEmptyTopic(topics: string[]): string {
|
findFirstNonEmptyTopic(topics: string[]): string {
|
||||||
|
const allSeries =
|
||||||
|
this.trendResponse()?.series || this.rawTrendResponse()?.series || [];
|
||||||
if (!topics || topics.length === 0) return '';
|
if (!topics || topics.length === 0) return '';
|
||||||
for (const t of topics) {
|
return findFirstNonEmptyTopic(
|
||||||
if (!this.isTopicEmpty(t)) {
|
topics,
|
||||||
return t;
|
allSeries,
|
||||||
}
|
this.startYear(),
|
||||||
}
|
this.endYear(),
|
||||||
return topics[0];
|
(t) => this.getMappedTopic(t),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
isVisible(id: string): boolean {
|
isVisible(id: string): boolean {
|
||||||
@@ -593,6 +608,7 @@ export class UniTrendParentComponent implements OnInit {
|
|||||||
patents: '#f59e0b',
|
patents: '#f59e0b',
|
||||||
projects: '#10b981',
|
projects: '#10b981',
|
||||||
news: '#ec4899',
|
news: '#ec4899',
|
||||||
|
[CC_NEWS_COMPOSITE_ID]: '#06b6d4',
|
||||||
};
|
};
|
||||||
const cleanKey = entityId.toLowerCase().trim();
|
const cleanKey = entityId.toLowerCase().trim();
|
||||||
if (categoryColors[cleanKey]) {
|
if (categoryColors[cleanKey]) {
|
||||||
@@ -600,10 +616,7 @@ export class UniTrendParentComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.selectedSearchType() === 'news') {
|
if (this.selectedSearchType() === 'news') {
|
||||||
const topicName = entityId.startsWith('news_topic_')
|
return newsSourceColor(entityId);
|
||||||
? entityId.slice('news_topic_'.length)
|
|
||||||
: entityId;
|
|
||||||
return this.getTopicColor(topicName);
|
|
||||||
}
|
}
|
||||||
const colorFn = buildEntityColorIndex(
|
const colorFn = buildEntityColorIndex(
|
||||||
this.primaryInstitution(),
|
this.primaryInstitution(),
|
||||||
@@ -739,7 +752,21 @@ export class UniTrendParentComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (type === 'news' || type === 'all' || type === 'patents') {
|
if (type === 'news') {
|
||||||
|
const active = this.activeChartTopic() || topics[0] || '';
|
||||||
|
const wanted = new Set([
|
||||||
|
NEWS_ENTITY_PREFIX + active,
|
||||||
|
CC_NEWS_ENTITY_PREFIX + active,
|
||||||
|
]);
|
||||||
|
return {
|
||||||
|
...raw,
|
||||||
|
series: raw.series
|
||||||
|
.filter((s) => wanted.has(s.entity_id))
|
||||||
|
.map((s) => ({ ...normalizeTopicData(s), visible: true })),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'all' || type === 'patents') {
|
||||||
return {
|
return {
|
||||||
...raw,
|
...raw,
|
||||||
series: raw.series.map((s) => ({
|
series: raw.series.map((s) => ({
|
||||||
@@ -860,6 +887,11 @@ export class UniTrendParentComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
if (resolved.authors && resolved.authors.length > 0) {
|
if (resolved.authors && resolved.authors.length > 0) {
|
||||||
this.comparisonAuthors.set(resolved.authors);
|
this.comparisonAuthors.set(resolved.authors);
|
||||||
|
const currentUrlAuthors =
|
||||||
|
this.route.snapshot.queryParamMap.getAll('authors');
|
||||||
|
if (currentUrlAuthors.length === 0 && type === 'authors') {
|
||||||
|
this.updateUrlParams();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resolved.treemapNode !== undefined) {
|
if (resolved.treemapNode !== undefined) {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { TrendSeries, TopicYearlyData } from '../../../api';
|
import { TrendSeries, TopicYearlyData } from '../../../api';
|
||||||
import { CompareItem } from '../models/trend.models';
|
import {
|
||||||
|
CC_NEWS_COMPOSITE_ID,
|
||||||
|
CC_NEWS_ENTITY_PREFIX,
|
||||||
|
CompareItem,
|
||||||
|
} from '../models/trend.models';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts short OpenAlex ID from full URL or string, ensuring uppercase ID prefix (e.g. I62318514, A50012345).
|
* Extracts short OpenAlex ID from full URL or string, ensuring uppercase ID prefix (e.g. I62318514, A50012345).
|
||||||
@@ -22,15 +26,42 @@ export function isTopicEmptyForSeries(
|
|||||||
seriesList: TrendSeries[],
|
seriesList: TrendSeries[],
|
||||||
startYr: number,
|
startYr: number,
|
||||||
endYr: number,
|
endYr: number,
|
||||||
|
getMappedTopicFn?: (topic: string) => string,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (!seriesList || seriesList.length === 0) return true;
|
if (!seriesList || seriesList.length === 0) return true;
|
||||||
|
const mapped = getMappedTopicFn ? getMappedTopicFn(topicName) : topicName;
|
||||||
|
const cleanId = cleanEntityId(topicName);
|
||||||
|
const cleanMappedId = cleanEntityId(mapped);
|
||||||
|
const topicLower = topicName.toLowerCase().trim();
|
||||||
|
const mappedLower = mapped.toLowerCase().trim();
|
||||||
|
|
||||||
for (const s of seriesList) {
|
for (const s of seriesList) {
|
||||||
const topicItems = s.topic_data?.[topicName] || [];
|
if (!s.topic_data) continue;
|
||||||
const filtered = topicItems.filter(
|
const entries = Object.entries(s.topic_data);
|
||||||
(y) => y.year >= startYr && y.year <= endYr,
|
|
||||||
);
|
for (const [key, topicItems] of entries) {
|
||||||
const sumRaw = filtered.reduce((acc, curr) => acc + (curr.raw || 0), 0);
|
if (!topicItems || topicItems.length === 0) continue;
|
||||||
if (sumRaw > 0) return false;
|
|
||||||
|
const keyLower = key.toLowerCase().trim();
|
||||||
|
const keyClean = cleanEntityId(key);
|
||||||
|
const revMapped = getMappedTopicFn
|
||||||
|
? getMappedTopicFn(key).toLowerCase().trim()
|
||||||
|
: '';
|
||||||
|
|
||||||
|
const isMatch =
|
||||||
|
keyLower === topicLower ||
|
||||||
|
keyLower === mappedLower ||
|
||||||
|
(cleanId && keyClean === cleanId) ||
|
||||||
|
(cleanMappedId && keyClean === cleanMappedId) ||
|
||||||
|
(revMapped && (revMapped === topicLower || revMapped === mappedLower));
|
||||||
|
|
||||||
|
if (isMatch) {
|
||||||
|
const sumRaw = topicItems
|
||||||
|
.filter((y) => y.year >= startYr && y.year <= endYr)
|
||||||
|
.reduce((acc, curr) => acc + (curr.raw || 0), 0);
|
||||||
|
if (sumRaw > 0) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -43,19 +74,49 @@ export function findFirstNonEmptyTopic(
|
|||||||
seriesList: TrendSeries[],
|
seriesList: TrendSeries[],
|
||||||
startYr: number,
|
startYr: number,
|
||||||
endYr: number,
|
endYr: number,
|
||||||
|
getMappedTopicFn?: (topic: string) => string,
|
||||||
): string {
|
): string {
|
||||||
if (!topics || topics.length === 0) return '';
|
if (!topics || topics.length === 0) return '';
|
||||||
for (const t of topics) {
|
for (const t of topics) {
|
||||||
if (!isTopicEmptyForSeries(t, seriesList, startYr, endYr)) {
|
if (
|
||||||
|
!isTopicEmptyForSeries(t, seriesList, startYr, endYr, getMappedTopicFn)
|
||||||
|
) {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return topics[0];
|
return topics[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const entityColors = [
|
||||||
* Builds deterministic entity color lookup map based on entity order and ID.
|
'#ec4899', // Pink (Primary UDE)
|
||||||
*/
|
'#3b82f6', // Blue
|
||||||
|
'#10b981', // Emerald Green
|
||||||
|
'#f59e0b', // Amber/Yellow
|
||||||
|
'#8b5cf6', // Purple
|
||||||
|
'#06b6d4', // Cyan
|
||||||
|
'#6366f1', // Indigo
|
||||||
|
'#ef4444', // Red
|
||||||
|
'#14b8a6', // Teal
|
||||||
|
'#f97316', // Orange
|
||||||
|
'#d946ef', // Fuchsia
|
||||||
|
'#84cc16', // Lime
|
||||||
|
'#22c55e', // Green
|
||||||
|
'#a855f7', // Purple/Fuchsia
|
||||||
|
'#eab308', // Yellow
|
||||||
|
'#f43f5e', // Rose
|
||||||
|
];
|
||||||
|
|
||||||
|
export function isCcNewsSeries(entityId: string): boolean {
|
||||||
|
return (
|
||||||
|
entityId === CC_NEWS_COMPOSITE_ID ||
|
||||||
|
entityId.startsWith(CC_NEWS_ENTITY_PREFIX)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function newsSourceColor(entityId: string): string {
|
||||||
|
return isCcNewsSeries(entityId) ? entityColors[1] : entityColors[0];
|
||||||
|
}
|
||||||
|
|
||||||
export function buildEntityColorIndex(
|
export function buildEntityColorIndex(
|
||||||
primaryId: string | null,
|
primaryId: string | null,
|
||||||
institutions: CompareItem[],
|
institutions: CompareItem[],
|
||||||
@@ -63,25 +124,6 @@ export function buildEntityColorIndex(
|
|||||||
regions: CompareItem[],
|
regions: CompareItem[],
|
||||||
authors: CompareItem[],
|
authors: CompareItem[],
|
||||||
): (id: string) => string {
|
): (id: string) => string {
|
||||||
const entityColors = [
|
|
||||||
'#ec4899', // Pink (Primary UDE)
|
|
||||||
'#3b82f6', // Blue
|
|
||||||
'#10b981', // Emerald Green
|
|
||||||
'#f59e0b', // Amber/Yellow
|
|
||||||
'#8b5cf6', // Purple
|
|
||||||
'#06b6d4', // Cyan
|
|
||||||
'#6366f1', // Indigo
|
|
||||||
'#ef4444', // Red
|
|
||||||
'#14b8a6', // Teal
|
|
||||||
'#f97316', // Orange
|
|
||||||
'#d946ef', // Fuchsia
|
|
||||||
'#84cc16', // Lime
|
|
||||||
'#22c55e', // Green
|
|
||||||
'#a855f7', // Purple/Fuchsia
|
|
||||||
'#eab308', // Yellow
|
|
||||||
'#f43f5e', // Rose
|
|
||||||
];
|
|
||||||
|
|
||||||
const colorMap = new Map<string, string>();
|
const colorMap = new Map<string, string>();
|
||||||
let nextIdx = 0;
|
let nextIdx = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,22 @@ export const bundProjectsFundingResolver: ResolveFn<
|
|||||||
'Institution ID is required to resolve BUND projects funding',
|
'Institution ID is required to resolve BUND projects funding',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const filtersEnabled = route.data['enableFilters'] ?? false;
|
||||||
|
|
||||||
|
if (!filtersEnabled) {
|
||||||
|
return inject(ProjectsService).getInstitutionBundProjectsFundingOverTime(
|
||||||
|
institutionId,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
undefined,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
}
|
||||||
const fundingStartYears = route.queryParamMap.getAll(
|
const fundingStartYears = route.queryParamMap.getAll(
|
||||||
bundProjectQueryParamKeys.funding_start,
|
bundProjectQueryParamKeys.funding_start,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,62 +15,90 @@ export const cordisEuProjectsFundingResolver: ResolveFn<
|
|||||||
'Institution ID is required to resolve Cordis EU projects funding',
|
'Institution ID is required to resolve Cordis EU projects funding',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
const filtersEnabled = route.data['enableFilters'] ?? false;
|
||||||
|
if (!filtersEnabled) {
|
||||||
|
return inject(
|
||||||
|
ProjectsService,
|
||||||
|
).getInstitutionCordisEuProjectsFundingOverTime(
|
||||||
|
institutionId,
|
||||||
|
undefined, // authorId (single) - institution view doesn't use this
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
undefined,
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
undefined,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const searchTerm =
|
||||||
|
route.queryParamMap.get(euProjectQueryParamKeys.title) ?? undefined;
|
||||||
|
|
||||||
const searchTerm =
|
const fundingStart = route.queryParamMap.getAll(
|
||||||
route.queryParamMap.get(euProjectQueryParamKeys.title) ?? undefined;
|
euProjectQueryParamKeys.funding_start,
|
||||||
|
);
|
||||||
|
const fundingEnd = route.queryParamMap.getAll(
|
||||||
|
euProjectQueryParamKeys.funding_end,
|
||||||
|
);
|
||||||
|
|
||||||
const fundingStart = route.queryParamMap.getAll(
|
const filteredTopicIds = route.queryParamMap.getAll(
|
||||||
euProjectQueryParamKeys.funding_start,
|
euProjectQueryParamKeys.topicId,
|
||||||
);
|
);
|
||||||
const fundingEnd = route.queryParamMap.getAll(
|
|
||||||
euProjectQueryParamKeys.funding_end,
|
|
||||||
);
|
|
||||||
|
|
||||||
const filteredTopicIds = route.queryParamMap.getAll(
|
const projectTypes = route.queryParamMap.getAll(
|
||||||
euProjectQueryParamKeys.topicId,
|
euProjectQueryParamKeys.projectType,
|
||||||
);
|
);
|
||||||
|
|
||||||
const projectTypes = route.queryParamMap.getAll(
|
const organizationIds = route.queryParamMap.getAll(
|
||||||
euProjectQueryParamKeys.projectType,
|
euProjectQueryParamKeys.institutionId,
|
||||||
);
|
);
|
||||||
|
|
||||||
const organizationIds = route.queryParamMap.getAll(
|
const authorIds = route.queryParamMap
|
||||||
euProjectQueryParamKeys.institutionId,
|
.getAll(euProjectQueryParamKeys.authorId)
|
||||||
);
|
.map((id) => id.split('/').pop() || id);
|
||||||
|
|
||||||
const authorIds = route.queryParamMap
|
const countries = route.queryParamMap.getAll(
|
||||||
.getAll(euProjectQueryParamKeys.authorId)
|
euProjectQueryParamKeys.country,
|
||||||
.map((id) => id.split('/').pop() || id);
|
);
|
||||||
|
|
||||||
const countries = route.queryParamMap.getAll(euProjectQueryParamKeys.country);
|
const frameworkProgrammes = route.queryParamMap.getAll(
|
||||||
|
euProjectQueryParamKeys.frameworkProgramme,
|
||||||
|
);
|
||||||
|
|
||||||
const frameworkProgrammes = route.queryParamMap.getAll(
|
const fundingSchemes = route.queryParamMap.getAll(
|
||||||
euProjectQueryParamKeys.frameworkProgramme,
|
euProjectQueryParamKeys.fundingScheme,
|
||||||
);
|
);
|
||||||
|
|
||||||
const fundingSchemes = route.queryParamMap.getAll(
|
const statuses = route.queryParamMap.getAll(euProjectQueryParamKeys.status);
|
||||||
euProjectQueryParamKeys.fundingScheme,
|
|
||||||
);
|
|
||||||
|
|
||||||
const statuses = route.queryParamMap.getAll(euProjectQueryParamKeys.status);
|
return inject(
|
||||||
|
ProjectsService,
|
||||||
return inject(ProjectsService).getInstitutionCordisEuProjectsFundingOverTime(
|
).getInstitutionCordisEuProjectsFundingOverTime(
|
||||||
institutionId,
|
institutionId,
|
||||||
undefined, // authorId (single) - institution view doesn't use this
|
undefined, // authorId (single) - institution view doesn't use this
|
||||||
authorIds,
|
authorIds,
|
||||||
organizationIds,
|
organizationIds,
|
||||||
[], // organizationNames
|
[], // organizationNames
|
||||||
projectTypes as any,
|
projectTypes as any,
|
||||||
searchTerm,
|
searchTerm,
|
||||||
[], // keywords - institution view doesn't use free-text keywords
|
[], // keywords - institution view doesn't use free-text keywords
|
||||||
[], // topicIds (fuzzy) - institution view doesn't use fuzzy topic search
|
[], // topicIds (fuzzy) - institution view doesn't use fuzzy topic search
|
||||||
filteredTopicIds,
|
filteredTopicIds,
|
||||||
fundingStart,
|
fundingStart,
|
||||||
fundingEnd,
|
fundingEnd,
|
||||||
countries,
|
countries,
|
||||||
frameworkProgrammes,
|
frameworkProgrammes,
|
||||||
fundingSchemes,
|
fundingSchemes,
|
||||||
statuses,
|
statuses,
|
||||||
false, // fuzzy
|
false, // fuzzy
|
||||||
);
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user