refactor/static_topic_cache #285
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;
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user