Compare commits

..
Author SHA1 Message Date
Louis e0d1f0df5c Merge remote-tracking branch 'origin/dev' into refactor/list-card-heights
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good
2026-08-17 00:05:35 +02:00
Louis 27301bf6a5 fix(card-search): keep a single result at normal card width
LocationBasedServices/smartguide/pipeline/head This commit looks good
2026-08-16 23:56:51 +02:00
Louis bbd4ff8685 fix(publications): refresh filter labels when a topic/author id is appended 2026-08-16 23:56:29 +02:00
Louis dbc53a9a49 fix(publication-card): stop card clicks navigating to /topic, wire chips to search filters 2026-08-16 23:56:11 +02:00
Louis 0f0f30f08c feat(publication-card): clamp title/topics/authors to fixed-height sections 2026-08-16 23:25:58 +02:00
Louis 6c3c43ef4f style(projects): wrap type filter chips in filter-card box 2026-08-16 23:00:13 +02:00
Louis a5f6ccc75b style(patents): align filter row with News's design and card grid 2026-08-16 22:37:12 +02:00
Louis cfa2c768eb fix(patents): clamp patent title to 3 lines 2026-08-16 22:26:18 +02:00
kuzko 54e0701698 Merge pull request 'refactor/static_topic_cache' (#285) from refactor/static_topic_cache into dev
LocationBasedServices/smartguide/pipeline/head This commit looks good
Reviewed-on: #285
2026-08-16 22:24:23 +02:00
Louis 4a61c00642 fix(project-card): clamp title to prevent row-to-row height drift 2026-08-16 22:18:38 +02:00
Kazgatari 49c45cb924 Merge branch 'dev' of https://project.nes.uni-due.de/gitea/lbs/smartguide into refactor/static_topic_cache
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good
2026-08-16 22:13:52 +02:00
Kazgatari ad14f60a2c changed icons 2026-08-16 22:13:33 +02:00
Louis 2bcd1d4586 fix(institution-card): stabilize header heigh 2026-08-16 22:06:53 +02:00
genja 5d2d694a20 Merge pull request 'feature/keywords-analysis' (#284) from feature/keywords-analysis into dev
LocationBasedServices/smartguide/pipeline/head This commit looks good
Reviewed-on: #284
2026-08-16 22:01:01 +02:00
Louis dc31b21dac fix(topic-card): stabilize header height and cap description length 2026-08-16 21:56:17 +02:00
genja d28a662da3 Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/pr-dev This commit looks good
2026-08-16 21:38:23 +02:00
genja 8a418a99b4 enabled project detail row only for projects where highlighted content is persistent 2026-08-16 21:38:01 +02:00
genja 17100024e5 moved topic resolving to search results state service 2026-08-16 21:36:32 +02:00
genja 9b95728c7b bund project field fixed 2026-08-16 21:36:12 +02:00
Kazgatari 4937889968 regenerate frontend 2026-08-16 21:19:05 +02:00
Kazgatari 36773c4ae2 Merge branch 'dev' of https://project.nes.uni-due.de/gitea/lbs/smartguide into refactor/static_topic_cache 2026-08-16 21:04:50 +02:00
Kazgatari 353d938d3e topic hierarchy model addition in backend and component change in frontend 2026-08-16 21:03:51 +02:00
genja f02e510847 expanded row view adjusted for DFG project table 2026-08-16 20:48:32 +02:00
genja 6e0acb9cde added expanded row for EU projects table 2026-08-16 20:47:23 +02:00
genja a0fdc8799b added expanded Row for bund project table 2026-08-16 20:47:03 +02:00
genja f4656fcf39 fixed eu projects resolver 2026-08-16 20:46:16 +02:00
genja d73ee592ea fixed Bund highlight model 2026-08-16 20:45:55 +02:00
Louis c6e1051059 Merge pull request 'fix/wordcloud-legend-highlight' (#283) from fix/wordcloud-legend-highlight into dev
LocationBasedServices/smartguide/pipeline/head This commit looks good
Reviewed-on: #283
2026-08-16 20:40:37 +02:00
Kazgatari 024724b51d removed cache logic from patents 2026-08-16 19:14:26 +02:00
Kazgatari 7798cdaea5 cleanup of comments and changed import signature in main 2026-08-16 17:54:30 +02:00
Kazgatari a1b9f5a084 removed old service manualy from generated files for now 2026-08-16 17:52:57 +02:00
Kazgatari 6f79733b3e removed topic cache and all affiliated files to see what breaks 2026-08-16 17:35:20 +02:00
69 changed files with 3815 additions and 29105 deletions
File diff suppressed because it is too large Load Diff
-193
View File
@@ -1,193 +0,0 @@
"""
This module defines the business logic for our
web service.
"""
import json
import logging
from inse.integrations import elasticsearch
from inse.models.openalex.topic import Topic
from inse.models.openalex.topic_domain import TopicDomain
from inse.models.openalex.topic_field import TopicField
from inse.models.openalex.topic_subfield import TopicSubfield
logger = logging.getLogger(__name__)
topic_cache_filename: str = "topic_hierarchy_cache.json"
def _load_topic_cache() -> dict:
"""Loads the topic hierarchy cache from a JSON file."""
import os
try:
cache_path = "/data/" + topic_cache_filename
if not os.path.exists(cache_path):
current_dir = os.path.dirname(__file__)
cache_path = os.path.join(current_dir, "..", "data", topic_cache_filename)
with open(cache_path, "r", encoding="utf-8") as f:
return json.load(f)
except Exception as exc:
logger.warning("Failed to load topic hierarchy cache: %s", exc)
return {}
async def build_topic_cache(save_json: bool = True) -> dict:
"""
Fetch topics from the hosted OpenAlex topics index and build a lookup cache (scheduled task).
Arguments:
save_json (bool): Whether to save the cache as a JSON file (default: True)
Returns:
taxonomy_cache (dict): The topic hierarchy dictionary.
"""
output_filename: str = "topic_hierarchy_cache.json"
taxonomy_cache = {}
try:
async for hit in elasticsearch.scan(
index="openalex-topics",
query={"match_all": {}},
source=["display_name", "name", "id", "subfield", "field", "domain"],
cluster="nes",
):
source = hit.get("_source", {})
topic_name = source.get("display_name") or source.get("name")
if not topic_name:
continue
taxonomy_cache[topic_name] = {
"topic_id": source.get("id") or hit.get("_id", ""),
"subfield": source.get("subfield", {}).get("display_name", ""),
"field": source.get("field", {}).get("display_name", ""),
"domain": source.get("domain", {}).get("display_name", ""),
}
except Exception as exc:
logger.error("Failed to scan topics from Elasticsearch: %s", exc)
logger.info("Processed %s topics total", len(taxonomy_cache))
if save_json:
data_json = json.dumps(taxonomy_cache, indent=2, ensure_ascii=True)
try:
output_path = "/data/" + output_filename
with open(output_path, "w", encoding="utf-8") as f:
f.write(data_json)
logger.info("Topic hierarchy cache written to %s", output_path)
except Exception as exc:
logger.warning("Failed to write topic hierarchy cache: %s", exc)
return taxonomy_cache
def get_topics_from_cache(topic_names: list[str]) -> list[Topic]:
"""
Given a list of topic names, retrieves their hierarchy information from the cache and returns a list of Topic models.
Arguments:
topic_names (List[str]): A list of topic names to retrieve.
Returns:
List[Topic]: A list of Topic models.
"""
cache = _load_topic_cache()
topics = []
for name in topic_names:
data = cache.get(name)
if not data:
continue
subfield_name = data.get("subfield", "")
field_name = data.get("field", "")
domain_name = data.get("domain", "")
topics.append(
Topic(
id=data.get("topic_id", ""),
display_name=name,
works_count=data.get("count", 1),
subfield=TopicSubfield(display_name=subfield_name)
if subfield_name
else None,
field=TopicField(display_name=field_name) if field_name else None,
domain=TopicDomain(display_name=domain_name) if domain_name else None,
)
)
return topics
def count_topic_hierarchy(topic_names: list[str]) -> dict:
"""
Given a list of topic names, counts the occurrences of each topic and their hierarchy levels (subfield, field, domain) using the cache.
Arguments:
topic_names (List[str]): A list of topic names to count.
Returns:
dict: A dictionary containing the counts of each hierarchy level.
"""
cache = _load_topic_cache()
counts = {"topics": {}, "subfields": {}, "fields": {}, "domains": {}}
for name in topic_names:
data = cache.get(name)
if not data:
continue
counts["topics"][name] = counts["topics"].get(name, 0) + 1
subfield = data.get("subfield", "")
if subfield:
counts["subfields"][subfield] = counts["subfields"].get(subfield, 0) + 1
field = data.get("field", "")
if field:
counts["fields"][field] = counts["fields"].get(field, 0) + 1
domain = data.get("domain", "")
if domain:
counts["domains"][domain] = counts["domains"].get(domain, 0) + 1
return counts
def get_topic_hierarchy() -> dict:
"""
Builds and returns a hierarchical tree structure of topics:
Domains -> Fields -> Subfields -> Topics
"""
flat_cache = _load_topic_cache()
tree = {}
for topic_name, info in flat_cache.items():
domain = info.get("domain") or "Unbekannter Bereich"
field = info.get("field") or "Unbekanntes Feld"
subfield = info.get("subfield") or "Unbekanntes Teilfeld"
topic_id = info.get("topic_id", "")
# Clean topic ID to just be the trailing ID or keep full URL
# For querying, display name is used in persons search, but ID is useful
if domain not in tree:
tree[domain] = {}
if field not in tree[domain]:
tree[domain][field] = {}
if subfield not in tree[domain][field]:
tree[domain][field][subfield] = []
tree[domain][field][subfield].append({"id": topic_id, "name": topic_name})
formatted_domains = []
for d_name, d_fields in tree.items():
formatted_fields = []
for f_name, f_subfields in d_fields.items():
formatted_subfields = []
for sf_name, sf_topics in f_subfields.items():
sf_topics.sort(key=lambda x: x["name"])
formatted_subfields.append({"name": sf_name, "topics": sf_topics})
formatted_subfields.sort(key=lambda x: x["name"])
formatted_fields.append({"name": f_name, "subfields": formatted_subfields})
formatted_fields.sort(key=lambda x: x["name"])
formatted_domains.append({"name": d_name, "fields": formatted_fields})
formatted_domains.sort(key=lambda x: x["name"])
return {"domains": formatted_domains}
-3
View File
@@ -64,7 +64,6 @@ from inse.works.service import router as works_service_router
from inse.works.v2.router import router as works_v2_router
from . import config
from .service import router as service_router
logger = logging.getLogger(__name__)
@@ -119,8 +118,6 @@ app.include_router(patents_all_router)
app.include_router(keywords_service_router)
app.include_router(keywords_patents_router)
app.include_router(service_router)
app.include_router(auth_router)
app.include_router(account_management_router)
app.include_router(organization_management_router)
+2 -2
View File
@@ -108,10 +108,10 @@ class BundProject(BaseModel):
examples=["Deutschland"],
)
implementing_agency: str | None = Field(
executing_agency: str | None = Field(
default=None,
validation_alias="Ausführende Stelle",
description="The implementing agency of the project",
description="The executing agency of the project",
examples=[
"Universität Duisburg-Essen - Fachbereich Allgemeine Informatik - Lehrstuhl Networked Embedded Systems (NES)"
],
@@ -12,19 +12,89 @@ from inse.patents.common import model
from inse.patents.ipc_lookup import extract_ipc_symbol, parse_ipc_symbol
MAPPING_FILENAME = "ipc_openalex_topic_mapping.json"
TOPIC_CACHE_FILENAME = "topic_hierarchy_cache.json"
LEVELS = ("section", "class", "subclass", "group", "subgroup")
MATCH_LEVELS = ("subgroup", "group", "subclass")
@dataclass(frozen=True)
class MappedOpenAlexTopic:
topic_id: str
topic_display_name: str | None = None
subfield_id: str | None = None
field_id: str | None = None
domain_id: str | None = None
subfield_name: str | None = None
field_name: str | None = None
domain_name: str | None = None
ipc_level: str | None = None
ipc_symbol: str | None = None
# High-frequency IPC subclasses missing from the ES-built mapping file.
SUBCLASS_TOPIC_OVERRIDES: dict[str, str] = {
"A61B": "Cardiac electrophysiology and arrhythmias",
"A61K": "Pharmaceutical studies and practices",
"A61P": "Cancer Immunotherapy and Biomarkers",
"C07K": "Cancer Immunotherapy and Biomarkers",
"C12N": "Biotechnology and Related Fields",
"C12Q": "Cancer Immunotherapy and Biomarkers",
"G01N": "Analytical Methods in Pharmaceuticals",
SUBCLASS_TOPIC_OVERRIDES: dict[str, MappedOpenAlexTopic] = {
"A61B": MappedOpenAlexTopic(
topic_id="https://openalex.org/T10217",
topic_display_name="Cardiac electrophysiology and arrhythmias",
subfield_name="Cardiology and Cardiovascular Medicine",
field_name="Medicine",
domain_name="Health Sciences",
ipc_level="subclass",
ipc_symbol="A61B",
),
"A61K": MappedOpenAlexTopic(
topic_id="https://openalex.org/T12015",
topic_display_name="Pharmaceutical studies and practices",
subfield_name="Pharmacology",
field_name="Pharmacology, Toxicology and Pharmaceutics",
domain_name="Health Sciences",
ipc_level="subclass",
ipc_symbol="A61K",
),
"A61P": MappedOpenAlexTopic(
topic_id="https://openalex.org/T11537",
topic_display_name="Cancer Immunotherapy and Biomarkers",
subfield_name="Oncology",
field_name="Medicine",
domain_name="Health Sciences",
ipc_level="subclass",
ipc_symbol="A61P",
),
"C07K": MappedOpenAlexTopic(
topic_id="https://openalex.org/T11537",
topic_display_name="Cancer Immunotherapy and Biomarkers",
subfield_name="Oncology",
field_name="Medicine",
domain_name="Health Sciences",
ipc_level="subclass",
ipc_symbol="C07K",
),
"C12N": MappedOpenAlexTopic(
topic_id="https://openalex.org/T10041",
topic_display_name="Biotechnology and Related Fields",
subfield_name="Biotechnology",
field_name="Immunology and Microbiology",
domain_name="Life Sciences",
ipc_level="subclass",
ipc_symbol="C12N",
),
"C12Q": MappedOpenAlexTopic(
topic_id="https://openalex.org/T11537",
topic_display_name="Cancer Immunotherapy and Biomarkers",
subfield_name="Oncology",
field_name="Medicine",
domain_name="Health Sciences",
ipc_level="subclass",
ipc_symbol="C12Q",
),
"G01N": MappedOpenAlexTopic(
topic_id="https://openalex.org/T10487",
topic_display_name="Analytical Methods in Pharmaceuticals",
subfield_name="Analytical Chemistry",
field_name="Chemistry",
domain_name="Physical Sciences",
ipc_level="subclass",
ipc_symbol="G01N",
),
}
_TOPIC_LABEL_STOPWORDS = frozenset({
@@ -92,20 +162,6 @@ def _meaningful_topic_tokens(label: str) -> set[str]:
}
@dataclass(frozen=True)
class MappedOpenAlexTopic:
topic_id: str
topic_display_name: str | None = None
subfield_id: str | None = None
field_id: str | None = None
domain_id: str | None = None
subfield_name: str | None = None
field_name: str | None = None
domain_name: str | None = None
ipc_level: str | None = None
ipc_symbol: str | None = None
@dataclass(frozen=True)
class OpenAlexTopicRefs:
topic_ids: frozenset[str]
@@ -141,84 +197,11 @@ def _mapping_path() -> str:
return os.path.join(_data_dir(), MAPPING_FILENAME)
@lru_cache(maxsize=1)
def _load_topic_cache() -> dict[str, dict[str, str]]:
path = os.path.join(_data_dir(), TOPIC_CACHE_FILENAME)
try:
with open(path, encoding="utf-8") as handle:
raw = json.load(handle)
except (OSError, json.JSONDecodeError):
return {}
if not isinstance(raw, dict):
return {}
return {
display_name: {
"topic_id": str(info.get("topic_id", "")),
"subfield": info.get("subfield"),
"field": info.get("field"),
"domain": info.get("domain"),
}
for display_name, info in raw.items()
if isinstance(info, dict) and info.get("topic_id")
}
def _enrich_mapped_topic(mapped: MappedOpenAlexTopic) -> MappedOpenAlexTopic:
cache = _load_topic_cache()
topic_name = mapped.topic_display_name or ""
info = cache.get(topic_name)
if info is None:
for candidate in cache.values():
if candidate.get("topic_id") == mapped.topic_id:
info = candidate
break
if info is None:
return mapped
return MappedOpenAlexTopic(
topic_id=mapped.topic_id,
topic_display_name=mapped.topic_display_name or topic_name,
subfield_id=mapped.subfield_id,
field_id=mapped.field_id,
domain_id=mapped.domain_id,
subfield_name=info.get("subfield"),
field_name=info.get("field"),
domain_name=info.get("domain"),
ipc_level=mapped.ipc_level,
ipc_symbol=mapped.ipc_symbol,
)
def _mapped_from_topic_name(
topic_display_name: str,
*,
ipc_level: str,
ipc_symbol: str,
) -> MappedOpenAlexTopic | None:
cache = _load_topic_cache()
info = cache.get(topic_display_name)
if info is None:
return None
return _enrich_mapped_topic(
MappedOpenAlexTopic(
topic_id=info["topic_id"],
topic_display_name=topic_display_name,
ipc_level=ipc_level,
ipc_symbol=ipc_symbol,
)
)
def _apply_subclass_overrides(
parsed: dict[str, dict[str, MappedOpenAlexTopic]],
) -> None:
for symbol, topic_name in SUBCLASS_TOPIC_OVERRIDES.items():
mapped = _mapped_from_topic_name(
topic_name,
ipc_level="subclass",
ipc_symbol=_normalize_symbol(symbol),
)
if mapped is not None:
parsed["subclass"][_normalize_symbol(symbol)] = mapped
for symbol, mapped in SUBCLASS_TOPIC_OVERRIDES.items():
parsed["subclass"][_normalize_symbol(symbol)] = mapped
@lru_cache(maxsize=1)
@@ -239,19 +222,17 @@ def load_ipc_openalex_mapping() -> dict[str, dict[str, MappedOpenAlexTopic]]:
if not topic_id:
continue
normalized_symbol = _normalize_symbol(symbol)
mapped = _enrich_mapped_topic(
MappedOpenAlexTopic(
topic_id=str(topic_id),
topic_display_name=entry.get("topic_display_name"),
subfield_id=entry.get("subfield_id"),
field_id=entry.get("field_id"),
domain_id=entry.get("domain_id"),
subfield_name=entry.get("subfield"),
field_name=entry.get("field"),
domain_name=entry.get("domain"),
ipc_level=level,
ipc_symbol=normalized_symbol,
)
mapped = MappedOpenAlexTopic(
topic_id=str(topic_id),
topic_display_name=entry.get("topic_display_name"),
subfield_id=entry.get("subfield_id"),
field_id=entry.get("field_id"),
domain_id=entry.get("domain_id"),
subfield_name=entry.get("subfield"),
field_name=entry.get("field"),
domain_name=entry.get("domain"),
ipc_level=level,
ipc_symbol=normalized_symbol,
)
parsed[level][normalized_symbol] = mapped
_apply_subclass_overrides(parsed)
@@ -260,7 +241,6 @@ def load_ipc_openalex_mapping() -> dict[str, dict[str, MappedOpenAlexTopic]]:
def clear_mapping_cache() -> None:
load_ipc_openalex_mapping.cache_clear()
_load_topic_cache.cache_clear()
from inse.patents.patents_openalex_keywords.resolver import clear_resolver_caches
clear_resolver_caches()
@@ -9,7 +9,6 @@ from typing import Any
import httpx
from inse.patents.authors.ipc_openalex_mapping import (
_load_topic_cache,
normalize_openalex_id,
)
from inse.patents.common.elastic_search_client import MissingApiKeyError
@@ -65,17 +64,7 @@ def _topic_id_variants(topic_id: str | None) -> list[str]:
def _topic_id_variants_for_item(item: KeywordPatentSearchItem) -> list[str]:
variants = _topic_id_variants(item.topic_id)
if variants:
return variants
display_name = (item.topic_display_name or "").strip()
if display_name:
info = _load_topic_cache().get(display_name)
if info and info.get("topic_id"):
return _topic_id_variants(str(info["topic_id"]))
return []
return _topic_id_variants(item.topic_id)
def _weighted_score(
@@ -1086,19 +1086,12 @@ def test_json_lookup_resolves_topic_id_from_display_name(monkeypatch) -> None:
}
},
)
monkeypatch.setattr(
"inse.patents.keywords.reverse_lookup._load_topic_cache",
lambda: {
"Science and Climate Studies": {
"topic_id": "https://openalex.org/T14329",
}
},
)
clear_reverse_lookup_caches()
items = [
KeywordPatentSearchItem(
keyword="Science and Climate Studies",
topic_id="https://openalex.org/T14329",
topic_display_name="Science and Climate Studies",
relevance_score=1.0,
)
@@ -18,7 +18,6 @@ from inse.util import get_model
logger = logging.getLogger(__name__)
TOPIC_CACHE_FILENAME = "topic_hierarchy_cache.json"
MATCH_METHOD = "sentence_transformer"
TOPIC_VECTORS_INDEX = "topicvectors"
@@ -39,31 +38,6 @@ class KeywordCandidate:
topic_display_name: str | None = None
def _data_dir() -> Path:
return Path(__file__).resolve().parents[4] / "data"
def load_topic_cache(cache_path: Path | None = None) -> list[TopicCandidate]:
path = cache_path or (_data_dir() / TOPIC_CACHE_FILENAME)
with path.open(encoding="utf-8") as handle:
raw = json.load(handle)
topics: list[TopicCandidate] = []
for display_name, info in raw.items():
topic_id = info.get("topic_id")
if not topic_id:
continue
topics.append(
TopicCandidate(
topic_id=str(topic_id),
display_name=display_name,
subfield=info.get("subfield"),
field=info.get("field"),
domain=info.get("domain"),
)
)
return topics
def topic_embedding_text(topic: TopicCandidate) -> str:
parts = [topic.display_name]
for label in (topic.subfield, topic.field, topic.domain):
@@ -8,7 +8,6 @@ from functools import lru_cache
from inse.patents.authors.ipc_openalex_mapping import (
MappedOpenAlexTopic,
_enrich_mapped_topic,
load_ipc_openalex_mapping,
normalize_openalex_id,
resolve_mapped_topics_for_code,
@@ -91,16 +90,14 @@ def mapped_topics_from_index_doc(doc: dict) -> list[MappedOpenAlexTopic]:
continue
seen.add(key)
mapped.append(
_enrich_mapped_topic(
MappedOpenAlexTopic(
topic_id=str(topic_id),
topic_display_name=match.get("topic_display_name"),
subfield_name=match.get("subfield"),
field_name=match.get("field"),
domain_name=match.get("domain"),
ipc_level=ipc_level,
ipc_symbol=ipc_symbol,
)
MappedOpenAlexTopic(
topic_id=str(topic_id),
topic_display_name=match.get("topic_display_name"),
subfield_name=match.get("subfield"),
field_name=match.get("field"),
domain_name=match.get("domain"),
ipc_level=ipc_level,
ipc_symbol=ipc_symbol,
)
)
@@ -113,13 +110,11 @@ def mapped_topics_from_index_doc(doc: dict) -> list[MappedOpenAlexTopic]:
continue
seen.add(key)
mapped.append(
_enrich_mapped_topic(
MappedOpenAlexTopic(
topic_id=str(topic_id),
topic_display_name=match.get("topic_display_name"),
ipc_level=ipc_level,
ipc_symbol=ipc_symbol,
)
MappedOpenAlexTopic(
topic_id=str(topic_id),
topic_display_name=match.get("topic_display_name"),
ipc_level=ipc_level,
ipc_symbol=ipc_symbol,
)
)
+4 -4
View File
@@ -88,7 +88,7 @@ class BundProjectHighlight(BaseModel):
default_factory=list,
description='Highlights from the Elasticsearch field "Zuwendungsempfänger".',
)
implementing_agency: list[str] = Field(
executing_agency: list[str] = Field(
default_factory=list,
description='Highlights from the Elasticsearch field "Ausführende Stelle".',
)
@@ -146,7 +146,7 @@ class BundProjectSummary(BundProject):
place=source.get("Ort"),
state=source.get("Bundesland"),
country=source.get("Staat"),
implementing_agency=source.get("Ausführende Stelle"),
executing_agency=source.get("Ausführende Stelle"),
topic=source.get("Thema"),
performance_plan_system=source.get("Leistungsplansystematik"),
performance_plan_system_text=source.get(
@@ -205,7 +205,7 @@ class BundProjectSummary(BundProject):
recipient=cls._highlight_fragments(
raw_highlight.get("Zuwendungsempfänger")
),
implementing_agency=cls._highlight_fragments(
executing_agency=cls._highlight_fragments(
raw_highlight.get("Ausführende Stelle")
),
)
@@ -215,7 +215,7 @@ class BundProjectSummary(BundProject):
highlight.joint_project,
highlight.topic,
highlight.recipient,
highlight.implementing_agency,
highlight.executing_agency,
)
)
-84
View File
@@ -1,84 +0,0 @@
"""
This module contains the rest api of the
service.
"""
import logging
from typing import Annotated
from fastapi import APIRouter, Query
from inse.config import get_settings
from . import logic
logger = logging.getLogger(__name__)
### startup
settings = get_settings()
router = APIRouter(
prefix="/api/inse-service",
tags=["INSE Service"],
responses={404: {"description": "Not found"}},
)
### topics
# hierarchy cache (temporaray => should be called by a scheduled job, with new openalex data indexing)
@router.get(
"/topics/cache",
operation_id="buildTopicCache",
response_model=dict,
summary="Builds the topic hierarchy cache.",
tags=["Topics"],
)
def build_topic_cache(
page_size: Annotated[
int, Query(description="Page size for each search page.", ge=1, le=1000)
] = 200,
save_json: Annotated[
bool, Query(description="Persist cache JSON to data folder.")
] = True,
):
return logic.build_topic_cache(page_size=page_size, save_json=save_json)
@router.get(
"/topics/count",
operation_id="countTopicHierarchy",
response_model=dict,
summary="Counts topic hierarchy occurrences from cache.",
tags=["Topics"],
)
def count_topic_hierarchy(
topic_names: Annotated[
list[str],
Query(
alias="topic",
description="Topic names (repeat parameter).",
example=[
"Big Data and Business Intelligence",
"Big Data and Business Intelligence",
"Topic Modeling",
"Entrepreneurship Studies and Influences",
"Complex Network Analysis Techniques",
"Semantic Web and Ontologies",
],
),
],
):
return logic.count_topic_hierarchy(topic_names)
@router.get(
"/topics/hierarchy",
operation_id="getTopicHierarchy",
response_model=dict,
summary="Returns the nested topic hierarchy (Domains -> Fields -> Subfields -> Topics).",
tags=["Topics"],
)
def get_topic_hierarchy():
return logic.get_topic_hierarchy()
+2 -103
View File
@@ -1,111 +1,10 @@
from fastapi.testclient import TestClient
from inse.main import app
client = TestClient(app)
URL_SERVICE_PREFIX="/inse-service"
def test_redirect_root():
response = client.get("/", follow_redirects=False)
assert response.status_code == 307
# def test_get_person_by_id_success():
# mock_person = model.Person(
# id="A5093075883",
# name="Arman Arzani",
# works_count=6,
# cited_by_count=4,
# affiliations=[],
# topics=[]
# )
# with patch("inse.logic.get_person_by_id", return_value=mock_person):
# response = client.get(
# URL_SERVICE_PREFIX + "/persons/id",
# params={"author_id": "A5093075883"}
# )
# assert response.status_code == 200
# data = response.json()
# assert data["id"] == "A5093075883"
# assert data["name"] == "Arman Arzani"
# assert data["works_count"] == 6
# assert data["cited_by_count"] == 4
# def test_get_person_by_id_not_found():
# invalid_id = "INVALID"
# with patch(
# "inse.logic.get_person_by_id",
# side_effect=HTTPException(
# status_code=404,
# detail="Person with id INVALID not found"
# )
# ):
# response = client.get(
# URL_SERVICE_PREFIX + "/persons/id",
# params={"author_id": invalid_id}
# )
# assert response.status_code == 404
# def test_get_person_by_id_missing_query_param():
# response = client.get(URL_SERVICE_PREFIX + "/persons/id")
# assert response.status_code == 422
# def test_search_persons_by_name_success():
# mock_result = model.PersonSearchResult(
# persons=[
# model.Person(
# id="A5047117780",
# name="Pedro José Marrón",
# works_count=285,
# cited_by_count=2638,
# )
# ]
# )
# with patch(
# "inse.logic.search_persons_by_name",
# return_value=mock_result
# ):
# response = client.get(
# URL_SERVICE_PREFIX + "/persons/searchByName",
# params={"author_name": "Pedro José Marrón"}
# )
# assert response.status_code == 200
# data = response.json()
# assert "persons" in data
# assert data["persons"][0]["name"] == "Pedro José Marrón"
# def test_search_persons_by_name_empty_result():
# response = client.get(
# URL_SERVICE_PREFIX + "/persons/searchByName",
# params={"author_name": "zzzz_nonexistent_name_123"}
# )
# assert response.status_code == 200
# data = response.json()
# assert data["persons"] == []
# def test_search_persons_by_name_missing_query_param():
# response = client.get(URL_SERVICE_PREFIX + "/persons/searchByName")
# assert response.status_code == 422
assert response.status_code == 307
+23
View File
@@ -1,4 +1,5 @@
from enum import StrEnum
from pydantic import BaseModel
from inse.model import Page
from inse.models.openalex.topic import Topic
@@ -12,3 +13,25 @@ class TopicSortBy(StrEnum):
class TopicPageV2(Page[Topic]):
pass
class TopicHierarchySubfield(BaseModel):
id: str | None = None
name: str
topics: list[Topic] = []
class TopicHierarchyField(BaseModel):
id: str | None = None
name: str
subfields: list[TopicHierarchySubfield] = []
class TopicHierarchyDomain(BaseModel):
id: str | None = None
name: str
fields: list[TopicHierarchyField] = []
class TopicHierarchyResponse(BaseModel):
domains: list[TopicHierarchyDomain] = []
+14 -1
View File
@@ -10,7 +10,11 @@ from inse.models.openalex.subfield import Subfield
from inse.models.openalex.topic import Topic
from inse.router_prefixes import RouterPrefixes
from inse.tags import Tags
from inse.topics.v2.model import TopicPageV2, TopicSortBy
from inse.topics.v2.model import (
TopicHierarchyResponse,
TopicPageV2,
TopicSortBy,
)
logger = logging.getLogger(__name__)
@@ -18,6 +22,15 @@ logger = logging.getLogger(__name__)
router = APIRouter(prefix=RouterPrefixes.TOPICS_V2, tags=[Tags.TOPICS_V2])
@router.get(
"/hierarchy",
operation_id="getTopicHierarchy",
summary="Returns the full topic hierarchy tree (Domain -> Field -> Subfield -> Topics).",
)
async def get_topic_hierarchy() -> TopicHierarchyResponse:
return await topics_service.get_topic_hierarchy()
@router.get(
"/search",
operation_id="searchTopics",
+123 -1
View File
@@ -5,7 +5,14 @@ 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.topics.v2.model import TopicPageV2, TopicSortBy
from inse.topics.v2.model import (
TopicHierarchyDomain,
TopicHierarchyField,
TopicHierarchyResponse,
TopicHierarchySubfield,
TopicPageV2,
TopicSortBy,
)
async def _search_topics(
@@ -322,3 +329,118 @@ async def get_topics_by_ids(topic_ids: list[str]) -> TopicPageV2:
"domain",
],
)
_cached_hierarchy: TopicHierarchyResponse | None = None #cache is small, data is static => reduces database calls
def clear_topic_hierarchy_cache() -> None:
global _cached_hierarchy
_cached_hierarchy = None
async def get_topic_hierarchy() -> TopicHierarchyResponse:
"""Builds and returns a hierarchical tree structure of topics:
Domains -> Fields -> Subfields -> Topics
Data is dynamically streamed from Elasticsearch openalex-topics using PIT+search_after scan and cached in-memory.
"""
global _cached_hierarchy
if _cached_hierarchy is not None:
return _cached_hierarchy
domains_map: dict[str, dict] = {}
async for hit in elasticsearch.scan(
index=ESIndex.OPENALEX_TOPICS,
query={"match_all": {}},
source=[
"id",
"display_name",
"description",
"subfield",
"field",
"domain",
"works_count",
"cited_by_count",
],
page_size=2000,
):
source = hit.get("_source", {})
topic_name = source.get("display_name")
topic_id = source.get("id") or hit.get("_id")
if not topic_name or not topic_id:
continue
domain_info = source.get("domain") or {}
field_info = source.get("field") or {}
subfield_info = source.get("subfield") or {}
domain_name = domain_info.get("display_name") or "Unbekannter Bereich"
domain_id = domain_info.get("id")
field_name = field_info.get("display_name") or "Unbekanntes Feld"
field_id = field_info.get("id")
subfield_name = subfield_info.get("display_name") or "Unbekanntes Teilfeld"
subfield_id = subfield_info.get("id")
if domain_name not in domains_map:
domains_map[domain_name] = {
"id": domain_id,
"name": domain_name,
"fields": {},
}
fields_map = domains_map[domain_name]["fields"]
if field_name not in fields_map:
fields_map[field_name] = {
"id": field_id,
"name": field_name,
"subfields": {},
}
subfields_map = fields_map[field_name]["subfields"]
if subfield_name not in subfields_map:
subfields_map[subfield_name] = {
"id": subfield_id,
"name": subfield_name,
"topics": [],
}
topic_obj = Topic.from_dict(source) if hasattr(Topic, "from_dict") else Topic(**source)
subfields_map[subfield_name]["topics"].append(topic_obj)
formatted_domains: list[TopicHierarchyDomain] = []
for d_name, d_val in sorted(domains_map.items(), key=lambda x: x[0]):
formatted_fields: list[TopicHierarchyField] = []
for f_name, f_val in sorted(d_val["fields"].items(), key=lambda x: x[0]):
formatted_subfields: list[TopicHierarchySubfield] = []
for sf_name, sf_val in sorted(
f_val["subfields"].items(), key=lambda x: x[0]
):
sf_val["topics"].sort(
key=lambda t: t.display_name or ""
)
formatted_subfields.append(
TopicHierarchySubfield(
id=sf_val["id"],
name=sf_name,
topics=sf_val["topics"],
)
)
formatted_fields.append(
TopicHierarchyField(
id=f_val["id"],
name=f_name,
subfields=formatted_subfields,
)
)
formatted_domains.append(
TopicHierarchyDomain(
id=d_val["id"],
name=d_name,
fields=formatted_fields,
)
)
result = TopicHierarchyResponse(domains=formatted_domains)
_cached_hierarchy = result
return result
+9 -1
View File
@@ -14,7 +14,6 @@ api/dFGInstitutions.service.ts
api/dFGPersons.service.ts
api/dashboard.service.ts
api/funding.service.ts
api/iNSEService.service.ts
api/institutions.service.ts
api/institutionsV2.service.ts
api/keywords.service.ts
@@ -137,6 +136,7 @@ model/euProjectTopics.ts
model/extractedKeywords.ts
model/extractedKeywordsLLM.ts
model/extractedKeywordsResponse.ts
model/fieldNode.ts
model/fileUpload.ts
model/filterType.ts
model/fp7EurosciVoc.ts
@@ -244,6 +244,8 @@ model/projectsSortBy.ts
model/publicationDetailByFunder.ts
model/publicationIdsByAuthorPosition.ts
model/publicationType.ts
model/publicationTypeCount.ts
model/publicationTypeCountsRequest.ts
model/publicationsByAuthorResponse.ts
model/rankedAuthor.ts
model/rankingResponse.ts
@@ -257,6 +259,7 @@ model/startCollaborationGraphResponse.ts
model/subfield.ts
model/subfieldDomain.ts
model/subfieldField.ts
model/subfieldNode.ts
model/subfieldShare.ts
model/timespan.ts
model/tokenType.ts
@@ -275,7 +278,12 @@ model/topicHeatmapField.ts
model/topicHeatmapSubfield.ts
model/topicHeatmapTopic.ts
model/topicHeatmapValue.ts
model/topicHierarchyDomain.ts
model/topicHierarchyField.ts
model/topicHierarchyResponse.ts
model/topicHierarchySubfield.ts
model/topicIds.ts
model/topicNode.ts
model/topicPageV2.ts
model/topicSortBy.ts
model/topicSubfield.ts
-3
View File
@@ -18,8 +18,6 @@ export * from './dashboard.service';
import { DashboardService } from './dashboard.service';
export * from './funding.service';
import { FundingService } from './funding.service';
export * from './iNSEService.service';
import { INSEServiceService } from './iNSEService.service';
export * from './institutions.service';
import { InstitutionsService } from './institutions.service';
export * from './institutionsV2.service';
@@ -59,7 +57,6 @@ export const APIS = [
DFGPersonsService,
DashboardService,
FundingService,
INSEServiceService,
InstitutionsService,
InstitutionsV2Service,
KeywordsService,
+899
View File
@@ -320,6 +320,133 @@ export class DashboardService extends BaseService {
);
}
/**
* Dashboard Bund Project Topics
* @endpoint get /api/dashboard/projects/bund/topics
* @param fromYear
* @param toYear
* @param secureFgpAcc
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDashboardBundProjectTopics(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<BundProjectTopics>;
public getDashboardBundProjectTopics(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<BundProjectTopics>>;
public getDashboardBundProjectTopics(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<BundProjectTopics>>;
public getDashboardBundProjectTopics(
fromYear?: number,
toYear?: number,
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 });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>fromYear,
'from_year',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>toYear,
'to_year',
);
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dashboard/projects/bund/topics`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<BundProjectTopics>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Dashboard Dfg Project Statuses
* @endpoint get /api/dashboard/projects/dfg/status
@@ -828,6 +955,133 @@ export class DashboardService extends BaseService {
);
}
/**
* Dashboard Eu Project Topics
* @endpoint get /api/dashboard/projects/eu/topics
* @param fromYear
* @param toYear
* @param secureFgpAcc
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDashboardEuProjectTopics(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<EuProjectTopics>;
public getDashboardEuProjectTopics(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<EuProjectTopics>>;
public getDashboardEuProjectTopics(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<EuProjectTopics>>;
public getDashboardEuProjectTopics(
fromYear?: number,
toYear?: number,
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 });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>fromYear,
'from_year',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>toYear,
'to_year',
);
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dashboard/projects/eu/topics`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<EuProjectTopics>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Dashboard Eu Projects
* @endpoint get /api/dashboard/statistics/projects/eu
@@ -1577,6 +1831,651 @@ export class DashboardService extends BaseService {
);
}
/**
* Dashboard Top Eu Project Authors
* @endpoint get /api/dashboard/top-authors/eu-projects
* @param fromYear
* @param toYear
* @param secureFgpAcc
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDashboardTopEuProjectAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<TopAuthorAnalysis>;
public getDashboardTopEuProjectAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<TopAuthorAnalysis>>;
public getDashboardTopEuProjectAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<TopAuthorAnalysis>>;
public getDashboardTopEuProjectAuthors(
fromYear?: number,
toYear?: number,
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 });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>fromYear,
'from_year',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>toYear,
'to_year',
);
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dashboard/top-authors/eu-projects`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<TopAuthorAnalysis>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Dashboard Top News Authors
* @endpoint get /api/dashboard/top-authors/news
* @param fromYear
* @param toYear
* @param secureFgpAcc
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDashboardTopNewsAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<TopAuthorAnalysis>;
public getDashboardTopNewsAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<TopAuthorAnalysis>>;
public getDashboardTopNewsAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<TopAuthorAnalysis>>;
public getDashboardTopNewsAuthors(
fromYear?: number,
toYear?: number,
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 });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>fromYear,
'from_year',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>toYear,
'to_year',
);
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dashboard/top-authors/news`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<TopAuthorAnalysis>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Dashboard Top Patent Authors
* @endpoint get /api/dashboard/top-authors/patents
* @param fromYear
* @param toYear
* @param secureFgpAcc
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDashboardTopPatentAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<TopAuthorAnalysis>;
public getDashboardTopPatentAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<TopAuthorAnalysis>>;
public getDashboardTopPatentAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<TopAuthorAnalysis>>;
public getDashboardTopPatentAuthors(
fromYear?: number,
toYear?: number,
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 });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>fromYear,
'from_year',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>toYear,
'to_year',
);
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dashboard/top-authors/patents`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<TopAuthorAnalysis>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Dashboard Top Project Authors
* @endpoint get /api/dashboard/top-authors/projects
* @param fromYear
* @param toYear
* @param secureFgpAcc
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDashboardTopProjectAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<TopAuthorAnalysis>;
public getDashboardTopProjectAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<TopAuthorAnalysis>>;
public getDashboardTopProjectAuthors(
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<TopAuthorAnalysis>>;
public getDashboardTopProjectAuthors(
fromYear?: number,
toYear?: number,
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 });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>fromYear,
'from_year',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>toYear,
'to_year',
);
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dashboard/top-authors/projects`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<TopAuthorAnalysis>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Dashboard Top Work Authors
* @endpoint get /api/dashboard/top-authors/works
* @param worksPeriod
* @param fromYear
* @param toYear
* @param secureFgpAcc
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getDashboardTopWorkAuthors(
worksPeriod?: 'all_time' | 'last_5_years',
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<TopAuthorAnalysis>;
public getDashboardTopWorkAuthors(
worksPeriod?: 'all_time' | 'last_5_years',
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<TopAuthorAnalysis>>;
public getDashboardTopWorkAuthors(
worksPeriod?: 'all_time' | 'last_5_years',
fromYear?: number,
toYear?: number,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<TopAuthorAnalysis>>;
public getDashboardTopWorkAuthors(
worksPeriod?: 'all_time' | 'last_5_years',
fromYear?: number,
toYear?: number,
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 });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>worksPeriod,
'works_period',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>fromYear,
'from_year',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>toYear,
'to_year',
);
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/dashboard/top-authors/works`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<TopAuthorAnalysis>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Dashboard Topic Heatmap
* @endpoint get /api/dashboard/topic-heatmap
@@ -1,213 +0,0 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
@Injectable({
providedIn: 'root'
})
export class INSEServiceService extends BaseService {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
/**
* Builds the topic hierarchy cache.
* @endpoint get /api/inse-service/topics/cache
* @param pageSize Page size for each search page.
* @param saveJson Persist cache JSON to data folder.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
public buildTopicCache(pageSize?: number, saveJson?: boolean, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>pageSize, 'page_size');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>saveJson, 'save_json');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/topics/cache`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<object>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Counts topic hierarchy occurrences from cache.
* @endpoint get /api/inse-service/topics/count
* @param topic Topic names (repeat parameter).
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public countTopicHierarchy(topic: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
public countTopicHierarchy(topic: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
public countTopicHierarchy(topic: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
public countTopicHierarchy(topic: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (topic === null || topic === undefined) {
throw new Error('Required parameter topic was null or undefined when calling countTopicHierarchy.');
}
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
if (topic) {
topic.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'topic');
})
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/topics/count`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<object>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Returns the nested topic hierarchy (Domains -&gt; Fields -&gt; Subfields -&gt; Topics).
* @endpoint get /api/inse-service/topics/hierarchy
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getTopicHierarchy(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<object>;
public getTopicHierarchy(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<object>>;
public getTopicHierarchy(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<object>>;
public getTopicHierarchy(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/topics/hierarchy`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<object>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -89,6 +89,7 @@ export class ProjectsService extends BaseService {
* @param sortBy The field to sort by.
* @param sortDirection The sort direction (asc or desc).
* @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 reportProgress flag to report request and response progress.
*/
@@ -108,6 +109,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
@@ -132,6 +134,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
@@ -156,6 +159,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
@@ -180,6 +184,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: {
@@ -295,6 +300,14 @@ export class ProjectsService extends BaseService {
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
@@ -1575,6 +1588,7 @@ export class ProjectsService extends BaseService {
* @param sortBy Sort field.
* @param sortDirection Sort direction: asc or desc.
* @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 reportProgress flag to report request and response progress.
*/
@@ -1594,6 +1608,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
@@ -1618,6 +1633,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
@@ -1642,6 +1658,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
@@ -1666,6 +1683,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: {
@@ -1785,6 +1803,14 @@ export class ProjectsService extends BaseService {
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
@@ -1858,6 +1884,7 @@ export class ProjectsService extends BaseService {
* @param sortBy Sort field.
* @param sortDirection Sort direction: asc or desc.
* @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 reportProgress flag to report request and response progress.
*/
@@ -1883,6 +1910,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
@@ -1913,6 +1941,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
@@ -1943,6 +1972,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
@@ -1973,6 +2003,7 @@ export class ProjectsService extends BaseService {
sortBy?: string,
sortDirection?: string,
fuzzy?: boolean,
secureFgpAcc?: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: {
@@ -2142,6 +2173,14 @@ export class ProjectsService extends BaseService {
let localVarHeaders = this.defaultHeaders;
// authentication (HTTPBearer) required
localVarHeaders = this.configuration.addCredentialToHeaders(
'HTTPBearer',
'Authorization',
localVarHeaders,
'Bearer ',
);
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
File diff suppressed because it is too large Load Diff
@@ -35,6 +35,8 @@ import { Subfield } from '../model/subfield';
// @ts-ignore
import { Topic } from '../model/topic';
// @ts-ignore
import { TopicHierarchyResponse } from '../model/topicHierarchyResponse';
// @ts-ignore
import { TopicPageV2 } from '../model/topicPageV2';
// @ts-ignore
import { TopicSortBy } from '../model/topicSortBy';
@@ -564,6 +566,97 @@ export class TopicsV2Service extends BaseService {
});
}
/**
* Returns the full topic hierarchy tree (Domain -&gt; Field -&gt; Subfield -&gt; Topics).
* @endpoint get /api/topics/v2/hierarchy
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getTopicHierarchy(
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<TopicHierarchyResponse>;
public getTopicHierarchy(
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<TopicHierarchyResponse>>;
public getTopicHierarchy(
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<TopicHierarchyResponse>>;
public getTopicHierarchy(
observe: any = 'body',
reportProgress: boolean = false,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<any> {
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/topics/v2/hierarchy`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<TopicHierarchyResponse>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Returns a paginated list of topics for a given list of topic IDs.
* @endpoint get /api/topics/v2/topics/id
+3 -65
View File
@@ -7,70 +7,9 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { FieldNode } from './fieldNode';
import { SubfieldShare } from './subfieldShare';
/**
* A primary topic within a subfield.
*/
export interface TopicNode {
/**
* The OpenAlex ID of the primary topic.
*/
id: string;
/**
* The primary-topic display name.
*/
name: string;
/**
* Number of works whose primary topic is this topic.
*/
count: number;
}
/**
* A subfield within a field, with its primary topics.
*/
export interface SubfieldNode {
/**
* The OpenAlex ID of the subfield.
*/
id: string;
/**
* The subfield display name.
*/
name: string;
/**
* Number of works whose primary topic belongs to this subfield.
*/
count: number;
/**
* Primary topics within this subfield, largest first.
*/
topics: Array<TopicNode>;
}
/**
* A field with its subfields, top of the primary-topic hierarchy.
*/
export interface FieldNode {
/**
* The OpenAlex ID of the field.
*/
id: string;
/**
* The field display name.
*/
name: string;
/**
* Number of works whose primary topic belongs to this field.
*/
count: number;
/**
* Subfields within this field, largest first.
*/
subfields: Array<SubfieldNode>;
}
export interface AuthorTopicProfile {
/**
* The OpenAlex ID of the author.
@@ -109,8 +48,7 @@ export interface AuthorTopicProfile {
*/
subfields?: Array<SubfieldShare>;
/**
* Field -> subfield -> topic hierarchy over all works, by primary topic,
* each level largest first. Drives the interactive topic treemap.
* Field -> subfield -> topic hierarchy over all works, by primary topic, each level largest first. Drives the interactive topic treemap.
*/
field_tree: Array<FieldNode>;
field_tree?: Array<FieldNode>;
}
@@ -1,33 +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.
*/
/**
* Highlighted matching fragments from a BUND project search.
*/
export interface BundProjectHighlight {
/**
* Highlights from the Elasticsearch field \"Verbundprojekt\".
*/
joint_project?: Array<string>;
/**
* Highlights from the Elasticsearch field \"Thema\".
*/
topic?: Array<string>;
/**
* Highlights from the Elasticsearch field \"Zuwendungsempfänger\".
*/
recipient?: Array<string>;
/**
* Highlights from the Elasticsearch field \"Ausführende Stelle\".
*/
implementing_agency?: Array<string>;
export interface BundProjectHighlight {
/**
* Highlights from the Elasticsearch field \"Verbundprojekt\".
*/
joint_project?: Array<string>;
/**
* Highlights from the Elasticsearch field \"Thema\".
*/
topic?: Array<string>;
/**
* Highlights from the Elasticsearch field \"Zuwendungsempfänger\".
*/
recipient?: Array<string>;
/**
* Highlights from the Elasticsearch field \"Ausführende Stelle\".
*/
executing_agency?: Array<string>;
}
@@ -25,7 +25,7 @@ export interface BundProjectSummary {
place?: string | null;
state?: string | null;
country?: string | null;
implementing_agency?: string | null;
executing_agency?: string | null;
topic?: string | null;
performance_plan_system?: string | null;
performance_plan_system_text?: string | null;
+29
View File
@@ -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 { SubfieldNode } from './subfieldNode';
export interface FieldNode {
/**
* The OpenAlex ID of the field.
*/
id: string;
/**
* The field display name.
*/
name: string;
/**
* Number of works whose primary topic belongs to this field.
*/
count: number;
/**
* Subfields within this field, largest first.
*/
subfields?: Array<SubfieldNode>;
}
+7
View File
@@ -102,6 +102,7 @@ export * from './euProjectTopics';
export * from './extractedKeywords';
export * from './extractedKeywordsLLM';
export * from './extractedKeywordsResponse';
export * from './fieldNode';
export * from './fileUpload';
export * from './filterType';
export * from './fp7EurosciVoc';
@@ -223,6 +224,7 @@ export * from './startCollaborationGraphResponse';
export * from './subfield';
export * from './subfieldDomain';
export * from './subfieldField';
export * from './subfieldNode';
export * from './subfieldShare';
export * from './timespan';
export * from './tokenType';
@@ -241,7 +243,12 @@ export * from './topicHeatmapField';
export * from './topicHeatmapSubfield';
export * from './topicHeatmapTopic';
export * from './topicHeatmapValue';
export * from './topicHierarchyDomain';
export * from './topicHierarchyField';
export * from './topicHierarchyResponse';
export * from './topicHierarchySubfield';
export * from './topicIds';
export * from './topicNode';
export * from './topicPageV2';
export * from './topicSortBy';
export * from './topicSubfield';
+29
View File
@@ -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 { TopicNode } from './topicNode';
export interface SubfieldNode {
/**
* The OpenAlex ID of the subfield.
*/
id: string;
/**
* The subfield display name.
*/
name: string;
/**
* Number of works whose primary topic belongs to this subfield.
*/
count: number;
/**
* Primary topics within this subfield, largest first.
*/
topics?: Array<TopicNode>;
}
@@ -0,0 +1,16 @@
/**
* 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 { TopicHierarchyField } from './topicHierarchyField';
export interface TopicHierarchyDomain {
id?: string | null;
name: string;
fields?: Array<TopicHierarchyField>;
}
@@ -0,0 +1,16 @@
/**
* 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 { TopicHierarchySubfield } from './topicHierarchySubfield';
export interface TopicHierarchyField {
id?: string | null;
name: string;
subfields?: Array<TopicHierarchySubfield>;
}
@@ -0,0 +1,14 @@
/**
* 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 { TopicHierarchyDomain } from './topicHierarchyDomain';
export interface TopicHierarchyResponse {
domains?: Array<TopicHierarchyDomain>;
}
@@ -0,0 +1,16 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Topic } from './topic';
export interface TopicHierarchySubfield {
id?: string | null;
name: string;
topics?: Array<Topic>;
}
+24
View File
@@ -0,0 +1,24 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export interface TopicNode {
/**
* The OpenAlex ID of the primary topic.
*/
id: string;
/**
* The primary-topic display name.
*/
name: string;
/**
* Number of works whose primary topic is this topic.
*/
count: number;
}
+6 -2
View File
@@ -788,7 +788,9 @@ export const routes: Routes = [
},
runGuardsAndResolvers: (from, to) => {
return Object.values(workQueryParamKeys).some(
(key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
(key) =>
from.queryParamMap.getAll(key).join(',') !==
to.queryParamMap.getAll(key).join(','),
);
},
},
@@ -852,7 +854,9 @@ export const routes: Routes = [
),
runGuardsAndResolvers: (from, to) => {
return Object.values(workQueryParamKeys).some(
(key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
(key) =>
from.queryParamMap.getAll(key).join(',') !==
to.queryParamMap.getAll(key).join(','),
);
},
resolve: {
@@ -442,17 +442,17 @@ export class CompareAuthorsComponent implements OnInit {
institution_id: profile.author_id,
organization_name: profile.display_name,
years: [],
fields: profile.field_tree.map((field) => ({
fields: (profile.field_tree ?? []).map((field) => ({
id: field.id,
name: field.name,
total: field.count,
values: [],
subfields: field.subfields.map((subfield) => ({
subfields: (field.subfields ?? []).map((subfield) => ({
id: subfield.id,
name: subfield.name,
total: subfield.count,
values: [],
topics: subfield.topics.map((topic) => ({
topics: (subfield.topics ?? []).map((topic) => ({
id: topic.id,
name: topic.name,
total: topic.count,
@@ -1,7 +1,7 @@
import { Injectable, computed, signal } from '@angular/core';
import { KeywordEntryWithTopic } from '../../../api/model/keywordEntryWithTopic';
import { Topic } from '../../../api';
import { TopicHierarchyColorInput } from '../../../resolvers/utils/topic-colors';
export type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
export interface PatentKeywordEntry {
@@ -133,18 +133,63 @@ export class SearchResultsStateService {
const keyword = entry.llm_keyword?.keyword?.trim().toLowerCase();
const topic = entry.topic_mapping?.topic;
if (keyword && topic) {
map.set(keyword, topic);
map.set(this.normalize(keyword), topic);
}
}
return map;
});
private normalize(str: string): string {
return str.toLowerCase().replace(/[^a-z0-9]+/g, '');
}
private toTopicInput(topic: Topic): TopicHierarchyColorInput {
return {
id: topic.id,
name: topic.display_name,
field_id: topic.field?.id,
field_name: topic.field?.display_name,
domain_id: topic.domain?.id,
domain_name: topic.domain?.display_name,
};
}
// Resolve a topic for a given keyword term, using the following strategy:
// 1. Exact / case-insensitive match (cheap, most common case)
// 2. Normalized match — catches "machine learning" vs "machine-learning"
// 3. Last-resort fuzzy substring match, also normalized
public resolveTopicForTerm(term: string): TopicHierarchyColorInput | null {
const directMap = this.keywordTopicMap();
// 1. Exact / case-insensitive match (cheap, most common case)
const exact = directMap.get(term) ?? directMap.get(term.toLowerCase());
if (exact) return this.toTopicInput(exact);
// 2. Normalized match — catches "machine learning" vs "machine-learning"
const normalizedTerm = this.normalize(term);
if (normalizedTerm) {
const normalized = directMap.get(normalizedTerm);
if (normalized) return this.toTopicInput(normalized);
// 3. Last-resort fuzzy substring match, also normalized
for (const [keyword, mappedTopic] of directMap) {
const normalizedKeyword = this.normalize(keyword);
if (normalizedKeyword) {
if (
normalizedKeyword.includes(normalizedTerm) ||
normalizedTerm.includes(normalizedKeyword)
) {
return this.toTopicInput(mappedTopic);
}
}
}
}
return null;
}
// Parallel topic-name list for trend dashboard strategies. Entries
// without a resolvable keyword are skipped when building the lookup map
// so they can never collide on an `undefined` key and shadow a real one.
readonly topicsList = computed(() => {
const list = this.keywords()
.map((kw) => {
const normalized = kw.trim().toLowerCase();
const normalized = this.normalize(kw);
const entry = this.selectedKeywordEntries().find(
(e) =>
e.llm_keyword?.keyword?.trim().toLowerCase() === normalized ||
@@ -269,14 +269,16 @@
searchLabel="Suche nach Titel oder Patent-Nr." />
<ng-template #filtersTmp>
<div class="filter-row">
<mat-chip-listbox
[value]="selectedSources"
multiple
(change)="handleSourceChipChange($event)">
<mat-chip-option value="EPO">EPO</mat-chip-option>
<mat-chip-option value="USPTO">USPTO</mat-chip-option>
</mat-chip-listbox>
<div class="additional-filters">
<app-filter-card>
<mat-chip-listbox
[value]="selectedSources"
multiple
(change)="handleSourceChipChange($event)">
<mat-chip-option value="EPO">EPO</mat-chip-option>
<mat-chip-option value="USPTO">USPTO</mat-chip-option>
</mat-chip-listbox>
</app-filter-card>
<app-year-range-slider
class="patent-year-filter"
@@ -20,22 +20,27 @@ h1 {
gap: 0.5rem;
}
.filter-row {
.additional-filters {
display: flex;
justify-content: space-between;
align-items: center;
align-items: stretch;
flex-wrap: wrap;
gap: 1rem;
gap: 1.5rem;
padding: 0 1rem 1rem;
}
.patent-year-filter {
display: flex;
width: min(400px, 100%);
}
::ng-deep app-year-range-slider .year-filter {
height: 100%;
}
.mat-mdc-standard-chip {
border-radius: var(--sg-radius-sm);
}
.patent-year-filter {
width: min(285px, 100%);
}
.state-message {
display: flex;
align-items: center;
@@ -72,6 +77,13 @@ mat-paginator {
background-color: var(--sg-background);
}
:host {
::ng-deep .mat-mdc-card-header-text {
min-width: 0;
width: 100%;
}
}
.card {
padding: 0.5rem;
background-color: var(--sg-card-bg);
@@ -85,9 +97,16 @@ mat-paginator {
}
mat-card-title {
display: -webkit-box;
width: 100%;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
line-clamp: 3;
overflow: hidden;
font-size: 14px;
font-weight: 600;
line-height: 1.4;
height: calc(1.4em * 3);
color: var(--sg-text);
}
}
@@ -22,6 +22,7 @@ import {
CardSearchComponent,
Page,
} from '../../shared/ui/card-search/card-search.component';
import { FilterCardComponent } from '../../shared/ui/filter-card/filter-card.component';
type PatentSource = 'EPO' | 'USPTO';
@@ -54,6 +55,7 @@ const MIN_YEAR = 1978;
LoadingComponent,
YearRangeSliderComponent,
CardSearchComponent,
FilterCardComponent,
],
templateUrl: './patents.component.html',
styleUrl: './patents.component.scss',
@@ -22,7 +22,6 @@ import {
InstitutionsV2Service,
WorkTopic,
} from '../../api';
import { TopicsService } from '../../api/api/topics.service';
import { TopicHierarchyComponent } from '../topic-hierarchy/topic-hierarchy.component';
import { PersonCardComponent } from '../person-card/person-card.component';
import { CountryFlagComponent } from '../../shared/ui/country-flag/country-flag.component';
@@ -81,7 +80,6 @@ export class PersonListComponent {
private readonly router = inject(Router);
private readonly route = inject(ActivatedRoute);
private readonly personsService = inject(PersonsService);
private readonly topicsService = inject(TopicsService);
private readonly institutionsService = inject(InstitutionsService);
private readonly institutionsV2Service = inject(InstitutionsV2Service);
private readonly destroyRef = inject(DestroyRef);
@@ -18,13 +18,16 @@
</ng-template>
<ng-template #additionalFiltersTmp>
<mat-chip-listbox
[value]="urlChips()"
(change)="handleChipBoxChange($event)"
multiple
style="padding: 0rem 1rem">
<mat-chip-option value="eu">EU</mat-chip-option>
<mat-chip-option value="bund">BUND</mat-chip-option>
<mat-chip-option value="dfg">DFG</mat-chip-option>
</mat-chip-listbox>
<div class="additional-filters">
<app-filter-card>
<mat-chip-listbox
[value]="urlChips()"
(change)="handleChipBoxChange($event)"
multiple>
<mat-chip-option value="eu">EU</mat-chip-option>
<mat-chip-option value="bund">BUND</mat-chip-option>
<mat-chip-option value="dfg">DFG</mat-chip-option>
</mat-chip-listbox>
</app-filter-card>
</div>
</ng-template>
@@ -4,3 +4,12 @@
gap: 1rem;
padding: 1rem;
}
.additional-filters {
display: flex;
padding: 0 1rem;
app-filter-card {
min-height: 90px;
}
}
@@ -14,6 +14,7 @@ import {
Page,
} from '../../shared/ui/card-search/card-search.component';
import { FilterObserver } from '../../shared/ui/selected-filters/selected-filters.component';
import { FilterCardComponent } from '../../shared/ui/filter-card/filter-card.component';
@Component({
selector: 'app-projects',
@@ -26,6 +27,7 @@ import { FilterObserver } from '../../shared/ui/selected-filters/selected-filter
MatChipsModule,
CardSearchComponent,
AppProjectCardComponent,
FilterCardComponent,
],
templateUrl: './projects.component.html',
styleUrl: './projects.component.scss',
@@ -16,7 +16,10 @@
</div>
<ng-template #cardTmp let-work>
<app-publication-card [work]="work" />
<app-publication-card
[work]="work"
(topicChipClick)="filterByTopic($event)"
(authorChipClick)="filterByAuthor($event)" />
</ng-template>
<ng-template #additionalFiltersTmp>
@@ -1,8 +1,11 @@
import { Component, computed, input } from '@angular/core';
import { Component, computed, inject, input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import {
Author,
AuthorPage,
InstitutionPageV2,
SortDirection,
Topic,
TopicPageV2,
WorkPageV2,
WorkSortBy,
@@ -15,6 +18,7 @@ import { MatDivider } from '@angular/material/divider';
import { AppPublicationCardComponent } from '../../shared/ui/app-publication-card/app-publication-card.component';
import { PublicationFilterComponent } from '../../shared/ui/publication-filters/publication-filters.component';
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
@Component({
selector: 'app-publications',
@@ -28,6 +32,9 @@ import { SelectorOption } from '../../shared/ui/query-param-selector/query-param
styleUrl: './publications.component.scss',
})
export class PublicationsComponent {
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
workPage = input.required<WorkPageV2>();
selectedAuthorsPage = input.required<AuthorPage>();
selectedInstitutionsPage = input.required<InstitutionPageV2>();
@@ -48,4 +55,42 @@ export class PublicationsComponent {
{ value: SortDirection.Asc, display_name: 'Aufsteigend' },
{ value: SortDirection.Desc, display_name: 'Absteigend' },
];
filterByTopic(topic: Topic): void {
if (!topic.id) return;
const selectedTopicIds = this.route.snapshot.queryParamMap.getAll(
workQueryParamKeys.topicId,
);
const nextTopicIds = selectedTopicIds.includes(topic.id)
? selectedTopicIds.filter((id) => id !== topic.id)
: [...selectedTopicIds, topic.id];
this.router.navigate([], {
queryParams: {
[workQueryParamKeys.topicId]: nextTopicIds,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
}
filterByAuthor(author: Author): void {
if (!author.id) return;
const selectedAuthorIds = this.route.snapshot.queryParamMap.getAll(
workQueryParamKeys.authorId,
);
const nextAuthorIds = selectedAuthorIds.includes(author.id)
? selectedAuthorIds.filter((id) => id !== author.id)
: [...selectedAuthorIds, author.id];
this.router.navigate([], {
queryParams: {
[workQueryParamKeys.authorId]: nextAuthorIds,
[workQueryParamKeys.page]: 0,
},
queryParamsHandling: 'merge',
});
}
}
@@ -1,179 +1,242 @@
<div class="hierarchy-container">
@if (searchQuery()) {
<div
class="search-mode-selector"
style="
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 12px;
border-bottom: 1px solid rgba(0, 0, 0, 0.08);
padding-bottom: 8px;
">
<span
style="
font-size: 12px;
font-weight: 500;
color: var(--sg-text);
opacity: 0.8;
"
>Modus:</span
>
<mat-radio-group
[value]="searchType()"
(change)="onSearchTypeChange($event.value)"
style="display: flex; gap: 16px">
<mat-radio-button
#tooltipSem="matTooltip"
value="semantic"
matTooltip="Findet Themen mit ähnlicher Bedeutung, auch ohne exakte Übereinstimmung der Worte."
matTooltipPosition="above"
(focusin)="tooltipSem.show()"
(focusout)="tooltipSem.hide()">
<span style="font-size: 12px; color: var(--sg-text)">Ähnlich</span>
</mat-radio-button>
<mat-radio-button
#tooltipGen="matTooltip"
value="hybrid"
matTooltip="Sucht nach exakten Wortübereinstimmungen kombiniert mit Relevanzgewichtung."
matTooltipPosition="above"
(focusin)="tooltipGen.show()"
(focusout)="tooltipGen.hide()">
<span style="font-size: 12px; color: var(--sg-text)">Genau</span>
</mat-radio-button>
</mat-radio-group>
</div>
}
<div class="topic-hierarchy-container">
<!-- Loading state for initial hierarchy fetch -->
@if (loading()) {
<app-loading
text="Lade Themen..."
icon="folder_open"
[size]="48"
[diameter]="48" />
<div class="hierarchy-loading-state">
<app-loading></app-loading>
<span>Lade Themen-Hierarchie...</span>
</div>
} @else {
@if (searchQuery()) {
<!-- Flat Search Results Mode -->
<div class="search-results">
<span class="results-meta"
>{{ filteredFlatTopics.length }} Treffer</span
>
<div class="flat-list">
@for (topic of filteredFlatTopics; track topic.id) {
<div class="flat-row">
<mat-checkbox
#tooltip="matTooltip"
[checked]="selectedTopics().has(topic.name)"
(change)="toggleTopic(topic.name)"
[matTooltip]="topic.name"
matTooltipPosition="above"
(focusin)="tooltip.show()"
(focusout)="tooltip.hide()">
<span
class="field-dot"
[style.background]="getFieldColor(topic.fieldName)"
aria-hidden="true"></span>
<span class="topic-name">{{ topic.name }}</span>
</mat-checkbox>
<span class="topic-path" [title]="topic.path">{{
topic.path
}}</span>
</div>
} @empty {
<div class="empty-search">Keine passenden Themen.</div>
}
<!-- Top Action / Status Toolbar -->
<div class="hierarchy-toolbar">
@if (isSearching()) {
<!-- Search Mode Toggle (Exact / Semantic) -->
<div class="search-mode-selector">
<span class="mode-label">Modus:</span>
<mat-radio-group
[value]="searchType()"
(change)="onSearchTypeChange($event.value)"
class="mode-radio-group"
aria-label="Suchmodus">
<mat-radio-button value="hybrid">
<span class="radio-text">Genau</span>
</mat-radio-button>
<mat-radio-button value="semantic">
<span class="radio-text">Ähnlich</span>
</mat-radio-button>
</mat-radio-group>
</div>
} @else {
<!-- Tree Expansion Controls -->
<div class="tree-controls">
<button
type="button"
class="tree-control-btn"
(click)="expandAll()"
matTooltip="Alle Ebenen ausklappen"
aria-label="Alle Ebenen ausklappen">
<mat-icon>{{ UNFOLD_MORE_ICON }}</mat-icon>
<span>Alle ausklappen</span>
</button>
<button
type="button"
class="tree-control-btn"
(click)="collapseAll()"
matTooltip="Alle Ebenen einklappen"
aria-label="Alle Ebenen einklappen">
<mat-icon>{{ UNFOLD_LESS_ICON }}</mat-icon>
<span>Alle einklappen</span>
</button>
</div>
}
<!-- Selected Count Pill -->
@if (selectedCount() > 0) {
<div class="selected-badge">
<span>{{ selectedCount() }} ausgewählt</span>
<button
type="button"
class="clear-selection-btn"
(click)="clearSelection()"
matTooltip="Auswahl aufheben"
aria-label="Auswahl aufheben">
<mat-icon>{{ CLOSE_ICON }}</mat-icon>
</button>
</div>
}
</div>
<!-- MAIN CONTENT: Search Results View vs. Hierarchical Tree Traversal -->
@if (isSearching()) {
<!-- SEARCH RESULTS VIEW -->
<div class="search-results-list" role="list">
@if (searchLoading()) {
<div class="search-loading-state">
<app-loading></app-loading>
<span>Suche Themen...</span>
</div>
} @else if (searchResults().length === 0) {
<div class="empty-search-state">
<mat-icon>{{ SEARCH_OFF_ICON }}</mat-icon>
<p>Keine Themen für „{{ searchQuery() }}“ gefunden.</p>
</div>
} @else {
@for (
topic of searchResults();
track topic.id || topic.display_name
) {
<div
class="search-topic-row"
[class.is-selected]="isTopicSelected(topic)"
[appComponentTooltip]="AppTopicTooltipComponent"
[tooltipInputs]="{ topic: topic, topicId: topic.id }"
[tooltipMaxWidth]="'500px'"
(click)="toggleTopic(topic)">
<mat-checkbox
[checked]="isTopicSelected(topic)"
(change)="toggleTopic(topic)"
(click)="$event.stopPropagation()"
color="primary"
[attr.aria-label]="topic.display_name">
</mat-checkbox>
<div
class="field-color-indicator"
[style.background-color]="
getFieldColor(topic.field?.display_name)
"></div>
<div class="topic-info">
<span class="topic-name">{{ topic.display_name }}</span>
@if (getTopicBreadcrumb(topic)) {
<span class="topic-breadcrumb">{{
getTopicBreadcrumb(topic)
}}</span>
}
</div>
@if (topic.works_count) {
<span
class="works-badge"
[matTooltip]="topic.works_count + ' Publikationen'">
{{ topic.works_count | number }}
</span>
}
</div>
}
}
</div>
} @else {
<!-- Embedded Multi-Nested Hierarchy Tree Mode -->
<div class="tree-root">
@for (domain of domains; track domain.name) {
<!-- LEVEL 1: Domain -->
<div class="tree-node domain-node">
<!-- HIERARCHICAL TREE TRAVERSAL VIEW -->
<div class="hierarchy-tree" role="tree">
@for (
domain of hierarchy()?.domains ?? [];
track domain.id || domain.name
) {
<div class="domain-node">
<!-- Domain Header (Level 1) -->
<button
type="button"
class="node-header domain-header"
(click)="toggleDomain(domain.name)">
<mat-icon class="toggle-icon">
{{
expandedDomains.has(domain.name)
? 'expand_more'
: 'chevron_right'
}}
</mat-icon>
(click)="toggleDomain(domain.name)"
[attr.aria-expanded]="expandedDomains().has(domain.name)">
<span class="node-title domain-title">{{ domain.name }}</span>
<span class="node-count-badge">{{
getDomainTopicCount(domain)
}}</span>
<mat-icon class="chevron-icon">{{ CHEVRON_RIGHT_ICON }}</mat-icon>
</button>
@if (expandedDomains.has(domain.name)) {
<div class="node-children domain-children">
@for (field of domain.fields; track field.name) {
<!-- LEVEL 2: Field -->
<div class="tree-node field-node">
<!-- Fields Container -->
@if (expandedDomains().has(domain.name)) {
<div class="domain-children">
@for (field of domain.fields; track field.id || field.name) {
<div class="field-node">
<!-- Field Header (Level 2) -->
<button
type="button"
class="node-header field-header"
(click)="toggleField(field.name)">
<mat-icon class="toggle-icon">
{{
expandedFields.has(field.name)
? 'expand_more'
: 'chevron_right'
}}
</mat-icon>
(click)="toggleField(field.name)"
[attr.aria-expanded]="expandedFields().has(field.name)">
<span
class="field-dot"
[style.background]="getFieldColor(field.name)"
aria-hidden="true"></span>
[style.background-color]="getFieldColor(field.name)">
</span>
<span class="node-title field-title">{{
field.name
}}</span>
<span class="node-count-badge">{{
getFieldTopicCount(field)
}}</span>
<mat-icon class="chevron-icon">{{
CHEVRON_RIGHT_ICON
}}</mat-icon>
</button>
@if (expandedFields.has(field.name)) {
<div class="node-children field-children">
<!-- Subfields Container -->
@if (expandedFields().has(field.name)) {
<div class="field-children">
@for (
subfield of field.subfields;
track subfield.name
track subfield.id || subfield.name
) {
<!-- LEVEL 3: Subfield -->
<div class="tree-node subfield-node">
<div class="subfield-node">
<!-- Subfield Header (Level 3) -->
<button
type="button"
class="node-header subfield-header"
(click)="toggleSubfield(subfield.name)">
<mat-icon class="toggle-icon">
{{
expandedSubfields.has(subfield.name)
? 'expand_more'
: 'chevron_right'
}}
</mat-icon>
<mat-icon class="folder-icon"
>folder_open</mat-icon
>
(click)="toggleSubfield(subfield.name)"
[attr.aria-expanded]="
expandedSubfields().has(subfield.name)
">
<span class="node-title subfield-title">{{
subfield.name
}}</span>
<span class="node-count-badge">{{
getSubfieldTopicCount(subfield)
}}</span>
<mat-icon class="chevron-icon">{{
CHEVRON_RIGHT_ICON
}}</mat-icon>
</button>
@if (expandedSubfields.has(subfield.name)) {
<div class="node-children subfield-children">
<!-- Topics Leaf List (Level 4) -->
@if (expandedSubfields().has(subfield.name)) {
<div class="subfield-children" role="group">
@for (
topic of subfield.topics;
track topic.id
track topic.id || topic.display_name
) {
<!-- LEVEL 4: Topic Checkbox -->
<div class="tree-leaf topic-node">
<div
class="topic-leaf-row"
[class.is-selected]="isTopicSelected(topic)"
[appComponentTooltip]="
AppTopicTooltipComponent
"
[tooltipInputs]="{
topic: topic,
topicId: topic.id,
}"
[tooltipMaxWidth]="'500px'"
(click)="toggleTopic(topic)">
<mat-checkbox
#tooltip="matTooltip"
[checked]="
selectedTopics().has(topic.name)
"
(change)="toggleTopic(topic.name)"
[matTooltip]="topic.name"
matTooltipPosition="above"
(focusin)="tooltip.show()"
(focusout)="tooltip.hide()">
<span class="topic-label">{{
topic.name
}}</span>
[checked]="isTopicSelected(topic)"
(change)="toggleTopic(topic)"
(click)="$event.stopPropagation()"
color="primary"
[attr.aria-label]="topic.display_name">
</mat-checkbox>
<span class="topic-leaf-name">{{
topic.display_name
}}</span>
@if (topic.works_count) {
<span
class="works-badge"
[matTooltip]="
topic.works_count + ' Publikationen'
">
{{ topic.works_count | number }}
</span>
}
</div>
}
</div>
@@ -1,229 +1,444 @@
.hierarchy-container {
.topic-hierarchy-container {
display: flex;
flex-direction: column;
width: 100%;
max-height: 400px;
overflow-y: auto;
overflow-x: hidden;
max-height: 480px;
background: var(--sg-surface);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: var(--sg-background);
padding: 4px 8px 4px 4px;
margin-top: 4px;
border-radius: var(--sg-radius-md, 8px);
padding: 8px;
box-sizing: border-box;
overflow: hidden;
}
/* Flat Search Results Styles */
.search-results {
/* Toolbar */
.hierarchy-toolbar {
display: flex;
flex-direction: column;
gap: 4px;
padding: 4px;
}
.results-meta {
font-size: 11px;
font-weight: 600;
color: var(--sg-text-muted);
text-transform: uppercase;
padding-left: 4px;
}
.flat-list {
display: flex;
flex-direction: column;
gap: 4px;
}
.flat-row {
display: flex;
flex-direction: column;
padding: 6px;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 4px 6px 8px 6px;
border-bottom: 1px solid var(--sg-border-soft);
margin-bottom: 6px;
flex-shrink: 0;
flex-wrap: wrap;
&:last-child {
border-bottom: none;
.search-mode-selector {
display: flex;
align-items: center;
gap: 8px;
.mode-label {
font-size: 11px;
font-weight: 600;
color: var(--sg-text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.mode-radio-group {
display: flex;
gap: 8px;
.radio-text {
font-size: 12px;
color: var(--sg-text);
}
}
}
.topic-name {
font-size: 12px;
color: var(--sg-text);
font-weight: 500;
display: block;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.tree-controls {
display: flex;
align-items: center;
gap: 6px;
.tree-control-btn {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 8px;
background: var(--sg-surface-soft);
border: 1px solid var(--sg-border-soft);
border-radius: var(--sg-radius-sm, 4px);
font-size: 11px;
font-weight: 500;
color: var(--sg-text-muted);
cursor: pointer;
transition: all 0.15s ease;
mat-icon {
font-size: 14px;
width: 14px;
height: 14px;
}
&:hover {
background: var(--sg-surface-hover, var(--sg-border-soft));
color: var(--sg-text);
}
}
}
.topic-path {
font-size: 10px;
color: var(--sg-text-soft);
padding-left: 28px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
.selected-badge {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 8px;
background: color-mix(in srgb, var(--sg-primary) 14%, transparent);
color: var(--sg-primary);
border: 1px solid color-mix(in srgb, var(--sg-primary) 30%, transparent);
border-radius: 12px;
font-size: 11px;
font-weight: 600;
.clear-selection-btn {
display: inline-flex;
align-items: center;
justify-content: center;
background: transparent;
border: none;
color: inherit;
cursor: pointer;
padding: 0;
width: 14px;
height: 14px;
mat-icon {
font-size: 12px;
width: 12px;
height: 12px;
}
&:hover {
opacity: 0.8;
}
}
}
}
.empty-search {
padding: 16px;
/* Loading & Empty States */
.hierarchy-loading-state,
.search-loading-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
padding: 32px 16px;
font-size: 12px;
color: var(--sg-text-muted);
text-align: center;
}
/* Hierarchy Tree Styles */
.tree-root {
.empty-search-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 32px 16px;
color: var(--sg-text-muted);
text-align: center;
mat-icon {
font-size: 28px;
width: 28px;
height: 28px;
opacity: 0.6;
}
p {
margin: 0;
font-size: 12px;
}
}
/* Scrollable Tree & Search Containers */
.hierarchy-tree,
.search-results-list {
display: flex;
flex-direction: column;
gap: 2px;
overflow-y: auto;
overflow-x: hidden;
padding-right: 2px;
flex: 1;
&::-webkit-scrollbar {
width: 5px;
}
&::-webkit-scrollbar-thumb {
background: var(--sg-border-soft);
border-radius: 4px;
}
&::-webkit-scrollbar-thumb:hover {
background: var(--sg-border-strong, var(--sg-text-muted));
}
}
.tree-node {
display: flex;
flex-direction: column;
}
.field-dot {
flex: 0 0 auto;
display: inline-block;
vertical-align: middle;
width: 9px;
height: 9px;
margin-right: 7px;
border-radius: 50%;
border: 1px solid var(--sg-color-mix-base);
box-shadow: 0 0 0 1px var(--sg-border-strong);
}
/* Node Headers Shared Styles */
.node-header {
display: flex;
align-items: center;
width: 100%;
background: transparent;
padding: 5px 8px;
border: none;
padding: 4px;
text-align: left;
background: transparent;
border-radius: var(--sg-radius-sm, 4px);
cursor: pointer;
border-radius: 4px;
color: var(--sg-text);
text-align: left;
transition: background 0.15s ease;
user-select: none;
box-sizing: border-box;
&:hover {
background: var(--sg-surface-soft);
}
.toggle-icon {
.node-title {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-right: 6px;
}
.node-count-badge {
font-size: 10.5px;
font-weight: 500;
color: var(--sg-text-muted);
background: var(--sg-surface-soft);
padding: 1px 6px;
border-radius: 10px;
margin-right: 4px;
flex-shrink: 0;
}
.chevron-icon {
font-size: 16px;
width: 16px;
height: 16px;
color: var(--sg-text-soft);
margin-right: 2px;
color: var(--sg-text-muted);
flex-shrink: 0;
transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}
.folder-icon {
font-size: 14px;
width: 14px;
height: 14px;
color: var(--sg-primary-soft);
margin-right: 4px;
}
.node-title {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
min-width: 0;
&[aria-expanded='true'] .chevron-icon {
transform: rotate(90deg);
}
}
.domain-header {
padding-top: 6px;
padding-bottom: 6px;
/* Level 1: Domain */
.domain-node {
margin-bottom: 2px;
.domain-title {
font-size: 12px;
.domain-header {
background: var(--sg-surface-soft);
font-weight: 600;
color: var(--sg-text);
padding: 6px 8px;
.domain-title {
font-size: 12.5px;
}
&:hover {
background: var(
--sg-surface-hover,
color-mix(in srgb, var(--sg-surface-soft) 80%, var(--sg-border))
);
}
}
.domain-children {
display: flex;
flex-direction: column;
gap: 2px;
padding-left: 10px;
margin-left: 8px;
border-left: 1.5px solid var(--sg-border-soft);
margin-top: 3px;
margin-bottom: 4px;
}
}
.field-header {
.field-title {
font-size: 11.5px;
font-weight: 500;
color: var(--sg-text-muted);
/* Level 2: Field */
.field-node {
.field-header {
padding: 4px 6px;
.field-dot {
width: 8px;
height: 8px;
border-radius: 50%;
margin-right: 8px;
flex-shrink: 0;
box-shadow: 0 0 0 1px var(--sg-border-strong);
}
.field-title {
font-size: 12px;
font-weight: 500;
color: var(--sg-text);
}
}
.field-children {
display: flex;
flex-direction: column;
gap: 2px;
padding-left: 10px;
margin-left: 6px;
border-left: 1.5px solid var(--sg-border-soft);
margin-top: 2px;
margin-bottom: 2px;
}
}
.subfield-header {
.subfield-title {
font-size: 11px;
color: var(--sg-text-muted);
/* Level 3: Subfield */
.subfield-node {
.subfield-header {
padding: 3px 6px;
.subfield-title {
font-size: 11.5px;
font-weight: 500;
color: var(--sg-text);
}
}
.subfield-children {
display: flex;
flex-direction: column;
gap: 1px;
padding-left: 8px;
margin-left: 6px;
border-left: 1.5px solid var(--sg-border-soft);
margin-top: 2px;
margin-bottom: 2px;
}
}
.node-children {
/* Level 4: Topic Leaf Row */
.topic-leaf-row {
display: flex;
flex-direction: column;
gap: 2px;
}
align-items: center;
gap: 6px;
padding: 3px 6px;
border-radius: var(--sg-radius-sm, 4px);
cursor: pointer;
transition: background 0.12s ease;
.domain-children {
padding-left: 10px;
border-left: 1px solid var(--sg-border-soft);
margin-left: 12px;
margin-bottom: 4px;
}
&:hover {
background: var(--sg-surface-soft);
}
.field-children {
padding-left: 10px;
border-left: 1px solid var(--sg-border-soft);
margin-left: 12px;
}
&.is-selected {
background: color-mix(in srgb, var(--sg-primary) 10%, transparent);
.subfield-children {
padding-left: 10px;
border-left: 1px dashed var(--sg-border-soft);
margin-left: 12px;
margin-bottom: 2px;
}
.topic-leaf-name {
color: var(--sg-primary);
font-weight: 500;
}
}
.tree-leaf {
padding: 2px 4px;
width: 100%;
box-sizing: border-box;
}
::ng-deep .mat-mdc-checkbox {
margin: 0;
padding: 0;
--mdc-checkbox-state-layer-size: 24px;
}
.topic-node {
width: 100%;
box-sizing: border-box;
.topic-label {
font-size: 11px;
.topic-leaf-name {
flex: 1;
font-size: 11.5px;
color: var(--sg-text);
display: block;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
mat-checkbox {
display: block !important;
width: 100% !important;
::ng-deep {
.mdc-form-field {
width: 100% !important;
display: flex !important;
align-items: center;
.works-badge {
font-size: 10px;
color: var(--sg-text-muted);
background: var(--sg-surface-soft);
padding: 1px 5px;
border-radius: 8px;
flex-shrink: 0;
}
}
/* Search Results Row */
.search-topic-row {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 8px;
border-radius: var(--sg-radius-sm, 4px);
border-bottom: 1px solid var(--sg-border-soft);
cursor: pointer;
transition: background 0.15s ease;
&:last-child {
border-bottom: none;
}
&:hover {
background: var(--sg-surface-soft);
}
&.is-selected {
background: color-mix(in srgb, var(--sg-primary) 10%, transparent);
.topic-info .topic-name {
color: var(--sg-primary);
font-weight: 600;
}
}
::ng-deep .mat-mdc-checkbox {
margin: 0;
padding: 0;
--mdc-checkbox-state-layer-size: 24px;
}
.field-color-indicator {
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
box-shadow: 0 0 0 1px var(--sg-border-strong);
}
.topic-info {
display: flex;
flex-direction: column;
flex: 1;
min-width: 0;
.topic-name {
font-size: 12px;
font-weight: 500;
color: var(--sg-text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mdc-label {
flex: 1 !important;
min-width: 0 !important;
.topic-breadcrumb {
font-size: 10px;
color: var(--sg-text-muted);
overflow: hidden;
padding-left: 8px !important;
text-overflow: ellipsis;
white-space: nowrap;
margin-top: 1px;
}
}
.works-badge {
font-size: 10.5px;
color: var(--sg-text-muted);
background: var(--sg-surface-soft);
padding: 2px 6px;
border-radius: 10px;
flex-shrink: 0;
}
}
@@ -1,22 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TopicHierarchyComponent } from './topic-hierarchy.component';
describe('TopicHierarchyComponent', () => {
let component: TopicHierarchyComponent;
let fixture: ComponentFixture<TopicHierarchyComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TopicHierarchyComponent],
}).compileComponents();
fixture = TestBed.createComponent(TopicHierarchyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,47 +1,49 @@
import { Component, input, model, output, OnInit, signal } from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
DestroyRef,
OnInit,
computed,
inject,
input,
model,
output,
signal,
} from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatIconModule } from '@angular/material/icon';
import { MatRadioModule } from '@angular/material/radio';
import { MatTooltipModule } from '@angular/material/tooltip';
import { TopicsService } from '../../api/api/topics.service';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
import { combineLatest, of } from 'rxjs';
import { toObservable } from '@angular/core/rxjs-interop';
import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
import {
catchError,
debounceTime,
distinctUntilChanged,
switchMap,
catchError,
} from 'rxjs/operators';
export interface TopicItem {
id: string;
name: string;
}
export interface SubfieldNode {
name: string;
topics: TopicItem[];
}
export interface FieldNode {
name: string;
subfields: SubfieldNode[];
}
export interface DomainNode {
name: string;
fields: FieldNode[];
}
interface FlatTopic {
id: string;
name: string;
path: string;
fieldName: string;
}
import { TopicsService } from '../../api/api/topics.service';
import { TopicsV2Service } from '../../api/api/topicsV2.service';
import {
Topic,
TopicHierarchyDomain,
TopicHierarchyField,
TopicHierarchyResponse,
TopicHierarchySubfield,
} from '../../api/model/models';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive';
import { AppTopicTooltipComponent } from '../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
import {
CHEVRON_RIGHT_ICON,
CLOSE_ICON,
SEARCH_OFF_ICON,
UNFOLD_LESS_ICON,
UNFOLD_MORE_ICON,
} from '../../shared/ui/icons';
@Component({
selector: 'app-topic-hierarchy',
@@ -53,87 +55,131 @@ interface FlatTopic {
MatRadioModule,
MatTooltipModule,
LoadingComponent,
ComponentTooltipDirective,
],
templateUrl: './topic-hierarchy.component.html',
styleUrl: './topic-hierarchy.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TopicHierarchyComponent implements OnInit {
selectedTopics = input<Set<string>>(new Set<string>());
searchQuery = input<string>('');
searchType = model<'hybrid' | 'semantic'>('hybrid');
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
readonly CHEVRON_RIGHT_ICON = CHEVRON_RIGHT_ICON;
readonly CLOSE_ICON = CLOSE_ICON;
readonly SEARCH_OFF_ICON = SEARCH_OFF_ICON;
readonly UNFOLD_LESS_ICON = UNFOLD_LESS_ICON;
readonly UNFOLD_MORE_ICON = UNFOLD_MORE_ICON;
selectionChange = output<Set<string>>();
private readonly topicsService = inject(TopicsService);
private readonly topicsV2Service = inject(TopicsV2Service);
private readonly destroyRef = inject(DestroyRef);
domains: DomainNode[] = [];
flatTopics: FlatTopic[] = [];
filteredFlatTopics: FlatTopic[] = [];
loading = signal(true);
// Inputs and outputs as Angular v21 signals
readonly selectedTopics = input<Set<string>>(new Set<string>());
readonly searchQuery = input<string>('');
readonly searchType = model<'hybrid' | 'semantic'>('hybrid');
readonly selectionChange = output<Set<string>>();
// Set of names of expanded nodes (lazy content rendering)
expandedDomains = new Set<string>();
expandedFields = new Set<string>();
expandedSubfields = new Set<string>();
// Hierarchy tree state
readonly hierarchy = signal<TopicHierarchyResponse | null>(null);
readonly loading = signal<boolean>(true);
readonly searchLoading = signal<boolean>(false);
constructor(private topicsService: TopicsService) {
// Tree expansion state
readonly expandedDomains = signal<Set<string>>(new Set<string>());
readonly expandedFields = signal<Set<string>>(new Set<string>());
readonly expandedSubfields = signal<Set<string>>(new Set<string>());
// Search results
readonly searchResults = signal<Topic[]>([]);
// Computed state
readonly isSearching = computed(() => {
const q = this.searchQuery();
return !!q && q.trim().length >= 2;
});
readonly selectedCount = computed(() => this.selectedTopics().size);
readonly allTopics = computed<Topic[]>(() => {
const data = this.hierarchy();
if (!data?.domains) return [];
const result: Topic[] = [];
for (const domain of data.domains) {
for (const field of domain.fields ?? []) {
for (const subfield of field.subfields ?? []) {
for (const topic of subfield.topics ?? []) {
result.push(topic);
}
}
}
}
return result;
});
constructor() {
combineLatest([
toObservable(this.searchQuery),
toObservable(this.searchType),
])
.pipe(
debounceTime(300),
debounceTime(250),
distinctUntilChanged(
(prev, curr) => prev[0] === curr[0] && prev[1] === curr[1],
),
switchMap(([query, searchType]) => {
if (!query || query.length < 2) {
this.filteredFlatTopics = [];
return of({ results: [] });
if (!query || query.trim().length < 2) {
this.searchResults.set([]);
this.searchLoading.set(false);
return of<Topic[]>([]);
}
this.loading.set(true);
this.searchLoading.set(true);
return this.topicsService
.vectorSearchTopics(query, 50, searchType)
.vectorSearchTopics(query.trim(), 50, searchType)
.pipe(
switchMap((res) => {
const results = (res?.results || []) as Topic[];
return of(results);
}),
catchError((err) => {
console.error('Error in semantic topic search:', err);
// Fallback to local filtering
const q = query.toLowerCase();
this.filteredFlatTopics = this.flatTopics.filter(
(t) =>
t.name.toLowerCase().includes(q) ||
t.path.toLowerCase().includes(q),
console.error(
'Error in vector topic search, falling back to local search:',
err,
);
return of({ results: [] });
const q = query.trim().toLowerCase();
const matched = this.allTopics().filter(
(t) =>
(t.display_name &&
t.display_name.toLowerCase().includes(q)) ||
(t.description &&
t.description.toLowerCase().includes(q)) ||
(t.subfield?.display_name &&
t.subfield.display_name.toLowerCase().includes(q)) ||
(t.field?.display_name &&
t.field.display_name.toLowerCase().includes(q)) ||
(t.domain?.display_name &&
t.domain.display_name.toLowerCase().includes(q)),
);
return of(matched);
}),
);
}),
takeUntilDestroyed(this.destroyRef),
)
.subscribe((response) => {
this.loading.set(false);
if (response && response.results) {
this.filteredFlatTopics = response.results.map((topic) => {
const parts = [];
if (topic.domain?.display_name)
parts.push(topic.domain.display_name);
if (topic.field?.display_name) parts.push(topic.field.display_name);
if (topic.subfield?.display_name)
parts.push(topic.subfield.display_name);
return {
id: topic.id || '',
name: topic.display_name || '',
path:
parts.length > 0 ? parts.join(' > ') : topic.description || '',
fieldName: topic.field?.display_name || '',
};
});
}
.subscribe((topics) => {
this.searchResults.set(topics);
this.searchLoading.set(false);
});
}
ngOnInit(): void {
this.topicsService.getTopicHierarchy().subscribe({
next: (res: any) => {
this.domains = res.domains || [];
this.flattenTopics(this.domains);
this.loadHierarchy();
}
loadHierarchy(): void {
this.loading.set(true);
this.topicsV2Service.getTopicHierarchy().subscribe({
next: (res) => {
this.hierarchy.set(res);
this.loading.set(false);
},
error: (err) => {
@@ -143,25 +189,85 @@ export class TopicHierarchyComponent implements OnInit {
});
}
flattenTopics(domains: DomainNode[]): void {
const flat: FlatTopic[] = [];
domains.forEach((domain) => {
domain.fields?.forEach((field) => {
field.subfields?.forEach((subfield) => {
subfield.topics?.forEach((topic) => {
if (topic.name && topic.id) {
flat.push({
id: topic.id,
name: topic.name,
path: `${domain.name} > ${field.name} > ${subfield.name}`,
fieldName: field.name,
});
}
});
});
});
});
this.flatTopics = flat;
toggleDomain(domainName: string): void {
const next = new Set(this.expandedDomains());
if (next.has(domainName)) {
next.delete(domainName);
} else {
next.add(domainName);
}
this.expandedDomains.set(next);
}
toggleField(fieldName: string): void {
const next = new Set(this.expandedFields());
if (next.has(fieldName)) {
next.delete(fieldName);
} else {
next.add(fieldName);
}
this.expandedFields.set(next);
}
toggleSubfield(subfieldName: string): void {
const next = new Set(this.expandedSubfields());
if (next.has(subfieldName)) {
next.delete(subfieldName);
} else {
next.add(subfieldName);
}
this.expandedSubfields.set(next);
}
expandAll(): void {
const domains = new Set<string>();
const fields = new Set<string>();
const subfields = new Set<string>();
const h = this.hierarchy();
if (h?.domains) {
for (const d of h.domains) {
domains.add(d.name);
for (const f of d.fields ?? []) {
fields.add(f.name);
for (const sf of f.subfields ?? []) {
subfields.add(sf.name);
}
}
}
}
this.expandedDomains.set(domains);
this.expandedFields.set(fields);
this.expandedSubfields.set(subfields);
}
collapseAll(): void {
this.expandedDomains.set(new Set<string>());
this.expandedFields.set(new Set<string>());
this.expandedSubfields.set(new Set<string>());
}
toggleTopic(topic: Topic | string): void {
const name = typeof topic === 'string' ? topic : topic.display_name || '';
if (!name) return;
const next = new Set(this.selectedTopics());
if (next.has(name)) {
next.delete(name);
} else {
next.add(name);
}
this.selectionChange.emit(next);
}
isTopicSelected(topic: Topic | string): boolean {
const name = typeof topic === 'string' ? topic : topic.display_name || '';
return this.selectedTopics().has(name);
}
clearSelection(): void {
this.selectionChange.emit(new Set<string>());
}
onSearchTypeChange(type: 'hybrid' | 'semantic'): void {
@@ -172,37 +278,33 @@ export class TopicHierarchyComponent implements OnInit {
return topicHierarchyColor({ field_name: fieldName });
}
toggleTopic(name: string): void {
const nextSelection = new Set(this.selectedTopics());
if (nextSelection.has(name)) {
nextSelection.delete(name);
} else {
nextSelection.add(name);
getDomainTopicCount(domain: TopicHierarchyDomain): number {
let count = 0;
for (const f of domain.fields ?? []) {
for (const sf of f.subfields ?? []) {
count += (sf.topics ?? []).length;
}
}
this.selectionChange.emit(nextSelection);
return count;
}
toggleDomain(name: string): void {
if (this.expandedDomains.has(name)) {
this.expandedDomains.delete(name);
} else {
this.expandedDomains.add(name);
getFieldTopicCount(field: TopicHierarchyField): number {
let count = 0;
for (const sf of field.subfields ?? []) {
count += (sf.topics ?? []).length;
}
return count;
}
toggleField(name: string): void {
if (this.expandedFields.has(name)) {
this.expandedFields.delete(name);
} else {
this.expandedFields.add(name);
}
getSubfieldTopicCount(subfield: TopicHierarchySubfield): number {
return (subfield.topics ?? []).length;
}
toggleSubfield(name: string): void {
if (this.expandedSubfields.has(name)) {
this.expandedSubfields.delete(name);
} else {
this.expandedSubfields.add(name);
}
getTopicBreadcrumb(topic: Topic): string {
const parts: string[] = [];
if (topic.domain?.display_name) parts.push(topic.domain.display_name);
if (topic.field?.display_name) parts.push(topic.field.display_name);
if (topic.subfield?.display_name) parts.push(topic.subfield.display_name);
return parts.join(' › ');
}
}
@@ -67,7 +67,6 @@ import {
TopicTreemapValue,
TopicTreemapTopicSelect,
} from '../../../shared/ui/topic-treemap/topic-treemap.models';
import { TopicsService } from '../../../api/api/topics.service';
import {
CC_NEWS_COMPOSITE_ID,
@@ -112,7 +111,6 @@ import { TrendDataService } from '../services/trend-data.service';
})
export class UniTrendParentComponent implements OnInit {
private readonly apiService = inject(UniversityRankingsService);
private readonly topicsService = inject(TopicsService);
private readonly institutionsApiService = inject(InstitutionsService);
private readonly institutionsV2Service = inject(InstitutionsV2Service);
private readonly personsApiService = inject(PersonsService);
@@ -41,25 +41,6 @@ export const RESOLVING_PROJECT_PAGE_FOR = {
type ResolvingEuProjectPageFor =
(typeof RESOLVING_PROJECT_PAGE_FOR)[keyof typeof RESOLVING_PROJECT_PAGE_FOR];
function getRepeatedOrCsv(routeQueryParamMap: any, key: string): string[] {
const repeatedValues = routeQueryParamMap.getAll(key) ?? [];
const csvValues =
routeQueryParamMap
.get(key)
?.split(',')
.map((value: string) => value.trim())
.filter(Boolean) ?? [];
return Array.from(
new Set(
[...repeatedValues, ...csvValues]
.map((value) => String(value).trim())
.filter(Boolean),
),
);
}
export const euCordisProjectsResolver: ResolveFn<EuCordisProjectSearchPage> = (
route,
state,
@@ -169,7 +150,7 @@ export const euCordisProjectsResolver: ResolveFn<EuCordisProjectSearchPage> = (
}
if (resolvingFor === RESOLVING_PROJECT_PAGE_FOR.KEYWORDS_SEARCH) {
const keywords = getRepeatedOrCsv(route.queryParamMap, 'keywords');
const keywords = route.queryParamMap.get('keywords')?.split(',') ?? [];
const selectedTopicIds = route.queryParamMap.getAll('topics');
const fuzzySearch = route.queryParamMap.get('fuzzy') === 'true';
@@ -77,8 +77,6 @@ export class AppAuthorChipComponent {
if (this.handleChipClick && author) {
this.handleChipClick.emit(author);
}
console.log('Chip clicked:', event);
}
stripOpenAlexId(id: string | null | undefined): string | undefined {
@@ -1,14 +1,37 @@
:host {
::ng-deep .mat-mdc-card-header-text {
min-width: 0;
width: 100%;
}
}
.card-content {
display: flex;
flex-direction: column;
gap: 1rem;
height: 100%;
}
mat-card-title {
display: -webkit-box;
width: 100%;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
line-height: 1.3rem;
height: 2.6rem;
}
.city-country {
display: flex;
align-items: center;
gap: 0.5rem;
display: block;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--sg-text-muted);
line-height: 1.25rem;
height: 1.25rem;
}
.metrics {
@@ -16,6 +39,8 @@
flex-direction: column;
gap: 0.5rem;
font-size: 0.875rem;
flex: 1 1 auto;
min-height: 0;
}
.metric-item {
@@ -1,3 +1,10 @@
:host {
::ng-deep .mat-mdc-card-header-text {
min-width: 0;
width: 100%;
}
}
.card-content {
display: flex;
flex-direction: column;
@@ -5,11 +12,26 @@
height: 100%;
}
mat-card-title {
display: -webkit-box;
width: 100%;
-webkit-box-orient: vertical;
-webkit-line-clamp: 5;
line-clamp: 5;
overflow: hidden;
line-height: 1.3rem;
height: 6.5rem;
}
.subtitle {
display: flex;
align-items: center;
gap: 0.5rem;
display: block;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--sg-text-muted);
line-height: 1.25rem;
height: 1.25rem;
}
.metrics {
@@ -1,9 +1,6 @@
@let work = this.work();
<mat-card
class="card-content popup"
appearance="outlined"
[routerLink]="work.id ? ['/topic', stripOpenAlexId(work.id)] : null">
<mat-card class="card-content popup" appearance="outlined">
<mat-card-header>
<mat-card-title>{{ work.title }}</mat-card-title>
<mat-card-subtitle class="subtitle">
@@ -15,15 +12,41 @@
<mat-divider />
<mat-card-content class="mat-card-content">
<div class="chips">
@for (topic of topics(); track topic.id) {
<app-topic-chip-2 [topic]="topic" />
}
@for (author of authors(); track author.id) {
<app-author-chip [author]="author" />
}
<div class="chip-section">
<div class="chip-section-header">
<mat-icon>label</mat-icon>
<span>Themen</span>
</div>
<div class="chips chips-column">
@for (topic of visibleTopics(); track topic.id) {
<app-topic-chip-2
[topic]="topic"
[isClickable]="true"
(handleChipClick)="topicChipClick.emit($event)"
(click)="$event.stopPropagation()" />
}
</div>
</div>
<mat-divider />
<div class="chip-section">
<div class="chip-section-header">
<mat-icon>person</mat-icon>
<span>Autoren</span>
</div>
<div class="chips chips-authors">
@for (author of visibleAuthors(); track author.id) {
<app-author-chip
[author]="author"
[isClickable]="true"
(handleChipClick)="authorChipClick.emit($event)"
(click)="$event.stopPropagation()" />
}
@if (hiddenAuthorCount() > 0) {
<span class="chip-overflow">+{{ hiddenAuthorCount() }}</span>
}
</div>
</div>
<mat-divider />
<div class="metrics">
@@ -1,3 +1,10 @@
:host {
::ng-deep .mat-mdc-card-header-text {
min-width: 0;
width: 100%;
}
}
.card-content {
display: flex;
flex-direction: column;
@@ -5,11 +12,46 @@
height: 100%;
}
mat-card-title {
display: -webkit-box;
width: 100%;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
line-clamp: 4;
overflow: hidden;
line-height: 1.3rem;
height: calc(1.3rem * 4);
}
.subtitle {
display: block;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
color: var(--sg-text-muted);
line-height: 1.25rem;
height: 1.25rem;
}
.chip-section {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.chip-section-header {
display: flex;
align-items: center;
gap: 0.5rem;
gap: 0.25rem;
color: var(--sg-text-muted);
font-size: 0.875rem;
mat-icon {
width: 18px;
height: 18px;
font-size: 18px;
}
}
.metrics {
@@ -42,6 +84,35 @@
height: 100%;
}
.chips-column {
flex-direction: column;
flex-wrap: nowrap;
align-items: flex-start;
// 3 rows reserved (32px chip height + 8px gap each) so the divider below
// sits at the same position regardless of how many topics exist.
min-height: calc(3 * 32px + 2 * 0.5rem);
}
.chips-authors {
flex-wrap: nowrap;
align-content: flex-start;
// 1 row reserved, capped so overflowing chips never push the divider down.
min-height: 32px;
max-height: 32px;
overflow: hidden;
}
.chip-overflow {
display: inline-flex;
align-items: center;
padding: 0.25rem 0.5rem;
border-radius: var(--sg-radius-sm);
background: var(--sg-surface-soft);
color: var(--sg-text-muted);
font-size: 0.8rem;
font-weight: 600;
}
.mat-card-content {
display: flex;
flex-direction: column;
@@ -1,5 +1,5 @@
import { Component, computed, input } from '@angular/core';
import { DehydratedAuthor, Work } from '../../../api';
import { Component, computed, input, output } from '@angular/core';
import { Author, DehydratedAuthor, Topic, Work } from '../../../api';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
@@ -11,6 +11,9 @@ import { LanguageCodePipe } from '../../pipes/language-code.pipe';
import { AppTopicChipComponent } from '../app-topic-chip/app-topic-chip.component';
import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.component';
const MAX_VISIBLE_TOPICS = 3;
const MAX_VISIBLE_AUTHORS = 3;
@Component({
selector: 'app-publication-card',
imports: [
@@ -31,6 +34,9 @@ import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.compo
export class AppPublicationCardComponent {
work = input.required<Work>();
topicChipClick = output<Topic>();
authorChipClick = output<Author>();
stripOpenAlexId(id: string | null | undefined): string | undefined {
if (!id) {
return undefined;
@@ -55,4 +61,12 @@ export class AppPublicationCardComponent {
.map((authorship) => authorship.author)
.filter((author): author is DehydratedAuthor => !!author);
});
visibleTopics = computed(() => this.topics().slice(0, MAX_VISIBLE_TOPICS));
visibleAuthors = computed(() => this.authors().slice(0, MAX_VISIBLE_AUTHORS));
hiddenAuthorCount = computed(() =>
Math.max(this.authors().length - MAX_VISIBLE_AUTHORS, 0),
);
}
@@ -12,7 +12,7 @@
<mat-divider />
<mat-card-content>
<p>{{ description() }}</p>
<p class="description">{{ description() }}</p>
<div class="metrics">
<div class="metric-item">
<mat-icon>menu_book</mat-icon>
@@ -15,22 +15,69 @@
::ng-deep .mdc-button--outlined {
border-color: var(--topic-border) !important;
}
::ng-deep .mat-mdc-card-header-text {
min-width: 0;
width: 100%;
}
}
.card-content {
display: flex;
flex-direction: column;
gap: 1rem;
height: 100%;
background-color: var(--topic-background);
border: 1px solid var(--topic-border);
}
mat-card-title {
display: -webkit-box;
width: 100%;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
line-height: 1.3rem;
height: 2.6rem;
}
.subtitle {
display: flex;
align-items: center;
gap: 0.5rem;
display: -webkit-box;
width: 100%;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
color: var(--sg-text-muted);
line-height: 1.25rem;
height: 2.5rem;
}
mat-card-content {
display: flex;
flex-direction: column;
gap: 1rem;
flex: 1 1 auto;
min-height: 0;
}
.description {
margin: 0;
max-height: 6.5rem;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: var(--topic-border) transparent;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background-color: var(--topic-border);
border-radius: 3px;
}
}
.metrics {
@@ -1,6 +1,7 @@
<app-data-table
[columns]="columns"
[data]="elements()"
[detailTemplate]="highlightRowEnabled() ? expandedProject : null"
[queryParamSortKey]="queryParamKeys.sortBy"
[queryParamSortDirectionKey]="queryParamKeys.sortDirection" />
@@ -106,3 +107,61 @@
}
</div>
</ng-template>
<ng-template #expandedProject let-project>
@if (project.highlight) {
@let highlight = project.highlight;
<section class="project-panel" aria-label="Weitere Projektdetails">
<div class="project-panel__content">
@if (highlight.topic.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.topic"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.topic))
" />
</article>
}
@if (highlight.recipient.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zuwendungsempfänger</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.recipient"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.recipient))
" />
</article>
}
@if (highlight.joint_project.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Verbundprojekt</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.joint_project"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.joint_project)
)
" />
</article>
}
@if (highlight.executing_agency.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Ausführende Stelle</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.executing_agency"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.executing_agency)
)
" />
</article>
}
</div>
</section>
}
</ng-template>
@@ -205,6 +205,97 @@
}
}
}
// ------------------------
// Expanded project panel
// ------------------------
.project-panel {
width: 100%;
padding: 12px 16px 14px;
color: var(--sg-text);
background: var(--sg-background);
border-top: 1px solid var(--sg-border);
}
.project-panel__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.project-panel__heading {
display: flex;
align-items: flex-start;
gap: 8px;
> mat-icon {
flex: 0 0 auto;
width: 19px;
height: 19px;
color: var(--sg-primary);
font-size: 19px;
}
h3 {
margin: 0;
font-size: 13px;
font-weight: 700;
line-height: 1.2;
}
p {
margin: 1px 0 0;
color: var(--sg-text-muted);
font-size: 11px;
line-height: 1.3;
}
}
.project-panel__content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
gap: 10px;
}
.panel-field {
min-width: 0;
&--full {
grid-column: 1 / -1;
}
}
.panel-field__label {
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.panel-field__text {
margin: 0;
font-size: 12px;
line-height: 1.5;
overflow-wrap: anywhere;
}
.project-panel__empty {
display: flex;
align-items: center;
gap: 6px;
grid-column: 1 / -1;
color: var(--sg-text-muted);
font-size: 12px;
mat-icon {
width: 16px;
height: 16px;
font-size: 16px;
}
}
// ------------------------
// Responsive adjustments
@@ -27,6 +27,12 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { bundProjectQueryParamKeys } from '../../../resolvers/bund-projects.resolver';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overflow-toggle.component';
import { SearchResultsStateService } from '../../../modules/keywords-search/search-results/search-results-state.service';
import {
HighlightedTextComponent,
HighlightTerm,
} from '../highlighted-text/highlighted-text.component';
import { MatDividerModule } from '@angular/material/divider';
@Component({
selector: 'app-bund-project-table',
imports: [
@@ -42,6 +48,7 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl
ChipComponent,
AppTopicChipComponent,
SkTextDirective,
HighlightedTextComponent,
],
templateUrl: './bund-project-table.component.html',
styleUrl: './bund-project-table.component.scss',
@@ -49,14 +56,19 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl
export class BundProjectTableComponent implements OnInit {
private readonly activatedRoute = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly searchResultsStateService = inject(
SearchResultsStateService,
{ optional: true },
);
page = input.required<BundProjectPage>();
authorFilterEnabled = input<boolean>(false);
institutionFilterEnabled = input<boolean>(false);
topicFilterEnabled = input<boolean>(false);
elements = computed(() => this.page().elements ?? []);
highlightRowEnabled = computed(() => {
return this.elements()[0]?.highlight ? true : false;
});
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
initialValue: this.activatedRoute.snapshot.queryParamMap,
});
@@ -353,4 +365,31 @@ export class BundProjectTableComponent implements OnInit {
return this.expandedProjectTopicsId.includes(project.funding_code);
}
/**
* Extracts the distinct matched terms out of Elasticsearch-style
* highlight fragments (terms wrapped in <em>...</em>).
*/
extractHighlightTerms(fragments: string[] | null | undefined): string[] {
const terms = new Set<string>();
for (const fragment of fragments ?? []) {
if (typeof fragment !== 'string') continue;
const matches = fragment.matchAll(/<em>(.*?)<\/em>/gi);
for (const match of matches) {
const term = match[1]?.trim();
if (term) {
terms.add(term);
}
}
}
return Array.from(terms);
}
getHighlightTerms(terms: string[] | null | undefined): HighlightTerm[] {
return (terms ?? []).map((term) => ({
term,
topic: this.searchResultsStateService?.resolveTopicForTerm(term) ?? null,
}));
}
}
@@ -28,7 +28,9 @@
.cards {
display: grid;
gap: 1.5rem;
grid-template-columns: repeat(auto-fit, minmax(var(--card-min-width), 1fr));
// auto-fill (not auto-fit) keeps empty tracks reserved, so a single result
// stays card-width instead of stretching to fill the whole row.
grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
padding: 0 1rem;
}
@@ -1,7 +1,7 @@
<app-data-table
[columns]="columns"
[data]="elements()"
[detailTemplate]="expandedProject"
[detailTemplate]="highlightRowEnabled() ? expandedProject : null"
[queryParamSortKey]="queryParamKeys.sortBy"
[queryParamSortDirectionKey]="queryParamKeys.sortDirection" />
@@ -63,113 +63,107 @@
</div>
</ng-template>
<ng-template #expandedProject let-project>
<section class="project-panel" aria-label="Weitere Projektdetails">
<header class="project-panel__header">
<div class="language-toggle" role="group" aria-label="Sprache wählen">
<button
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'de'"
(click)="setPanelLanguage(project, 'de')">
DE
</button>
<button
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'en'"
(click)="setPanelLanguage(project, 'en')">
EN
</button>
</div>
</header>
<mat-divider />
<div class="project-panel__content">
@if (getPanelLanguage(project) === 'de') {
@if (project.title_de) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.title_de"
[highlights]="
getHighlightTerms(
extractHighlightTerms(project.highlight?.title_de)
)
" />
</article>
}
@if (project.abstract_de) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zusammenfassung</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.abstract_de"
[highlights]="
getHighlightTerms(
extractHighlightTerms(project.highlight?.abstract_de)
)
" />
</article>
}
} @else {
@if (project.title_en) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Title</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.title_en"
[highlights]="
getHighlightTerms(
extractHighlightTerms(project.highlight?.title_en)
)
" />
</article>
}
@if (project.abstract_en) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Abstract</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.abstract_en"
[highlights]="
getHighlightTerms(
extractHighlightTerms(project.highlight?.abstract_en)
)
" />
</article>
}
}
@if (!hasAnyPanelContent(project)) {
<div class="project-panel__empty">
<mat-icon aria-hidden="true">info</mat-icon>
<span>Keine weiteren Angaben vorhanden.</span>
@if (project.highlight) {
@let highlight = project.highlight;
<section class="project-panel" aria-label="Weitere Projektdetails">
<header class="project-panel__header">
<div class="language-toggle" role="group" aria-label="Sprache wählen">
<button
[disabled]="!hasDePanelContent(project)"
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'de'"
(click)="setPanelLanguage(project, 'de')">
DE
</button>
<button
[disabled]="!hasEnPanelContent(project)"
type="button"
class="language-toggle__button"
[class.active]="getPanelLanguage(project) === 'en'"
(click)="setPanelLanguage(project, 'en')">
EN
</button>
</div>
}
@if (getProjectClassifications(project).length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Fachsystematik</h4>
@for (
classification of getProjectClassifications(project);
track $index
) {
<app-highlighted-text
class="panel-field__text"
[content]="getClassificationFullChain(classification)"
[highlights]="
getHighlightTerms(
getClassificationHighlightTerms(project, $index)
)
" />
} @empty {
<span class="empty-text">-</span>
</header>
<mat-divider />
<div class="project-panel__content">
@if (getPanelLanguage(project) === 'de') {
@if (highlight.title_de.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.title_de"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.title_de))
" />
</article>
}
</article>
}
</div>
</section>
@if (project.highlight?.abstract_de.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zusammenfassung</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.abstract_de"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.abstract_de)
)
" />
</article>
}
} @else {
@if (project.highlight?.title_en.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Title</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.title_en"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.title_en))
" />
</article>
}
@if (highlight.abstract_en.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Abstract</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.abstract_en"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.abstract_en)
)
" />
</article>
}
}
@if (project.highlight?.subject_classifications?.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Fachsystematik</h4>
@for (
classification of getProjectClassifications(project);
track $index
) {
<app-highlighted-text
class="panel-field__text"
[content]="getClassificationFullChain(classification)"
[highlights]="
getHighlightTerms(
getClassificationHighlightTerms(project, $index)
)
" />
} @empty {
<span class="empty-text">-</span>
}
</article>
}
</div>
</section>
}
</ng-template>
<ng-template #authorsTmp let-project>
@let projectAuthors = getProjectAuthors(project);
@@ -26,7 +26,6 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { SkTextDirective } from '../../../custom-directives/sk-text.directive';
import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overflow-toggle.component';
import { SearchResultsStateService } from '../../../modules/keywords-search/search-results/search-results-state.service';
import { TopicHierarchyColorInput } from '../../../resolvers/utils/topic-colors';
import {
HighlightedTextComponent,
HighlightTerm,
@@ -65,7 +64,9 @@ export class DfgProjectTableComponent implements OnInit {
topicFilterEnabled = input<boolean>(false);
elements = computed(() => this.page().elements ?? []);
highlightRowEnabled = computed(() => {
return this.elements()[0]?.highlight ? true : false;
});
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
initialValue: this.activatedRoute.snapshot.queryParamMap,
});
@@ -455,8 +456,12 @@ export class DfgProjectTableComponent implements OnInit {
private readonly selectedPanelLanguage = new Map<string, HighlightLanguage>();
getPanelLanguage(project: DfgProjectSummary): HighlightLanguage {
if (!project.id) return 'de';
return this.selectedPanelLanguage.get(project.id) ?? 'de';
if (this.hasDePanelContent(project)) {
return this.selectedPanelLanguage.get(project.id) ?? 'de';
} else if (this.hasEnPanelContent(project)) {
return this.selectedPanelLanguage.get(project.id) ?? 'en';
}
return 'de'; // default to German if no content is available'
}
setPanelLanguage(
@@ -467,15 +472,23 @@ export class DfgProjectTableComponent implements OnInit {
this.selectedPanelLanguage.set(project.id, language);
}
hasAnyPanelContent(project: DfgProjectSummary): boolean {
const language = this.getPanelLanguage(project);
hasDePanelContent(project: DfgProjectSummary): boolean {
const hasLocalizedContent =
language === 'de'
? !!project.title_de || !!project.abstract_de
: !!project.title_en || !!project.abstract_en;
project.highlight?.title_de?.length ||
project.highlight?.abstract_de?.length
? true
: false;
return hasLocalizedContent || !!project.subject_classifications_raw?.length;
return hasLocalizedContent;
}
hasEnPanelContent(project: DfgProjectSummary): boolean {
const hasLocalizedContent =
project.highlight?.title_en?.length ||
project.highlight?.abstract_en?.length
? true
: false;
return hasLocalizedContent;
}
getClassificationHighlightTerms(
project: DfgProjectSummary,
@@ -528,40 +541,7 @@ export class DfgProjectTableComponent implements OnInit {
getHighlightTerms(terms: string[] | null | undefined): HighlightTerm[] {
return (terms ?? []).map((term) => ({
term,
topic: this.resolveTopicForTerm(term),
topic: this.searchResultsStateService?.resolveTopicForTerm(term) ?? null,
}));
}
private resolveTopicForTerm(term: string): TopicHierarchyColorInput | null {
const topic =
this.keywordTopicMap().get(term) ??
this.keywordTopicMap().get(term.toLowerCase());
//Attempt to find a topic for the term by checking if the term is a substring of any keyword in the keywordTopicMap
if (!topic) {
for (const [keyword, mappedTopic] of this.keywordTopicMap()) {
if (
keyword.toLowerCase().includes(term.toLowerCase()) ||
term.toLowerCase().includes(keyword.toLowerCase())
) {
return {
id: mappedTopic.id,
name: mappedTopic.display_name,
field_id: mappedTopic.field?.id,
field_name: mappedTopic.field?.display_name,
domain_id: mappedTopic.domain?.id,
domain_name: mappedTopic.domain?.display_name,
};
}
}
}
if (!topic) return null;
return {
id: topic.id,
name: topic.display_name,
field_id: topic.field?.id,
field_name: topic.field?.display_name,
domain_id: topic.domain?.id,
domain_name: topic.domain?.display_name,
};
}
}
@@ -1,6 +1,7 @@
<app-data-table
[columns]="columns()"
[data]="projects()"
[detailTemplate]="highlightRowEnabled() ? expandedProject : null"
[queryParamSortKey]="queryParamKeys.sortBy"
[queryParamSortDirectionKey]="queryParamKeys.sortDirection" />
@@ -146,3 +147,70 @@
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
<ng-template #expandedProject let-project>
@if (project.highlight) {
@let highlight = project.highlight;
<section class="project-panel" aria-label="Weitere Projektdetails">
<div class="project-panel__content">
@if (highlight.title.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Titel</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.title"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.title))
" />
</article>
}
@if (highlight.objective.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Zusammenfassung</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.objective"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.objective))
" />
</article>
}
@if (highlight.acronym.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Akronym</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.acronym"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.acronym))
" />
</article>
}
@if (highlight.cordis_topic_text.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Cordis-Thema</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.cordis_topic_text"
[highlights]="
getHighlightTerms(
extractHighlightTerms(highlight.cordis_topic_text)
)
" />
</article>
}
@if (highlight.keywords.length > 0) {
<article class="panel-field panel-field--full">
<h4 class="panel-field__label">Schlüsselwörter</h4>
<app-highlighted-text
class="panel-field__text"
[content]="project.keywords"
[highlights]="
getHighlightTerms(extractHighlightTerms(highlight.keywords))
" />
</article>
}
</div>
</section>
}
</ng-template>
@@ -142,7 +142,97 @@
.classification-container {
max-width: 200px;
}
// ------------------------
// Expanded project panel
// ------------------------
.project-panel {
width: 100%;
padding: 12px 16px 14px;
color: var(--sg-text);
background: var(--sg-background);
border-top: 1px solid var(--sg-border);
}
.project-panel__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.project-panel__heading {
display: flex;
align-items: flex-start;
gap: 8px;
> mat-icon {
flex: 0 0 auto;
width: 19px;
height: 19px;
color: var(--sg-primary);
font-size: 19px;
}
h3 {
margin: 0;
font-size: 13px;
font-weight: 700;
line-height: 1.2;
}
p {
margin: 1px 0 0;
color: var(--sg-text-muted);
font-size: 11px;
line-height: 1.3;
}
}
.project-panel__content {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
gap: 10px;
}
.panel-field {
min-width: 0;
&--full {
grid-column: 1 / -1;
}
}
.panel-field__label {
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.panel-field__text {
margin: 0;
font-size: 12px;
line-height: 1.5;
overflow-wrap: anywhere;
}
.project-panel__empty {
display: flex;
align-items: center;
gap: 6px;
grid-column: 1 / -1;
color: var(--sg-text-muted);
font-size: 12px;
mat-icon {
width: 16px;
height: 16px;
font-size: 16px;
}
}
// ------------------------
// Data table overrides (applied via ::ng-deep)
// ------------------------
@@ -33,6 +33,12 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { ChipComponent } from '../chip/chip.component';
import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.component';
import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overflow-toggle.component';
import {
HighlightedTextComponent,
HighlightTerm,
} from '../highlighted-text/highlighted-text.component';
import { MatDividerModule } from '@angular/material/divider';
import { SearchResultsStateService } from '../../../modules/keywords-search/search-results/search-results-state.service';
@Component({
selector: 'app-eu-project-table',
imports: [
@@ -49,6 +55,8 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl
ChipComponent,
AppAuthorChipComponent,
SkTextDirective,
MatDividerModule,
HighlightedTextComponent,
],
templateUrl: './eu-project-table.component.html',
styleUrl: './eu-project-table.component.scss',
@@ -56,7 +64,10 @@ import { ChipOverflowToggleComponent } from '../chip-overflow-toggle/chip-overfl
export class EuProjectTableComponent {
private readonly activatedRoute = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly searchResultsStateService = inject(
SearchResultsStateService,
{ optional: true },
);
queryParamKeys = euProjectQueryParamKeys;
page = input<EuCordisProjectSearchPage | undefined>();
@@ -73,6 +84,9 @@ export class EuProjectTableComponent {
return this.page()?.total ?? 0;
});
highlightRowEnabled = computed(() => {
return this.projects()[0]?.highlight ? true : false;
});
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
initialValue: this.activatedRoute.snapshot.queryParamMap,
});
@@ -94,7 +108,12 @@ export class EuProjectTableComponent {
selectedTypesQueryParams = computed(() => {
return this.queryParamMap().getAll(this.queryParamKeys.projectType);
});
keywordTopicMap = computed(() => {
return (
this.searchResultsStateService?.keywordTopicMap() ??
new Map<string, Topic>()
);
});
projectTypeTmp = viewChild.required<TemplateRef<unknown>>('projectTypeTmp');
fundingStartTmp = viewChild.required<TemplateRef<unknown>>('fundingStartTmp');
fundingEndTmp = viewChild.required<TemplateRef<unknown>>('fundingEndTmp');
@@ -507,4 +526,33 @@ export class EuProjectTableComponent {
? this.expandedProjectTopicsIds.filter((id) => id !== projectId)
: [...this.expandedProjectTopicsIds, projectId];
}
// Highlighted Text
/**
* Extracts the distinct matched terms out of Elasticsearch-style
* highlight fragments (terms wrapped in <em>...</em>).
*/
extractHighlightTerms(fragments: string[] | null | undefined): string[] {
const terms = new Set<string>();
for (const fragment of fragments ?? []) {
if (typeof fragment !== 'string') continue;
const matches = fragment.matchAll(/<em>(.*?)<\/em>/gi);
for (const match of matches) {
const term = match[1]?.trim();
if (term) {
terms.add(term);
}
}
}
return Array.from(terms);
}
getHighlightTerms(terms: string[] | null | undefined): HighlightTerm[] {
return (terms ?? []).map((term) => ({
term,
topic: this.searchResultsStateService?.resolveTopicForTerm(term) ?? null,
}));
}
}
+18
View File
@@ -1,3 +1,4 @@
// Main
export const BOOKMARKS_ICON = 'bookmarks' as const;
export const COMPANY_CONNECTION_ICON = 'business' as const;
export const DASHBOARD_ICON = 'dashboard' as const;
@@ -16,3 +17,20 @@ export const PERSON_ICON = 'person' as const;
export const PROJECT_ICON = 'work' as const;
export const PUBLICATION_ICON = 'menu_book' as const;
export const TOPIC_ICON = 'topic' as const;
// Custom UI Icons
export const EXPAND_LESS_ICON = 'expand_less' as const;
export const EXPAND_MORE_ICON = 'expand_more' as const;
export const UNFOLD_LESS_ICON = 'unfold_less' as const;
export const UNFOLD_MORE_ICON = 'unfold_more' as const;
export const CLEAR_ICON = 'clear' as const;
export const CLOSE_ICON = 'close' as const;
export const CHECK_ICON = 'check' as const;
export const CHEVRON_RIGHT_ICON = 'chevron_right' as const;
export const SEARCH_ICON = 'search' as const;
export const SEARCH_OFF_ICON = 'search_off' as const;
// Other
export const ADD_ICON = 'add' as const;
export const INFO_OUTLINE_ICON = 'info_outline' as const;
export const OPEN_IN_NEW_ICON = 'open_in_new' as const;