Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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}
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -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()
|
||||
@@ -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
|
||||
@@ -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] = []
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 -> Fields -> Subfields -> 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 -> Field -> Subfield -> 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
|
||||
|
||||
@@ -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\".
|
||||
*/
|
||||
executing_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>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -11,38 +11,36 @@ import { BundProjectHighlight } from './bundProjectHighlight';
|
||||
import { Topic } from './topic';
|
||||
import { BundInstitutionSummary } from './bundInstitutionSummary';
|
||||
|
||||
|
||||
export interface BundProjectSummary {
|
||||
funding_code?: string | null;
|
||||
department?: string | null;
|
||||
department_fullname?: string | null;
|
||||
referat?: string | null;
|
||||
project_sponsor?: string | null;
|
||||
project_sponsor_fullname?: string | null;
|
||||
work_unit?: string | null;
|
||||
recipient?: string | null;
|
||||
municipal_code?: string | null;
|
||||
municipality?: string | null;
|
||||
place?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
executing_agency?: string | null;
|
||||
topic?: string | null;
|
||||
performance_plan_system?: string | null;
|
||||
performance_plan_system_text?: string | null;
|
||||
funding_start?: string | null;
|
||||
funding_end?: string | null;
|
||||
grant_amount?: number | null;
|
||||
funding_profile?: string | null;
|
||||
joint_project?: string | null;
|
||||
funding_type?: string | null;
|
||||
publication_date?: string | null;
|
||||
unix_timestamp?: number | null;
|
||||
date?: string | null;
|
||||
'new'?: boolean | null;
|
||||
duration?: string | null;
|
||||
oa_topics?: Array<Topic> | null;
|
||||
institution?: BundInstitutionSummary | null;
|
||||
highlight?: BundProjectHighlight | null;
|
||||
export interface BundProjectSummary {
|
||||
funding_code?: string | null;
|
||||
department?: string | null;
|
||||
department_fullname?: string | null;
|
||||
referat?: string | null;
|
||||
project_sponsor?: string | null;
|
||||
project_sponsor_fullname?: string | null;
|
||||
work_unit?: string | null;
|
||||
recipient?: string | null;
|
||||
municipal_code?: string | null;
|
||||
municipality?: string | null;
|
||||
place?: string | null;
|
||||
state?: string | null;
|
||||
country?: string | null;
|
||||
executing_agency?: string | null;
|
||||
topic?: string | null;
|
||||
performance_plan_system?: string | null;
|
||||
performance_plan_system_text?: string | null;
|
||||
funding_start?: string | null;
|
||||
funding_end?: string | null;
|
||||
grant_amount?: number | null;
|
||||
funding_profile?: string | null;
|
||||
joint_project?: string | null;
|
||||
funding_type?: string | null;
|
||||
publication_date?: string | null;
|
||||
unix_timestamp?: number | null;
|
||||
date?: string | null;
|
||||
new?: boolean | null;
|
||||
duration?: string | null;
|
||||
oa_topics?: Array<Topic> | null;
|
||||
institution?: BundInstitutionSummary | null;
|
||||
highlight?: BundProjectHighlight | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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: {
|
||||
|
||||
@@ -45,6 +45,7 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
private componentRef: ComponentRef<T> | null = null;
|
||||
private showTimeout?: ReturnType<typeof setTimeout>;
|
||||
private hideTimeout?: ReturnType<typeof setTimeout>;
|
||||
private dismissTimeout?: ReturnType<typeof setTimeout>;
|
||||
|
||||
private isOverHost = false;
|
||||
private isOverOverlay = false;
|
||||
@@ -84,6 +85,24 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
this.scheduleHide();
|
||||
}
|
||||
|
||||
@HostListener('click')
|
||||
onHostClick(): void {
|
||||
this.scheduleDismiss();
|
||||
}
|
||||
|
||||
private scheduleDismiss(): void {
|
||||
clearTimeout(this.dismissTimeout);
|
||||
this.dismissTimeout = setTimeout(() => this.dismiss());
|
||||
}
|
||||
|
||||
private dismiss(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.isOverHost = false;
|
||||
this.isOverOverlay = false;
|
||||
this.hide();
|
||||
}
|
||||
|
||||
private scheduleHide(): void {
|
||||
this.hideTimeout = setTimeout(() => {
|
||||
if (!this.isOverHost && !this.isOverOverlay) {
|
||||
@@ -155,6 +174,7 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
|
||||
overlayElement.addEventListener('mouseenter', this.onOverlayEnter);
|
||||
overlayElement.addEventListener('mouseleave', this.onOverlayLeave);
|
||||
overlayElement.addEventListener('click', this.onOverlayClick, true);
|
||||
}
|
||||
|
||||
private applyMaxWidth(
|
||||
@@ -179,11 +199,16 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
this.scheduleHide();
|
||||
};
|
||||
|
||||
private readonly onOverlayClick = (): void => {
|
||||
this.scheduleDismiss();
|
||||
};
|
||||
|
||||
private hide(): void {
|
||||
if (this.overlayRef) {
|
||||
const overlayElement = this.overlayRef.overlayElement;
|
||||
overlayElement.removeEventListener('mouseenter', this.onOverlayEnter);
|
||||
overlayElement.removeEventListener('mouseleave', this.onOverlayLeave);
|
||||
overlayElement.removeEventListener('click', this.onOverlayClick, true);
|
||||
this.overlayRef.detach();
|
||||
}
|
||||
this.componentRef = null;
|
||||
@@ -192,6 +217,7 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
ngOnDestroy(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
clearTimeout(this.hideTimeout);
|
||||
clearTimeout(this.dismissTimeout);
|
||||
this.overlayRef?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
[color]="tag.color"
|
||||
[disabled]="!tag.id"
|
||||
[active]="isTagActive(tag)"
|
||||
[secondaryActionLabel]="tagAction(tag)?.label ?? null"
|
||||
[secondaryActionLink]="tagAction(tag)?.link ?? null"
|
||||
[secondaryActionQueryParams]="tagAction(tag)?.queryParams ?? null"
|
||||
countIcon="article"
|
||||
descriptionTooltipTarget="button"
|
||||
(chipClick)="onTagClick(tag)">
|
||||
|
||||
@@ -14,6 +14,7 @@ import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { TopicCount } from '../../api';
|
||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { TopicLegendComponent } from '../../shared/ui/topic-legend/topic-legend.component';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
@@ -45,6 +46,12 @@ interface InterestTag {
|
||||
domainDescription: string;
|
||||
}
|
||||
|
||||
interface InterestTagAction {
|
||||
label: string;
|
||||
link: unknown[];
|
||||
queryParams: Record<string, string | number>;
|
||||
}
|
||||
|
||||
const MAX_TAGS = 5;
|
||||
|
||||
@Component({
|
||||
@@ -69,6 +76,10 @@ export class PersonInterestingComponent implements OnInit {
|
||||
|
||||
readonly topics = input<TopicCount[] | null>(null);
|
||||
readonly loading = input<boolean>(false);
|
||||
|
||||
readonly personPublicationsLink = input<unknown[] | null>(null);
|
||||
readonly personName = input<string>('');
|
||||
|
||||
readonly legendExpanded = signal(false);
|
||||
readonly activeLegendFieldIds = signal<ReadonlySet<string>>(new Set());
|
||||
readonly activeLegendSubfieldIds = signal<ReadonlySet<string>>(new Set());
|
||||
@@ -142,6 +153,36 @@ export class PersonInterestingComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private readonly tagActions = computed(() => {
|
||||
const actions = new Map<string, InterestTagAction>();
|
||||
const link = this.personPublicationsLink();
|
||||
|
||||
if (!link) {
|
||||
return actions;
|
||||
}
|
||||
|
||||
const person = this.personName() || 'dieser Person';
|
||||
|
||||
for (const tag of this.tags()) {
|
||||
if (!tag.id) continue;
|
||||
|
||||
actions.set(tag.id, {
|
||||
label: `Publikationen von ${person}`,
|
||||
link,
|
||||
queryParams: {
|
||||
[workQueryParamKeys.page]: 0,
|
||||
[workQueryParamKeys.topicId]: tag.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return actions;
|
||||
});
|
||||
|
||||
tagAction(tag: InterestTag): InterestTagAction | null {
|
||||
return this.tagActions().get(tag.id) ?? null;
|
||||
}
|
||||
|
||||
onTagClick(tag: InterestTag): void {
|
||||
if (!tag.id) return;
|
||||
this.tagClick.emit({
|
||||
|
||||
@@ -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);
|
||||
|
||||
+50
-2
@@ -171,8 +171,15 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!getMainTopicItem(item)?.id"
|
||||
[attr.aria-label]="
|
||||
getTopicAriaLabel(getMainTopicItem(item), [item.year])
|
||||
"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: getMainTopicItem(item)?.id }"
|
||||
[tooltipInputs]="
|
||||
getTopicTooltipInputs(getMainTopicItem(item), [
|
||||
item.year,
|
||||
])
|
||||
"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="
|
||||
selectTopic(getMainTopicItem(item), [item.year])
|
||||
@@ -217,6 +224,16 @@
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActiveByLegend(topic)"
|
||||
[secondaryActionLabel]="
|
||||
getTopicAction(topic, [item.year])?.label ?? null
|
||||
"
|
||||
[secondaryActionLink]="
|
||||
getTopicAction(topic, [item.year])?.link ?? null
|
||||
"
|
||||
[secondaryActionQueryParams]="
|
||||
getTopicAction(topic, [item.year])?.queryParams ??
|
||||
null
|
||||
"
|
||||
(chipClick)="selectTopic(topic, [item.year])">
|
||||
</app-topic-chip>
|
||||
</ng-container>
|
||||
@@ -288,8 +305,19 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!phase.primaryTopic.id"
|
||||
[attr.aria-label]="
|
||||
getTopicAriaLabel(
|
||||
phase.primaryTopic,
|
||||
getPhaseYears(phase)
|
||||
)
|
||||
"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: phase.primaryTopic.id }"
|
||||
[tooltipInputs]="
|
||||
getTopicTooltipInputs(
|
||||
phase.primaryTopic,
|
||||
getPhaseYears(phase)
|
||||
)
|
||||
"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="
|
||||
selectTopic(phase.primaryTopic, getPhaseYears(phase))
|
||||
@@ -317,6 +345,16 @@
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActiveByLegend(topic)"
|
||||
[secondaryActionLabel]="
|
||||
getTopicAction(topic, getPhaseYears(phase))?.label ?? null
|
||||
"
|
||||
[secondaryActionLink]="
|
||||
getTopicAction(topic, getPhaseYears(phase))?.link ?? null
|
||||
"
|
||||
[secondaryActionQueryParams]="
|
||||
getTopicAction(topic, getPhaseYears(phase))
|
||||
?.queryParams ?? null
|
||||
"
|
||||
(chipClick)="selectTopic(topic, getPhaseYears(phase))">
|
||||
</app-topic-chip>
|
||||
</ng-container>
|
||||
@@ -396,6 +434,16 @@
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="!topic.id"
|
||||
[active]="isTopicActiveByLegend(topic)"
|
||||
[secondaryActionLabel]="
|
||||
getTopicAction(topic, [year.year])?.label ?? null
|
||||
"
|
||||
[secondaryActionLink]="
|
||||
getTopicAction(topic, [year.year])?.link ?? null
|
||||
"
|
||||
[secondaryActionQueryParams]="
|
||||
getTopicAction(topic, [year.year])?.queryParams ??
|
||||
null
|
||||
"
|
||||
(chipClick)="selectTopic(topic, [year.year])">
|
||||
</app-topic-chip>
|
||||
</ng-container>
|
||||
|
||||
+105
@@ -30,6 +30,7 @@ import {
|
||||
toggleTopicLegendSubfieldSelection,
|
||||
} from '../../../../resolvers/utils/topic-legend';
|
||||
import { buildTopicHierarchyTooltip } from '../../../../resolvers/utils/topic-tooltip';
|
||||
import { workQueryParamKeys } from '../../../../resolvers/work-page.resolver';
|
||||
|
||||
export interface TopicTimelineTopic {
|
||||
id?: string;
|
||||
@@ -92,6 +93,19 @@ interface TimelineScrollAnchor {
|
||||
scrollLeft: number;
|
||||
}
|
||||
|
||||
interface TimelineTopicAction {
|
||||
label: string;
|
||||
link: unknown[];
|
||||
queryParams: Record<string, string | number | number[]>;
|
||||
}
|
||||
|
||||
interface TimelineTopicTooltipInputs {
|
||||
topicId: string | undefined;
|
||||
secondaryActionLabel: string | null;
|
||||
secondaryActionLink: unknown[] | null;
|
||||
secondaryActionQueryParams: Record<string, string | number | number[]> | null;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-research-timeline',
|
||||
standalone: true,
|
||||
@@ -123,6 +137,8 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
@Input() subfieldLegendVisible = true;
|
||||
@Input() subfieldLegendExpanded = false;
|
||||
@Input() wordCloudLegendTopics: TopicLegendTopic[] = [];
|
||||
@Input() personPublicationsLink: unknown[] | null = null;
|
||||
@Input() personName = '';
|
||||
|
||||
@Output() viewModeChange = new EventEmitter<TimelineViewMode>();
|
||||
@Output() yearRangeChange = new EventEmitter<TimelineYearRange>();
|
||||
@@ -146,6 +162,11 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
private readonly displayedPhaseTopicLimit = 4;
|
||||
private readonly scrollRestoreThreshold = 24;
|
||||
private readonly expandedPhaseIds = new Set<string>();
|
||||
private readonly topicActionCache = new Map<string, TimelineTopicAction>();
|
||||
private readonly tooltipInputsCache = new Map<
|
||||
string,
|
||||
TimelineTopicTooltipInputs
|
||||
>();
|
||||
activeLegendFieldIds: ReadonlySet<string> = new Set();
|
||||
activeLegendSubfieldIds: ReadonlySet<string> = new Set();
|
||||
|
||||
@@ -169,6 +190,11 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
if (changes['elements'] || changes['startYear'] || changes['endYear']) {
|
||||
this.applyInputYearRange();
|
||||
}
|
||||
|
||||
if (changes['personName'] || changes['personPublicationsLink']) {
|
||||
this.topicActionCache.clear();
|
||||
this.tooltipInputsCache.clear();
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewChecked(): void {
|
||||
@@ -330,6 +356,85 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
return phase.years.map((year) => year.year);
|
||||
}
|
||||
|
||||
getTopicAction(
|
||||
topic: TopicTimelineTopic | undefined,
|
||||
years: number[],
|
||||
): TimelineTopicAction | null {
|
||||
if (!this.personPublicationsLink || !topic?.id || years.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const selectedYears = this.normalizeSelectedYears(years);
|
||||
const cacheKey = `${topic.id}|${selectedYears.join(',')}`;
|
||||
const cached = this.topicActionCache.get(cacheKey);
|
||||
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const person = this.personName || 'dieser Person';
|
||||
const action: TimelineTopicAction = {
|
||||
label: `Publikationen von ${person} ${this.formatYearRange(selectedYears)}`,
|
||||
link: this.personPublicationsLink,
|
||||
queryParams: {
|
||||
[workQueryParamKeys.page]: 0,
|
||||
[workQueryParamKeys.years]: selectedYears,
|
||||
[workQueryParamKeys.topicId]: topic.id,
|
||||
},
|
||||
};
|
||||
|
||||
this.topicActionCache.set(cacheKey, action);
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
getTopicTooltipInputs(
|
||||
topic: TopicTimelineTopic | undefined,
|
||||
years: number[],
|
||||
): TimelineTopicTooltipInputs {
|
||||
const action = this.getTopicAction(topic, years);
|
||||
const cacheKey = `${topic?.id ?? ''}|${years.join(',')}`;
|
||||
const cached = this.tooltipInputsCache.get(cacheKey);
|
||||
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
const inputs: TimelineTopicTooltipInputs = {
|
||||
topicId: topic?.id,
|
||||
secondaryActionLabel: action?.label ?? null,
|
||||
secondaryActionLink: action?.link ?? null,
|
||||
secondaryActionQueryParams: action?.queryParams ?? null,
|
||||
};
|
||||
|
||||
this.tooltipInputsCache.set(cacheKey, inputs);
|
||||
|
||||
return inputs;
|
||||
}
|
||||
|
||||
getTopicAriaLabel(
|
||||
topic: TopicTimelineTopic | undefined,
|
||||
years: number[],
|
||||
): string | null {
|
||||
if (!topic?.id || years.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const person = this.personName || 'dieser Person';
|
||||
const selectedYears = this.normalizeSelectedYears(years);
|
||||
|
||||
return `Publikationen von ${person} zum Thema ${topic.name} ${this.formatYearRange(selectedYears)}`;
|
||||
}
|
||||
|
||||
private formatYearRange(years: number[]): string {
|
||||
const firstYear = years[0];
|
||||
const lastYear = years[years.length - 1];
|
||||
|
||||
return firstYear === lastYear
|
||||
? `(${firstYear})`
|
||||
: `(${firstYear}–${lastYear})`;
|
||||
}
|
||||
|
||||
getYearPublicationTooltip(item: TopicTimelineElement): string {
|
||||
return this.getPublicationTooltip(
|
||||
item.publication_count,
|
||||
|
||||
+2
-1
@@ -15,8 +15,9 @@
|
||||
[style.fontSize.px]="word.fontSize"
|
||||
[style.fontWeight]="word.fontWeight"
|
||||
[disabled]="!word.topicId"
|
||||
[attr.aria-label]="wordAriaLabel(word)"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="{ topicId: word.rawTopicId }"
|
||||
[tooltipInputs]="tooltipInputsFor(word)"
|
||||
[tooltipDisabled]="!word.rawTopicId"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="selectWord(word)">
|
||||
|
||||
+65
-1
@@ -8,6 +8,14 @@ import {
|
||||
getTopicLegendSubfieldId,
|
||||
TopicLegendTopic,
|
||||
} from '../../../../resolvers/utils/topic-legend';
|
||||
import { workQueryParamKeys } from '../../../../resolvers/work-page.resolver';
|
||||
|
||||
interface WordTooltipInputs {
|
||||
topicId: string;
|
||||
secondaryActionLabel: string | null;
|
||||
secondaryActionLink: unknown[] | null;
|
||||
secondaryActionQueryParams: Record<string, string | number>;
|
||||
}
|
||||
|
||||
export interface WordCloudTopicOccurrence {
|
||||
name: string;
|
||||
@@ -158,7 +166,24 @@ function stripOpenAlexId(id: string | null | undefined): string {
|
||||
export class ResearchWordcloudComponent {
|
||||
readonly AppTopicTooltipComponent = AppTopicTooltipComponent;
|
||||
|
||||
@Input() words: WordCloudWord[] = [];
|
||||
@Input() set words(value: WordCloudWord[]) {
|
||||
this._words = value;
|
||||
this.rebuildTooltipInputs();
|
||||
}
|
||||
get words(): WordCloudWord[] {
|
||||
return this._words;
|
||||
}
|
||||
|
||||
@Input() set personPublicationsLink(value: unknown[] | null) {
|
||||
this._personPublicationsLink = value;
|
||||
this.rebuildTooltipInputs();
|
||||
}
|
||||
|
||||
@Input() set personName(value: string) {
|
||||
this._personName = value;
|
||||
this.rebuildTooltipInputs();
|
||||
}
|
||||
|
||||
@Input() loading = false;
|
||||
@Input() loadFailed = false;
|
||||
@Input() activeFieldIds: ReadonlySet<string> = new Set();
|
||||
@@ -166,6 +191,11 @@ export class ResearchWordcloudComponent {
|
||||
|
||||
@Output() wordSelect = new EventEmitter<WordCloudWord>();
|
||||
|
||||
private _words: WordCloudWord[] = [];
|
||||
private _personPublicationsLink: unknown[] | null = null;
|
||||
private _personName = '';
|
||||
private tooltipInputsByTopic = new Map<string, WordTooltipInputs>();
|
||||
|
||||
selectWord(word: WordCloudWord): void {
|
||||
if (!word.topicId) {
|
||||
return;
|
||||
@@ -181,4 +211,38 @@ export class ResearchWordcloudComponent {
|
||||
this.activeSubfieldIds.has(word.subfieldLegendId))
|
||||
);
|
||||
}
|
||||
|
||||
tooltipInputsFor(word: WordCloudWord): WordTooltipInputs | null {
|
||||
return this.tooltipInputsByTopic.get(word.topicId) ?? null;
|
||||
}
|
||||
|
||||
wordAriaLabel(word: WordCloudWord): string {
|
||||
return this._personName
|
||||
? `Publikationen von ${this._personName} zum Thema ${word.name}`
|
||||
: `Publikationen dieser Person zum Thema ${word.name}`;
|
||||
}
|
||||
|
||||
private rebuildTooltipInputs(): void {
|
||||
const label = this._personName
|
||||
? `Publikationen von ${this._personName}`
|
||||
: 'Publikationen dieser Person';
|
||||
const link = this._personPublicationsLink;
|
||||
|
||||
this.tooltipInputsByTopic = new Map(
|
||||
this._words
|
||||
.filter((word) => word.topicId)
|
||||
.map((word) => [
|
||||
word.topicId,
|
||||
{
|
||||
topicId: word.rawTopicId,
|
||||
secondaryActionLabel: link ? label : null,
|
||||
secondaryActionLink: link,
|
||||
secondaryActionQueryParams: {
|
||||
[workQueryParamKeys.page]: 0,
|
||||
[workQueryParamKeys.topicId]: word.topicId,
|
||||
},
|
||||
},
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
[subfieldLegendVisible]="timelineLegendVisible"
|
||||
[subfieldLegendExpanded]="timelineLegendExpanded"
|
||||
[wordCloudLegendTopics]="wordCloudLegendTopics"
|
||||
[personName]="personName"
|
||||
[personPublicationsLink]="personPublicationsLink"
|
||||
(viewModeChange)="onTimelineViewModeChange($event)"
|
||||
(yearRangeChange)="onTimelineYearRangeChange($event)"
|
||||
(subfieldLegendVisibleChange)="onTimelineLegendVisibleChange($event)"
|
||||
@@ -27,6 +29,8 @@
|
||||
[loadFailed]="wordCloudLoadFailed"
|
||||
[activeFieldIds]="activeLegendFieldIds"
|
||||
[activeSubfieldIds]="activeLegendSubfieldIds"
|
||||
[personName]="personName"
|
||||
[personPublicationsLink]="personPublicationsLink"
|
||||
(wordSelect)="onWordClick($event)" />
|
||||
</app-research-timeline>
|
||||
</section>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { ActivatedRoute, ParamMap, Router } from '@angular/router';
|
||||
import { combineLatest, distinctUntilChanged, map } from 'rxjs';
|
||||
import { combineLatest, distinctUntilChanged, map, of, switchMap } from 'rxjs';
|
||||
|
||||
import { TopicCount, TopicsByYear, WorksService } from '../../api';
|
||||
import {
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
TopicLegendSelectionState,
|
||||
TopicLegendTopic,
|
||||
} from '../../resolvers/utils/topic-legend';
|
||||
import { PersonDataResolved } from '../../resolvers/person.resolver';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-overview',
|
||||
@@ -69,6 +70,8 @@ export class PersonOverviewComponent implements OnInit {
|
||||
wordCloudLoadFailed = false;
|
||||
activeLegendFieldIds: ReadonlySet<string> = new Set();
|
||||
activeLegendSubfieldIds: ReadonlySet<string> = new Set();
|
||||
personName = '';
|
||||
personPublicationsLink: unknown[] | null = null;
|
||||
|
||||
private rawTopicOccurrences: WordCloudTopicOccurrence[] = [];
|
||||
|
||||
@@ -80,10 +83,16 @@ export class PersonOverviewComponent implements OnInit {
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((authorId) => {
|
||||
this.personPublicationsLink =
|
||||
authorId && authorId !== '0'
|
||||
? ['/person', authorId, 'publications']
|
||||
: null;
|
||||
this.loadTopicTimeline(authorId);
|
||||
this.loadWordCloud(authorId);
|
||||
});
|
||||
|
||||
this.loadPersonName();
|
||||
|
||||
this.route.queryParamMap
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe((queryParams) => {
|
||||
@@ -337,6 +346,25 @@ export class PersonOverviewComponent implements OnInit {
|
||||
this.timelineEarlierYearsLoadFailed = false;
|
||||
}
|
||||
|
||||
private loadPersonName(): void {
|
||||
combineLatest(this.route.pathFromRoot.map((route) => route.data))
|
||||
.pipe(
|
||||
map((dataEntries) =>
|
||||
dataEntries
|
||||
.map((data) => data['personData'] as PersonDataResolved | undefined)
|
||||
.find((resolved): resolved is PersonDataResolved =>
|
||||
Boolean(resolved),
|
||||
),
|
||||
),
|
||||
distinctUntilChanged(),
|
||||
switchMap((resolved) => resolved?.personData$ ?? of(null)),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((response) => {
|
||||
this.personName = response?.results?.[0]?.display_name ?? '';
|
||||
});
|
||||
}
|
||||
|
||||
private loadWordCloud(authorId: string): void {
|
||||
if (!authorId || authorId === '0') {
|
||||
this.wordCloudWords = [];
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
<app-person-interesting
|
||||
[topics]="primaryTopicCounts()"
|
||||
[loading]="isTopicsLoading()"
|
||||
[personName]="personName()"
|
||||
[personPublicationsLink]="personPublicationsLink()"
|
||||
(tagClick)="onInterestingTagClick($event)"></app-person-interesting>
|
||||
</section>
|
||||
@if (this.links()) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
inject,
|
||||
signal,
|
||||
DestroyRef,
|
||||
ElementRef,
|
||||
input,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
@@ -18,11 +19,20 @@ import { MatTabsModule } from '@angular/material/tabs';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import {
|
||||
ActivatedRoute,
|
||||
NavigationEnd,
|
||||
Router,
|
||||
RouterModule,
|
||||
RouterOutlet,
|
||||
} from '@angular/router';
|
||||
import { of, switchMap, finalize, map, catchError, combineLatest } from 'rxjs';
|
||||
import {
|
||||
of,
|
||||
switchMap,
|
||||
finalize,
|
||||
map,
|
||||
catchError,
|
||||
combineLatest,
|
||||
filter,
|
||||
} from 'rxjs';
|
||||
|
||||
import { PersonInterestingComponent } from '../person-interesting/person-interesting.component';
|
||||
import { CountryFlagComponent } from '../../shared/ui/country-flag/country-flag.component';
|
||||
@@ -82,11 +92,28 @@ export class PersonComponent {
|
||||
() => this.navBar()?.activeLink() ?? null,
|
||||
);
|
||||
|
||||
private readonly tabPanelElement = viewChild('tabPanel', {
|
||||
read: ElementRef,
|
||||
});
|
||||
|
||||
private publicationFilterKey: string | null = null;
|
||||
|
||||
constructor() {
|
||||
this.bookmarkService
|
||||
.load()
|
||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||
.subscribe();
|
||||
|
||||
this.router.events
|
||||
.pipe(
|
||||
filter(
|
||||
(event): event is NavigationEnd => event instanceof NavigationEnd,
|
||||
),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((event) =>
|
||||
this.scrollToPanelOnFilterChange(event.urlAfterRedirects),
|
||||
);
|
||||
}
|
||||
|
||||
readonly params = toSignal(this.activatedRoute.paramMap);
|
||||
@@ -169,6 +196,13 @@ export class PersonComponent {
|
||||
readonly displayName = computed(
|
||||
() => this.person()?.display_name ?? 'Unbekannte Person',
|
||||
);
|
||||
|
||||
readonly personName = computed(() => this.person()?.display_name ?? '');
|
||||
|
||||
readonly personPublicationsLink = computed<unknown[] | null>(() => {
|
||||
const authorId = this.authorId();
|
||||
return authorId ? ['/person', authorId, 'publications'] : null;
|
||||
});
|
||||
readonly initials = computed(() => this.buildInitials(this.displayName()));
|
||||
readonly primaryAffiliation = computed(
|
||||
() => this.person()?.affiliations?.[0] ?? null,
|
||||
@@ -368,6 +402,46 @@ export class PersonComponent {
|
||||
});
|
||||
}
|
||||
|
||||
private scrollToPanelOnFilterChange(url: string): void {
|
||||
const { queryParams } = this.router.parseUrl(url);
|
||||
const filterKey = [workQueryParamKeys.topicId, workQueryParamKeys.years]
|
||||
.map((key) => {
|
||||
const value = queryParams[key];
|
||||
return Array.isArray(value) ? value.join(',') : (value ?? '');
|
||||
})
|
||||
.join('|');
|
||||
|
||||
const previousFilterKey = this.publicationFilterKey;
|
||||
this.publicationFilterKey = filterKey;
|
||||
|
||||
const hasFilter = filterKey !== '|';
|
||||
const isFirstNavigation = previousFilterKey === null;
|
||||
|
||||
if (isFirstNavigation || !hasFilter || filterKey === previousFilterKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.scrollPanelIntoView();
|
||||
}
|
||||
|
||||
private scrollPanelIntoView(): void {
|
||||
const scrollToPanel = (): void => {
|
||||
this.tabPanelElement()?.nativeElement.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'start',
|
||||
});
|
||||
};
|
||||
|
||||
requestAnimationFrame(scrollToPanel);
|
||||
|
||||
setTimeout(() => {
|
||||
const panel = this.tabPanelElement();
|
||||
if (panel && panel.nativeElement.getBoundingClientRect().top > 8) {
|
||||
scrollToPanel();
|
||||
}
|
||||
}, 400);
|
||||
}
|
||||
|
||||
private getId(key: string): string | null {
|
||||
const ids = this.person()?.ids as Record<string, string> | undefined;
|
||||
if (!ids) {
|
||||
|
||||
@@ -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(' › ');
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
@@ -40,13 +40,24 @@
|
||||
|
||||
<mat-card-footer>
|
||||
<mat-card-actions class="card-actions">
|
||||
@if (hasSecondaryAction()) {
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="secondaryActionLink()"
|
||||
[queryParams]="secondaryActionQueryParams()"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>{{ secondaryActionIcon() }}</mat-icon>
|
||||
{{ secondaryActionLabel() }}
|
||||
</a>
|
||||
}
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="['/topic', stripOpenAlexId(topic.id), 'publications']"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>menu_book</mat-icon>
|
||||
Publikationen
|
||||
{{ publicationsActionLabel() }}
|
||||
</a>
|
||||
</mat-card-actions>
|
||||
</mat-card-footer>
|
||||
|
||||
@@ -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 {
|
||||
@@ -49,6 +96,7 @@
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Topic } from '../../../api';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { Params, RouterModule } from '@angular/router';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
@@ -27,6 +27,31 @@ import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
export class AppTopicCardComponent {
|
||||
topic = input.required<Topic>();
|
||||
|
||||
/**
|
||||
* Optional extra footer action, e.g. "Publikationen von <Person>". Only
|
||||
* rendered when both label and link are given.
|
||||
*/
|
||||
secondaryActionLabel = input<string | null>(null);
|
||||
secondaryActionIcon = input<string>('person_search');
|
||||
secondaryActionLink = input<unknown[] | string | null>(null);
|
||||
secondaryActionQueryParams = input<Params | null>(null);
|
||||
|
||||
hasSecondaryAction = computed(
|
||||
() =>
|
||||
Boolean(this.secondaryActionLabel()) &&
|
||||
Boolean(this.secondaryActionLink()),
|
||||
);
|
||||
|
||||
/**
|
||||
* Without a secondary action "Publikationen" is unambiguous. Next to a
|
||||
* person-scoped action it is not, so the scope becomes explicit.
|
||||
*/
|
||||
publicationsActionLabel = computed(() =>
|
||||
this.hasSecondaryAction()
|
||||
? 'Alle Publikationen zum Thema'
|
||||
: 'Publikationen',
|
||||
);
|
||||
|
||||
stripOpenAlexId(id: string | null | undefined): string | undefined {
|
||||
if (!id) {
|
||||
return undefined;
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
@let topic = this._topic();
|
||||
|
||||
@if (topic) {
|
||||
<app-topic-card [topic]="topic" />
|
||||
<app-topic-card
|
||||
[topic]="topic"
|
||||
[secondaryActionLabel]="secondaryActionLabel()"
|
||||
[secondaryActionIcon]="secondaryActionIcon()"
|
||||
[secondaryActionLink]="secondaryActionLink()"
|
||||
[secondaryActionQueryParams]="secondaryActionQueryParams()" />
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Component, effect, inject, input, signal } from '@angular/core';
|
||||
import { Params } from '@angular/router';
|
||||
import { Topic, TopicsV2Service } from '../../../api';
|
||||
import { AppTopicCardComponent } from '../app-topic-card/app-topic-card.component';
|
||||
|
||||
@@ -14,6 +15,11 @@ export class AppTopicTooltipComponent {
|
||||
topicId = input<string | null | undefined>(undefined);
|
||||
topic = input<Topic | null | undefined>(undefined);
|
||||
|
||||
secondaryActionLabel = input<string | null>(null);
|
||||
secondaryActionIcon = input<string>('person_search');
|
||||
secondaryActionLink = input<unknown[] | string | null>(null);
|
||||
secondaryActionQueryParams = input<Params | null>(null);
|
||||
|
||||
_topic = signal<Topic | undefined>(undefined);
|
||||
_isLoading = signal<boolean>(false);
|
||||
|
||||
|
||||
@@ -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,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;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, computed, input, output } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { Params } from '@angular/router';
|
||||
import { Topic } from '../../../api';
|
||||
import { ComponentTooltipDirective } from '../../../directives/component-tooltip.directive';
|
||||
import { AppTopicTooltipComponent } from '../app-topic-tooltip/app-topic-tooltip.component';
|
||||
@@ -102,6 +103,10 @@ export class TopicChipComponent {
|
||||
descriptionTooltipTarget = input<TopicChipTooltipTarget>('label');
|
||||
topicId = input<string | null | undefined>(undefined);
|
||||
topic = input<Topic | null | undefined>(undefined);
|
||||
secondaryActionLabel = input<string | null>(null);
|
||||
secondaryActionIcon = input<string>('person_search');
|
||||
secondaryActionLink = input<unknown[] | string | null>(null);
|
||||
secondaryActionQueryParams = input<Params | null>(null);
|
||||
|
||||
chipClick = output<void>();
|
||||
|
||||
@@ -188,6 +193,10 @@ export class TopicChipComponent {
|
||||
return {
|
||||
topic: this.topicObject(),
|
||||
topicId: this.topicId() ?? this.topic()?.id ?? undefined,
|
||||
secondaryActionLabel: this.secondaryActionLabel(),
|
||||
secondaryActionIcon: this.secondaryActionIcon(),
|
||||
secondaryActionLink: this.secondaryActionLink(),
|
||||
secondaryActionQueryParams: this.secondaryActionQueryParams(),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user