Compare commits
51
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f471a6532a | ||
|
|
1ab51196ce | ||
|
|
043db9b7cc | ||
|
|
c222d422a9 | ||
|
|
d1310f24ff | ||
|
|
fbf5dbefe3 | ||
|
|
387cab897a | ||
|
|
d78aef8df1 | ||
|
|
1a34333c63 | ||
|
|
514e572eb9 | ||
|
|
0c2a45ba66 | ||
|
|
70ed62a220 | ||
|
|
9d1ab1babb | ||
|
|
d7a269589c | ||
|
|
84747b9efb | ||
|
|
3596c42947 | ||
|
|
3249a8569b | ||
|
|
479c144c8b | ||
|
|
d89d1ded98 | ||
|
|
fa7e607f3e | ||
|
|
a0477fcdb1 | ||
|
|
f3539e4210 | ||
|
|
9cd109fc17 | ||
|
|
84f3314b60 | ||
|
|
5b37115e46 | ||
|
|
8f707df86f | ||
|
|
514634d5f0 | ||
|
|
d1588ac5c1 | ||
|
|
c30208e61e | ||
|
|
8c61b4d54f | ||
|
|
239129e513 | ||
|
|
e21b84544c | ||
|
|
3b16f8d8fc | ||
|
|
be74063a51 | ||
|
|
c8b055902f | ||
|
|
124d65f8c9 | ||
|
|
db5156a02d | ||
|
|
9dadc1f12f | ||
|
|
08cfec6be0 | ||
|
|
28b57059b7 | ||
|
|
dc2ef6fd20 | ||
|
|
11d20546b1 | ||
|
|
b6618e030e | ||
|
|
23da3e44ba | ||
|
|
379f94ddc7 | ||
|
|
ebdf0b8eab | ||
|
|
bd39e16d9b | ||
|
|
977ac97241 | ||
|
|
d465ef6915 | ||
|
|
7442a56b0a | ||
|
|
9432d01135 |
@@ -8,6 +8,15 @@ build
|
|||||||
__pycache__
|
__pycache__
|
||||||
# Ignore macos
|
# Ignore macos
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# Ignore local environment files
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
**/.env
|
||||||
|
**/.env.*
|
||||||
|
!.env.example
|
||||||
|
!**/.env.example
|
||||||
|
|
||||||
# Ignore generated python code
|
# Ignore generated python code
|
||||||
src/python/account/
|
src/python/account/
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ task exportOpenApiSpec(type: Exec) {
|
|||||||
commandLine 'docker', 'run', '--rm',
|
commandLine 'docker', 'run', '--rm',
|
||||||
'--platform', "${targetPlatform}",
|
'--platform', "${targetPlatform}",
|
||||||
'-w', '/home',
|
'-w', '/home',
|
||||||
'-v', "${projectDir}/src/main:/home",
|
//'-v', "${projectDir}/src/main:/home", the source code is already baked into the image at build time
|
||||||
'-v', "${openApiDir}:/mnt/openapi",
|
'-v', "${openApiDir}:/mnt/openapi",
|
||||||
'-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'",
|
'-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'",
|
||||||
'--name', "${imageName}-service-openapi",
|
'--name', "${imageName}-service-openapi",
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""
|
"""
|
||||||
One-time script to fetch all topics from 'openalex-topics',
|
Script to fetch all topics from 'openalex-topics',
|
||||||
vectorize display names and chunked descriptions using the sentence-transformers model,
|
vectorize display names, full descriptions, and individual keywords using the sentence-transformers model,
|
||||||
and push them to the 'topicvectors' index with multi-vector hybrid mapping.
|
and push them to the 'topicvectors' index with multi-vector mapping.
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import base64
|
|
||||||
import re
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import httpx
|
import httpx
|
||||||
import numpy as np
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
# Add service/src/main to python path to load settings
|
# Add service/src/main to python path to load settings
|
||||||
@@ -24,8 +20,10 @@ sys.path.append(str(project_root / "service" / "src" / "main"))
|
|||||||
from inse.config import settings
|
from inse.config import settings
|
||||||
|
|
||||||
ELASTIC_URL = settings.elasticsearch_url
|
ELASTIC_URL = settings.elasticsearch_url
|
||||||
|
if ELASTIC_URL and not ELASTIC_URL.endswith("/"):
|
||||||
|
ELASTIC_URL += "/"
|
||||||
API_KEY = settings.elasticsearch_api_key
|
API_KEY = settings.elasticsearch_api_key
|
||||||
MODEL_NAME = "paraphrase-multilingual-mpnet-base-v2"
|
MODEL_NAME = settings.sentence_transformers_model_name
|
||||||
|
|
||||||
# Import sentence-transformers
|
# Import sentence-transformers
|
||||||
from sentence_transformers import SentenceTransformer
|
from sentence_transformers import SentenceTransformer
|
||||||
@@ -35,14 +33,6 @@ headers = {
|
|||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
def split_into_sentences(text):
|
|
||||||
if not text:
|
|
||||||
return []
|
|
||||||
# Split on period, exclamation, or question mark followed by whitespace
|
|
||||||
sentences = re.split(r'(?<=[.!?])\s+', text.strip())
|
|
||||||
# Filter out empty or extremely short sentences
|
|
||||||
return [s for s in sentences if len(s.strip()) > 3]
|
|
||||||
|
|
||||||
def fetch_all_topics():
|
def fetch_all_topics():
|
||||||
print("Fetching topics from 'openalex-topics'...")
|
print("Fetching topics from 'openalex-topics'...")
|
||||||
topics = []
|
topics = []
|
||||||
@@ -75,7 +65,67 @@ def fetch_all_topics():
|
|||||||
print(f"Total topics fetched: {len(topics)}")
|
print(f"Total topics fetched: {len(topics)}")
|
||||||
return topics
|
return topics
|
||||||
|
|
||||||
def bulk_index_topics(topics, display_name_vectors, nested_description_vectors):
|
def update_mappings():
|
||||||
|
print("Checking/updating mappings for 'topicvectors'...")
|
||||||
|
mapping_payload = {
|
||||||
|
"properties": {
|
||||||
|
"display_name_vector": {
|
||||||
|
"type": "dense_vector",
|
||||||
|
"dims": 768,
|
||||||
|
"index": True,
|
||||||
|
"similarity": "cosine",
|
||||||
|
"index_options": {
|
||||||
|
"type": "int8_hnsw",
|
||||||
|
"m": 16,
|
||||||
|
"ef_construction": 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description_vector": {
|
||||||
|
"type": "dense_vector",
|
||||||
|
"dims": 768,
|
||||||
|
"index": True,
|
||||||
|
"similarity": "cosine",
|
||||||
|
"index_options": {
|
||||||
|
"type": "int8_hnsw",
|
||||||
|
"m": 16,
|
||||||
|
"ef_construction": 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"keyword_vectors": {
|
||||||
|
"type": "nested",
|
||||||
|
"properties": {
|
||||||
|
"vector": {
|
||||||
|
"type": "dense_vector",
|
||||||
|
"dims": 768,
|
||||||
|
"index": True,
|
||||||
|
"similarity": "cosine",
|
||||||
|
"index_options": {
|
||||||
|
"type": "int8_hnsw",
|
||||||
|
"m": 16,
|
||||||
|
"ef_construction": 100
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
with httpx.Client(timeout=30.0) as client:
|
||||||
|
# Check if index exists
|
||||||
|
check_resp = client.get(f"{ELASTIC_URL}topicvectors", headers=headers)
|
||||||
|
if check_resp.status_code == 404:
|
||||||
|
print("Index 'topicvectors' does not exist. Creating it...")
|
||||||
|
create_payload = {
|
||||||
|
"mappings": mapping_payload
|
||||||
|
}
|
||||||
|
resp = client.put(f"{ELASTIC_URL}topicvectors", json=create_payload, headers=headers)
|
||||||
|
resp.raise_for_status()
|
||||||
|
else:
|
||||||
|
print("Index 'topicvectors' exists. Updating mappings...")
|
||||||
|
resp = client.put(f"{ELASTIC_URL}topicvectors/_mapping", json=mapping_payload, headers=headers)
|
||||||
|
resp.raise_for_status()
|
||||||
|
print("Mappings update process completed.")
|
||||||
|
|
||||||
|
def bulk_index_topics(topics, display_name_vectors, description_vectors, keyword_vectors_list):
|
||||||
print("Bulk indexing vectorized topics into 'topicvectors'...")
|
print("Bulk indexing vectorized topics into 'topicvectors'...")
|
||||||
batch_size = 500
|
batch_size = 500
|
||||||
|
|
||||||
@@ -83,22 +133,24 @@ def bulk_index_topics(topics, display_name_vectors, nested_description_vectors):
|
|||||||
for i in range(0, len(topics), batch_size):
|
for i in range(0, len(topics), batch_size):
|
||||||
batch_topics = topics[i:i+batch_size]
|
batch_topics = topics[i:i+batch_size]
|
||||||
batch_name_vecs = display_name_vectors[i:i+batch_size]
|
batch_name_vecs = display_name_vectors[i:i+batch_size]
|
||||||
batch_desc_vecs_list = nested_description_vectors[i:i+batch_size]
|
batch_desc_vecs = description_vectors[i:i+batch_size]
|
||||||
|
batch_kw_vecs_list = keyword_vectors_list[i:i+batch_size]
|
||||||
|
|
||||||
bulk_lines = []
|
bulk_lines = []
|
||||||
for t, name_vec, desc_vecs in zip(batch_topics, batch_name_vecs, batch_desc_vecs_list):
|
for t, name_vec, desc_vec, kw_vecs in zip(batch_topics, batch_name_vecs, batch_desc_vecs, batch_kw_vecs_list):
|
||||||
source = t["_source"]
|
source = t["_source"]
|
||||||
|
|
||||||
# Remove deprecated single vector if present
|
source.pop("siblings", None) # drop siblings field when making the copy
|
||||||
if "vector" in source:
|
|
||||||
del source["vector"]
|
|
||||||
|
|
||||||
# Assign name vector as a standard float list
|
# Assign name vector as a standard float list
|
||||||
source["display_name_vector"] = name_vec.tolist()
|
source["display_name_vector"] = name_vec.tolist()
|
||||||
|
|
||||||
# Assign nested description vectors as standard float lists
|
# Assign description vector
|
||||||
source["description_vectors"] = [
|
source["description_vector"] = desc_vec.tolist()
|
||||||
{"vector": vec.tolist()} for vec in desc_vecs
|
|
||||||
|
# Assign nested keyword vectors
|
||||||
|
source["keyword_vectors"] = [
|
||||||
|
{"vector": vec.tolist()} for vec in kw_vecs
|
||||||
]
|
]
|
||||||
|
|
||||||
# Meta line
|
# Meta line
|
||||||
@@ -124,6 +176,8 @@ def bulk_index_topics(topics, display_name_vectors, nested_description_vectors):
|
|||||||
print(f"Indexed batch {i} to {i + len(batch_topics)}")
|
print(f"Indexed batch {i} to {i + len(batch_topics)}")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
update_mappings()
|
||||||
|
|
||||||
topics = fetch_all_topics()
|
topics = fetch_all_topics()
|
||||||
if not topics:
|
if not topics:
|
||||||
print("No topics found. Exiting.")
|
print("No topics found. Exiting.")
|
||||||
@@ -133,44 +187,50 @@ def main():
|
|||||||
model = SentenceTransformer(MODEL_NAME)
|
model = SentenceTransformer(MODEL_NAME)
|
||||||
|
|
||||||
# 1. Gather all texts to embed
|
# 1. Gather all texts to embed
|
||||||
display_names = []
|
keywords_by_topic = []
|
||||||
description_sentences_by_topic = []
|
|
||||||
all_texts_to_embed = []
|
all_texts_to_embed = []
|
||||||
|
|
||||||
for t in topics:
|
for t in topics:
|
||||||
source = t["_source"]
|
source = t["_source"]
|
||||||
|
|
||||||
name = source.get("display_name") or ""
|
name = source.get("display_name") or ""
|
||||||
display_names.append(name)
|
|
||||||
all_texts_to_embed.append(name)
|
all_texts_to_embed.append(name)
|
||||||
|
|
||||||
desc = source.get("description") or ""
|
desc = source.get("description") or ""
|
||||||
sentences = split_into_sentences(desc)
|
all_texts_to_embed.append(desc)
|
||||||
description_sentences_by_topic.append(sentences)
|
|
||||||
all_texts_to_embed.extend(sentences)
|
|
||||||
|
|
||||||
print(f"Embedding {len(all_texts_to_embed)} texts (display names and description passages)...")
|
kws = source.get("keywords") or []
|
||||||
|
if not isinstance(kws, list):
|
||||||
|
kws = [kws] if kws else []
|
||||||
|
keywords_by_topic.append(kws)
|
||||||
|
all_texts_to_embed.extend(kws)
|
||||||
|
|
||||||
|
print(f"Embedding {len(all_texts_to_embed)} texts (display names, descriptions, and keywords)...")
|
||||||
all_vectors = model.encode(all_texts_to_embed, show_progress_bar=True, batch_size=32)
|
all_vectors = model.encode(all_texts_to_embed, show_progress_bar=True, batch_size=32)
|
||||||
|
|
||||||
# 2. Map embeddings back to topics
|
# 2. Map embeddings back to topics
|
||||||
display_name_vectors = []
|
display_name_vectors = []
|
||||||
nested_description_vectors = []
|
description_vectors = []
|
||||||
|
keyword_vectors_list = []
|
||||||
|
|
||||||
vector_idx = 0
|
vector_idx = 0
|
||||||
for idx, t in enumerate(topics):
|
for idx, t in enumerate(topics):
|
||||||
# First vector is the display name
|
|
||||||
display_name_vectors.append(all_vectors[vector_idx])
|
display_name_vectors.append(all_vectors[vector_idx])
|
||||||
vector_idx += 1
|
vector_idx += 1
|
||||||
|
|
||||||
# Next N vectors are the description chunks
|
description_vectors.append(all_vectors[vector_idx])
|
||||||
sentences = description_sentences_by_topic[idx]
|
vector_idx += 1
|
||||||
topic_desc_vecs = []
|
|
||||||
for _ in range(len(sentences)):
|
kws = keywords_by_topic[idx]
|
||||||
topic_desc_vecs.append(all_vectors[vector_idx])
|
topic_kw_vecs = []
|
||||||
|
for _ in range(len(kws)):
|
||||||
|
topic_kw_vecs.append(all_vectors[vector_idx])
|
||||||
vector_idx += 1
|
vector_idx += 1
|
||||||
nested_description_vectors.append(topic_desc_vecs)
|
keyword_vectors_list.append(topic_kw_vecs)
|
||||||
|
|
||||||
# Bulk index
|
# Bulk index
|
||||||
bulk_index_topics(topics, display_name_vectors, nested_description_vectors)
|
bulk_index_topics(topics, display_name_vectors, description_vectors, keyword_vectors_list)
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
{
|
|
||||||
"query": "localization",
|
|
||||||
"max_score": 23.237041,
|
|
||||||
"results": [
|
|
||||||
{
|
|
||||||
"topic_name": "Indoor and Outdoor Localization Technologies",
|
|
||||||
"score": 23.237041
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Robotics and Sensor-Based Localization",
|
|
||||||
"score": 21.511477
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Spectral Theory in Mathematical Physics",
|
|
||||||
"score": 14.039959
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Socioeconomic Development in MENA",
|
|
||||||
"score": 11.518878
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Electrical Fault Detection and Protection",
|
|
||||||
"score": 10.770052
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Machine Learning in Bioinformatics",
|
|
||||||
"score": 10.322677
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Software System Performance and Reliability",
|
|
||||||
"score": 10.112644
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Quantum many-body systems",
|
|
||||||
"score": 10.112644
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Random lasers and scattering media",
|
|
||||||
"score": 10.112644
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Insect Pheromone Research and Control",
|
|
||||||
"score": 9.910988
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Tactile and Sensory Interactions",
|
|
||||||
"score": 9.910988
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Handwritten Text Recognition Techniques",
|
|
||||||
"score": 9.910988
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Integrated Circuits and Semiconductor Failure Analysis",
|
|
||||||
"score": 9.910988
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Medical Imaging and Analysis",
|
|
||||||
"score": 9.7172165
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Microwave Imaging and Scattering Analysis",
|
|
||||||
"score": 9.7172165
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Neurology and Historical Studies",
|
|
||||||
"score": 9.7172165
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "High-Velocity Impact and Material Behavior",
|
|
||||||
"score": 9.7172165
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Software Engineering Research",
|
|
||||||
"score": 9.530875
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Software Testing and Debugging Techniques",
|
|
||||||
"score": 9.530875
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Digital Media Forensic Detection",
|
|
||||||
"score": 9.530875
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Infrared Thermography in Medicine",
|
|
||||||
"score": 9.351548
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Explainable Artificial Intelligence (XAI)",
|
|
||||||
"score": 9.351548
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Underwater Vehicles and Communication Systems",
|
|
||||||
"score": 9.351548
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Diffusion and Search Dynamics",
|
|
||||||
"score": 8.8518915
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Direction-of-Arrival Estimation Techniques",
|
|
||||||
"score": 5.968384
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Retinal Imaging and Analysis",
|
|
||||||
"score": 5.6107
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"topic_name": "Radar Systems and Signal Processing",
|
|
||||||
"score": 4.721418
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
ELASTICSEARCH_URL=https://project.nes.uni-due.de/elastic/
|
|
||||||
ELASTICSEARCH_API_KEY=am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ
|
|
||||||
|
|
||||||
LLM_API_URL=https://project.nes.uni-due.de/llm2/v1/
|
|
||||||
LLM_API_KEY=c2d5e7ccf7a4760dd3d19bed2caed9d85ff7437400e0ea82a6d6f912ebc2f212
|
|
||||||
LLM_MODEL=gemma4-e4b
|
|
||||||
|
|
||||||
# Patent search (EPO + USPTO)
|
|
||||||
PATENT_ELASTICSEARCH_URL=https://inse.nes.uni-due.de/elastic
|
|
||||||
PATENT_ELASTICSEARCH_API_KEY=bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
|
||||||
ELASTICSEARCH_URL=https://project.nes.uni-due.de/elastic
|
|
||||||
ELASTICSEARCH_API_KEY=am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ
|
|
||||||
|
|
||||||
ELASTICSEARCH_INSE_URL=https://inse.nes.uni-due.de/elastic
|
|
||||||
ELASTICSEARCH_INSE_API_KEY=bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
|
||||||
|
|
||||||
LLM_API_URL=https://project.nes.uni-due.de/llm2/v1/
|
|
||||||
LLM_API_KEY=c2d5e7ccf7a4760dd3d19bed2caed9d85ff7437400e0ea82a6d6f912ebc2f212
|
|
||||||
LLM_MODEL=gemma4-e4b
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Database config
|
||||||
|
DATABASE_URL=sqlite:///../data/inse-sqlite.db
|
||||||
|
DATABASE_DEBUG=false
|
||||||
|
DATABASE_INIT=true
|
||||||
|
|
||||||
|
# Authorization config
|
||||||
|
AUTH_DISABLED=false
|
||||||
|
AUTH_STANDALONE=true
|
||||||
|
AUTH_SECRET=change-me
|
||||||
|
|
||||||
|
# OpenAlex config
|
||||||
|
OPENALEX_WORKS_SEARCH_INDEX=openalex-works*
|
||||||
|
OPENALEX_WORKS_SEARCH_TIMEOUT_SECONDS=30.0
|
||||||
|
OPENALEX_API_BASE_URL=https://api.openalex.org
|
||||||
|
OPENALEX_API_KEY=
|
||||||
|
OPENALEX_API_TIMEOUT_SECONDS=30.0
|
||||||
|
|
||||||
|
# Patent Elasticsearch config
|
||||||
|
PATENT_ELASTICSEARCH_URL=
|
||||||
|
PATENT_ELASTICSEARCH_API_KEY=
|
||||||
|
|
||||||
|
# LLM config
|
||||||
|
LLM_API_URL=
|
||||||
|
LLM_API_KEY=
|
||||||
|
LLM_MODEL=
|
||||||
|
|
||||||
|
# Sentence Transformers config
|
||||||
|
SENTENCE_TRANSFORMERS_MODEL_NAME=paraphrase-multilingual-mpnet-base-v2
|
||||||
|
|
||||||
|
# Elasticsearch config
|
||||||
|
ELASTICSEARCH_URL=
|
||||||
|
ELASTICSEARCH_API_KEY=
|
||||||
|
ELASTICSEARCH_INSE_URL=
|
||||||
|
ELASTICSEARCH_INSE_API_KEY=
|
||||||
|
|
||||||
|
# App config
|
||||||
|
ALLOWED_ORIGINS=["http://localhost:4200"]
|
||||||
|
SERVERS=[{"url":"http://localhost:8000","description":"Local development server"}]
|
||||||
|
LOGGING_LEVEL=DEBUG
|
||||||
@@ -22,14 +22,13 @@ class CompanyConnectionsSearchClient:
|
|||||||
self.base_url = (
|
self.base_url = (
|
||||||
base_url
|
base_url
|
||||||
or config.settings.elasticsearch_url
|
or config.settings.elasticsearch_url
|
||||||
or config.settings.openalex_works_search_base_url
|
or ""
|
||||||
).rstrip("/")
|
).rstrip("/")
|
||||||
self.api_key = (
|
self.api_key = (
|
||||||
api_key
|
api_key
|
||||||
if api_key is not None
|
if api_key is not None
|
||||||
else config.settings.elasticsearch_api_key
|
else config.settings.elasticsearch_api_key
|
||||||
or config.settings.openalex_works_api_key
|
)
|
||||||
)
|
|
||||||
self.openalex_index = openalex_index
|
self.openalex_index = openalex_index
|
||||||
self.handelsregister_index = handelsregister_index
|
self.handelsregister_index = handelsregister_index
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
|
|||||||
@@ -26,22 +26,18 @@ class Settings(BaseSettings):
|
|||||||
auth_disabled: bool = False
|
auth_disabled: bool = False
|
||||||
auth_standalone: bool = True
|
auth_standalone: bool = True
|
||||||
auth_secret: str = "change-me-to-a-secure-secret-key"
|
auth_secret: str = "change-me-to-a-secure-secret-key"
|
||||||
# OpenAlex works search config
|
|
||||||
openalex_works_search_base_url: str = "https://project.nes.uni-due.de/elastic"
|
|
||||||
# IMPORTANT: wildcard * needed to query all work indices
|
# IMPORTANT: wildcard * needed to query all work indices
|
||||||
openalex_works_search_index: str = "openalex-works*"
|
openalex_works_search_index: str = "openalex-works*"
|
||||||
openalex_works_api_key: str = (
|
|
||||||
"am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ=="
|
|
||||||
)
|
|
||||||
openalex_works_search_timeout_seconds: float = 30.0
|
openalex_works_search_timeout_seconds: float = 30.0
|
||||||
# OpenAlex public API config
|
# OpenAlex public API config
|
||||||
openalex_api_base_url: str = "https://api.openalex.org"
|
openalex_api_base_url: str = "https://api.openalex.org"
|
||||||
openalex_api_key: Optional[str] = None
|
openalex_api_key: Optional[str] = None
|
||||||
openalex_api_timeout_seconds: float = 30.0
|
openalex_api_timeout_seconds: float = 30.0
|
||||||
|
|
||||||
# Patent elasticsearch config
|
|
||||||
|
# Patent Elasticsearch config
|
||||||
patent_elasticsearch_url: str = "https://inse.nes.uni-due.de/elastic"
|
patent_elasticsearch_url: str = "https://inse.nes.uni-due.de/elastic"
|
||||||
patent_elasticsearch_api_key: str = ""
|
patent_elasticsearch_api_key: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
# LLM config
|
# LLM config
|
||||||
@@ -49,8 +45,11 @@ class Settings(BaseSettings):
|
|||||||
llm_api_key: Optional[str] = None
|
llm_api_key: Optional[str] = None
|
||||||
llm_model: Optional[str] = None
|
llm_model: Optional[str] = None
|
||||||
|
|
||||||
# elasticsearch config
|
# Sentence Transformers config
|
||||||
elasticsearch_url: Optional[str] = None
|
sentence_transformers_model_name: str = "paraphrase-multilingual-mpnet-base-v2"
|
||||||
|
|
||||||
|
# Elasticsearch config
|
||||||
|
elasticsearch_url: str = "https://project.nes.uni-due.de/elastic"
|
||||||
elasticsearch_api_key: Optional[str] = None
|
elasticsearch_api_key: Optional[str] = None
|
||||||
elasticsearch_inse_url: Optional[str] = None
|
elasticsearch_inse_url: Optional[str] = None
|
||||||
elasticsearch_inse_api_key: Optional[str] = None
|
elasticsearch_inse_api_key: Optional[str] = None
|
||||||
@@ -63,9 +62,6 @@ class Settings(BaseSettings):
|
|||||||
{"url": "http://localhost:8000", "description": "Local development server"},
|
{"url": "http://localhost:8000", "description": "Local development server"},
|
||||||
]
|
]
|
||||||
|
|
||||||
elasticsearch_inse_url: Optional[str] = None
|
|
||||||
elasticsearch_inse_api_key: Optional[str] = None
|
|
||||||
|
|
||||||
logging_level: str = "DEBUG"
|
logging_level: str = "DEBUG"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ class FundedPublicationsSearchClient:
|
|||||||
timeout: float | None = None,
|
timeout: float | None = None,
|
||||||
transport: httpx.AsyncBaseTransport | None = None,
|
transport: httpx.AsyncBaseTransport | None = None,
|
||||||
):
|
):
|
||||||
self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/")
|
self.base_url = (base_url or config.settings.elasticsearch_url or "").rstrip("/")
|
||||||
self.index = index or config.settings.openalex_works_search_index
|
self.index = index or config.settings.openalex_works_search_index
|
||||||
self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key
|
self.api_key = api_key if api_key is not None else config.settings.elasticsearch_api_key
|
||||||
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,21 @@ class InstitutionsSearchClient:
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_institution_by_id(self, raw_institution_id: str) -> Institution:
|
def get_institution_by_id(self, raw_oa_institution_id: str) -> Institution:
|
||||||
"""
|
"""Retrieves an institution by its raw OpenAlex institution ID.
|
||||||
Retrieves a single institution by its OpenAlex ID from the local Elasticsearch cluster.
|
|
||||||
|
Args:
|
||||||
|
raw_oa_institution_id (str): The raw OpenAlex institution ID to search for.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
NotFoundException: If no institution is found with the given ID or if the institution data cannot be parsed.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Institution: The institution corresponding to the given raw OpenAlex institution ID.
|
||||||
"""
|
"""
|
||||||
query = {
|
query = {
|
||||||
"match": {
|
"match": {
|
||||||
"id": f"https://openalex.org/{raw_institution_id.upper()}",
|
"id": f"https://openalex.org/{raw_oa_institution_id.upper()}",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,13 +43,13 @@ class InstitutionsSearchClient:
|
|||||||
hits = res.get("hits", {}).get("hits", [])
|
hits = res.get("hits", {}).get("hits", [])
|
||||||
if not hits:
|
if not hits:
|
||||||
raise NotFoundException(
|
raise NotFoundException(
|
||||||
f"Institution with ID '{raw_institution_id}' not found."
|
f"Institution with ID '{raw_oa_institution_id}' not found."
|
||||||
)
|
)
|
||||||
|
|
||||||
institution = self._convert_hit_to_institution(hits[0])
|
institution = self._convert_hit_to_institution(hits[0])
|
||||||
if not institution:
|
if not institution:
|
||||||
raise NotFoundException(
|
raise NotFoundException(
|
||||||
f"Institution with ID '{raw_institution_id}' could not be parsed."
|
f"Institution with ID '{raw_oa_institution_id}' could not be parsed."
|
||||||
)
|
)
|
||||||
|
|
||||||
return institution
|
return institution
|
||||||
@@ -208,37 +216,39 @@ class InstitutionsSearchClient:
|
|||||||
if query_text:
|
if query_text:
|
||||||
stripped = query_text.strip()
|
stripped = query_text.strip()
|
||||||
|
|
||||||
must.append({
|
must.append(
|
||||||
"bool": {
|
{
|
||||||
"should": [
|
"bool": {
|
||||||
{
|
"should": [
|
||||||
"wildcard": {
|
{
|
||||||
"display_name.keyword": {
|
"wildcard": {
|
||||||
"value": f"*{stripped}*",
|
"display_name.keyword": {
|
||||||
"boost": 2
|
"value": f"*{stripped}*",
|
||||||
}
|
"boost": 2,
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
"wildcard": {
|
{
|
||||||
"display_name_alternatives.keyword": {
|
"wildcard": {
|
||||||
"value": f"*{stripped}*",
|
"display_name_alternatives.keyword": {
|
||||||
"boost": 2
|
"value": f"*{stripped}*",
|
||||||
}
|
"boost": 2,
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
"wildcard": {
|
{
|
||||||
"display_name_acronyms.keyword": {
|
"wildcard": {
|
||||||
"value": f"*{stripped.upper()}*",
|
"display_name_acronyms.keyword": {
|
||||||
"boost": 10
|
"value": f"*{stripped.upper()}*",
|
||||||
}
|
"boost": 10,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"minimum_should_match": 1,
|
||||||
}
|
}
|
||||||
],
|
}
|
||||||
"minimum_should_match": 1
|
)
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
filter_queries = []
|
filter_queries = []
|
||||||
|
|
||||||
@@ -278,35 +288,41 @@ class InstitutionsSearchClient:
|
|||||||
|
|
||||||
return [Institution.from_dict(hit["_source"]) for hit in hits]
|
return [Institution.from_dict(hit["_source"]) for hit in hits]
|
||||||
|
|
||||||
def get_institution_aliases_by_id(self, raw_institution_id: str) -> List[str]:
|
def get_institution_aliases_by_oa_institution_id(
|
||||||
|
self, raw_oa_institution_id: str
|
||||||
|
) -> List[str]:
|
||||||
"""Get a list of institution aliases for a given institution ID, including both display name alternatives and predefined aliases.
|
"""Get a list of institution aliases for a given institution ID, including both display name alternatives and predefined aliases.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
raw_institution_id (str): The raw institution ID for which to retrieve aliases.
|
raw_oa_institution_id (str): The raw OpenAlex institution ID for which to retrieve aliases.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
List[str]: A list of aliases for the given institution ID.
|
List[str]: A list of aliases for the given institution ID.
|
||||||
"""
|
"""
|
||||||
institution = self.get_institution_by_id(raw_institution_id)
|
institution = self.get_institution_by_id(raw_oa_institution_id)
|
||||||
aliases = list(
|
aliases = list(
|
||||||
self.augment_aliases(set(institution.display_name_alternatives or []))
|
self.augment_aliases(set(institution.display_name_alternatives or []))
|
||||||
| self.get_predefined_institution_aliases(raw_institution_id)
|
| self.get_predefined_institution_aliases(raw_oa_institution_id)
|
||||||
)
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Retrieved aliases for institution_id=%s: %s", raw_institution_id, aliases
|
"Retrieved aliases for institution_id=%s: %s",
|
||||||
|
raw_oa_institution_id,
|
||||||
|
aliases,
|
||||||
)
|
)
|
||||||
return aliases
|
return aliases
|
||||||
|
|
||||||
def get_predefined_institution_aliases(self, raw_institution_id: str) -> Set[str]:
|
def get_predefined_institution_aliases(
|
||||||
|
self, raw_oa_institution_id: str
|
||||||
|
) -> Set[str]:
|
||||||
"""Get predefined aliases for a given institution ID.
|
"""Get predefined aliases for a given institution ID.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
raw_institution_id (str): The raw institution ID for which to retrieve predefined aliases.
|
raw_oa_institution_id (str): The raw OpenAlex institution ID for which to retrieve predefined aliases.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Set[str]: A set of predefined aliases for the given institution ID.
|
Set[str]: A set of predefined aliases for the given institution ID.
|
||||||
"""
|
"""
|
||||||
raw_institution_id = raw_institution_id.upper()
|
raw_oa_institution_id = raw_oa_institution_id.upper()
|
||||||
predefined_aliases = {
|
predefined_aliases = {
|
||||||
"I62318514": [
|
"I62318514": [
|
||||||
"universität duisburg-essen",
|
"universität duisburg-essen",
|
||||||
@@ -317,7 +333,9 @@ class InstitutionsSearchClient:
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.augment_aliases(set(predefined_aliases.get(raw_institution_id, [])))
|
return self.augment_aliases(
|
||||||
|
set(predefined_aliases.get(raw_oa_institution_id, []))
|
||||||
|
)
|
||||||
|
|
||||||
def augment_aliases(self, aliases: Set[str]) -> Set[str]:
|
def augment_aliases(self, aliases: Set[str]) -> Set[str]:
|
||||||
"""Augment a set of aliases by applying the augment_alias function to each alias.
|
"""Augment a set of aliases by applying the augment_alias function to each alias.
|
||||||
@@ -407,3 +425,80 @@ class InstitutionsSearchClient:
|
|||||||
"Failed to validate institution hit ID %s: %s", hit.get("_id"), e
|
"Failed to validate institution hit ID %s: %s", hit.get("_id"), e
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_cordis_eu_organisation_ids_by_oa_institution_id(
|
||||||
|
self, raw_oa_institution_id: str
|
||||||
|
) -> Optional[List[str]]:
|
||||||
|
"""Retrieves the corresponding EU organisation IDs for a given OpenAlex institution ID by searching for institution aliases and matching them against the Cordis EU organisations indices.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
raw_oa_institution_id (str): The raw OpenAlex institution ID for which to retrieve the corresponding EU organisation IDs.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Optional[List[str]]: A list of corresponding EU organisation IDs or None if the search fails.
|
||||||
|
"""
|
||||||
|
|
||||||
|
institution_aliases = set(
|
||||||
|
self.get_institution_aliases_by_oa_institution_id(
|
||||||
|
raw_oa_institution_id=raw_oa_institution_id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
body = {
|
||||||
|
"size": 0,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{
|
||||||
|
"terms": {
|
||||||
|
"name.keyword": [
|
||||||
|
institution_alias.upper()
|
||||||
|
for institution_alias in institution_aliases
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"aggs": {
|
||||||
|
"organisation_ids": {
|
||||||
|
"terms": {"field": "organisationID", "size": 10000}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"Searching for EU organisation IDs for raw_oa_institution_id=%s with aliases=%s and query: %s",
|
||||||
|
raw_oa_institution_id,
|
||||||
|
institution_aliases,
|
||||||
|
body,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# IMPORTANT: The indices are named organizations and not organisations. + 15 Minutes debugging why the search returns 0 results
|
||||||
|
response = elasticsearch.search(
|
||||||
|
index="cordis_eu_*_organizations", body=body, cluster="inse"
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
logger.exception("Error while searching for EU organisation IDs: %s", e)
|
||||||
|
return None
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"Received response for EU organisation ID search for raw_oa_institution_id=%s: %s",
|
||||||
|
raw_oa_institution_id,
|
||||||
|
response,
|
||||||
|
)
|
||||||
|
|
||||||
|
aggregations = response.get("aggregations", {})
|
||||||
|
organisation_ids_buckets = aggregations.get("organisation_ids", {}).get(
|
||||||
|
"buckets", []
|
||||||
|
)
|
||||||
|
organisation_ids = [bucket.get("key") for bucket in organisation_ids_buckets]
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
"Extracted EU organisation IDs for raw_oa_institution_id=%s: %s",
|
||||||
|
raw_oa_institution_id,
|
||||||
|
organisation_ids,
|
||||||
|
)
|
||||||
|
|
||||||
|
return organisation_ids
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, List, Optional, Tuple
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
|
from inse.model import ESCluster, ESIndex
|
||||||
from .. import config
|
from .. import config
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _cluster_credentials(cluster: str) -> Tuple[str, str]:
|
def _cluster_credentials(cluster: ESCluster) -> Tuple[str, str]:
|
||||||
"""Retrieves the Elasticsearch URL and API key for the specified cluster from the configuration.
|
"""Retrieves the Elasticsearch URL and API key for the specified cluster from the configuration.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
cluster (str): The cluster for which to retrieve credentials. Allowed values are "nes" and "inse".
|
cluster (ElasticsearchCluster): The cluster for which to retrieve credentials. Allowed values are "nes" and "inse".
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
ValueError: If the cluster is unknown or the credentials are not set in the configuration.
|
ValueError: If the cluster is unknown or the credentials are not set in the configuration.
|
||||||
@@ -19,7 +22,7 @@ def _cluster_credentials(cluster: str) -> Tuple[str, str]:
|
|||||||
Tuple[str, str]: The Elasticsearch URL and API key for the specified cluster.
|
Tuple[str, str]: The Elasticsearch URL and API key for the specified cluster.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if cluster == "nes":
|
if cluster == ESCluster.NES:
|
||||||
if (
|
if (
|
||||||
not config.settings.elasticsearch_url
|
not config.settings.elasticsearch_url
|
||||||
or not config.settings.elasticsearch_api_key
|
or not config.settings.elasticsearch_api_key
|
||||||
@@ -28,7 +31,7 @@ def _cluster_credentials(cluster: str) -> Tuple[str, str]:
|
|||||||
"Elasticsearch URL and API key must be set in the configuration for cluster 'nes'"
|
"Elasticsearch URL and API key must be set in the configuration for cluster 'nes'"
|
||||||
)
|
)
|
||||||
return config.settings.elasticsearch_url, config.settings.elasticsearch_api_key
|
return config.settings.elasticsearch_url, config.settings.elasticsearch_api_key
|
||||||
elif cluster == "inse":
|
elif cluster == ESCluster.INSE:
|
||||||
if (
|
if (
|
||||||
not config.settings.elasticsearch_inse_url
|
not config.settings.elasticsearch_inse_url
|
||||||
or not config.settings.elasticsearch_inse_api_key
|
or not config.settings.elasticsearch_inse_api_key
|
||||||
@@ -45,10 +48,40 @@ def _cluster_credentials(cluster: str) -> Tuple[str, str]:
|
|||||||
raise ValueError(f"Unknown cluster: {cluster!r} (allowed: 'nes', 'inse')")
|
raise ValueError(f"Unknown cluster: {cluster!r} (allowed: 'nes', 'inse')")
|
||||||
|
|
||||||
|
|
||||||
|
def _index_to_cluster(index: ESIndex) -> Optional[ESCluster]:
|
||||||
|
"""Determines the Elasticsearch cluster to use based on the specified index.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
index (ESIndex): The Elasticsearch index for which to determine the cluster. Allowed values are defined in the ESIndex enum.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
ValueError: If the index is unknown.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ESCluster: The Elasticsearch cluster to use for the specified index.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if index in {
|
||||||
|
ESIndex.OPENALEX_WORKS,
|
||||||
|
ESIndex.OPENALEX_AUTHORS,
|
||||||
|
ESIndex.OPENALEX_INSTITUTIONS,
|
||||||
|
ESIndex.OPENALEX_PUBLICATIONS,
|
||||||
|
}:
|
||||||
|
return ESCluster.NES
|
||||||
|
elif index in {
|
||||||
|
ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD,
|
||||||
|
ESIndex.CORDIS_EU_PROJECTS_WILDCARD,
|
||||||
|
ESIndex.CORDIS_EU_PUBLICATIONS_WILDCARD,
|
||||||
|
ESIndex.PROJECTS_BUND_V1,
|
||||||
|
ESIndex.PROJECTS_DFG_ALL,
|
||||||
|
}:
|
||||||
|
return ESCluster.INSE
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def search(
|
def search(
|
||||||
index: str,
|
index: ESIndex | List[ESIndex],
|
||||||
query_field: Optional[str] = None,
|
|
||||||
query_value: Optional[str] = None,
|
|
||||||
query: Optional[Dict] = None,
|
query: Optional[Dict] = None,
|
||||||
source: Optional[List] = None,
|
source: Optional[List] = None,
|
||||||
size: Optional[int] = None,
|
size: Optional[int] = None,
|
||||||
@@ -56,14 +89,13 @@ def search(
|
|||||||
sort: Optional[List] = None,
|
sort: Optional[List] = None,
|
||||||
body: Optional[Dict] = None,
|
body: Optional[Dict] = None,
|
||||||
track_total_hits=False,
|
track_total_hits=False,
|
||||||
cluster: str = "nes",
|
highlight: Optional[Dict] = None,
|
||||||
|
cluster: ESCluster = ESCluster.NES,
|
||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
"""Searches the specified Elasticsearch index using either a simple query string or a full query body.
|
"""Searches the specified Elasticsearch index using either a simple query string or a full query body.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
index (str): The name of the Elasticsearch index to search.
|
index (ElasticsearchIndex): The Elasticsearch index to search.
|
||||||
query_field (Optional[str], optional): The field to search in. Defaults to None.
|
|
||||||
query_value (Optional[str], optional): The value to search for. Defaults to None.
|
|
||||||
query (Optional[Dict], optional): The full query body. Defaults to None.
|
query (Optional[Dict], optional): The full query body. Defaults to None.
|
||||||
source (Optional[List], optional): The fields to include in the response. Defaults to None.
|
source (Optional[List], optional): The fields to include in the response. Defaults to None.
|
||||||
size (Optional[int], optional): The maximum number of results to return. Defaults to None.
|
size (Optional[int], optional): The maximum number of results to return. Defaults to None.
|
||||||
@@ -71,22 +103,41 @@ def search(
|
|||||||
sort (Optional[List], optional): The fields to sort by. Defaults to None.
|
sort (Optional[List], optional): The fields to sort by. Defaults to None.
|
||||||
body (Optional[Dict], optional): The full query body. Defaults to None.
|
body (Optional[Dict], optional): The full query body. Defaults to None.
|
||||||
track_total_hits (bool, optional): Whether to track the total number of hits. Defaults to False.
|
track_total_hits (bool, optional): Whether to track the total number of hits. Defaults to False.
|
||||||
cluster (str, optional): The Elasticsearch cluster to search. Defaults to "nes".
|
cluster (ElasticsearchCluster, optional): The Elasticsearch cluster to search. Defaults to ElasticsearchCluster.NES.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Dict[str, Any]: The search results.
|
Dict[str, Any]: The search results.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
clusters = set()
|
||||||
|
if isinstance(index, list):
|
||||||
|
for idx in index:
|
||||||
|
cluster_for_index = _index_to_cluster(idx)
|
||||||
|
if cluster_for_index is not None:
|
||||||
|
clusters.add(cluster_for_index)
|
||||||
|
else:
|
||||||
|
cluster_for_index = _index_to_cluster(index)
|
||||||
|
if cluster_for_index is not None:
|
||||||
|
clusters.add(cluster_for_index)
|
||||||
|
|
||||||
|
if len(clusters) > 1:
|
||||||
|
raise ValueError(
|
||||||
|
f"All indices in the search request must belong to the same cluster, but found clusters: {clusters}"
|
||||||
|
)
|
||||||
|
elif len(clusters) == 1:
|
||||||
|
cluster = clusters.pop()
|
||||||
|
|
||||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||||
|
|
||||||
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
headers = {"Authorization": f"ApiKey {api_key}", "Content-Type": "application/json"}
|
||||||
|
|
||||||
payload: Dict[str, Any]
|
payload: Dict[str, Any] = {}
|
||||||
|
|
||||||
if body is not None:
|
if body is not None:
|
||||||
payload = body
|
payload = body
|
||||||
elif query is not None:
|
else:
|
||||||
payload = {"query": query}
|
if query is not None:
|
||||||
|
payload["query"] = query
|
||||||
if source is not None:
|
if source is not None:
|
||||||
payload["_source"] = source
|
payload["_source"] = source
|
||||||
if size is not None:
|
if size is not None:
|
||||||
@@ -97,29 +148,35 @@ def search(
|
|||||||
payload["sort"] = sort
|
payload["sort"] = sort
|
||||||
if track_total_hits:
|
if track_total_hits:
|
||||||
payload["track_total_hits"] = True
|
payload["track_total_hits"] = True
|
||||||
else:
|
if highlight is not None:
|
||||||
payload = {
|
payload["highlight"] = highlight
|
||||||
"query": {
|
|
||||||
"query_string": {"default_field": query_field, "query": query_value}
|
if len(payload) == 0:
|
||||||
}
|
raise ValueError(
|
||||||
}
|
"At least one of 'query', 'body', 'source', 'size', 'offset', 'sort' must be provided"
|
||||||
|
)
|
||||||
|
|
||||||
with httpx.Client(timeout=httpx.Timeout(30.0)) as client:
|
with httpx.Client(timeout=httpx.Timeout(30.0)) as client:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Sending search request to Elasticsearch cluster '{cluster}' at {elasticsearch_url} with payload: {payload}"
|
f"Sending search request to Elasticsearch cluster '{cluster}' at {elasticsearch_url} for {index} with payload: {json.dumps(payload)}"
|
||||||
)
|
)
|
||||||
|
if isinstance(index, list):
|
||||||
|
index_str = ",".join(index)
|
||||||
|
else:
|
||||||
|
index_str = index
|
||||||
|
|
||||||
response = client.post(
|
response = client.post(
|
||||||
f"{elasticsearch_url}/{index}/_search", json=payload, headers=headers
|
f"{elasticsearch_url}/{index_str}/_search", json=payload, headers=headers
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
return response.json()
|
return response.json()
|
||||||
|
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
index: str,
|
index: ESIndex,
|
||||||
doc_id: str,
|
doc_id: str,
|
||||||
source: Optional[list] = None,
|
source: Optional[list] = None,
|
||||||
cluster: str = "nes",
|
cluster: ESCluster = ESCluster.NES,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
|
|
||||||
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
elasticsearch_url, api_key = _cluster_credentials(cluster)
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ from inse.topics.service import router as topics_service_router
|
|||||||
from inse.works.service import router as works_service_router
|
from inse.works.service import router as works_service_router
|
||||||
from inse.persons.service import router as persons_service_router
|
from inse.persons.service import router as persons_service_router
|
||||||
from inse.funders.service import router as funders_service_router
|
from inse.funders.service import router as funders_service_router
|
||||||
|
from inse.news.service import router as news_service_router
|
||||||
|
from inse.projects.router import router as projects_router
|
||||||
from inse.patents.service import router as patents_service_router
|
from inse.patents.service import router as patents_service_router
|
||||||
|
|
||||||
from inse.institutions.router import router as institutions_router
|
from inse.institutions.router import router as institutions_router
|
||||||
@@ -52,6 +54,7 @@ app.include_router(topics_service_router)
|
|||||||
app.include_router(works_service_router)
|
app.include_router(works_service_router)
|
||||||
app.include_router(persons_service_router)
|
app.include_router(persons_service_router)
|
||||||
app.include_router(funders_service_router)
|
app.include_router(funders_service_router)
|
||||||
|
app.include_router(news_service_router)
|
||||||
app.include_router(company_connections_router)
|
app.include_router(company_connections_router)
|
||||||
app.include_router(service_router)
|
app.include_router(service_router)
|
||||||
app.include_router(account_router)
|
app.include_router(account_router)
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
This module defines the model classes returned from
|
This module defines the model classes returned from
|
||||||
our api using pydantic.
|
our api using pydantic.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from enum import StrEnum
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from pydantic import ConfigDict
|
from pydantic import ConfigDict
|
||||||
from pydantic import Field
|
from pydantic import Field
|
||||||
@@ -13,28 +16,49 @@ from typing import Generic
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar('T', bound=BaseModel)
|
T = TypeVar("T", bound=BaseModel)
|
||||||
|
|
||||||
|
|
||||||
class Entity(BaseModel):
|
class Entity(BaseModel):
|
||||||
id: int = Field(description="The id of the entity.")
|
id: int = Field(description="The id of the entity.")
|
||||||
|
|
||||||
|
|
||||||
class Item(Entity):
|
class Item(Entity):
|
||||||
model_config = ConfigDict(from_attributes=True)
|
model_config = ConfigDict(from_attributes=True)
|
||||||
name: str = Field(description="The name of the item.")
|
name: str = Field(description="The name of the item.")
|
||||||
description: str = Field(description="The description of the item.")
|
description: str = Field(description="The description of the item.")
|
||||||
|
|
||||||
|
|
||||||
class ItemCreate(BaseModel):
|
class ItemCreate(BaseModel):
|
||||||
name: str = Field(description="The name of the item.")
|
name: str = Field(description="The name of the item.")
|
||||||
description: str = Field(description="The description of the item.")
|
description: str = Field(description="The description of the item.")
|
||||||
|
|
||||||
|
|
||||||
class Page(BaseModel, Generic[T]):
|
class Page(BaseModel, Generic[T]):
|
||||||
elements: List[T] = Field(default=[], description="The elements of the page.")
|
elements: List[T] = Field(default=[], description="The elements of the page.")
|
||||||
offset: int = Field(default=0, description="The page offset in elements.")
|
offset: int = Field(default=0, description="The page offset in elements.")
|
||||||
total: int = Field(default=0, description="The total number of elements.")
|
total: int = Field(default=0, description="The total number of elements.")
|
||||||
size: int = Field(default=20, description="The page size in elements.")
|
size: int = Field(default=20, description="The page size in elements.")
|
||||||
|
|
||||||
|
|
||||||
class ItemPage(Page[Item]):
|
class ItemPage(Page[Item]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class ESCluster(StrEnum):
|
||||||
|
NES = "nes"
|
||||||
|
INSE = "inse"
|
||||||
|
|
||||||
|
|
||||||
|
class ESIndex(StrEnum):
|
||||||
|
OPENALEX_WORKS = "openalex-works"
|
||||||
|
OPENALEX_AUTHORS = "openalex-authors"
|
||||||
|
OPENALEX_INSTITUTIONS = "openalex-institutions"
|
||||||
|
OPENALEX_PUBLICATIONS = "openalex-publications"
|
||||||
|
|
||||||
|
CORDIS_EU_ORGANIZATIONS_WILDCARD = "cordis_eu_*_organizations"
|
||||||
|
CORDIS_EU_PROJECTS_WILDCARD = "cordis_eu_*_projects"
|
||||||
|
CORDIS_EU_PUBLICATIONS_WILDCARD = "cordis_eu_*_publications"
|
||||||
|
|
||||||
|
PROJECTS_BUND_V1 = "projects_bund_v1"
|
||||||
|
PROJECTS_DFG_ALL = "projects_dfg_all"
|
||||||
@@ -0,0 +1,274 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Business logic for the "aktuell" news index on the INSE cluster.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from fastapi import HTTPException
|
||||||
|
from starlette.status import HTTP_500_INTERNAL_SERVER_ERROR
|
||||||
|
|
||||||
|
from ..integrations import elasticsearch
|
||||||
|
from ..persons.logic import find_ude_author_by_name, get_author_name_by_id
|
||||||
|
from .model import MentionedPerson, NewsArticle, NewsArticleDetail, NewsPage
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def get_news_page(page: int, page_size: int, sort_order: str = "desc") -> NewsPage:
|
||||||
|
offset = (page - 1) * page_size
|
||||||
|
|
||||||
|
response = _run_search(
|
||||||
|
query={"match_all": {}},
|
||||||
|
source=["date", "maintitle", "author", "url"],
|
||||||
|
size=page_size,
|
||||||
|
offset=offset,
|
||||||
|
sort=[{"date_full": sort_order}],
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_page(response, page, page_size)
|
||||||
|
|
||||||
|
|
||||||
|
def search_news(query_text: str, page: int, page_size: int) -> NewsPage:
|
||||||
|
offset = (page - 1) * page_size
|
||||||
|
|
||||||
|
highlight = {
|
||||||
|
"fields": {"full_content": {"fragment_size": 200, "number_of_fragments": 1}},
|
||||||
|
"pre_tags": ["<em>"],
|
||||||
|
"post_tags": ["</em>"],
|
||||||
|
"encoder": "html",
|
||||||
|
}
|
||||||
|
|
||||||
|
response = _run_search(
|
||||||
|
query={"match": {"full_content": query_text}},
|
||||||
|
source=["date", "maintitle", "author", "url"],
|
||||||
|
size=page_size,
|
||||||
|
offset=offset,
|
||||||
|
sort=None,
|
||||||
|
highlight=highlight,
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_page(response, page, page_size)
|
||||||
|
|
||||||
|
def get_news_by_author(
|
||||||
|
author_id: str,
|
||||||
|
page: int = 1,
|
||||||
|
page_size: int = 10,
|
||||||
|
sort_order: str = "desc",
|
||||||
|
query_text: str | None = None,
|
||||||
|
) -> NewsPage:
|
||||||
|
|
||||||
|
author_name = get_author_name_by_id(author_id)
|
||||||
|
if not author_name:
|
||||||
|
return _empty_page(page, page_size)
|
||||||
|
|
||||||
|
news_ids = _find_news_ids_for_author(author_name)
|
||||||
|
if not news_ids:
|
||||||
|
return _empty_page(page, page_size)
|
||||||
|
|
||||||
|
es_query = {"bool": {"filter": [{"ids": {"values": news_ids}}]}}
|
||||||
|
if query_text:
|
||||||
|
es_query["bool"]["must"] = [
|
||||||
|
{"multi_match": {"query": query_text, "fields": ["maintitle", "author"]}}
|
||||||
|
]
|
||||||
|
|
||||||
|
offset = (page - 1) * page_size
|
||||||
|
response = _run_search(
|
||||||
|
query=es_query,
|
||||||
|
source=["date", "maintitle", "author", "url"],
|
||||||
|
size=page_size,
|
||||||
|
offset=offset,
|
||||||
|
sort=[{"date_full": sort_order}],
|
||||||
|
)
|
||||||
|
|
||||||
|
return _build_page(response, page, page_size)
|
||||||
|
|
||||||
|
|
||||||
|
def _find_news_ids_for_author(author_name: str) -> list:
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = elasticsearch.search(
|
||||||
|
index="aktuell_postproc",
|
||||||
|
query={"term": {"authors.keyword": author_name}},
|
||||||
|
source=["news_id"],
|
||||||
|
size=1000,
|
||||||
|
cluster="inse",
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f"Postproc-search: Finding news IDs for author '{author_name}' failed.")
|
||||||
|
return []
|
||||||
|
|
||||||
|
news_ids = []
|
||||||
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
|
news_id = hit.get("_source", {}).get("news_id")
|
||||||
|
if news_id:
|
||||||
|
news_ids.append(news_id)
|
||||||
|
|
||||||
|
return news_ids
|
||||||
|
|
||||||
|
|
||||||
|
def _empty_page(page: int = 1, page_size: int = 0) -> NewsPage:
|
||||||
|
return NewsPage(total=0, page=page, page_size=page_size, results=[])
|
||||||
|
|
||||||
|
|
||||||
|
def get_news_by_id(news_id: str) -> NewsArticleDetail:
|
||||||
|
try:
|
||||||
|
response = elasticsearch.get(
|
||||||
|
index="aktuell",
|
||||||
|
doc_id=news_id,
|
||||||
|
source=["date", "maintitle", "author", "url", "full_content"],
|
||||||
|
cluster="inse",
|
||||||
|
)
|
||||||
|
except Exception as exc:
|
||||||
|
logger.exception("Abruf des News-Artikels fehlgeschlagen.")
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTP_500_INTERNAL_SERVER_ERROR,
|
||||||
|
detail="Etwas ist schiefgelaufen.",
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
source = response.get("_source", {})
|
||||||
|
|
||||||
|
relevant, authors = _get_postproc_labels(news_id)
|
||||||
|
|
||||||
|
return NewsArticleDetail(
|
||||||
|
id=response.get("_id"),
|
||||||
|
date=source.get("date"),
|
||||||
|
maintitle=source.get("maintitle"),
|
||||||
|
author=source.get("author"),
|
||||||
|
url=source.get("url"),
|
||||||
|
full_content=source.get("full_content"),
|
||||||
|
relevant=relevant,
|
||||||
|
authors=_build_mentioned_persons(authors),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _build_mentioned_persons(author_names: list) -> list:
|
||||||
|
|
||||||
|
ude_persons = []
|
||||||
|
other_persons = []
|
||||||
|
|
||||||
|
for name in author_names:
|
||||||
|
match = find_ude_author_by_name(name)
|
||||||
|
if match:
|
||||||
|
ude_persons.append(
|
||||||
|
MentionedPerson(name=name, is_ude=True, person_id=match["id"])
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
other_persons.append(MentionedPerson(name=name))
|
||||||
|
|
||||||
|
return ude_persons + other_persons
|
||||||
|
|
||||||
|
|
||||||
|
def _get_postproc_labels(news_id: str) -> tuple[bool | None, list]:
|
||||||
|
try:
|
||||||
|
response = elasticsearch.search(
|
||||||
|
index="aktuell_postproc",
|
||||||
|
query={"term": {"news_id.keyword": news_id}},
|
||||||
|
source=["relevant", "authors"],
|
||||||
|
size=1,
|
||||||
|
cluster="inse",
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f"Postproc-Lookup for {news_id} failed.")
|
||||||
|
return None, []
|
||||||
|
|
||||||
|
hits = response.get("hits", {}).get("hits", [])
|
||||||
|
if not hits:
|
||||||
|
return None, []
|
||||||
|
|
||||||
|
postproc_source = hits[0].get("_source", {})
|
||||||
|
relevant = bool(postproc_source.get("relevant", 0))
|
||||||
|
authors = postproc_source.get("authors") or []
|
||||||
|
|
||||||
|
return relevant, authors
|
||||||
|
|
||||||
|
|
||||||
|
def _run_search(query: dict, source: list, size: int, offset: int, sort, highlight: dict = None) -> dict:
|
||||||
|
try:
|
||||||
|
return elasticsearch.search(
|
||||||
|
index="aktuell",
|
||||||
|
query=query,
|
||||||
|
source=source,
|
||||||
|
size=size,
|
||||||
|
offset=offset,
|
||||||
|
sort=sort,
|
||||||
|
track_total_hits=True,
|
||||||
|
highlight=highlight,
|
||||||
|
cluster="inse",
|
||||||
|
)
|
||||||
|
except Exception as exc:
|
||||||
|
logger.exception("Elasticsearch-Anfrage an Index 'aktuell' fehlgeschlagen.")
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTP_500_INTERNAL_SERVER_ERROR,
|
||||||
|
detail="Etwas ist schiefgelaufen.",
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
|
||||||
|
def _build_page(response: dict, page: int, page_size: int) -> NewsPage:
|
||||||
|
hits_section = response.get("hits", {})
|
||||||
|
total = hits_section.get("total", {}).get("value", 0)
|
||||||
|
hits = hits_section.get("hits", [])
|
||||||
|
|
||||||
|
news_ids = []
|
||||||
|
for hit in hits:
|
||||||
|
news_id = hit.get("_id")
|
||||||
|
if news_id:
|
||||||
|
news_ids.append(news_id)
|
||||||
|
|
||||||
|
relevance_map = _get_relevance_map(news_ids)
|
||||||
|
|
||||||
|
articles = []
|
||||||
|
for hit in hits:
|
||||||
|
article = _parse_hit(hit)
|
||||||
|
article.relevant = relevance_map.get(article.id)
|
||||||
|
articles.append(article)
|
||||||
|
|
||||||
|
return NewsPage(
|
||||||
|
total=total,
|
||||||
|
page=page,
|
||||||
|
page_size=page_size,
|
||||||
|
results=articles,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_relevance_map(news_ids: list) -> dict:
|
||||||
|
if not news_ids:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = elasticsearch.search(
|
||||||
|
index="aktuell_postproc",
|
||||||
|
query={"terms": {"news_id.keyword": news_ids}},
|
||||||
|
source=["news_id", "relevant"],
|
||||||
|
size=len(news_ids),
|
||||||
|
cluster="inse",
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Postproc-Relevanz-Lookup fehlgeschlagen.")
|
||||||
|
return {}
|
||||||
|
|
||||||
|
relevance_map = {}
|
||||||
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
|
postproc_source = hit.get("_source", {})
|
||||||
|
news_id = postproc_source.get("news_id")
|
||||||
|
if news_id is not None:
|
||||||
|
relevance_map[news_id] = bool(postproc_source.get("relevant", 0))
|
||||||
|
|
||||||
|
return relevance_map
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_hit(hit: dict) -> NewsArticle:
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
|
||||||
|
fragments = hit.get("highlight", {}).get("full_content")
|
||||||
|
snippet = fragments[0] if fragments else None
|
||||||
|
|
||||||
|
return NewsArticle(
|
||||||
|
id=hit.get("_id"),
|
||||||
|
date=source.get("date"),
|
||||||
|
maintitle=source.get("maintitle"),
|
||||||
|
author=source.get("author"),
|
||||||
|
url=source.get("url"),
|
||||||
|
snippet=snippet,
|
||||||
|
)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
|
from pydantic import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
class NewsArticle(BaseModel):
|
||||||
|
id: str
|
||||||
|
date: Optional[str] = None
|
||||||
|
maintitle: Optional[str] = None
|
||||||
|
author: Optional[str] = None
|
||||||
|
url: Optional[str] = None
|
||||||
|
relevant: Optional[bool] = None
|
||||||
|
snippet: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
class MentionedPerson(BaseModel):
|
||||||
|
name: str
|
||||||
|
is_ude: bool = False
|
||||||
|
person_id: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
|
class NewsArticleDetail(NewsArticle):
|
||||||
|
full_content: Optional[str] = None
|
||||||
|
relevant: Optional[bool] = None
|
||||||
|
authors: List[MentionedPerson] = []
|
||||||
|
|
||||||
|
|
||||||
|
class NewsPage(BaseModel):
|
||||||
|
total: int
|
||||||
|
page: int
|
||||||
|
page_size: int
|
||||||
|
results: List[NewsArticle]
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
REST API for the "aktuell" news index.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from fastapi import APIRouter
|
||||||
|
from fastapi import Path
|
||||||
|
from fastapi import Query
|
||||||
|
|
||||||
|
from inse.tags import Tags
|
||||||
|
from . import logic
|
||||||
|
from .model import NewsArticleDetail, NewsPage
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/api/news", tags=[Tags.NEWS])
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"",
|
||||||
|
operation_id="listNews",
|
||||||
|
response_model=NewsPage,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Returns a page of news articles, newest first.",
|
||||||
|
tags=[Tags.NEWS],
|
||||||
|
)
|
||||||
|
def list_news(
|
||||||
|
page: Annotated[
|
||||||
|
int, Query(description="Page number (1-based).", ge=1)
|
||||||
|
] = 1,
|
||||||
|
page_size: Annotated[
|
||||||
|
int, Query(alias="pageSize", description="Articles per page.", ge=1, le=100)
|
||||||
|
] = 10,
|
||||||
|
sort_order: Annotated[
|
||||||
|
str, Query(alias="sortOrder", description="Sort order: 'desc' (newest first) or 'asc' (oldest first).", pattern="^(asc|desc)$")
|
||||||
|
] = "desc",
|
||||||
|
):
|
||||||
|
return logic.get_news_page(page, page_size, sort_order)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/search",
|
||||||
|
operation_id="searchNews",
|
||||||
|
response_model=NewsPage,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Searches news articles by full text (full_content).",
|
||||||
|
tags=[Tags.NEWS],
|
||||||
|
)
|
||||||
|
def search_news(
|
||||||
|
query: Annotated[
|
||||||
|
str, Query(description="Search term, matched against the full text (full_content).", min_length=1)
|
||||||
|
],
|
||||||
|
page: Annotated[
|
||||||
|
int, Query(description="Page number (1-based).", ge=1)
|
||||||
|
] = 1,
|
||||||
|
page_size: Annotated[
|
||||||
|
int, Query(alias="pageSize", description="Articles per page.", ge=1, le=100)
|
||||||
|
] = 10,
|
||||||
|
):
|
||||||
|
return logic.search_news(query, page, page_size)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/by-author",
|
||||||
|
operation_id="getNewsByAuthor",
|
||||||
|
response_model=NewsPage,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Returns news articles in which the given person is mentioned.",
|
||||||
|
tags=[Tags.NEWS],
|
||||||
|
)
|
||||||
|
def get_news_by_author(
|
||||||
|
author_id: Annotated[
|
||||||
|
str, Query(alias="authorId", description="OpenAlex author id, e.g. A5034365278.")
|
||||||
|
],
|
||||||
|
page: Annotated[
|
||||||
|
int, Query(description="Page number (1-based).", ge=1)
|
||||||
|
] = 1,
|
||||||
|
page_size: Annotated[
|
||||||
|
int, Query(alias="pageSize", description="Articles per page.", ge=1, le=100)
|
||||||
|
] = 10,
|
||||||
|
sort_order: Annotated[
|
||||||
|
str, Query(alias="sortOrder", description="Sort order: 'desc' (newest first) or 'asc' (oldest first).", pattern="^(asc|desc)$")
|
||||||
|
] = "desc",
|
||||||
|
query: Annotated[
|
||||||
|
str | None, Query(description="Optional search term, matched against title/author.")
|
||||||
|
] = None,
|
||||||
|
):
|
||||||
|
return logic.get_news_by_author(author_id, page, page_size, sort_order, query)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/{news_id}",
|
||||||
|
operation_id="getNewsById",
|
||||||
|
response_model=NewsArticleDetail,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Returns a single news article including its full content.",
|
||||||
|
tags=[Tags.NEWS],
|
||||||
|
)
|
||||||
|
def get_news_by_id(
|
||||||
|
news_id: Annotated[
|
||||||
|
str, Path(description="The unique id of the news article (Elasticsearch _id).")
|
||||||
|
],
|
||||||
|
):
|
||||||
|
return logic.get_news_by_id(news_id)
|
||||||
@@ -13,6 +13,8 @@ from elasticsearch import ApiError, NotFoundError
|
|||||||
import hashlib
|
import hashlib
|
||||||
import httpx
|
import httpx
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
|
|
||||||
|
from inse.model import ESIndex
|
||||||
from .. import config
|
from .. import config
|
||||||
from .. import util
|
from .. import util
|
||||||
from ..integrations import llm
|
from ..integrations import llm
|
||||||
@@ -28,8 +30,63 @@ from inse.persons.model import (
|
|||||||
PersonSearchRequest,
|
PersonSearchRequest,
|
||||||
CareerMetrics,
|
CareerMetrics,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
INDEX_NAME = "openalex-authors"
|
INDEX_NAME = "openalex-authors"
|
||||||
|
UDE_INSTITUTION_ID = "https://openalex.org/I62318514" # Universität Duisburg-Essen
|
||||||
|
|
||||||
|
def find_ude_author_by_name(display_name: str) -> Optional[dict]:
|
||||||
|
query = {
|
||||||
|
"_source": ["display_name"],
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{
|
||||||
|
"match_phrase": {
|
||||||
|
"display_name": display_name
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nested": {
|
||||||
|
"path": "affiliations",
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"affiliations.institution.id": UDE_INSTITUTION_ID
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"size": 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
data = elasticsearch.search(index=INDEX_NAME, body=query)
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f"UDE-Lookup für '{display_name}' fehlgeschlagen.")
|
||||||
|
return None
|
||||||
|
|
||||||
|
hits = data.get("hits", {}).get("hits", [])
|
||||||
|
|
||||||
|
display_name = display_name.strip().lower()
|
||||||
|
exact_matches = []
|
||||||
|
|
||||||
|
for hit in hits:
|
||||||
|
hit_display_name = hit.get("_source", {}).get("display_name", "")
|
||||||
|
if hit_display_name.strip().lower() == display_name:
|
||||||
|
exact_matches.append(hit)
|
||||||
|
|
||||||
|
if not exact_matches:
|
||||||
|
return None
|
||||||
|
|
||||||
|
hit = exact_matches[0]
|
||||||
|
|
||||||
|
return {
|
||||||
|
"id": hit.get("_id"),
|
||||||
|
"display_name": hit.get("_source", {}).get("display_name"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_author_name_by_id(author_id: str) -> Optional[str]:
|
def get_author_name_by_id(author_id: str) -> Optional[str]:
|
||||||
@@ -55,20 +112,26 @@ def get_author_name_by_id(author_id: str) -> Optional[str]:
|
|||||||
def search_persons(
|
def search_persons(
|
||||||
author_id: Optional[str] = None,
|
author_id: Optional[str] = None,
|
||||||
query: Optional[str] = None,
|
query: Optional[str] = None,
|
||||||
include: Optional[set[str]] = None,
|
|
||||||
) -> AuthorsListResponse:
|
) -> AuthorsListResponse:
|
||||||
if author_id:
|
if author_id:
|
||||||
query_field = "_id"
|
query_ = {
|
||||||
query_value = author_id
|
"query_string": {
|
||||||
|
"default_field": "_id",
|
||||||
|
"query": author_id,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
elif query:
|
elif query:
|
||||||
query_field = "display_name"
|
query_ = {
|
||||||
query_value = query
|
"query_string": {
|
||||||
|
"default_field": "display_name",
|
||||||
|
"query": query,
|
||||||
|
}
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
return AuthorsListResponse(results=[], meta=Meta(count=0))
|
return AuthorsListResponse(results=[], meta=Meta(count=0))
|
||||||
|
|
||||||
data = elasticsearch.search(
|
data = elasticsearch.search(index=ESIndex.OPENALEX_AUTHORS, query=query_)
|
||||||
index="openalex-authors", query_field=query_field, query_value=query_value
|
|
||||||
)
|
|
||||||
|
|
||||||
authors = []
|
authors = []
|
||||||
for hit in data.get("hits", {}).get("hits", []):
|
for hit in data.get("hits", {}).get("hits", []):
|
||||||
@@ -221,9 +284,7 @@ def _get_publication_years_for_author(author_id: str) -> list[int]:
|
|||||||
)
|
)
|
||||||
|
|
||||||
buckets = (
|
buckets = (
|
||||||
response.get("aggregations", {})
|
response.get("aggregations", {}).get("publication_years", {}).get("buckets", [])
|
||||||
.get("publication_years", {})
|
|
||||||
.get("buckets", [])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
publication_years: list[int] = []
|
publication_years: list[int] = []
|
||||||
@@ -237,6 +298,7 @@ def _get_publication_years_for_author(author_id: str) -> list[int]:
|
|||||||
|
|
||||||
return publication_years
|
return publication_years
|
||||||
|
|
||||||
|
|
||||||
def _classify_career_stage(active_years: int) -> str:
|
def _classify_career_stage(active_years: int) -> str:
|
||||||
if active_years <= 0:
|
if active_years <= 0:
|
||||||
return "unknown"
|
return "unknown"
|
||||||
@@ -399,7 +461,6 @@ def get_person_by_id(
|
|||||||
return CustomAuthorsListResponse(results=[custom_author])
|
return CustomAuthorsListResponse(results=[custom_author])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def search_persons_by_name(
|
def search_persons_by_name(
|
||||||
author_name: str,
|
author_name: str,
|
||||||
limit: Optional[int] = 10,
|
limit: Optional[int] = 10,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def search_persons(
|
|||||||
if include
|
if include
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
return logic.search_persons(author_id, query, include_set)
|
return logic.search_persons(author_id, query)
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ from pydantic import BaseModel, Field, field_validator
|
|||||||
from inse.models.bund_project import BundProject
|
from inse.models.bund_project import BundProject
|
||||||
from inse.models.eu_project import EuProject
|
from inse.models.eu_project import EuProject
|
||||||
from inse.models.cordis_eu_project import CordisEuProject
|
from inse.models.cordis_eu_project import CordisEuProject
|
||||||
|
from inse.model import ESIndex
|
||||||
|
|
||||||
|
|
||||||
class ProjectType(StrEnum):
|
class ProjectType(StrEnum):
|
||||||
@@ -15,6 +16,17 @@ class ProjectType(StrEnum):
|
|||||||
EU = "eu"
|
EU = "eu"
|
||||||
DFG = "dfg"
|
DFG = "dfg"
|
||||||
|
|
||||||
|
def to_es_index(self) -> ESIndex:
|
||||||
|
mapping = {
|
||||||
|
self.BUND: ESIndex.PROJECTS_BUND_V1,
|
||||||
|
self.EU: ESIndex.CORDIS_EU_PROJECTS_WILDCARD,
|
||||||
|
self.DFG: ESIndex.PROJECTS_DFG_ALL,
|
||||||
|
}
|
||||||
|
index = mapping.get(self)
|
||||||
|
if index is None:
|
||||||
|
raise ValueError(f"Unsupported project type: {self}")
|
||||||
|
return index
|
||||||
|
|
||||||
|
|
||||||
class ProjectsSortBy(StrEnum):
|
class ProjectsSortBy(StrEnum):
|
||||||
TITLE = "title"
|
TITLE = "title"
|
||||||
@@ -22,6 +34,24 @@ class ProjectsSortBy(StrEnum):
|
|||||||
FUNDING_END = "funding_end"
|
FUNDING_END = "funding_end"
|
||||||
FUNDING_AMOUNT = "funding_amount"
|
FUNDING_AMOUNT = "funding_amount"
|
||||||
|
|
||||||
|
def to_cordis_eu_project_sort_field(self) -> str:
|
||||||
|
mapping = {
|
||||||
|
self.TITLE: "title.keyword",
|
||||||
|
self.FUNDING_START: "startDate",
|
||||||
|
self.FUNDING_END: "endDate",
|
||||||
|
self.FUNDING_AMOUNT: "ecMaxContribution",
|
||||||
|
}
|
||||||
|
return mapping.get(self, "title.keyword")
|
||||||
|
|
||||||
|
def to_bund_project_sort_field(self) -> str:
|
||||||
|
mapping = {
|
||||||
|
self.TITLE: "Thema.keyword",
|
||||||
|
self.FUNDING_START: "funding_start",
|
||||||
|
self.FUNDING_END: "funding_end",
|
||||||
|
self.FUNDING_AMOUNT: "Fördersumme",
|
||||||
|
}
|
||||||
|
return mapping.get(self, "Thema.keyword")
|
||||||
|
|
||||||
|
|
||||||
class SortDirection(StrEnum):
|
class SortDirection(StrEnum):
|
||||||
ASC = "asc"
|
ASC = "asc"
|
||||||
@@ -142,6 +172,9 @@ class FundingProject(BaseModel):
|
|||||||
)
|
)
|
||||||
id: str = Field(description="The unique identifier of the project.")
|
id: str = Field(description="The unique identifier of the project.")
|
||||||
title: Optional[str] = Field(default=None, description="The title of the project.")
|
title: Optional[str] = Field(default=None, description="The title of the project.")
|
||||||
|
acronym: Optional[str] = Field(
|
||||||
|
default=None, description="The acronym of the project (if available)."
|
||||||
|
)
|
||||||
start_date: Optional[date] = Field(
|
start_date: Optional[date] = Field(
|
||||||
default=None, description="The funding start date of the project."
|
default=None, description="The funding start date of the project."
|
||||||
)
|
)
|
||||||
@@ -184,7 +217,7 @@ class FundingProject(BaseModel):
|
|||||||
title=source.get("title"),
|
title=source.get("title"),
|
||||||
start_date=source.get("startDate"),
|
start_date=source.get("startDate"),
|
||||||
end_date=source.get("endDate"),
|
end_date=source.get("endDate"),
|
||||||
funding_amount=source.get("ecMacContribution"),
|
funding_amount=source.get("ecMaxContribution"),
|
||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -218,6 +251,7 @@ class FundingProject(BaseModel):
|
|||||||
title=source.get("title"),
|
title=source.get("title"),
|
||||||
start_date=source.get("funding_start"),
|
start_date=source.get("funding_start"),
|
||||||
end_date=source.get("funding_end"),
|
end_date=source.get("funding_end"),
|
||||||
|
acronym=source.get("acronym"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -225,3 +259,58 @@ class FundingProjectPage(Page):
|
|||||||
elements: List[FundingProject] = Field(
|
elements: List[FundingProject] = Field(
|
||||||
default_factory=list, description="The funding projects on this page."
|
default_factory=list, description="The funding projects on this page."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EuOrganizationShort(BaseModel):
|
||||||
|
project_id: str = Field(description="The unique identifier of the project.")
|
||||||
|
organization_id: str = Field(
|
||||||
|
description="The unique identifier of the organization."
|
||||||
|
)
|
||||||
|
ec_contribution: Optional[float] = Field(
|
||||||
|
default=None,
|
||||||
|
description="The EC contribution amount for the organization in the project.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EuProjectShort(BaseModel):
|
||||||
|
id: str = Field(description="The unique identifier of the EU project.")
|
||||||
|
title: Optional[str] = Field(
|
||||||
|
default=None, description="The title of the EU project."
|
||||||
|
)
|
||||||
|
start_date: Optional[date] = Field(
|
||||||
|
default=None, description="The funding start date of the EU project."
|
||||||
|
)
|
||||||
|
end_date: Optional[date] = Field(
|
||||||
|
default=None, description="The funding end date of the EU project."
|
||||||
|
)
|
||||||
|
acronym: Optional[str] = Field(
|
||||||
|
default=None, description="The acronym of the EU project."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EuOrganizationProjectSummary(BaseModel):
|
||||||
|
organization_id: str = Field(
|
||||||
|
description="The unique identifier of the organization."
|
||||||
|
)
|
||||||
|
project_id: str = Field(description="The unique identifier of the project.")
|
||||||
|
title: Optional[str] = Field(default=None, description="The title of the project.")
|
||||||
|
start_date: Optional[date] = Field(
|
||||||
|
default=None, description="The funding start date of the project."
|
||||||
|
)
|
||||||
|
end_date: Optional[date] = Field(
|
||||||
|
default=None, description="The funding end date of the project."
|
||||||
|
)
|
||||||
|
acronym: Optional[str] = Field(
|
||||||
|
default=None, description="The acronym of the project."
|
||||||
|
)
|
||||||
|
ec_contribution: Optional[float] = Field(
|
||||||
|
default=None,
|
||||||
|
description="The EC contribution amount for the organization in the project.",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class EuOrganizationProjectSummaryPage(Page):
|
||||||
|
elements: List[EuOrganizationProjectSummary] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="The organization project summaries on this page.",
|
||||||
|
)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ from inse.projects.model import (
|
|||||||
BundProjectPage,
|
BundProjectPage,
|
||||||
CordisEuProjectPage,
|
CordisEuProjectPage,
|
||||||
DfgProjectPage,
|
DfgProjectPage,
|
||||||
|
EuOrganizationProjectSummaryPage,
|
||||||
FundingProjectPage,
|
FundingProjectPage,
|
||||||
InstitutionFunderSummary,
|
InstitutionFunderSummary,
|
||||||
ProjectType,
|
ProjectType,
|
||||||
@@ -19,12 +20,7 @@ from inse.models.dfg_project_details import DfgProjectDetails
|
|||||||
from inse.models.bund_project_details import BundProjectDetails
|
from inse.models.bund_project_details import BundProjectDetails
|
||||||
from inse.tags import Tags
|
from inse.tags import Tags
|
||||||
from inse.projects import service as projects_service
|
from inse.projects import service as projects_service
|
||||||
from inse.projects.projects_search_client import (
|
|
||||||
BundProjectsSearchClient,
|
|
||||||
CompleteProjectsSearchClient,
|
|
||||||
DfgProjectsSearchClient,
|
|
||||||
EuProjectsSearchClient,
|
|
||||||
)
|
|
||||||
from inse.institutions.institutions_search_client import (
|
from inse.institutions.institutions_search_client import (
|
||||||
InstitutionsSearchClient,
|
InstitutionsSearchClient,
|
||||||
)
|
)
|
||||||
@@ -35,24 +31,29 @@ logger = logging.getLogger(__name__)
|
|||||||
router = APIRouter(prefix="/api/projects", tags=[Tags.PROJECTS])
|
router = APIRouter(prefix="/api/projects", tags=[Tags.PROJECTS])
|
||||||
|
|
||||||
|
|
||||||
@lru_cache
|
@router.get(
|
||||||
def get_bund_search_client() -> BundProjectsSearchClient:
|
"/author/{raw_oa_author_id}/eu",
|
||||||
return BundProjectsSearchClient()
|
summary="Get EU projects for an author.",
|
||||||
|
description="Returns a list of EU projects associated with the specified author ID.",
|
||||||
|
operation_id="getEuProjectsForAuthor",
|
||||||
@lru_cache
|
responses={
|
||||||
def get_eu_search_client() -> EuProjectsSearchClient:
|
status.HTTP_200_OK: {
|
||||||
return EuProjectsSearchClient()
|
"description": "Successful Response",
|
||||||
|
"model": CordisEuProjectPage,
|
||||||
|
},
|
||||||
@lru_cache
|
status.HTTP_404_NOT_FOUND: {"description": "Author not found"},
|
||||||
def get_dfg_search_client() -> DfgProjectsSearchClient:
|
},
|
||||||
return DfgProjectsSearchClient()
|
response_model_by_alias=False,
|
||||||
|
)
|
||||||
|
def get_eu_projects_for_author(
|
||||||
@lru_cache
|
raw_oa_author_id: Annotated[str, Path(description="The author ID to filter by.")],
|
||||||
def get_complete_projects_search_client() -> CompleteProjectsSearchClient:
|
) -> CordisEuProjectPage:
|
||||||
return CompleteProjectsSearchClient()
|
logger.debug(
|
||||||
|
f"Received request to get EU projects for author_id={raw_oa_author_id}"
|
||||||
|
)
|
||||||
|
return projects_service.search_cordis_eu_projects_for_author_id(
|
||||||
|
raw_oa_author_id=raw_oa_author_id,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
@@ -70,9 +71,6 @@ def get_complete_projects_search_client() -> CompleteProjectsSearchClient:
|
|||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def search_bund_projects(
|
async def search_bund_projects(
|
||||||
bund_search_client: Annotated[
|
|
||||||
BundProjectsSearchClient, Depends(get_bund_search_client)
|
|
||||||
],
|
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -81,8 +79,7 @@ async def search_bund_projects(
|
|||||||
Body(description="The filtering properties for the projects search."),
|
Body(description="The filtering properties for the projects search."),
|
||||||
],
|
],
|
||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
return await projects_service.search_bund_projects(
|
return projects_service.search_bund_projects(
|
||||||
bund_search_client=bund_search_client,
|
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
filtering_properties=filtering_properties,
|
filtering_properties=filtering_properties,
|
||||||
)
|
)
|
||||||
@@ -102,15 +99,11 @@ async def search_bund_projects(
|
|||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def get_single_dfg_project(
|
def get_single_dfg_project(
|
||||||
dfg_search_client: Annotated[
|
|
||||||
DfgProjectsSearchClient, Depends(get_dfg_search_client)
|
|
||||||
],
|
|
||||||
id: Annotated[str, Path(description="The ID of the DFG project to retrieve.")],
|
id: Annotated[str, Path(description="The ID of the DFG project to retrieve.")],
|
||||||
) -> DfgProjectDetails:
|
) -> DfgProjectDetails:
|
||||||
logger.debug(f"Received request to get single DFG project for id={id}")
|
logger.debug(f"Received request to get single DFG project for id={id}")
|
||||||
return await projects_service.get_single_dfg_project(
|
return projects_service.get_single_dfg_project(
|
||||||
dfg_search_client=dfg_search_client,
|
|
||||||
project_id=id,
|
project_id=id,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -129,15 +122,11 @@ async def get_single_dfg_project(
|
|||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def get_single_bund_project(
|
def get_single_bund_project(
|
||||||
bund_search_client: Annotated[
|
|
||||||
BundProjectsSearchClient, Depends(get_bund_search_client)
|
|
||||||
],
|
|
||||||
id: Annotated[str, Path(description="The ID of the BUND project to retrieve.")],
|
id: Annotated[str, Path(description="The ID of the BUND project to retrieve.")],
|
||||||
) -> BundProjectDetails:
|
) -> BundProjectDetails:
|
||||||
logger.debug(f"Received request to get single BUND project for id={id}")
|
logger.debug(f"Received request to get single BUND project for id={id}")
|
||||||
return await projects_service.get_single_bund_project(
|
return projects_service.get_single_bund_project(
|
||||||
bund_search_client=bund_search_client,
|
|
||||||
project_id=id,
|
project_id=id,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -156,10 +145,7 @@ async def get_single_bund_project(
|
|||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def get_institution_bund_projects_funding_over_time(
|
def get_institution_bund_projects_funding_over_time(
|
||||||
bund_search_client: Annotated[
|
|
||||||
BundProjectsSearchClient, Depends(get_bund_search_client)
|
|
||||||
],
|
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -167,8 +153,7 @@ async def get_institution_bund_projects_funding_over_time(
|
|||||||
str, Query(description="The institution ID to filter by.")
|
str, Query(description="The institution ID to filter by.")
|
||||||
],
|
],
|
||||||
) -> InstitutionFunderSummary:
|
) -> InstitutionFunderSummary:
|
||||||
return await projects_service.get_institution_bund_projects_funding_over_time(
|
return projects_service.get_institution_bund_projects_funding_over_time(
|
||||||
bund_search_client=bund_search_client,
|
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
raw_oa_institution_id=raw_oa_institution_id,
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
)
|
)
|
||||||
@@ -182,14 +167,13 @@ async def get_institution_bund_projects_funding_over_time(
|
|||||||
responses={
|
responses={
|
||||||
status.HTTP_200_OK: {
|
status.HTTP_200_OK: {
|
||||||
"description": "Successful Response",
|
"description": "Successful Response",
|
||||||
"model": CordisEuProjectPage,
|
"model": EuOrganizationProjectSummaryPage,
|
||||||
},
|
},
|
||||||
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def search_cordis_eu_projects(
|
async def search_cordis_eu_projects(
|
||||||
eu_search_client: Annotated[EuProjectsSearchClient, Depends(get_eu_search_client)],
|
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -197,9 +181,8 @@ async def search_cordis_eu_projects(
|
|||||||
ProjectsFilteringProperties,
|
ProjectsFilteringProperties,
|
||||||
Body(description="The filtering properties for the projects search."),
|
Body(description="The filtering properties for the projects search."),
|
||||||
],
|
],
|
||||||
) -> CordisEuProjectPage:
|
) -> EuOrganizationProjectSummaryPage:
|
||||||
return await projects_service.search_cordis_eu_projects(
|
return projects_service.search_cordis_eu_projects(
|
||||||
eu_search_client=eu_search_client,
|
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
projects_filtering_properties=projects_filtering_properties,
|
projects_filtering_properties=projects_filtering_properties,
|
||||||
)
|
)
|
||||||
@@ -220,7 +203,6 @@ async def search_cordis_eu_projects(
|
|||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def get_institution_cordis_eu_projects_funding_over_time(
|
async def get_institution_cordis_eu_projects_funding_over_time(
|
||||||
eu_search_client: Annotated[EuProjectsSearchClient, Depends(get_eu_search_client)],
|
|
||||||
institutions_search_client: Annotated[
|
institutions_search_client: Annotated[
|
||||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
],
|
],
|
||||||
@@ -229,7 +211,6 @@ async def get_institution_cordis_eu_projects_funding_over_time(
|
|||||||
],
|
],
|
||||||
) -> InstitutionFunderSummary:
|
) -> InstitutionFunderSummary:
|
||||||
return await projects_service.get_institution_cordis_eu_projects_funding_over_time(
|
return await projects_service.get_institution_cordis_eu_projects_funding_over_time(
|
||||||
eu_search_client=eu_search_client,
|
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
raw_oa_institution_id=raw_oa_institution_id,
|
raw_oa_institution_id=raw_oa_institution_id,
|
||||||
)
|
)
|
||||||
@@ -250,9 +231,6 @@ async def get_institution_cordis_eu_projects_funding_over_time(
|
|||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def get_dfg_projects(
|
async def get_dfg_projects(
|
||||||
dfg_search_client: Annotated[
|
|
||||||
DfgProjectsSearchClient, Depends(get_dfg_search_client)
|
|
||||||
],
|
|
||||||
author_id: Annotated[str, Query(description="The author ID to filter by.")],
|
author_id: Annotated[str, Query(description="The author ID to filter by.")],
|
||||||
topic: Annotated[
|
topic: Annotated[
|
||||||
Optional[str], Query(description="The topic to filter by.")
|
Optional[str], Query(description="The topic to filter by.")
|
||||||
@@ -274,7 +252,6 @@ async def get_dfg_projects(
|
|||||||
sort_direction,
|
sort_direction,
|
||||||
)
|
)
|
||||||
return await projects_service.get_dfg_projects_by_author_id(
|
return await projects_service.get_dfg_projects_by_author_id(
|
||||||
dfg_search_client=dfg_search_client,
|
|
||||||
author_id=author_id,
|
author_id=author_id,
|
||||||
topic=topic,
|
topic=topic,
|
||||||
page=page,
|
page=page,
|
||||||
@@ -297,10 +274,7 @@ async def get_dfg_projects(
|
|||||||
},
|
},
|
||||||
response_model_by_alias=False,
|
response_model_by_alias=False,
|
||||||
)
|
)
|
||||||
async def search_projects(
|
def search_projects(
|
||||||
complete_projects_search_client: Annotated[
|
|
||||||
CompleteProjectsSearchClient, Depends(get_complete_projects_search_client)
|
|
||||||
],
|
|
||||||
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
page: Annotated[int, Query(description="The page number.", ge=0)] = 0,
|
||||||
size: Annotated[int, Query(description="The page size.", ge=1)] = 10,
|
size: Annotated[int, Query(description="The page size.", ge=1)] = 10,
|
||||||
selected_project_types: Annotated[
|
selected_project_types: Annotated[
|
||||||
@@ -319,8 +293,7 @@ async def search_projects(
|
|||||||
SortDirection, Query(description="The sort direction (asc or desc).")
|
SortDirection, Query(description="The sort direction (asc or desc).")
|
||||||
] = SortDirection.ASC,
|
] = SortDirection.ASC,
|
||||||
) -> FundingProjectPage:
|
) -> FundingProjectPage:
|
||||||
return await projects_service.search_projects(
|
return projects_service.search_all_projects(
|
||||||
projects_search_client=complete_projects_search_client,
|
|
||||||
page=page,
|
page=page,
|
||||||
size=size,
|
size=size,
|
||||||
selected_project_types=selected_project_types,
|
selected_project_types=selected_project_types,
|
||||||
|
|||||||
@@ -2,17 +2,15 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, List, Optional, Set
|
from typing import Any, Dict, List, Optional, Set
|
||||||
|
|
||||||
|
from inse.projects import projects_search_client
|
||||||
from inse.projects.projects_search_client import (
|
from inse.projects.projects_search_client import (
|
||||||
BundProjectsSearchClient,
|
get_eu_organization_project_contributions,
|
||||||
CompleteProjectsSearchClient,
|
|
||||||
DfgProjectsSearchClient,
|
|
||||||
EuProjectsSearchClient,
|
|
||||||
)
|
)
|
||||||
from inse.projects.model import (
|
from inse.projects.model import (
|
||||||
BundProjectPage,
|
BundProjectPage,
|
||||||
CordisEuProjectPage,
|
CordisEuProjectPage,
|
||||||
DfgProjectPage,
|
DfgProjectPage,
|
||||||
EuProjectPage,
|
EuOrganizationProjectSummaryPage,
|
||||||
FundingProjectPage,
|
FundingProjectPage,
|
||||||
InstitutionFunderSummary,
|
InstitutionFunderSummary,
|
||||||
ProjectType,
|
ProjectType,
|
||||||
@@ -27,12 +25,13 @@ from inse.institutions.institutions_search_client import (
|
|||||||
)
|
)
|
||||||
from inse.exceptions import NotFoundException
|
from inse.exceptions import NotFoundException
|
||||||
from inse.persons.logic import get_author_name_by_id
|
from inse.persons.logic import get_author_name_by_id
|
||||||
|
from inse.works.logic import get_publication_dois_of_author
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
async def search_projects(
|
def search_all_projects(
|
||||||
projects_search_client: CompleteProjectsSearchClient,
|
|
||||||
page: int,
|
page: int,
|
||||||
size: int,
|
size: int,
|
||||||
sort_by: ProjectsSortBy,
|
sort_by: ProjectsSortBy,
|
||||||
@@ -40,18 +39,20 @@ async def search_projects(
|
|||||||
selected_project_types: Optional[Set[ProjectType]] = None,
|
selected_project_types: Optional[Set[ProjectType]] = None,
|
||||||
title: Optional[str] = None,
|
title: Optional[str] = None,
|
||||||
) -> FundingProjectPage:
|
) -> FundingProjectPage:
|
||||||
return await projects_search_client.search_projects(
|
return projects_search_client.search_all_projects(
|
||||||
page=page,
|
projects_filtering_properties=ProjectsFilteringProperties(
|
||||||
size=size,
|
project_type=ProjectType.EU, # placeholder, shall be ignored in search_all_projects
|
||||||
|
page=page,
|
||||||
|
size=size,
|
||||||
|
sort_by=sort_by,
|
||||||
|
sort_direction=sort_direction,
|
||||||
|
query=title,
|
||||||
|
),
|
||||||
selected_project_types=selected_project_types,
|
selected_project_types=selected_project_types,
|
||||||
title=title,
|
|
||||||
sort_by=sort_by,
|
|
||||||
sort_direction=sort_direction,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def search_bund_projects(
|
def search_bund_projects(
|
||||||
bund_search_client: BundProjectsSearchClient,
|
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
institutions_search_client: InstitutionsSearchClient,
|
||||||
filtering_properties: ProjectsFilteringProperties,
|
filtering_properties: ProjectsFilteringProperties,
|
||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
@@ -60,15 +61,17 @@ async def search_bund_projects(
|
|||||||
f"Invalid project type: {filtering_properties.project_type}. Expected 'bund'."
|
f"Invalid project type: {filtering_properties.project_type}. Expected 'bund'."
|
||||||
)
|
)
|
||||||
|
|
||||||
return await get_bund_projects_by_institution_id(
|
logger.debug(
|
||||||
bund_search_client=bund_search_client,
|
f"search_bund_projects called with filtering_properties: {filtering_properties}"
|
||||||
|
)
|
||||||
|
|
||||||
|
return get_bund_projects_by_institution_id(
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
filtering_properties=filtering_properties,
|
filtering_properties=filtering_properties,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def get_bund_projects_by_institution_id(
|
def get_bund_projects_by_institution_id(
|
||||||
bund_search_client: BundProjectsSearchClient,
|
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
institutions_search_client: InstitutionsSearchClient,
|
||||||
filtering_properties: ProjectsFilteringProperties,
|
filtering_properties: ProjectsFilteringProperties,
|
||||||
) -> BundProjectPage:
|
) -> BundProjectPage:
|
||||||
@@ -78,46 +81,41 @@ async def get_bund_projects_by_institution_id(
|
|||||||
logger.info(
|
logger.info(
|
||||||
f"Fetching bund projects for institution_id={filtering_properties.raw_oa_institution_id}, page={filtering_properties.page}, size={filtering_properties.size}"
|
f"Fetching bund projects for institution_id={filtering_properties.raw_oa_institution_id}, page={filtering_properties.page}, size={filtering_properties.size}"
|
||||||
)
|
)
|
||||||
institution_aliases = institutions_search_client.get_institution_aliases_by_id(
|
institution_aliases = (
|
||||||
filtering_properties.raw_oa_institution_id
|
institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
||||||
|
filtering_properties.raw_oa_institution_id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Found institution aliases for institution_id={filtering_properties.raw_oa_institution_id}: {institution_aliases}"
|
f"get_bund_projects_by_institution_id: Found institution aliases for institution_id={filtering_properties.raw_oa_institution_id}: {institution_aliases}"
|
||||||
)
|
)
|
||||||
response = await bund_search_client.search_bund_projects(
|
response = projects_search_client.search_bund_projects(
|
||||||
page=filtering_properties.page,
|
|
||||||
size=filtering_properties.size,
|
|
||||||
institution_names=institution_aliases,
|
institution_names=institution_aliases,
|
||||||
topic=filtering_properties.query,
|
filter_properties=filtering_properties,
|
||||||
sort_by=filtering_properties.sort_by,
|
|
||||||
sort_direction=filtering_properties.sort_direction,
|
|
||||||
)
|
)
|
||||||
logger.debug(f"get_bund_projects_by_institution_id response: {response}")
|
logger.debug(f"get_bund_projects_by_institution_id response: {response}")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
async def search_cordis_eu_projects(
|
def search_cordis_eu_projects(
|
||||||
eu_search_client: EuProjectsSearchClient,
|
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
institutions_search_client: InstitutionsSearchClient,
|
||||||
projects_filtering_properties: ProjectsFilteringProperties,
|
projects_filtering_properties: ProjectsFilteringProperties,
|
||||||
) -> CordisEuProjectPage:
|
) -> EuOrganizationProjectSummaryPage:
|
||||||
if projects_filtering_properties.project_type != "eu":
|
if projects_filtering_properties.project_type != "eu":
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
f"Invalid project type: {projects_filtering_properties.project_type}. Expected 'eu'."
|
f"Invalid project type: {projects_filtering_properties.project_type}. Expected 'eu'."
|
||||||
)
|
)
|
||||||
|
|
||||||
return await get_cordis_eu_projects_by_institution_id(
|
return get_cordis_eu_projects_by_institution_id(
|
||||||
eu_search_client=eu_search_client,
|
|
||||||
institutions_search_client=institutions_search_client,
|
institutions_search_client=institutions_search_client,
|
||||||
projects_filtering_properties=projects_filtering_properties,
|
projects_filtering_properties=projects_filtering_properties,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def get_cordis_eu_projects_by_institution_id(
|
def get_cordis_eu_projects_by_institution_id(
|
||||||
eu_search_client: EuProjectsSearchClient,
|
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
institutions_search_client: InstitutionsSearchClient,
|
||||||
projects_filtering_properties: ProjectsFilteringProperties,
|
projects_filtering_properties: ProjectsFilteringProperties,
|
||||||
) -> CordisEuProjectPage:
|
) -> EuOrganizationProjectSummaryPage:
|
||||||
if not projects_filtering_properties.raw_oa_institution_id:
|
if not projects_filtering_properties.raw_oa_institution_id:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"raw_oa_institution_id must be provided to fetch CORDIS EU projects by institution ID"
|
"raw_oa_institution_id must be provided to fetch CORDIS EU projects by institution ID"
|
||||||
@@ -126,81 +124,26 @@ async def get_cordis_eu_projects_by_institution_id(
|
|||||||
logger.info(
|
logger.info(
|
||||||
f"Fetching CORDIS EU projects for institution_id={projects_filtering_properties.raw_oa_institution_id}, page={projects_filtering_properties.page}, size={projects_filtering_properties.size}"
|
f"Fetching CORDIS EU projects for institution_id={projects_filtering_properties.raw_oa_institution_id}, page={projects_filtering_properties.page}, size={projects_filtering_properties.size}"
|
||||||
)
|
)
|
||||||
institution_aliases = institutions_search_client.get_institution_aliases_by_id(
|
institution_aliases = (
|
||||||
projects_filtering_properties.raw_oa_institution_id
|
institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
||||||
|
projects_filtering_properties.raw_oa_institution_id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Found institution aliases for institution_id={projects_filtering_properties.raw_oa_institution_id}: {institution_aliases}"
|
f"Found institution aliases for institution_id={projects_filtering_properties.raw_oa_institution_id}: {institution_aliases}"
|
||||||
)
|
)
|
||||||
|
|
||||||
institution_eu_organisation_id = await (
|
page = get_eu_organization_project_contributions(
|
||||||
institutions_search_client.get_eu_organisation_id_by_oa_institution_id(
|
organization_names=institution_aliases,
|
||||||
projects_filtering_properties.raw_oa_institution_id
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if not institution_eu_organisation_id:
|
|
||||||
logger.debug(
|
|
||||||
f"No EU organization ID found for institution_id={projects_filtering_properties.raw_oa_institution_id}"
|
|
||||||
)
|
|
||||||
raise NotFoundException(
|
|
||||||
f"EU organization ID for institution with id {projects_filtering_properties.raw_oa_institution_id} not found"
|
|
||||||
)
|
|
||||||
|
|
||||||
cordis_eu_project_page = await eu_search_client.search_eu_projects2(
|
|
||||||
eu_organisation_id=institution_eu_organisation_id,
|
|
||||||
projects_filtering_properties=projects_filtering_properties,
|
projects_filtering_properties=projects_filtering_properties,
|
||||||
)
|
)
|
||||||
|
|
||||||
return cordis_eu_project_page
|
logger.debug(f"get_cordis_eu_projects_by_institution_id response: {page}")
|
||||||
|
|
||||||
|
return page
|
||||||
async def get_eu_projects_by_institution_id(
|
|
||||||
eu_search_client: EuProjectsSearchClient,
|
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
|
||||||
raw_oa_institution_id: str,
|
|
||||||
topic: Optional[str],
|
|
||||||
page: int,
|
|
||||||
size: int,
|
|
||||||
sort_by: str = "topic",
|
|
||||||
sort_direction: str = "asc",
|
|
||||||
) -> EuProjectPage:
|
|
||||||
logger.info(
|
|
||||||
f"Fetching EU projects for institution_id={raw_oa_institution_id}, page={page}, size={size}"
|
|
||||||
)
|
|
||||||
institution_aliases = institutions_search_client.get_institution_aliases_by_id(
|
|
||||||
raw_oa_institution_id
|
|
||||||
)
|
|
||||||
logger.debug(
|
|
||||||
f"Found institution aliases for institution_id={raw_oa_institution_id}: {institution_aliases}"
|
|
||||||
)
|
|
||||||
|
|
||||||
institution_eu_organisation_id = await (
|
|
||||||
institutions_search_client.get_eu_organisation_id_by_oa_institution_id(
|
|
||||||
raw_oa_institution_id
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if not institution_eu_organisation_id:
|
|
||||||
logger.debug(
|
|
||||||
f"No EU organization ID found for institution_id={raw_oa_institution_id}"
|
|
||||||
)
|
|
||||||
raise NotFoundException(
|
|
||||||
f"EU organization ID for institution with id {raw_oa_institution_id} not found"
|
|
||||||
)
|
|
||||||
|
|
||||||
response = await eu_search_client.search_eu_projects(
|
|
||||||
page=page,
|
|
||||||
size=size,
|
|
||||||
institution_names=institution_aliases,
|
|
||||||
topic=topic,
|
|
||||||
sort_by=sort_by,
|
|
||||||
sort_direction=sort_direction,
|
|
||||||
)
|
|
||||||
logger.debug(f"get_eu_projects_by_institution_id response: {response}")
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
async def get_dfg_projects_by_author_id(
|
async def get_dfg_projects_by_author_id(
|
||||||
dfg_search_client: DfgProjectsSearchClient,
|
|
||||||
author_id: str,
|
author_id: str,
|
||||||
topic: Optional[str],
|
topic: Optional[str],
|
||||||
page: int,
|
page: int,
|
||||||
@@ -219,7 +162,7 @@ async def get_dfg_projects_by_author_id(
|
|||||||
)
|
)
|
||||||
logger.debug(f"Found author name for author_id={author_id}: {name}")
|
logger.debug(f"Found author name for author_id={author_id}: {name}")
|
||||||
|
|
||||||
response = await dfg_search_client.search_dfg_projects(
|
response = projects_search_client.search_dfg_projects(
|
||||||
page=page,
|
page=page,
|
||||||
size=size,
|
size=size,
|
||||||
names=[name],
|
names=[name],
|
||||||
@@ -231,17 +174,18 @@ async def get_dfg_projects_by_author_id(
|
|||||||
|
|
||||||
|
|
||||||
async def get_institution_cordis_eu_projects_funding_over_time(
|
async def get_institution_cordis_eu_projects_funding_over_time(
|
||||||
eu_search_client: EuProjectsSearchClient,
|
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
institutions_search_client: InstitutionsSearchClient,
|
||||||
raw_oa_institution_id: str,
|
raw_oa_institution_id: str,
|
||||||
) -> InstitutionFunderSummary:
|
) -> InstitutionFunderSummary:
|
||||||
|
institution_aliases = (
|
||||||
cordis_eu_project_page = await search_cordis_eu_projects(
|
institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
||||||
eu_search_client,
|
raw_oa_institution_id
|
||||||
institutions_search_client,
|
)
|
||||||
ProjectsFilteringProperties(
|
)
|
||||||
|
page = get_eu_organization_project_contributions(
|
||||||
|
organization_names=institution_aliases,
|
||||||
|
projects_filtering_properties=ProjectsFilteringProperties(
|
||||||
project_type=ProjectType.EU,
|
project_type=ProjectType.EU,
|
||||||
raw_oa_institution_id=raw_oa_institution_id,
|
|
||||||
page=0,
|
page=0,
|
||||||
size=10000,
|
size=10000,
|
||||||
),
|
),
|
||||||
@@ -249,30 +193,34 @@ async def get_institution_cordis_eu_projects_funding_over_time(
|
|||||||
|
|
||||||
return _calculate_funding_over_time(
|
return _calculate_funding_over_time(
|
||||||
project_type=ProjectType.EU,
|
project_type=ProjectType.EU,
|
||||||
projects=cordis_eu_project_page.elements,
|
projects=page.elements,
|
||||||
funding_start_attr="startDate",
|
funding_start_attr="start_date",
|
||||||
funding_end_attr="endDate",
|
funding_end_attr="end_date",
|
||||||
funding_amount_attr="totalCost",
|
funding_amount_attr="ec_contribution",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def get_institution_bund_projects_funding_over_time(
|
def get_institution_bund_projects_funding_over_time(
|
||||||
bund_search_client: BundProjectsSearchClient,
|
|
||||||
institutions_search_client: InstitutionsSearchClient,
|
institutions_search_client: InstitutionsSearchClient,
|
||||||
raw_oa_institution_id: str,
|
raw_oa_institution_id: str,
|
||||||
) -> InstitutionFunderSummary:
|
) -> InstitutionFunderSummary:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Fetching funding over time for institution_id={raw_oa_institution_id}"
|
f"Fetching funding over time for institution_id={raw_oa_institution_id}"
|
||||||
)
|
)
|
||||||
institution_aliases = institutions_search_client.get_institution_aliases_by_id(
|
institution_aliases = (
|
||||||
raw_oa_institution_id
|
institutions_search_client.get_institution_aliases_by_oa_institution_id(
|
||||||
|
raw_oa_institution_id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Found institution aliases for institution_id={raw_oa_institution_id}: {institution_aliases}"
|
f"Found institution aliases for institution_id={raw_oa_institution_id}: {institution_aliases}"
|
||||||
)
|
)
|
||||||
response = await bund_search_client.search_bund_projects(
|
response = projects_search_client.search_bund_projects(
|
||||||
page=0,
|
filter_properties=ProjectsFilteringProperties(
|
||||||
size=10000,
|
project_type=ProjectType.BUND,
|
||||||
|
page=0,
|
||||||
|
size=10000,
|
||||||
|
),
|
||||||
institution_names=institution_aliases,
|
institution_names=institution_aliases,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -353,25 +301,49 @@ def _calculate_funding_over_time(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def get_single_dfg_project(
|
def get_single_dfg_project(
|
||||||
dfg_search_client: DfgProjectsSearchClient,
|
|
||||||
project_id: str,
|
project_id: str,
|
||||||
) -> DfgProjectDetails:
|
) -> DfgProjectDetails:
|
||||||
logger.debug(f"Fetching single DFG project for id={project_id}")
|
logger.debug(f"Fetching single DFG project for id={project_id}")
|
||||||
|
|
||||||
project = await dfg_search_client.get_dfg_project_by_id(project_id)
|
project = projects_search_client.get_dfg_project_by_id(project_id)
|
||||||
if not project:
|
if not project:
|
||||||
raise NotFoundException(f"DFG project with id {project_id} not found")
|
raise NotFoundException(f"DFG project with id {project_id} not found")
|
||||||
return project
|
return project
|
||||||
|
|
||||||
|
|
||||||
async def get_single_bund_project(
|
def get_single_bund_project(
|
||||||
bund_search_client: BundProjectsSearchClient,
|
|
||||||
project_id: str,
|
project_id: str,
|
||||||
) -> BundProjectDetails:
|
) -> BundProjectDetails:
|
||||||
logger.debug(f"Fetching single BUND project for id={project_id}")
|
logger.debug(f"Fetching single BUND project for id={project_id}")
|
||||||
|
|
||||||
project = await bund_search_client.get_bund_project_by_id(project_id)
|
project = projects_search_client.get_bund_project_by_id(project_id)
|
||||||
if not project:
|
if not project:
|
||||||
raise NotFoundException(f"BUND project with id {project_id} not found")
|
raise NotFoundException(f"BUND project with id {project_id} not found")
|
||||||
return project
|
return project
|
||||||
|
|
||||||
|
|
||||||
|
def search_cordis_eu_projects_for_author_id(
|
||||||
|
raw_oa_author_id: str,
|
||||||
|
) -> CordisEuProjectPage:
|
||||||
|
|
||||||
|
# Direct search not possible -> multi stage search
|
||||||
|
# 1. Exisiting author has publications with DOIs
|
||||||
|
# 2. CORDIS EU projects have associated publications with DOIs
|
||||||
|
# 3. Matching DOIs of author publications with DOIs of CORDIS EU project publications -> projects with associated publications of the author
|
||||||
|
|
||||||
|
dois = get_publication_dois_of_author(raw_oa_author_id=raw_oa_author_id)
|
||||||
|
|
||||||
|
logger.debug(f"Found DOIs for author_id={raw_oa_author_id}: {dois}")
|
||||||
|
|
||||||
|
project_ids = projects_search_client.get_cordis_eu_project_ids_by_dois(dois=dois)
|
||||||
|
|
||||||
|
logger.debug(
|
||||||
|
f"Found project IDs {project_ids} for author_id={raw_oa_author_id} and dois={dois}"
|
||||||
|
)
|
||||||
|
|
||||||
|
funding_project_page = projects_search_client.get_cordis_eu_projects_by_project_ids(
|
||||||
|
project_ids=project_ids
|
||||||
|
)
|
||||||
|
|
||||||
|
return funding_project_page
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ class Tags(Enum):
|
|||||||
INSTITUTIONS = "Institutions"
|
INSTITUTIONS = "Institutions"
|
||||||
TOPICS = "Topics"
|
TOPICS = "Topics"
|
||||||
WORKS = "Works"
|
WORKS = "Works"
|
||||||
|
NEWS = "News"
|
||||||
PROJECTS = "Projects"
|
PROJECTS = "Projects"
|
||||||
|
|||||||
@@ -256,10 +256,19 @@ def _datetime_str_or_none(value: Any) -> str | None:
|
|||||||
return f"{text}T00:00:00Z"
|
return f"{text}T00:00:00Z"
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
# Configuration for vector search similarity thresholds and boosts
|
||||||
|
SIMILARITY_THRESHOLD = 0.62
|
||||||
|
BOOST_LEXICAL = 1.0
|
||||||
|
# higher values for semantic weights, because cosine similarity is between 0 and 1
|
||||||
|
BOOST_DISPLAY_NAME_VECTOR = 30.0
|
||||||
|
BOOST_DESCRIPTION_VECTOR = 15.0
|
||||||
|
BOOST_KEYWORD_VECTORS = 25.0
|
||||||
|
|
||||||
async def vector_search_topics(
|
async def vector_search_topics(
|
||||||
*,
|
*,
|
||||||
query: str,
|
query: str,
|
||||||
limit: int = 25,
|
limit: int = 25,
|
||||||
|
search_type: str = "hybrid",
|
||||||
) -> TopicsListResponse:
|
) -> TopicsListResponse:
|
||||||
"""
|
"""
|
||||||
Perform a semantic similarity search on the topicvectors index.
|
Perform a semantic similarity search on the topicvectors index.
|
||||||
@@ -287,53 +296,70 @@ async def vector_search_topics(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# 2. Query Elasticsearch using standard Bool Should hybrid search
|
# 2. Query Elasticsearch using standard Bool Should hybrid search
|
||||||
|
should_clauses = []
|
||||||
|
|
||||||
|
# Lexical multi_match search (only in hybrid mode)
|
||||||
|
if search_type == "hybrid":
|
||||||
|
should_clauses.append({
|
||||||
|
"multi_match": {
|
||||||
|
"query": query,
|
||||||
|
"fields": [
|
||||||
|
"display_name^3",
|
||||||
|
"keywords^2",
|
||||||
|
"description^1"
|
||||||
|
],
|
||||||
|
"boost": BOOST_LEXICAL
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
# Semantic KNN clauses
|
||||||
|
should_clauses.extend([
|
||||||
|
{
|
||||||
|
"knn": {
|
||||||
|
"field": "display_name_vector",
|
||||||
|
"query_vector": query_vector,
|
||||||
|
"similarity": SIMILARITY_THRESHOLD,
|
||||||
|
"boost": BOOST_DISPLAY_NAME_VECTOR,
|
||||||
|
"k": 500,
|
||||||
|
"num_candidates": 500
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"knn": {
|
||||||
|
"field": "description_vector",
|
||||||
|
"query_vector": query_vector,
|
||||||
|
"similarity": SIMILARITY_THRESHOLD,
|
||||||
|
"boost": BOOST_DESCRIPTION_VECTOR,
|
||||||
|
"k": 500,
|
||||||
|
"num_candidates": 500
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nested": {
|
||||||
|
"path": "keyword_vectors",
|
||||||
|
"query": {
|
||||||
|
"knn": {
|
||||||
|
"field": "keyword_vectors.vector",
|
||||||
|
"query_vector": query_vector,
|
||||||
|
"similarity": SIMILARITY_THRESHOLD,
|
||||||
|
"k": 500,
|
||||||
|
"num_candidates": 500
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"score_mode": "max",
|
||||||
|
"boost": BOOST_KEYWORD_VECTORS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
body = {
|
body = {
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"should": [
|
"should": should_clauses
|
||||||
{
|
|
||||||
"multi_match": {
|
|
||||||
"query": query,
|
|
||||||
"fields": [
|
|
||||||
"display_name^3",
|
|
||||||
"keywords^2",
|
|
||||||
"description^1"
|
|
||||||
],
|
|
||||||
"boost": 1.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"knn": {
|
|
||||||
"field": "display_name_vector",
|
|
||||||
"query_vector": query_vector,
|
|
||||||
"k": limit,
|
|
||||||
"num_candidates": 100,
|
|
||||||
"similarity": 0.62,
|
|
||||||
"boost": 2.0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nested": {
|
|
||||||
"path": "description_vectors",
|
|
||||||
"query": {
|
|
||||||
"knn": {
|
|
||||||
"field": "description_vectors.vector",
|
|
||||||
"query_vector": query_vector,
|
|
||||||
"k": limit,
|
|
||||||
"num_candidates": 100,
|
|
||||||
"similarity": 0.62
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"score_mode": "max",
|
|
||||||
"boost": 1.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"_source": {
|
"_source": {
|
||||||
"excludes": ["display_name_vector", "description_vectors", "description", "siblings"] # remove unrequired fields (description, sibling currently not needed)
|
"excludes": ["display_name_vector", "description_vector", "keyword_vectors", "description"] # remove unrequired fields
|
||||||
},
|
},
|
||||||
"size": limit
|
"size": limit
|
||||||
}
|
}
|
||||||
@@ -354,13 +380,6 @@ async def vector_search_topics(
|
|||||||
# 3. Format result
|
# 3. Format result
|
||||||
hits = raw_results.get("hits", {}).get("hits", [])
|
hits = raw_results.get("hits", {}).get("hits", [])
|
||||||
|
|
||||||
# Log scores to JSON for threshold analysis TODO: Remove after finetune
|
|
||||||
try:
|
|
||||||
from .score_logger import log_scores_to_json
|
|
||||||
log_scores_to_json(hits, query)
|
|
||||||
except Exception as exc:
|
|
||||||
logger.warning(f"Could not log search scores: {exc}")
|
|
||||||
|
|
||||||
total = len(hits)
|
total = len(hits)
|
||||||
results = [hit.get("_source", {}) for hit in hits]
|
results = [hit.get("_source", {}) for hit in hits]
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Any, Dict, List
|
|
||||||
|
|
||||||
def log_scores_to_json(hits: List[Dict[str, Any]], query: str) -> None:
|
|
||||||
"""
|
|
||||||
Utility function to log the names and scores of all vector search hits to a JSON file.
|
|
||||||
This helps in debugging and manually tweaking the similarity score thresholds.
|
|
||||||
"""
|
|
||||||
scores_data = []
|
|
||||||
for hit in hits:
|
|
||||||
source = hit.get("_source", {})
|
|
||||||
topic_name = source.get("display_name") or source.get("name") or "Unknown"
|
|
||||||
score = hit.get("_score", 0.0)
|
|
||||||
scores_data.append({
|
|
||||||
"topic_name": topic_name,
|
|
||||||
"score": score
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
data_dir = Path("/data")
|
|
||||||
|
|
||||||
output_file = data_dir / "search_scores.json"
|
|
||||||
|
|
||||||
log_payload = {
|
|
||||||
"query": query,
|
|
||||||
"max_score": hits[0].get("_score", 0.0) if hits else 0.0,
|
|
||||||
"results": scores_data
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
with open(output_file, "w", encoding="utf-8") as f:
|
|
||||||
json.dump(log_payload, f, indent=2, ensure_ascii=False)
|
|
||||||
print(f"DEBUG: Saved search scores for query '{query}' to {output_file}")
|
|
||||||
except Exception as exc:
|
|
||||||
print(f"DEBUG: Failed to save search scores: {exc}")
|
|
||||||
@@ -129,9 +129,14 @@ async def vector_search_topics(
|
|||||||
int,
|
int,
|
||||||
Query(description="Maximum number of topics to return.", ge=1, le=100),
|
Query(description="Maximum number of topics to return.", ge=1, le=100),
|
||||||
] = 25,
|
] = 25,
|
||||||
|
search_type: Annotated[
|
||||||
|
str,
|
||||||
|
Query(alias="searchType", description="Search approach: 'hybrid' or 'semantic'."),
|
||||||
|
] = "hybrid",
|
||||||
):
|
):
|
||||||
return await logic.vector_search_topics(
|
return await logic.vector_search_topics(
|
||||||
query=query,
|
query=query,
|
||||||
limit=limit,
|
limit=limit,
|
||||||
|
search_type=search_type,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ def get_persons_data(hit:dict):
|
|||||||
return author
|
return author
|
||||||
|
|
||||||
from sentence_transformers import SentenceTransformer
|
from sentence_transformers import SentenceTransformer
|
||||||
|
from .config import settings
|
||||||
# Sentence Transformer Model
|
# Sentence Transformer Model
|
||||||
_model: SentenceTransformer | None = None
|
_model: SentenceTransformer | None = None
|
||||||
|
|
||||||
@@ -55,5 +56,6 @@ def get_model():
|
|||||||
if os.environ.get("SENTENCE_TRANSFORMERS_HOME") == "/models":
|
if os.environ.get("SENTENCE_TRANSFORMERS_HOME") == "/models":
|
||||||
os.environ["HF_HUB_OFFLINE"] = "1"
|
os.environ["HF_HUB_OFFLINE"] = "1"
|
||||||
|
|
||||||
_model = SentenceTransformer("paraphrase-multilingual-mpnet-base-v2")
|
model_name = settings.sentence_transformers_model_name
|
||||||
|
_model = SentenceTransformer(model_name)
|
||||||
return _model
|
return _model
|
||||||
@@ -649,9 +649,7 @@ def _author_works_query(author_id: str) -> dict[str, Any]:
|
|||||||
|
|
||||||
def _parse_year_count_buckets(response: dict) -> list[dict]:
|
def _parse_year_count_buckets(response: dict) -> list[dict]:
|
||||||
return (
|
return (
|
||||||
response.get("aggregations", {})
|
response.get("aggregations", {}).get("publication_years", {}).get("buckets", [])
|
||||||
.get("publication_years", {})
|
|
||||||
.get("buckets", [])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -691,13 +689,9 @@ def _collect_topic_ids_from_year_buckets(year_buckets: list[dict]) -> set[str]:
|
|||||||
topic_ids: set[str] = set()
|
topic_ids: set[str] = set()
|
||||||
|
|
||||||
for year_bucket in year_buckets:
|
for year_bucket in year_buckets:
|
||||||
primary_buckets = (
|
primary_buckets = year_bucket.get("primary_topics", {}).get("buckets", [])
|
||||||
year_bucket.get("primary_topics", {}).get("buckets", [])
|
|
||||||
)
|
|
||||||
topic_buckets = (
|
topic_buckets = (
|
||||||
year_bucket.get("topics_nested", {})
|
year_bucket.get("topics_nested", {}).get("topics", {}).get("buckets", [])
|
||||||
.get("topics", {})
|
|
||||||
.get("buckets", [])
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for bucket in primary_buckets + topic_buckets:
|
for bucket in primary_buckets + topic_buckets:
|
||||||
@@ -723,9 +717,7 @@ def _build_timeline_elements_from_aggregations(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
topics = _build_topic_counts_from_buckets(
|
topics = _build_topic_counts_from_buckets(
|
||||||
year_bucket.get("topics_nested", {})
|
year_bucket.get("topics_nested", {}).get("topics", {}).get("buckets", []),
|
||||||
.get("topics", {})
|
|
||||||
.get("buckets", []),
|
|
||||||
topic_details=topic_details,
|
topic_details=topic_details,
|
||||||
max_topics_per_year=max_topics_per_year,
|
max_topics_per_year=max_topics_per_year,
|
||||||
use_reverse_nested_count=True,
|
use_reverse_nested_count=True,
|
||||||
@@ -781,6 +773,7 @@ def _build_topic_counts_from_buckets(
|
|||||||
|
|
||||||
return topics
|
return topics
|
||||||
|
|
||||||
|
|
||||||
async def _search_author_works_data(
|
async def _search_author_works_data(
|
||||||
search_client: OpenAlexWorksSearchClient,
|
search_client: OpenAlexWorksSearchClient,
|
||||||
author_id: str,
|
author_id: str,
|
||||||
@@ -861,3 +854,49 @@ def _parse_full_work_search_response(data: dict) -> tuple[list[Work], int]:
|
|||||||
) from exc
|
) from exc
|
||||||
|
|
||||||
return elements, total
|
return elements, total
|
||||||
|
|
||||||
|
|
||||||
|
def get_publication_dois_of_author(
|
||||||
|
raw_oa_author_id: str,
|
||||||
|
) -> List[str]:
|
||||||
|
query = {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships",
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"authorships.author.id": f"https://openalex.org/{raw_oa_author_id.strip().upper()}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filter": [{"exists": {"field": "doi"}}],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = elasticsearch.search(
|
||||||
|
index="openalex-works",
|
||||||
|
source=["doi"],
|
||||||
|
size=10000,
|
||||||
|
query=query,
|
||||||
|
cluster="nes",
|
||||||
|
)
|
||||||
|
except httpx.HTTPError as exc:
|
||||||
|
logger.exception("Request for publication DOIs of author failed.")
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="Request for publication DOIs of author failed.",
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
dois = []
|
||||||
|
for hit in response.get("hits", {}).get("hits", []):
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
doi = source.get("doi")
|
||||||
|
if doi:
|
||||||
|
dois.append(doi)
|
||||||
|
|
||||||
|
return dois
|
||||||
|
|||||||
@@ -26,12 +26,13 @@ class OpenAlexWorksSearchClient:
|
|||||||
timeout: float | None = None,
|
timeout: float | None = None,
|
||||||
transport: httpx.AsyncBaseTransport | None = None,
|
transport: httpx.AsyncBaseTransport | None = None,
|
||||||
):
|
):
|
||||||
self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/")
|
self.base_url = (base_url or config.settings.elasticsearch_url or "").rstrip("/")
|
||||||
self.index = index or config.settings.openalex_works_search_index
|
self.index = index or config.settings.openalex_works_search_index
|
||||||
self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key
|
self.api_key = api_key if api_key is not None else config.settings.elasticsearch_api_key
|
||||||
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
|
|
||||||
|
|
||||||
def author_works_query(
|
def author_works_query(
|
||||||
self,
|
self,
|
||||||
author_id: str,
|
author_id: str,
|
||||||
|
|||||||
+187
-4
@@ -17,6 +17,21 @@ GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_publications/_search
|
|||||||
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"size": 100,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{
|
||||||
|
"terms": {
|
||||||
|
"projectID": ["287661"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_mapping
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_mapping
|
||||||
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
@@ -47,6 +62,73 @@ Content-Type: application/json
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 10.1371/journal.pone.0018216
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_publications/_mapping
|
||||||
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_publications/_search
|
||||||
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_fp7_project_iprs/_search
|
||||||
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_publications/_search
|
||||||
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{
|
||||||
|
"terms": {
|
||||||
|
"qaProcessedDoi": [
|
||||||
|
"10.5555/3234847.3234861",
|
||||||
|
"10.1145/1858367.1858373",
|
||||||
|
"10.1145/3583120.3586961",
|
||||||
|
"10.1109/ipin.2017.8115906",
|
||||||
|
"10.1145/3274783.3275217",
|
||||||
|
"10.1007/978-3-031-20716-7_7",
|
||||||
|
"10.1109/percomw.2012.6197554",
|
||||||
|
"10.1016/j.pmcj.2012.12.002",
|
||||||
|
"10.1007/978-3-658-32266-3_30",
|
||||||
|
"10.1109/percomw.2013.6529502",
|
||||||
|
"10.1109/ie.2010.40",
|
||||||
|
"10.18419/opus-2650",
|
||||||
|
"10.1007/s00138-024-01553-z",
|
||||||
|
"10.1007/978-3-030-90439-5_15",
|
||||||
|
"10.1201/9781003338659-4",
|
||||||
|
"10.1016/j.pmcj.2013.10.013",
|
||||||
|
"10.1109/percom.2009.4912852",
|
||||||
|
"10.1109/icra55743.2025.11128432",
|
||||||
|
"10.1145/2494091.2497327",
|
||||||
|
"10.1007/978-3-658-46485-1_31",
|
||||||
|
"10.1109/ie.2017.22",
|
||||||
|
"10.1109/jiot.2016.2554146",
|
||||||
|
"10.1145/2493432.2493459",
|
||||||
|
"10.3233/ais-160416",
|
||||||
|
"10.1109/percomw.2007.111",
|
||||||
|
"10.5194/asr-17-183-2020",
|
||||||
|
"10.1007/978-3-658-36430-4_37",
|
||||||
|
"10.1007/978-3-030-64559-5_50"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_search
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_search
|
||||||
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
@@ -79,6 +161,26 @@ GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_search
|
|||||||
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"size": 1000,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{
|
||||||
|
"term": {
|
||||||
|
"name.keyword": "UNIVERSITAET DUISBURG-ESSEN"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_search
|
||||||
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"size": 0,
|
"size": 0,
|
||||||
"query": {
|
"query": {
|
||||||
@@ -101,6 +203,38 @@ Content-Type: application/json
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_projects/_mapping
|
||||||
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
###
|
||||||
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_search
|
||||||
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"terms": {
|
||||||
|
"name": [
|
||||||
|
"UNIVERSITÄT DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITY OF DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITAT DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITY OF DUISBURG ESSEN",
|
||||||
|
"UNIVERSITAT DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITAET DUISBURG ESSEN",
|
||||||
|
"UNIVERSITÄT DUISBURG ESSEN",
|
||||||
|
"UNIVERSITAT DUISBURG ESSEN",
|
||||||
|
"UNIVERSITÄT DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITAET DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITY OF DUISBURG-ESSEN"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"_source": ["projectID", "organisationID", "ecContribution"]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_search
|
GET https://inse.nes.uni-due.de/elastic/cordis_eu_*_organizations/_search
|
||||||
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
Authorization: ApiKey bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||||
@@ -132,18 +266,27 @@ Content-Type: application/json
|
|||||||
"bool": {
|
"bool": {
|
||||||
"filter": [
|
"filter": [
|
||||||
{
|
{
|
||||||
"term": {
|
"terms": {
|
||||||
"name.keyword": "UNIVERSITAET DUISBURG-ESSEN"
|
"name.keyword": [
|
||||||
|
"UNIVERSITAET DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITY OF DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITÄT DUISBURG-ESSEN",
|
||||||
|
"UNIVERSITAT DUISBURG ESSEN",
|
||||||
|
"UNIVERSITÄT DUISBURG ESSEN",
|
||||||
|
"UNIVERSITY OF DUISBURG ESSEN",
|
||||||
|
"UNIVERSITAET DUISBURG ESSEN",
|
||||||
|
"UNIVERSITAT DUISBURG-ESSEN"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"aggs": {
|
"aggs": {
|
||||||
"specific_org_rcn_values": {
|
"organisation_ids": {
|
||||||
"terms": {
|
"terms": {
|
||||||
"field": "organisationID",
|
"field": "organisationID",
|
||||||
"size": 1000
|
"size": 10000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1052,6 +1195,46 @@ Content-Type: application/json
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
GET https://project.nes.uni-due.de/elastic/openalex-works/_search
|
||||||
|
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
GET https://project.nes.uni-due.de/elastic/openalex-works/_search
|
||||||
|
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"_source": ["title", "doi"],
|
||||||
|
"size": 100,
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{
|
||||||
|
"nested": {
|
||||||
|
"path": "authorships",
|
||||||
|
"query": {
|
||||||
|
"term": {
|
||||||
|
"authorships.author.id": "https://openalex.org/A5007170803"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"filter": [
|
||||||
|
{
|
||||||
|
"exists": {
|
||||||
|
"field": "doi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
GET https://project.nes.uni-due.de/elastic/openalex-authors/_search
|
GET https://project.nes.uni-due.de/elastic/openalex-authors/_search
|
||||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ api/iNSEAccountService.service.ts
|
|||||||
api/iNSEService.service.ts
|
api/iNSEService.service.ts
|
||||||
api/institutions.service.ts
|
api/institutions.service.ts
|
||||||
api/items.service.ts
|
api/items.service.ts
|
||||||
|
api/news.service.ts
|
||||||
|
api/patents.service.ts
|
||||||
api/personNetwork.service.ts
|
api/personNetwork.service.ts
|
||||||
api/persons.service.ts
|
api/persons.service.ts
|
||||||
api/projects.service.ts
|
api/projects.service.ts
|
||||||
@@ -59,6 +61,8 @@ model/dehydratedSource.ts
|
|||||||
model/dfgProjectDetails.ts
|
model/dfgProjectDetails.ts
|
||||||
model/dfgProjectPage.ts
|
model/dfgProjectPage.ts
|
||||||
model/dfgProjectSummary.ts
|
model/dfgProjectSummary.ts
|
||||||
|
model/euOrganizationProjectSummary.ts
|
||||||
|
model/euOrganizationProjectSummaryPage.ts
|
||||||
model/filterInformation.ts
|
model/filterInformation.ts
|
||||||
model/filterProperties.ts
|
model/filterProperties.ts
|
||||||
model/funderByAuthor.ts
|
model/funderByAuthor.ts
|
||||||
@@ -85,10 +89,16 @@ model/latitude.ts
|
|||||||
model/location.ts
|
model/location.ts
|
||||||
model/longitude.ts
|
model/longitude.ts
|
||||||
model/matchedOfficer.ts
|
model/matchedOfficer.ts
|
||||||
|
model/mentionedPerson.ts
|
||||||
model/meta.ts
|
model/meta.ts
|
||||||
model/model2YrMeanCitedness.ts
|
model/model2YrMeanCitedness.ts
|
||||||
model/models.ts
|
model/models.ts
|
||||||
|
model/newsArticle.ts
|
||||||
|
model/newsArticleDetail.ts
|
||||||
|
model/newsPage.ts
|
||||||
model/openAccess.ts
|
model/openAccess.ts
|
||||||
|
model/patentEntry.ts
|
||||||
|
model/patentsByAuthorResponse.ts
|
||||||
model/personBio.ts
|
model/personBio.ts
|
||||||
model/projectType.ts
|
model/projectType.ts
|
||||||
model/projectsFilteringProperties.ts
|
model/projectsFilteringProperties.ts
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ export * from './institutions.service';
|
|||||||
import { InstitutionsService } from './institutions.service';
|
import { InstitutionsService } from './institutions.service';
|
||||||
export * from './items.service';
|
export * from './items.service';
|
||||||
import { ItemsService } from './items.service';
|
import { ItemsService } from './items.service';
|
||||||
|
export * from './news.service';
|
||||||
|
import { NewsService } from './news.service';
|
||||||
|
export * from './patents.service';
|
||||||
|
import { PatentsService } from './patents.service';
|
||||||
export * from './personNetwork.service';
|
export * from './personNetwork.service';
|
||||||
import { PersonNetworkService } from './personNetwork.service';
|
import { PersonNetworkService } from './personNetwork.service';
|
||||||
export * from './persons.service';
|
export * from './persons.service';
|
||||||
@@ -20,4 +24,18 @@ export * from './topics.service';
|
|||||||
import { TopicsService } from './topics.service';
|
import { TopicsService } from './topics.service';
|
||||||
export * from './works.service';
|
export * from './works.service';
|
||||||
import { WorksService } from './works.service';
|
import { WorksService } from './works.service';
|
||||||
export const APIS = [CompanyConnectionsService, FundingService, INSEAccountServiceService, INSEServiceService, InstitutionsService, ItemsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService];
|
export const APIS = [
|
||||||
|
CompanyConnectionsService,
|
||||||
|
FundingService,
|
||||||
|
INSEAccountServiceService,
|
||||||
|
INSEServiceService,
|
||||||
|
InstitutionsService,
|
||||||
|
ItemsService,
|
||||||
|
NewsService,
|
||||||
|
PatentsService,
|
||||||
|
PersonNetworkService,
|
||||||
|
PersonsService,
|
||||||
|
ProjectsService,
|
||||||
|
TopicsService,
|
||||||
|
WorksService,
|
||||||
|
];
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,11 @@
|
|||||||
/**
|
/**
|
||||||
* Innovation Search Engine API
|
* 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 */
|
/* tslint:disable:no-unused-variable member-ordering */
|
||||||
|
|
||||||
@@ -16,39 +22,16 @@ import {
|
|||||||
import { CustomHttpParameterCodec } from '../encoder';
|
import { CustomHttpParameterCodec } from '../encoder';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
// @ts-ignore
|
||||||
|
import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
import { Configuration } from '../configuration';
|
import { Configuration } from '../configuration';
|
||||||
import { BaseService } from '../api.base.service';
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
export interface PatentEntry {
|
|
||||||
patent_id: string;
|
|
||||||
source: string;
|
|
||||||
title: string | null;
|
|
||||||
abstract: string | null;
|
|
||||||
publication_date: string | null;
|
|
||||||
publication_year: string | null;
|
|
||||||
inventors: string[];
|
|
||||||
assignees: string[];
|
|
||||||
ipc: string[];
|
|
||||||
country: string | null;
|
|
||||||
confidence_score: number;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PatentsByAuthorResponse {
|
|
||||||
author_id: string;
|
|
||||||
author_name: string | null;
|
|
||||||
patent_count: number;
|
|
||||||
patents: PatentEntry[];
|
|
||||||
}
|
|
||||||
|
|
||||||
type GetPatentsByAuthorOptions = {
|
|
||||||
httpHeaderAccept?: 'application/json';
|
|
||||||
context?: HttpContext;
|
|
||||||
transferCache?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
@@ -62,35 +45,51 @@ export class PatentsService extends BaseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get patents by author.
|
* Get patents matched to an author by name.
|
||||||
* @endpoint get /api/inse-service/authors/{author_id}/patents
|
* @endpoint get /api/inse-service/authors/{author_id}/patents
|
||||||
* @param authorId
|
* @param authorId
|
||||||
* @param observe
|
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||||
* @param reportProgress
|
* @param reportProgress flag to report request and response progress.
|
||||||
*/
|
*/
|
||||||
public getPatentsByAuthor(
|
public getPatentsByAuthor(
|
||||||
authorId: string,
|
authorId: string,
|
||||||
observe?: 'body',
|
observe?: 'body',
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
options?: GetPatentsByAuthorOptions,
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
): Observable<PatentsByAuthorResponse>;
|
): Observable<PatentsByAuthorResponse>;
|
||||||
public getPatentsByAuthor(
|
public getPatentsByAuthor(
|
||||||
authorId: string,
|
authorId: string,
|
||||||
observe?: 'response',
|
observe?: 'response',
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
options?: GetPatentsByAuthorOptions,
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
): Observable<HttpResponse<PatentsByAuthorResponse>>;
|
): Observable<HttpResponse<PatentsByAuthorResponse>>;
|
||||||
public getPatentsByAuthor(
|
public getPatentsByAuthor(
|
||||||
authorId: string,
|
authorId: string,
|
||||||
observe?: 'events',
|
observe?: 'events',
|
||||||
reportProgress?: boolean,
|
reportProgress?: boolean,
|
||||||
options?: GetPatentsByAuthorOptions,
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
): Observable<HttpEvent<PatentsByAuthorResponse>>;
|
): Observable<HttpEvent<PatentsByAuthorResponse>>;
|
||||||
public getPatentsByAuthor(
|
public getPatentsByAuthor(
|
||||||
authorId: string,
|
authorId: string,
|
||||||
observe: any = 'body',
|
observe: any = 'body',
|
||||||
reportProgress: boolean = false,
|
reportProgress: boolean = false,
|
||||||
options?: GetPatentsByAuthorOptions,
|
options?: {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
},
|
||||||
): Observable<any> {
|
): Observable<any> {
|
||||||
if (authorId === null || authorId === undefined) {
|
if (authorId === null || authorId === undefined) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -128,16 +127,7 @@ export class PatentsService extends BaseService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({
|
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`;
|
||||||
name: 'authorId',
|
|
||||||
value: authorId,
|
|
||||||
in: 'path',
|
|
||||||
style: 'simple',
|
|
||||||
explode: false,
|
|
||||||
dataType: 'string',
|
|
||||||
dataFormat: undefined,
|
|
||||||
})}/patents`;
|
|
||||||
|
|
||||||
const { basePath, withCredentials } = this.configuration;
|
const { basePath, withCredentials } = this.configuration;
|
||||||
return this.httpClient.request<PatentsByAuthorResponse>(
|
return this.httpClient.request<PatentsByAuthorResponse>(
|
||||||
'get',
|
'get',
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* 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 EuOrganizationProjectSummary {
|
||||||
|
/**
|
||||||
|
* The unique identifier of the organization.
|
||||||
|
*/
|
||||||
|
organization_id: string;
|
||||||
|
/**
|
||||||
|
* The unique identifier of the project.
|
||||||
|
*/
|
||||||
|
project_id: string;
|
||||||
|
title?: string | null;
|
||||||
|
start_date?: string | null;
|
||||||
|
end_date?: string | null;
|
||||||
|
acronym?: string | null;
|
||||||
|
ec_contribution?: number | 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 { EuOrganizationProjectSummary } from './euOrganizationProjectSummary';
|
||||||
|
|
||||||
|
export interface EuOrganizationProjectSummaryPage {
|
||||||
|
/**
|
||||||
|
* The current page number.
|
||||||
|
*/
|
||||||
|
page?: number;
|
||||||
|
/**
|
||||||
|
* The requested page size.
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
|
/**
|
||||||
|
* The total number of items.
|
||||||
|
*/
|
||||||
|
total?: number;
|
||||||
|
/**
|
||||||
|
* The organization project summaries on this page.
|
||||||
|
*/
|
||||||
|
elements?: Array<EuOrganizationProjectSummary>;
|
||||||
|
}
|
||||||
@@ -9,22 +9,19 @@
|
|||||||
*/
|
*/
|
||||||
import { ProjectType } from './projectType';
|
import { ProjectType } from './projectType';
|
||||||
|
|
||||||
|
|
||||||
export interface FundingProject {
|
export interface FundingProject {
|
||||||
/**
|
/**
|
||||||
* The type of the project.
|
* The type of the project.
|
||||||
*/
|
*/
|
||||||
type: ProjectType;
|
type: ProjectType;
|
||||||
/**
|
/**
|
||||||
* The unique identifier of the project.
|
* The unique identifier of the project.
|
||||||
*/
|
*/
|
||||||
id: string;
|
id: string;
|
||||||
title?: string | null;
|
title?: string | null;
|
||||||
start_date?: string | null;
|
acronym?: string | null;
|
||||||
end_date?: string | null;
|
start_date?: string | null;
|
||||||
funding_amount?: number | null;
|
end_date?: string | null;
|
||||||
|
funding_amount?: number | null;
|
||||||
}
|
}
|
||||||
export namespace FundingProject {
|
export namespace FundingProject {}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* 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 MentionedPerson {
|
||||||
|
name: string;
|
||||||
|
is_ude?: boolean;
|
||||||
|
person_id?: string | null;
|
||||||
|
}
|
||||||
@@ -38,6 +38,8 @@ export * from './dehydratedSource';
|
|||||||
export * from './dfgProjectDetails';
|
export * from './dfgProjectDetails';
|
||||||
export * from './dfgProjectPage';
|
export * from './dfgProjectPage';
|
||||||
export * from './dfgProjectSummary';
|
export * from './dfgProjectSummary';
|
||||||
|
export * from './euOrganizationProjectSummary';
|
||||||
|
export * from './euOrganizationProjectSummaryPage';
|
||||||
export * from './filterInformation';
|
export * from './filterInformation';
|
||||||
export * from './filterProperties';
|
export * from './filterProperties';
|
||||||
export * from './funderByAuthor';
|
export * from './funderByAuthor';
|
||||||
@@ -64,9 +66,15 @@ export * from './latitude';
|
|||||||
export * from './location';
|
export * from './location';
|
||||||
export * from './longitude';
|
export * from './longitude';
|
||||||
export * from './matchedOfficer';
|
export * from './matchedOfficer';
|
||||||
|
export * from './mentionedPerson';
|
||||||
export * from './meta';
|
export * from './meta';
|
||||||
export * from './model2YrMeanCitedness';
|
export * from './model2YrMeanCitedness';
|
||||||
|
export * from './newsArticle';
|
||||||
|
export * from './newsArticleDetail';
|
||||||
|
export * from './newsPage';
|
||||||
export * from './openAccess';
|
export * from './openAccess';
|
||||||
|
export * from './patentEntry';
|
||||||
|
export * from './patentsByAuthorResponse';
|
||||||
export * from './personBio';
|
export * from './personBio';
|
||||||
export * from './projectType';
|
export * from './projectType';
|
||||||
export * from './projectsFilteringProperties';
|
export * from './projectsFilteringProperties';
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* 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 NewsArticle {
|
||||||
|
id: string;
|
||||||
|
date?: string | null;
|
||||||
|
maintitle?: string | null;
|
||||||
|
author?: string | null;
|
||||||
|
url?: string | null;
|
||||||
|
relevant?: boolean | null;
|
||||||
|
snippet?: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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 { MentionedPerson } from './mentionedPerson';
|
||||||
|
|
||||||
|
export interface NewsArticleDetail {
|
||||||
|
id: string;
|
||||||
|
date?: string | null;
|
||||||
|
maintitle?: string | null;
|
||||||
|
author?: string | null;
|
||||||
|
url?: string | null;
|
||||||
|
relevant?: boolean | null;
|
||||||
|
snippet?: string | null;
|
||||||
|
full_content?: string | null;
|
||||||
|
authors?: Array<MentionedPerson>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { NewsArticle } from './newsArticle';
|
||||||
|
|
||||||
|
export interface NewsPage {
|
||||||
|
total: number;
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
results: Array<NewsArticle>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/**
|
||||||
|
* 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 PatentEntry {
|
||||||
|
patent_id: string;
|
||||||
|
source: string;
|
||||||
|
title?: string | null;
|
||||||
|
abstract?: string | null;
|
||||||
|
publication_date?: string | null;
|
||||||
|
publication_year?: string | null;
|
||||||
|
inventors?: Array<string>;
|
||||||
|
assignees?: Array<string>;
|
||||||
|
ipc?: Array<string>;
|
||||||
|
country?: string | null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { PatentEntry } from './patentEntry';
|
||||||
|
|
||||||
|
export interface PatentsByAuthorResponse {
|
||||||
|
author_id: string;
|
||||||
|
author_name?: string | null;
|
||||||
|
patent_count: number;
|
||||||
|
patents: Array<PatentEntry>;
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import { personResolver } from './resolvers/person.resolver';
|
|||||||
import { institutionResolver } from './resolvers/institution.resolver';
|
import { institutionResolver } from './resolvers/institution.resolver';
|
||||||
import { bundProjectPageResolver } from './resolvers/bund-project-page.resolver';
|
import { bundProjectPageResolver } from './resolvers/bund-project-page.resolver';
|
||||||
import { dfgProjectsResolver } from './resolvers/dfg-projects.resolver';
|
import { dfgProjectsResolver } from './resolvers/dfg-projects.resolver';
|
||||||
|
import { personNewsResolver } from './resolvers/person-news.resolver';
|
||||||
import { institutionsResolver } from './resolvers/institutions.resolver';
|
import { institutionsResolver } from './resolvers/institutions.resolver';
|
||||||
import { bundProjectsFundingResolver } from './resolvers/bund-projects-funding.resolver';
|
import { bundProjectsFundingResolver } from './resolvers/bund-projects-funding.resolver';
|
||||||
import { dfgSingleProjectResolver } from './resolvers/dfg-single-project-resolver';
|
import { dfgSingleProjectResolver } from './resolvers/dfg-single-project-resolver';
|
||||||
@@ -14,6 +15,7 @@ import { bundSingleProjectResolver } from './resolvers/bund-single-project-resol
|
|||||||
import { cordisEuProjectPageResolver } from './resolvers/cordis-eu-project-page.resolver';
|
import { cordisEuProjectPageResolver } from './resolvers/cordis-eu-project-page.resolver';
|
||||||
import { cordisEuProjectsFundingResolver } from './resolvers/cordis-eu-projects-funding.resolver';
|
import { cordisEuProjectsFundingResolver } from './resolvers/cordis-eu-projects-funding.resolver';
|
||||||
import { fundingProjectPageResolver } from './resolvers/funding-project-page.resolver';
|
import { fundingProjectPageResolver } from './resolvers/funding-project-page.resolver';
|
||||||
|
import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-project-page.resolver';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -82,6 +84,20 @@ export const routes: Routes = [
|
|||||||
return scalarChanged || topicsChanged;
|
return scalarChanged || topicsChanged;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'news',
|
||||||
|
canActivate: [userGuard],
|
||||||
|
loadComponent: () =>
|
||||||
|
import('./modules/news/news.component').then((mod) => mod.NewsComponent),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'news/:id',
|
||||||
|
canActivate: [userGuard],
|
||||||
|
loadComponent: () =>
|
||||||
|
import('./modules/news-detail/news-detail.component').then(
|
||||||
|
(mod) => mod.NewsDetailComponent,
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'publication/:publicationId',
|
path: 'publication/:publicationId',
|
||||||
canActivate: [userGuard],
|
canActivate: [userGuard],
|
||||||
@@ -147,6 +163,7 @@ export const routes: Routes = [
|
|||||||
),
|
),
|
||||||
resolve: {
|
resolve: {
|
||||||
dfgProjectPage: dfgProjectsResolver,
|
dfgProjectPage: dfgProjectsResolver,
|
||||||
|
personCordisEuProjectPage: personCordisEuProjectPageResolver,
|
||||||
},
|
},
|
||||||
runGuardsAndResolvers: (from, to) => {
|
runGuardsAndResolvers: (from, to) => {
|
||||||
const keys = ['page', 'size', 'sort_by', 'sort_direction', 'search'];
|
const keys = ['page', 'size', 'sort_by', 'sort_direction', 'search'];
|
||||||
@@ -199,6 +216,23 @@ export const routes: Routes = [
|
|||||||
(mod) => mod.PersonFundingComponent,
|
(mod) => mod.PersonFundingComponent,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'news',
|
||||||
|
loadComponent: () =>
|
||||||
|
import('./modules/person-news/person-news.component').then(
|
||||||
|
(mod) => mod.PersonNewsComponent,
|
||||||
|
),
|
||||||
|
resolve: {
|
||||||
|
newsPage: personNewsResolver,
|
||||||
|
},
|
||||||
|
runGuardsAndResolvers: (from, to) => {
|
||||||
|
const keys = ['page', 'pageSize', 'sortOrder', 'query'];
|
||||||
|
|
||||||
|
return keys.some(
|
||||||
|
(key) => from.queryParamMap.get(key) !== to.queryParamMap.get(key),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'patents',
|
path: 'patents',
|
||||||
loadComponent: () =>
|
loadComponent: () =>
|
||||||
|
|||||||
@@ -1,28 +1,39 @@
|
|||||||
<div class="dashboard-wrapper">
|
<div class="dashboard-wrapper">
|
||||||
<header class="dashboard-header">
|
<header class="dashboard-header">
|
||||||
<h2>University Performance Dashboard</h2>
|
<h2>University Performance Dashboard</h2>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<select (change)="onTopicChange($any($event.target).value)">
|
<select (change)="onTopicChange($any($event.target).value)">
|
||||||
@for (t of topics; track t){
|
@for (t of topics; track t) {
|
||||||
<option [value]="t">{{t}}</option>
|
<option [value]="t">{{ t }}</option>
|
||||||
}
|
}
|
||||||
|
</select>
|
||||||
|
|
||||||
</select>
|
<div class="toggle-group">
|
||||||
|
<button
|
||||||
<div class="toggle-group">
|
[class.active]="metric === 'publications'"
|
||||||
<button [class.active]="metric === 'publications'" (click)="setMetric('publications')">Publications</button>
|
(click)="setMetric('publications')">
|
||||||
<button [class.active]="metric === 'citations'" (click)="setMetric('citations')">Citations</button>
|
Publications
|
||||||
</div>
|
</button>
|
||||||
</div>
|
<button
|
||||||
</header>
|
[class.active]="metric === 'citations'"
|
||||||
|
(click)="setMetric('citations')">
|
||||||
<div class="content-grid">
|
Citations
|
||||||
<section class="chart-section">
|
</button>
|
||||||
<app-university-line-chart [data]="rawDataSource" [metric]="metric"></app-university-line-chart>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<aside class="table-section">
|
|
||||||
<app-university-ranking-table [rankings]="computedRankings" [loading]="isLoading"></app-university-ranking-table>
|
|
||||||
</aside>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="content-grid">
|
||||||
|
<section class="chart-section">
|
||||||
|
<app-university-line-chart
|
||||||
|
[data]="rawDataSource"
|
||||||
|
[metric]="metric"></app-university-line-chart>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<aside class="table-section">
|
||||||
|
<app-university-ranking-table
|
||||||
|
[rankings]="computedRankings"
|
||||||
|
[loading]="isLoading"></app-university-ranking-table>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -40,9 +40,16 @@
|
|||||||
background: white;
|
background: white;
|
||||||
color: #0056b3;
|
color: #0056b3;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:first-child { border-radius: 4px 0 0 4px; }
|
&:first-child {
|
||||||
&:last-child { border-radius: 0 4px 4px 0; }
|
border-radius: 4px 0 0 4px;
|
||||||
&.active { background: #0056b3; color: white; }
|
}
|
||||||
|
&:last-child {
|
||||||
|
border-radius: 0 4px 4px 0;
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
background: #0056b3;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,20 +61,35 @@
|
|||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
|
|
||||||
th, td {
|
th,
|
||||||
|
td {
|
||||||
padding: 0.75rem;
|
padding: 0.75rem;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
border-bottom: 1px solid #f0f0f0;
|
border-bottom: 1px solid #f0f0f0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-tier { background-color: #f8fbff; font-weight: 600; }
|
.top-tier {
|
||||||
.positive { color: #28a745; }
|
background-color: #f8fbff;
|
||||||
.negative { color: #dc3545; }
|
font-weight: 600;
|
||||||
.mover-badge { margin-left: 4px; font-size: 0.8rem; }
|
}
|
||||||
|
.positive {
|
||||||
|
color: #28a745;
|
||||||
|
}
|
||||||
|
.negative {
|
||||||
|
color: #dc3545;
|
||||||
|
}
|
||||||
|
.mover-badge {
|
||||||
|
margin-left: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
.trend-col {
|
.trend-col {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
&[data-trend="up"] { color: #28a745; }
|
&[data-trend='up'] {
|
||||||
&[data-trend="down"] { color: #dc3545; }
|
color: #28a745;
|
||||||
|
}
|
||||||
|
&[data-trend='down'] {
|
||||||
|
color: #dc3545;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,28 @@
|
|||||||
|
|
||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UniversityRankingService } from '../university-ranking/services/uni-ranking-service';
|
import { UniversityRankingService } from '../university-ranking/services/uni-ranking-service';
|
||||||
import {UniversityLineChartComponent} from '../university-ranking/uni-line-chart/uni-line-chart.component';
|
import { UniversityLineChartComponent } from '../university-ranking/uni-line-chart/uni-line-chart.component';
|
||||||
import { UniversityRankingTableComponent } from '../university-ranking/uni-ranking-table/uni-ranking-table.component';
|
import { UniversityRankingTableComponent } from '../university-ranking/uni-ranking-table/uni-ranking-table.component';
|
||||||
import { UniversityTopicData, UniversityRanking } from '../../api';
|
import { UniversityTopicData, UniversityRanking } from '../../api';
|
||||||
export type ResearchTopic = 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology';
|
export type ResearchTopic =
|
||||||
|
| 'Artificial Intelligence'
|
||||||
|
| 'Quantum Computing'
|
||||||
|
| 'Renewable Energy'
|
||||||
|
| 'Biotechnology';
|
||||||
export type DashboardMetric = 'publications' | 'citations';
|
export type DashboardMetric = 'publications' | 'citations';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'dashboard',
|
selector: 'dashboard',
|
||||||
imports: [UniversityLineChartComponent,UniversityRankingTableComponent],
|
imports: [UniversityLineChartComponent, UniversityRankingTableComponent],
|
||||||
templateUrl: './dashboard.component.html',
|
templateUrl: './dashboard.component.html',
|
||||||
styleUrl: './dashboard.component.scss',
|
styleUrl: './dashboard.component.scss',
|
||||||
})
|
})
|
||||||
export class DashboardComponent implements OnInit {
|
export class DashboardComponent implements OnInit {
|
||||||
topics: ResearchTopic[] = ['Artificial Intelligence', 'Quantum Computing', 'Renewable Energy', 'Biotechnology'];
|
topics: ResearchTopic[] = [
|
||||||
|
'Artificial Intelligence',
|
||||||
|
'Quantum Computing',
|
||||||
|
'Renewable Energy',
|
||||||
|
'Biotechnology',
|
||||||
|
];
|
||||||
selectedTopic: ResearchTopic = 'Artificial Intelligence';
|
selectedTopic: ResearchTopic = 'Artificial Intelligence';
|
||||||
metric: DashboardMetric = 'publications';
|
metric: DashboardMetric = 'publications';
|
||||||
|
|
||||||
@@ -41,13 +48,15 @@ export class DashboardComponent implements OnInit {
|
|||||||
|
|
||||||
private loadData() {
|
private loadData() {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.dataService.getRankingData(this.selectedTopic, this.metric).subscribe(response => {
|
this.dataService
|
||||||
// Map backend snake_case properties to frontend camelCase if necessary,
|
.getRankingData(this.selectedTopic, this.metric)
|
||||||
// though OpenAPI Generator usually handles this.
|
.subscribe((response) => {
|
||||||
console.log(response);
|
// Map backend snake_case properties to frontend camelCase if necessary,
|
||||||
this.rawDataSource = (response.timeseries as any) || [];
|
// though OpenAPI Generator usually handles this.
|
||||||
this.computedRankings = (response.rankings as any) || [];
|
console.log(response);
|
||||||
this.isLoading = false;
|
this.rawDataSource = (response.timeseries as any) || [];
|
||||||
});
|
this.computedRankings = (response.rankings as any) || [];
|
||||||
|
this.isLoading = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,10 @@
|
|||||||
<div class="funding-area">
|
<div class="funding-area">
|
||||||
<mat-card appearance="outlined">
|
<mat-card appearance="outlined">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-form-field style="width: 100%">
|
<app-query-param-input
|
||||||
<mat-label>Suche nach Themen</mat-label>
|
label="Suche nach Themen"
|
||||||
<input
|
queryParamKey="search" />
|
||||||
matInput
|
|
||||||
type="search"
|
|
||||||
[debounceTime]="300"
|
|
||||||
[(debouncedValue)]="urlSearchTerm"
|
|
||||||
(debouncedValueChange)="handleSearchTermChange($event)" />
|
|
||||||
<mat-icon matPrefix>search</mat-icon>
|
|
||||||
<button matIconButton matSuffix (click)="clearSearchTerm()">
|
|
||||||
<mat-icon>clear</mat-icon>
|
|
||||||
</button>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-tab-group
|
<mat-tab-group
|
||||||
[selectedIndex]="tabIndex()"
|
[selectedIndex]="tabIndex()"
|
||||||
(selectedTabChange)="selectedTabChange($event)">
|
(selectedTabChange)="selectedTabChange($event)">
|
||||||
@@ -24,24 +15,20 @@
|
|||||||
<app-data-table
|
<app-data-table
|
||||||
[data]="euProjectData"
|
[data]="euProjectData"
|
||||||
[columns]="euProjectColumns"
|
[columns]="euProjectColumns"
|
||||||
[activeSortKey]="urlSortKey()"
|
queryParamSortKey="sort_by"
|
||||||
[sortDirection]="urlSortDirection()"
|
queryParamSortDirectionKey="sort_direction" />
|
||||||
(sortChange)="handleSortChange($event)" />
|
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
<mat-tab label="Bund">
|
<mat-tab label="Bund">
|
||||||
<app-data-table
|
<app-data-table
|
||||||
[data]="bundProjectData"
|
[data]="bundProjectData"
|
||||||
[columns]="bundProjectColumns"
|
[columns]="bundProjectColumns"
|
||||||
[activeSortKey]="urlSortKey()"
|
queryParamSortKey="sort_by"
|
||||||
[sortDirection]="urlSortDirection()"
|
queryParamSortDirectionKey="sort_direction" />
|
||||||
(sortChange)="handleSortChange($event)" />
|
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
<mat-paginator
|
<app-query-param-paginator
|
||||||
[length]="this.pageTotal()"
|
[total]="pageTotal()"
|
||||||
[pageSize]="this.pageSize()"
|
[pageSizeOptions]="[10, 20, 50]" />
|
||||||
[pageIndex]="this.pageIndex()"
|
|
||||||
(page)="handlePageChange($event)" />
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
<div class="funding-info-section">
|
<div class="funding-info-section">
|
||||||
@@ -94,3 +81,15 @@
|
|||||||
<ng-template #fundingAmountTmp let-row>
|
<ng-template #fundingAmountTmp let-row>
|
||||||
{{ row.funding_amount | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
|
{{ row.funding_amount | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #euProjectActionsTmp let-row>
|
||||||
|
<a mat-icon-button color="primary" [routerLink]="['/projects/eu', row.id]">
|
||||||
|
<mat-icon>open_in_new</mat-icon>
|
||||||
|
</a></ng-template
|
||||||
|
>
|
||||||
|
|
||||||
|
<ng-template #bundProjectActionsTmp let-row>
|
||||||
|
<a mat-icon-button color="primary" [routerLink]="['/projects/bund', row.id]">
|
||||||
|
<mat-icon>open_in_new</mat-icon>
|
||||||
|
</a>
|
||||||
|
</ng-template>
|
||||||
|
|||||||
@@ -4,22 +4,20 @@ import {
|
|||||||
effect,
|
effect,
|
||||||
input,
|
input,
|
||||||
OnInit,
|
OnInit,
|
||||||
signal,
|
|
||||||
TemplateRef,
|
TemplateRef,
|
||||||
viewChild,
|
viewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
import {
|
import {
|
||||||
BundProject,
|
BundProject,
|
||||||
BundProjectPage,
|
BundProjectPage,
|
||||||
CordisEuProject,
|
EuOrganizationProjectSummary,
|
||||||
CordisEuProjectPage,
|
EuOrganizationProjectSummaryPage,
|
||||||
InstitutionFunderSummary,
|
InstitutionFunderSummary,
|
||||||
} from '../../api';
|
} from '../../api';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatTabChangeEvent, MatTabsModule } from '@angular/material/tabs';
|
import { MatTabChangeEvent, MatTabsModule } from '@angular/material/tabs';
|
||||||
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import {
|
import {
|
||||||
@@ -27,15 +25,16 @@ import {
|
|||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
} from '../../shared/ui/data-table/data-table.component';
|
} from '../../shared/ui/data-table/data-table.component';
|
||||||
import { CurrencyPipe, DatePipe } from '@angular/common';
|
import { CurrencyPipe, DatePipe } from '@angular/common';
|
||||||
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
import { toSignal } from '@angular/core/rxjs-interop';
|
||||||
import { Sort, SortDirection } from '@angular/material/sort';
|
|
||||||
import { DebounceDirective } from '../../directives/debounce.directive';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
|
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
|
||||||
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
|
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
|
||||||
|
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||||
|
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||||
|
|
||||||
type BundProjectRow = {
|
type BundProjectRow = {
|
||||||
|
id: string;
|
||||||
topic: string;
|
topic: string;
|
||||||
funding_start: Date;
|
funding_start: Date;
|
||||||
funding_end: Date;
|
funding_end: Date;
|
||||||
@@ -44,6 +43,7 @@ type BundProjectRow = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type EuProjectRow = {
|
type EuProjectRow = {
|
||||||
|
id: string;
|
||||||
topic: string;
|
topic: string;
|
||||||
funding_start: Date;
|
funding_start: Date;
|
||||||
funding_end: Date;
|
funding_end: Date;
|
||||||
@@ -56,17 +56,18 @@ type EuProjectRow = {
|
|||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
MatPaginatorModule,
|
|
||||||
FormsModule,
|
FormsModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
DatePipe,
|
DatePipe,
|
||||||
CurrencyPipe,
|
CurrencyPipe,
|
||||||
DebounceDirective,
|
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
InstitutionProjectsFundingGraphComponent,
|
InstitutionProjectsFundingGraphComponent,
|
||||||
PersonNetworkInfoCardComponent,
|
PersonNetworkInfoCardComponent,
|
||||||
|
RouterModule,
|
||||||
|
QueryParamPaginatorComponent,
|
||||||
|
QueryParamInputComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './institution-projects.component.html',
|
templateUrl: './institution-projects.component.html',
|
||||||
styleUrl: './institution-projects.component.scss',
|
styleUrl: './institution-projects.component.scss',
|
||||||
@@ -76,13 +77,19 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
|
fundingEndTmp = viewChild.required<TemplateRef<any>>('fundingEndTmp');
|
||||||
fundingAmountTmp = viewChild.required<TemplateRef<any>>('fundingAmountTmp');
|
fundingAmountTmp = viewChild.required<TemplateRef<any>>('fundingAmountTmp');
|
||||||
|
|
||||||
cordisEuProjectPage = input.required<CordisEuProjectPage>();
|
cordisEuProjectPage = input.required<EuOrganizationProjectSummaryPage>();
|
||||||
euProjectColumns: GenericColumn<EuProjectRow>[] = [];
|
euProjectColumns: GenericColumn<EuProjectRow>[] = [];
|
||||||
euProjectData: EuProjectRow[] = [];
|
euProjectData: EuProjectRow[] = [];
|
||||||
|
euProjectActionsTmp = viewChild.required<TemplateRef<any>>(
|
||||||
|
'euProjectActionsTmp',
|
||||||
|
);
|
||||||
|
|
||||||
bundProjectPage = input.required<BundProjectPage>();
|
bundProjectPage = input.required<BundProjectPage>();
|
||||||
bundProjectColumns: GenericColumn<BundProjectRow>[] = [];
|
bundProjectColumns: GenericColumn<BundProjectRow>[] = [];
|
||||||
bundProjectData: BundProjectRow[] = [];
|
bundProjectData: BundProjectRow[] = [];
|
||||||
|
bundProjectActionsTmp = viewChild.required<TemplateRef<any>>(
|
||||||
|
'bundProjectActionsTmp',
|
||||||
|
);
|
||||||
|
|
||||||
bundProjectsFunding = input.required<InstitutionFunderSummary>();
|
bundProjectsFunding = input.required<InstitutionFunderSummary>();
|
||||||
bundTotalFunding = computed(() => {
|
bundTotalFunding = computed(() => {
|
||||||
@@ -108,24 +115,10 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
return funding.annual_average_over_period ?? 0;
|
return funding.annual_average_over_period ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
urlSortKey = signal<string>('');
|
|
||||||
urlSortDirection = signal<SortDirection>('');
|
|
||||||
urlSearchTerm = signal<string>('');
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly activatedRoute: ActivatedRoute,
|
private readonly activatedRoute: ActivatedRoute,
|
||||||
private readonly router: Router,
|
private readonly router: Router,
|
||||||
) {
|
) {
|
||||||
this.activatedRoute.queryParams
|
|
||||||
.pipe(takeUntilDestroyed())
|
|
||||||
.subscribe((params) => {
|
|
||||||
this.urlSortKey.set(params['sort_by'] ?? '');
|
|
||||||
this.urlSortDirection.set(
|
|
||||||
(params['sort_direction'] as SortDirection) ?? '',
|
|
||||||
);
|
|
||||||
this.urlSearchTerm.set(params['search'] ?? '');
|
|
||||||
});
|
|
||||||
|
|
||||||
effect(() => {
|
effect(() => {
|
||||||
const euPage = this.cordisEuProjectPage();
|
const euPage = this.cordisEuProjectPage();
|
||||||
if (euPage) {
|
if (euPage) {
|
||||||
@@ -142,20 +135,6 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
: [];
|
: [];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
effect(() => {
|
|
||||||
const searchTerm = this.urlSearchTerm();
|
|
||||||
if (searchTerm) {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: searchTerm, page: 0, size: 10 },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
effect(() => {
|
|
||||||
console.log('Funding over time data:', this.bundProjectsFunding());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly queryParams = toSignal(this.activatedRoute.queryParamMap, {
|
readonly queryParams = toSignal(this.activatedRoute.queryParamMap, {
|
||||||
@@ -166,12 +145,6 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
return this.queryParams()?.get('project_tab') ?? 'eu';
|
return this.queryParams()?.get('project_tab') ?? 'eu';
|
||||||
});
|
});
|
||||||
|
|
||||||
readonly page = computed(() => {
|
|
||||||
const pageParam = this.queryParams()?.get('page');
|
|
||||||
const page = pageParam ? Number.parseInt(pageParam, 10) : 0;
|
|
||||||
return Number.isNaN(page) ? 0 : page;
|
|
||||||
});
|
|
||||||
|
|
||||||
readonly selectedPage = computed(() => {
|
readonly selectedPage = computed(() => {
|
||||||
if (this.displayedProjects() === 'eu') {
|
if (this.displayedProjects() === 'eu') {
|
||||||
return this.cordisEuProjectPage();
|
return this.cordisEuProjectPage();
|
||||||
@@ -184,14 +157,6 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
return this.selectedPage()?.total ?? 0;
|
return this.selectedPage()?.total ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
readonly pageSize = computed(() => {
|
|
||||||
return this.selectedPage()?.size ?? 10;
|
|
||||||
});
|
|
||||||
|
|
||||||
readonly pageIndex = computed(() => {
|
|
||||||
return this.selectedPage()?.page ?? 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.euProjectColumns = [
|
this.euProjectColumns = [
|
||||||
{
|
{
|
||||||
@@ -221,10 +186,16 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
accessorKey: 'funding_amount',
|
accessorKey: 'funding_amount',
|
||||||
cellTemplate: this.fundingAmountTmp(),
|
cellTemplate: this.fundingAmountTmp(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'actions',
|
||||||
|
header: '',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.euProjectActionsTmp(),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
this.bundProjectColumns = [
|
this.bundProjectColumns = [
|
||||||
{
|
{
|
||||||
id: 'topic',
|
id: 'title',
|
||||||
header: 'Titel',
|
header: 'Titel',
|
||||||
type: 'accessor',
|
type: 'accessor',
|
||||||
accessorKey: 'topic',
|
accessorKey: 'topic',
|
||||||
@@ -250,22 +221,30 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
accessorKey: 'funding_amount',
|
accessorKey: 'funding_amount',
|
||||||
cellTemplate: this.fundingAmountTmp(),
|
cellTemplate: this.fundingAmountTmp(),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'actions',
|
||||||
|
header: '',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.bundProjectActionsTmp(),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
transformEuRow(project: CordisEuProject): EuProjectRow {
|
transformEuRow(project: EuOrganizationProjectSummary): EuProjectRow {
|
||||||
return {
|
return {
|
||||||
|
id: project.project_id,
|
||||||
topic: project.title || '',
|
topic: project.title || '',
|
||||||
funding_start: project.startDate
|
funding_start: project.start_date
|
||||||
? new Date(project.startDate)
|
? new Date(project.start_date)
|
||||||
: new Date(0),
|
: new Date(0),
|
||||||
funding_end: project.endDate ? new Date(project.endDate) : new Date(0),
|
funding_end: project.end_date ? new Date(project.end_date) : new Date(0),
|
||||||
funding_amount: Number(project.totalCost) || 0,
|
funding_amount: Number(project.ec_contribution) || 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
transformBundRow(project: BundProject): BundProjectRow {
|
transformBundRow(project: BundProject): BundProjectRow {
|
||||||
return {
|
return {
|
||||||
|
id: project.funding_code || '',
|
||||||
topic: project.topic || '',
|
topic: project.topic || '',
|
||||||
funding_start: project.funding_start
|
funding_start: project.funding_start
|
||||||
? new Date(project.funding_start)
|
? new Date(project.funding_start)
|
||||||
@@ -296,32 +275,4 @@ export class InstitutionProjectsComponent implements OnInit {
|
|||||||
queryParamsHandling: 'merge',
|
queryParamsHandling: 'merge',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePageChange(event: PageEvent): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { page: event.pageIndex, size: event.pageSize },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSortChange(event: Sort): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { sort_by: event.active, sort_direction: event.direction },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSearchTermChange(newTerm: string): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: newTerm, page: 0, size: 10 },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
clearSearchTerm(): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: null, page: 0, size: 10 },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,34 +4,19 @@
|
|||||||
<mat-divider />
|
<mat-divider />
|
||||||
|
|
||||||
<div class="search-and-sorting">
|
<div class="search-and-sorting">
|
||||||
<mat-form-field style="width: 100%">
|
<app-query-param-input
|
||||||
<mat-label>Suche nach Namen</mat-label>
|
[label]="'Suche nach Namen'"
|
||||||
<input
|
[debounceTime]="400"
|
||||||
matInput
|
[queryParamKey]="'search'" />
|
||||||
type="search"
|
|
||||||
[debounceTime]="300"
|
|
||||||
[(debouncedValue)]="urlSearchTerm"
|
|
||||||
(debouncedValueChange)="handleSearchTermChange($event)" />
|
|
||||||
<mat-icon matPrefix>search</mat-icon>
|
|
||||||
<button matIconButton matSuffix (click)="clearSearchTerm()">
|
|
||||||
<mat-icon>clear</mat-icon>
|
|
||||||
</button>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<div class="sorting">
|
<div class="sorting">
|
||||||
<select (change)="handleSortFieldChange($event)" [value]="urlSortBy()">
|
<app-query-param-selector
|
||||||
<option value="relevance">Relevanz</option>
|
[options]="sortingOptions"
|
||||||
<option value="name">Name</option>
|
[queryParamKey]="'sort_by'" />
|
||||||
<option value="works_count">Anzahl Publikationen</option>
|
|
||||||
<option value="citations_count">Anzahl Zitationen</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select
|
<app-query-param-selector
|
||||||
(change)="handleSortOrderChange($event)"
|
[options]="sortingDirectionOptions"
|
||||||
[value]="urlSortingOrder()">
|
[queryParamKey]="'sorting_order'" />
|
||||||
<option value="desc">Absteigend</option>
|
|
||||||
<option value="asc">Aufsteigend</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -106,11 +91,7 @@
|
|||||||
|
|
||||||
<mat-divider />
|
<mat-divider />
|
||||||
|
|
||||||
<mat-paginator
|
<app-query-param-paginator
|
||||||
[length]="institutionPageValue.total"
|
[total]="institutionPageValue.total ?? 0"
|
||||||
[pageSize]="institutionPageValue.size"
|
[pageSizeOptions]="[10, 20, 50]" />
|
||||||
[pageSizeOptions]="[10, 20, 50]"
|
|
||||||
[pageIndex]="institutionPageValue.page"
|
|
||||||
(page)="handlePageChange($event)">
|
|
||||||
</mat-paginator>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,26 +25,10 @@
|
|||||||
.cards {
|
.cards {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.cards {
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.cards {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-paginator {
|
|
||||||
background-color: var(--sg-background);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
background-color: var(--sg-background);
|
background-color: var(--sg-background);
|
||||||
|
|||||||
@@ -1,26 +1,28 @@
|
|||||||
import { Component, effect, input, signal } from '@angular/core';
|
import { Component, input } from '@angular/core';
|
||||||
import { Institution, InstitutionPage } from '../../api';
|
import { Institution, InstitutionPage } from '../../api';
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { RouterModule } from '@angular/router';
|
||||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { DebounceDirective } from '../../directives/debounce.directive';
|
|
||||||
import { MatPaginator, PageEvent } from '@angular/material/paginator';
|
|
||||||
import { MatDividerModule } from '@angular/material/divider';
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
|
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||||
|
import {
|
||||||
|
QueryParamSelectorComponent,
|
||||||
|
SelectorOption,
|
||||||
|
} from '../../shared/ui/query-param-selector/query-param-selector.component';
|
||||||
|
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-institutions',
|
selector: 'app-institutions',
|
||||||
imports: [
|
imports: [
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatInputModule,
|
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
DebounceDirective,
|
|
||||||
MatPaginator,
|
|
||||||
MatDividerModule,
|
MatDividerModule,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
QueryParamPaginatorComponent,
|
||||||
|
QueryParamSelectorComponent,
|
||||||
|
QueryParamInputComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './institutions.component.html',
|
templateUrl: './institutions.component.html',
|
||||||
styleUrl: './institutions.component.scss',
|
styleUrl: './institutions.component.scss',
|
||||||
@@ -28,74 +30,21 @@ import { MatDividerModule } from '@angular/material/divider';
|
|||||||
export class InstitutionsComponent {
|
export class InstitutionsComponent {
|
||||||
institutionPage = input.required<InstitutionPage>();
|
institutionPage = input.required<InstitutionPage>();
|
||||||
|
|
||||||
urlSearchTerm = signal<string>('');
|
sortingOptions: SelectorOption[] = [
|
||||||
urlSortBy = signal<string>('relevance');
|
{ value: 'relevance', display_name: 'Relevanz' },
|
||||||
urlSortingOrder = signal<string>('desc');
|
{ value: 'name', display_name: 'Name' },
|
||||||
|
{ value: 'works_count', display_name: 'Anzahl Publikationen' },
|
||||||
constructor(
|
{ value: 'citations_count', display_name: 'Anzahl Zitationen' },
|
||||||
private readonly activatedRoute: ActivatedRoute,
|
];
|
||||||
private readonly router: Router,
|
sortingDirectionOptions: SelectorOption[] = [
|
||||||
) {
|
{ value: 'asc', display_name: 'Aufsteigend' },
|
||||||
this.activatedRoute.queryParams
|
{ value: 'desc', display_name: 'Absteigend' },
|
||||||
.pipe(takeUntilDestroyed())
|
];
|
||||||
.subscribe((params) => {
|
|
||||||
this.urlSearchTerm.set(params['search'] || '');
|
|
||||||
this.urlSortBy.set(params['sort_by'] || 'relevance');
|
|
||||||
this.urlSortingOrder.set(params['sorting_order'] || 'desc');
|
|
||||||
});
|
|
||||||
|
|
||||||
effect(() => {
|
|
||||||
const searchTerm = this.urlSearchTerm();
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: searchTerm },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSearchTermChange(newTerm: string): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: newTerm },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
clearSearchTerm(): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: null },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePageChange(event: PageEvent): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { page: event.pageIndex, size: event.pageSize },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
extractInstitutionId(institution: Institution): string {
|
extractInstitutionId(institution: Institution): string {
|
||||||
return institution.id?.split('/').pop() ?? '';
|
return institution.id?.split('/').pop() ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSortFieldChange(event: Event): void {
|
|
||||||
const selectElement = event.target as HTMLSelectElement;
|
|
||||||
const sortField = selectElement.value;
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { sort_by: sortField },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSortOrderChange(event: Event): void {
|
|
||||||
const selectElement = event.target as HTMLSelectElement;
|
|
||||||
const sortOrder = selectElement.value;
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { sorting_order: sortOrder },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
getDisplayName(institution: Institution): string {
|
getDisplayName(institution: Institution): string {
|
||||||
const primary = institution.display_name?.trim();
|
const primary = institution.display_name?.trim();
|
||||||
if (primary && primary.length > 0) return primary;
|
if (primary && primary.length > 0) return primary;
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
<div class="detail-page">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="back-link"
|
||||||
|
(click)="navigateBack()"
|
||||||
|
aria-label="Zurück zu den Nachrichten">
|
||||||
|
<mat-icon>arrow_back</mat-icon>
|
||||||
|
Alle Nachrichten
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (loading) {
|
||||||
|
<div class="state">
|
||||||
|
<mat-spinner diameter="42"></mat-spinner>
|
||||||
|
<p>Nachricht wird geladen...</p>
|
||||||
|
</div>
|
||||||
|
} @else if (notFound || !article) {
|
||||||
|
<div class="state error-state">
|
||||||
|
<mat-icon>search_off</mat-icon>
|
||||||
|
<h2>Nachricht nicht gefunden</h2>
|
||||||
|
<p>Der Artikel konnte nicht geladen werden.</p>
|
||||||
|
<a mat-stroked-button routerLink="/persons">Zur Personensuche</a>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="detail-layout">
|
||||||
|
<main>
|
||||||
|
<header class="hero">
|
||||||
|
<div class="eyebrow">
|
||||||
|
@if (article.author) {
|
||||||
|
<span>{{ article.author }}</span>
|
||||||
|
}
|
||||||
|
@if (article.date) {
|
||||||
|
<span>{{ formatDate(article.date) }}</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<p class="article-heading">{{ article.maintitle || 'Kein Titel' }}</p>
|
||||||
|
|
||||||
|
@if (article.relevant === true) {
|
||||||
|
<span class="relevance-badge is-relevant">
|
||||||
|
<mat-icon>check_circle</mat-icon>
|
||||||
|
Relevant
|
||||||
|
</span>
|
||||||
|
} @else if (article.relevant === false) {
|
||||||
|
<span class="relevance-badge not-relevant">
|
||||||
|
<mat-icon>cancel</mat-icon>
|
||||||
|
Nicht relevant
|
||||||
|
</span>
|
||||||
|
} @else {
|
||||||
|
<span class="relevance-badge undetermined">
|
||||||
|
<mat-icon>help</mat-icon>
|
||||||
|
Relevanz nicht bestimmt
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="article-body">
|
||||||
|
@if (article.full_content) {
|
||||||
|
<p class="content">{{ article.full_content }}</p>
|
||||||
|
} @else {
|
||||||
|
<p class="placeholder">Kein Inhalt verfügbar.</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (article.url) {
|
||||||
|
<div class="article-actions">
|
||||||
|
<a
|
||||||
|
mat-stroked-button
|
||||||
|
[href]="article.url"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener">
|
||||||
|
<mat-icon>open_in_new</mat-icon>
|
||||||
|
Originalartikel öffnen
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<aside class="sidebar">
|
||||||
|
<div class="sidebar-card">
|
||||||
|
<h3>
|
||||||
|
<mat-icon>group</mat-icon>
|
||||||
|
Erwähnte Personen
|
||||||
|
</h3>
|
||||||
|
<div class="person-list">
|
||||||
|
@if (article.authors && article.authors.length) {
|
||||||
|
@for (person of article.authors; track person.name) {
|
||||||
|
@if (person.is_ude && person.person_id) {
|
||||||
|
<a
|
||||||
|
class="person-item is-link"
|
||||||
|
[routerLink]="['/person', person.person_id, 'overview']">
|
||||||
|
<div class="avatar">{{ person.name.charAt(0) }}</div>
|
||||||
|
<span class="person-name">{{ person.name }}</span>
|
||||||
|
<span class="ude-badge">UDE</span>
|
||||||
|
</a>
|
||||||
|
} @else {
|
||||||
|
<article class="person-item is-muted">
|
||||||
|
<div class="avatar">{{ person.name.charAt(0) }}</div>
|
||||||
|
<span class="person-name">{{ person.name }}</span>
|
||||||
|
</article>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} @else {
|
||||||
|
<p class="placeholder">Keine erwähnten Personen gefunden.</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sidebar-card">
|
||||||
|
<h3>
|
||||||
|
<mat-icon>label</mat-icon>
|
||||||
|
Relevante Themen
|
||||||
|
</h3>
|
||||||
|
<div class="chip-list">
|
||||||
|
@for (topic of relevantTopics; track topic; let i = $index) {
|
||||||
|
<span class="topic-chip" [ngClass]="chipColor(i)">{{
|
||||||
|
topic
|
||||||
|
}}</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,295 @@
|
|||||||
|
.detail-page {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 28px 32px 64px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
padding: 0;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 18px;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 80px 0;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 48px;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state h2 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-layout {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 280px;
|
||||||
|
gap: 40px;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.eyebrow {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
span + span::before {
|
||||||
|
content: '·';
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-heading {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.relevance-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 14px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-relevant {
|
||||||
|
background: #effaf3;
|
||||||
|
border: 1px solid #bdebcf;
|
||||||
|
color: #24834f;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.not-relevant {
|
||||||
|
background: var(--sg-surface-muted);
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.undetermined {
|
||||||
|
background: #fff7e8;
|
||||||
|
border: 1px solid #ffd796;
|
||||||
|
color: #c67500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body {
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
margin: 0;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.placeholder {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-actions {
|
||||||
|
margin-top: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
position: sticky;
|
||||||
|
top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-card {
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px solid #d7e4ff;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin: 0 0 14px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--sg-text);
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 18px;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 38px minmax(0, 1fr) auto;
|
||||||
|
gap: 11px;
|
||||||
|
align-items: center;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: var(--sg-surface-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item.is-link {
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
transition: background 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item.is-link:hover {
|
||||||
|
background: #e5ecfb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item.is-muted {
|
||||||
|
.avatar {
|
||||||
|
background: #ececef;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-name {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ude-badge {
|
||||||
|
justify-self: end;
|
||||||
|
padding: 3px 9px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #effaf3;
|
||||||
|
border: 1px solid #bdebcf;
|
||||||
|
color: #24834f;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
width: 38px;
|
||||||
|
height: 38px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #e5ecfb;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-name {
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chip-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topic-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border: 1px solid var(--topic-border);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--topic-bg);
|
||||||
|
color: var(--topic-color);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.purple {
|
||||||
|
--topic-border: #d8cafe;
|
||||||
|
--topic-bg: #f6f0ff;
|
||||||
|
--topic-color: #7255d9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.blue {
|
||||||
|
--topic-border: #bdd4ff;
|
||||||
|
--topic-bg: #f0f6ff;
|
||||||
|
--topic-color: #0b63ce;
|
||||||
|
}
|
||||||
|
|
||||||
|
.green {
|
||||||
|
--topic-border: #bdebcf;
|
||||||
|
--topic-bg: #effaf3;
|
||||||
|
--topic-color: #24834f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.orange {
|
||||||
|
--topic-border: #ffd796;
|
||||||
|
--topic-bg: #fff7e8;
|
||||||
|
--topic-color: #c67500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pink {
|
||||||
|
--topic-border: #ffc7d7;
|
||||||
|
--topic-bg: #fff1f5;
|
||||||
|
--topic-color: #d12f61;
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
||||||
|
import { Location, NgClass } from '@angular/common';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
|
||||||
|
import { WorksService } from '../../api';
|
||||||
|
|
||||||
|
interface MentionedPerson {
|
||||||
|
name: string;
|
||||||
|
is_ude?: boolean;
|
||||||
|
person_id?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NewsArticleDetail {
|
||||||
|
id: string;
|
||||||
|
date?: string | null;
|
||||||
|
maintitle?: string | null;
|
||||||
|
author?: string | null;
|
||||||
|
url?: string | null;
|
||||||
|
full_content?: string | null;
|
||||||
|
relevant?: boolean;
|
||||||
|
authors?: MentionedPerson[];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-news-detail',
|
||||||
|
imports: [
|
||||||
|
MatButtonModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
|
RouterLink,
|
||||||
|
NgClass,
|
||||||
|
],
|
||||||
|
templateUrl: './news-detail.component.html',
|
||||||
|
styleUrl: './news-detail.component.scss',
|
||||||
|
})
|
||||||
|
export class NewsDetailComponent implements OnInit {
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly httpClient = inject(HttpClient);
|
||||||
|
private readonly worksService = inject(WorksService);
|
||||||
|
private readonly location = inject(Location);
|
||||||
|
|
||||||
|
article: NewsArticleDetail | null = null;
|
||||||
|
loading = false;
|
||||||
|
notFound = false;
|
||||||
|
|
||||||
|
readonly relevantTopics = [
|
||||||
|
'Künstliche Intelligenz',
|
||||||
|
'Maschinelles Lernen',
|
||||||
|
'Digitalisierung',
|
||||||
|
'Datenwissenschaft',
|
||||||
|
];
|
||||||
|
|
||||||
|
private readonly chipColors = ['purple', 'blue', 'green', 'orange', 'pink'];
|
||||||
|
|
||||||
|
chipColor(index: number): string {
|
||||||
|
return this.chipColors[index % this.chipColors.length];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.paramMap
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe((params) => {
|
||||||
|
const id = params.get('id');
|
||||||
|
if (id) {
|
||||||
|
this.fetchArticle(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
navigateBack(): void {
|
||||||
|
this.location.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
formatDate(dateStr?: string | null): string {
|
||||||
|
if (!dateStr) return '-';
|
||||||
|
const date = new Date(dateStr);
|
||||||
|
if (isNaN(date.getTime())) return dateStr;
|
||||||
|
return new Intl.DateTimeFormat('de-DE', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
}).format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
private fetchArticle(id: string): void {
|
||||||
|
this.loading = true;
|
||||||
|
this.notFound = false;
|
||||||
|
const basePath = this.worksService.configuration.basePath ?? '';
|
||||||
|
this.httpClient
|
||||||
|
.get<NewsArticleDetail>(`${basePath}/api/news/${encodeURIComponent(id)}`)
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe({
|
||||||
|
next: (article) => {
|
||||||
|
this.article = article;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.notFound = true;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<div class="page">
|
||||||
|
<div>
|
||||||
|
<h6>Nachrichten</h6>
|
||||||
|
<p>Aktuelle Nachrichten aus Campus-Aktuell.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="news-toolbar">
|
||||||
|
<mat-form-field appearance="outline" class="search-field">
|
||||||
|
<mat-icon matPrefix>search</mat-icon>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[formControl]="searchControl"
|
||||||
|
placeholder="Nachrichten durchsuchen..." />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
@if (!isSearching) {
|
||||||
|
<mat-form-field appearance="outline" class="sort-field">
|
||||||
|
<mat-select
|
||||||
|
[value]="sortOrder"
|
||||||
|
(selectionChange)="onSortChange($event.value)">
|
||||||
|
<mat-option value="desc">Neueste zuerst</mat-option>
|
||||||
|
<mat-option value="asc">Älteste zuerst</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-wrap">
|
||||||
|
@if (loading) {
|
||||||
|
<div class="loading">
|
||||||
|
<mat-spinner diameter="36"></mat-spinner>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<table mat-table [dataSource]="articles" class="mat-elevation-z2">
|
||||||
|
<ng-container matColumnDef="maintitle">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Titel</th>
|
||||||
|
<td mat-cell *matCellDef="let article">
|
||||||
|
<a class="article-title" [routerLink]="['/news', article.id]">{{
|
||||||
|
article.maintitle || 'Kein Titel'
|
||||||
|
}}</a>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="snippet">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Fundstelle</th>
|
||||||
|
<td mat-cell *matCellDef="let article">
|
||||||
|
@if (article.snippet) {
|
||||||
|
<span class="snippet" [innerHTML]="article.snippet"></span>
|
||||||
|
} @else {
|
||||||
|
<span class="snippet-empty">—</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="relevance">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Relevanz</th>
|
||||||
|
<td mat-cell *matCellDef="let article">
|
||||||
|
@if (article.relevant === true) {
|
||||||
|
<span class="relevance-badge is-relevant">
|
||||||
|
<mat-icon>check_circle</mat-icon>
|
||||||
|
Relevant
|
||||||
|
</span>
|
||||||
|
} @else if (article.relevant === false) {
|
||||||
|
<span class="relevance-badge not-relevant">
|
||||||
|
<mat-icon>cancel</mat-icon>
|
||||||
|
Nicht relevant
|
||||||
|
</span>
|
||||||
|
} @else {
|
||||||
|
<span class="relevance-badge undetermined">
|
||||||
|
<mat-icon>help</mat-icon>
|
||||||
|
Nicht bestimmt
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="date">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Datum</th>
|
||||||
|
<td mat-cell *matCellDef="let article">
|
||||||
|
{{ formatDate(article.date) }}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@if (!loading && articles.length === 0) {
|
||||||
|
<div class="empty-state">
|
||||||
|
@if (isSearching) {
|
||||||
|
Keine Ergebnisse für „{{ searchControl.value.trim() }}" gefunden.
|
||||||
|
} @else {
|
||||||
|
Keine Nachrichten gefunden.
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-footer">
|
||||||
|
<span>{{ articleRange() }}</span>
|
||||||
|
<mat-paginator
|
||||||
|
[length]="total"
|
||||||
|
[pageIndex]="currentPage - 1"
|
||||||
|
[pageSize]="paginationService.selection"
|
||||||
|
[pageSizeOptions]="paginationService.options"
|
||||||
|
(page)="onPage($event)">
|
||||||
|
</mat-paginator>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
.page {
|
||||||
|
padding: 28px 32px 42px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page > div:first-child p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.news-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-field {
|
||||||
|
max-width: 480px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mat-mdc-form-field-subscript-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mat-mdc-text-field-wrapper {
|
||||||
|
height: 42px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mat-mdc-form-field-infix {
|
||||||
|
min-height: unset;
|
||||||
|
height: 42px;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mdc-notched-outline__leading,
|
||||||
|
::ng-deep .news-toolbar .mdc-notched-outline__notch,
|
||||||
|
::ng-deep .news-toolbar .mdc-notched-outline__trailing {
|
||||||
|
border-color: #d9e2f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar input.mat-mdc-input-element {
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar input.mat-mdc-input-element::placeholder {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
opacity: 1;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-field {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-wrap {
|
||||||
|
position: relative;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 600px;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0 10px;
|
||||||
|
background: transparent;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-title {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 520px;
|
||||||
|
line-height: 1.35;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: var(--sg-text);
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 1;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
background: rgba(255, 255, 255, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
padding: 28px;
|
||||||
|
text-align: center;
|
||||||
|
color: rgba(0, 0, 0, 0.6);
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snippet {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .snippet em {
|
||||||
|
font-style: normal;
|
||||||
|
background: #fff48d;
|
||||||
|
padding: 0 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snippet-empty {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.relevance-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.is-relevant {
|
||||||
|
background: #effaf3;
|
||||||
|
border: 1px solid #bdebcf;
|
||||||
|
color: #24834f;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.not-relevant {
|
||||||
|
background: var(--sg-surface-muted);
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.undetermined {
|
||||||
|
background: #fff7e8;
|
||||||
|
border: 1px solid #ffd796;
|
||||||
|
color: #c67500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-header-cell {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-row {
|
||||||
|
height: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-cell {
|
||||||
|
color: var(--sg-text);
|
||||||
|
border-bottom-color: var(--sg-border);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-paginator {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
min-height: 66px;
|
||||||
|
padding: 0 22px 0 28px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.page {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-footer {
|
||||||
|
align-items: stretch;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
||||||
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
|
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
|
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
||||||
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
import { MatTableModule } from '@angular/material/table';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
import { debounceTime, distinctUntilChanged } from 'rxjs';
|
||||||
|
|
||||||
|
import { WorksService } from '../../api';
|
||||||
|
import { PaginationService } from '../../shared/services/pagination.service';
|
||||||
|
|
||||||
|
interface NewsArticle {
|
||||||
|
id: string;
|
||||||
|
date?: string | null;
|
||||||
|
maintitle?: string | null;
|
||||||
|
author?: string | null;
|
||||||
|
url?: string | null;
|
||||||
|
relevant?: boolean | null;
|
||||||
|
snippet?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NewsPage {
|
||||||
|
total: number;
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
results: NewsArticle[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type SortOrder = 'desc' | 'asc';
|
||||||
|
const DEFAULT_SORT_ORDER: SortOrder = 'desc';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-news',
|
||||||
|
imports: [
|
||||||
|
MatIconModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatPaginatorModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
|
MatTableModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
RouterLink,
|
||||||
|
],
|
||||||
|
templateUrl: './news.component.html',
|
||||||
|
styleUrl: './news.component.scss',
|
||||||
|
})
|
||||||
|
export class NewsComponent implements OnInit {
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly httpClient = inject(HttpClient);
|
||||||
|
private readonly worksService = inject(WorksService);
|
||||||
|
readonly paginationService = inject(PaginationService);
|
||||||
|
|
||||||
|
readonly searchControl = new FormControl('', { nonNullable: true });
|
||||||
|
|
||||||
|
get displayedColumns(): string[] {
|
||||||
|
if (this.isSearching) {
|
||||||
|
return ['maintitle', 'snippet', 'relevance', 'date'];
|
||||||
|
}
|
||||||
|
return ['maintitle', 'relevance', 'date'];
|
||||||
|
}
|
||||||
|
|
||||||
|
articles: NewsArticle[] = [];
|
||||||
|
total = 0;
|
||||||
|
loading = false;
|
||||||
|
|
||||||
|
currentPage = 1;
|
||||||
|
sortOrder: SortOrder = DEFAULT_SORT_ORDER;
|
||||||
|
|
||||||
|
get isSearching(): boolean {
|
||||||
|
return this.searchControl.value.trim().length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.queryParamMap
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe((params) => {
|
||||||
|
this.currentPage = this.parsePage(params.get('page'));
|
||||||
|
this.paginationService.selection = this.parsePageSize(
|
||||||
|
params.get('pageSize'),
|
||||||
|
);
|
||||||
|
this.sortOrder = this.parseSortOrder(params.get('sortOrder'));
|
||||||
|
this.searchControl.setValue(params.get('q') ?? '', {
|
||||||
|
emitEvent: false,
|
||||||
|
});
|
||||||
|
this.load();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.searchControl.valueChanges
|
||||||
|
.pipe(
|
||||||
|
debounceTime(300),
|
||||||
|
distinctUntilChanged(),
|
||||||
|
takeUntilDestroyed(this.destroyRef),
|
||||||
|
)
|
||||||
|
.subscribe((query) => {
|
||||||
|
this.router.navigate([], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: { q: query.trim() || null, page: 1 },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
load(): void {
|
||||||
|
this.loading = true;
|
||||||
|
const query = this.searchControl.value.trim();
|
||||||
|
const basePath = this.worksService.configuration.basePath ?? '';
|
||||||
|
|
||||||
|
if (query) {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('query', query)
|
||||||
|
.set('page', this.currentPage)
|
||||||
|
.set('pageSize', this.paginationService.selection);
|
||||||
|
|
||||||
|
this.httpClient
|
||||||
|
.get<NewsPage>(`${basePath}/api/news/search`, { params })
|
||||||
|
.subscribe({
|
||||||
|
next: (page) => {
|
||||||
|
this.articles = page.results ?? [];
|
||||||
|
this.total = page.total ?? 0;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.articles = [];
|
||||||
|
this.total = 0;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('page', this.currentPage)
|
||||||
|
.set('pageSize', this.paginationService.selection)
|
||||||
|
.set('sortOrder', this.sortOrder);
|
||||||
|
|
||||||
|
this.httpClient
|
||||||
|
.get<NewsPage>(`${basePath}/api/news`, { params })
|
||||||
|
.subscribe({
|
||||||
|
next: (page) => {
|
||||||
|
this.articles = page.results ?? [];
|
||||||
|
this.total = page.total ?? 0;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.articles = [];
|
||||||
|
this.total = 0;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onPage(event: PageEvent): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: {
|
||||||
|
page: event.pageIndex + 1,
|
||||||
|
pageSize: event.pageSize,
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onSortChange(order: SortOrder): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: {
|
||||||
|
sortOrder: order,
|
||||||
|
page: 1,
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
formatDate(dateStr?: string | null): string {
|
||||||
|
if (!dateStr) return '-';
|
||||||
|
const date = new Date(dateStr);
|
||||||
|
if (isNaN(date.getTime())) return dateStr;
|
||||||
|
return new Intl.DateTimeFormat('de-DE').format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
articleRange(): string {
|
||||||
|
if (this.total === 0) return 'Keine Nachrichten gefunden';
|
||||||
|
const pageSize = this.paginationService.selection;
|
||||||
|
const start = (this.currentPage - 1) * pageSize + 1;
|
||||||
|
const end = Math.min(start + this.articles.length - 1, this.total);
|
||||||
|
return `Zeige ${start} bis ${end} von ${this.total} Nachrichten`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parsePage(value: string | null): number {
|
||||||
|
const page = Number.parseInt(value ?? '', 10);
|
||||||
|
if (Number.isNaN(page) || page < 1) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parsePageSize(value: string | null): number {
|
||||||
|
const pageSize = Number.parseInt(value ?? '', 10);
|
||||||
|
if (this.paginationService.options.includes(pageSize)) {
|
||||||
|
return pageSize;
|
||||||
|
}
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseSortOrder(value: string | null): SortOrder {
|
||||||
|
if (value === 'asc' || value === 'desc') {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
return DEFAULT_SORT_ORDER;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<article class="person-card">
|
<article class="person-card">
|
||||||
<a [routerLink]="['/person', person.id, 'overview']" class="card-header">
|
<a [routerLink]="['/person', person().id, 'overview']" class="card-header">
|
||||||
<!-- Initials Avatar or Profile Image fallback -->
|
<!-- Initials Avatar or Profile Image fallback -->
|
||||||
<div [skText]="loading" class="avatar">
|
<div [skText]="loading()" class="avatar">
|
||||||
{{ getInitials(person.display_name) }}
|
{{ initials() }}
|
||||||
</div>
|
</div>
|
||||||
<div class="header-main">
|
<div class="header-main">
|
||||||
<div class="bookmark">
|
<div class="bookmark">
|
||||||
@@ -11,41 +11,43 @@
|
|||||||
(click)="
|
(click)="
|
||||||
toggleBookmark(); $event.stopPropagation(); $event.preventDefault()
|
toggleBookmark(); $event.stopPropagation(); $event.preventDefault()
|
||||||
"
|
"
|
||||||
[class.bookmarked]="isBookmarked"
|
[class.bookmarked]="isBookmarked()"
|
||||||
aria-label="Bookmark person">
|
aria-label="Bookmark person">
|
||||||
<mat-icon>{{
|
<mat-icon>{{
|
||||||
isBookmarked ? 'bookmark' : 'bookmark_border'
|
isBookmarked() ? 'bookmark' : 'bookmark_border'
|
||||||
}}</mat-icon>
|
}}</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<h2
|
<h2
|
||||||
[skText]="loading"
|
[skText]="loading()"
|
||||||
class="person-name"
|
class="person-name"
|
||||||
[title]="person.display_name ?? ''">
|
[title]="person().display_name ?? ''">
|
||||||
{{ person.display_name ?? '' }}
|
{{ person().display_name ?? '' }}
|
||||||
</h2>
|
</h2>
|
||||||
<p [skText]="loading" class="person-id">
|
<p [skText]="loading()" class="person-id">
|
||||||
{{ getDistinguishingId(person) }}
|
{{ distinguishingId() }}
|
||||||
</p>
|
</p>
|
||||||
<p [skText]="loading" class="stats">
|
<p [skText]="loading()" class="stats">
|
||||||
{{ getStatsString() }}
|
{{ statsString() }}
|
||||||
</p>
|
</p>
|
||||||
<p [skText]="loading" class="stats">
|
<p [skText]="loading()" class="stats">
|
||||||
{{ getHIndexString() }}
|
{{ hIndexString() }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@if (institution(person); as inst) {
|
@if (institution(); as inst) {
|
||||||
<div class="institution-row" style="margin-bottom: 8px">
|
<div class="institution-row" style="margin-bottom: 8px">
|
||||||
<span
|
<button
|
||||||
|
type="button"
|
||||||
class="institution-tag"
|
class="institution-tag"
|
||||||
|
[matTooltip]="inst.display_name || ''"
|
||||||
|
matTooltipPosition="above"
|
||||||
(click)="
|
(click)="
|
||||||
institutionClick.emit(inst.display_name || '');
|
institutionClick.emit(inst.display_name || '');
|
||||||
$event.stopPropagation()
|
$event.stopPropagation()
|
||||||
"
|
">
|
||||||
[title]="inst.display_name || ''">
|
|
||||||
<mat-icon
|
<mat-icon
|
||||||
style="
|
style="
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
@@ -57,12 +59,12 @@
|
|||||||
>apartment</mat-icon
|
>apartment</mat-icon
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
[skText]="loading"
|
[skText]="loading()"
|
||||||
class="institution-name"
|
class="institution-name"
|
||||||
style="vertical-align: middle"
|
style="vertical-align: middle"
|
||||||
>{{ inst.display_name ?? '' }}</span
|
>{{ inst.display_name ?? '' }}</span
|
||||||
>
|
>
|
||||||
@if (inst.country_code && !loading) {
|
@if (inst.country_code && !loading()) {
|
||||||
<img
|
<img
|
||||||
alt=""
|
alt=""
|
||||||
class="flag-img"
|
class="flag-img"
|
||||||
@@ -75,38 +77,41 @@
|
|||||||
>{{ inst.country_code.toUpperCase() }}</span
|
>{{ inst.country_code.toUpperCase() }}</span
|
||||||
>
|
>
|
||||||
}
|
}
|
||||||
</span>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="topic-row">
|
<div class="topic-row">
|
||||||
@for (topic of topics(person); track topic.id) {
|
@for (topic of topics(); track topic.id) {
|
||||||
<span
|
<button
|
||||||
[skText]="loading"
|
type="button"
|
||||||
|
[skText]="loading()"
|
||||||
class="topic-tag"
|
class="topic-tag"
|
||||||
|
[class.active]="selectedTopics().has(topic.display_name || '')"
|
||||||
|
[matTooltip]="getTopicTooltip(topic)"
|
||||||
|
matTooltipPosition="above"
|
||||||
(click)="
|
(click)="
|
||||||
topicClick.emit(topic.display_name || ''); $event.stopPropagation()
|
topicClick.emit(topic.display_name || ''); $event.stopPropagation()
|
||||||
"
|
">
|
||||||
[title]="getTopicTooltip(topic)"
|
{{ topic.display_name }}
|
||||||
>{{ topic.display_name }}</span
|
</button>
|
||||||
>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<a [routerLink]="['/person', person.id, 'overview']" class="action-btn">
|
<a [routerLink]="['/person', person().id, 'overview']" class="action-btn">
|
||||||
<mat-icon>visibility</mat-icon>
|
<mat-icon>visibility</mat-icon>
|
||||||
<span>Übersicht</span>
|
<span>Übersicht</span>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
[routerLink]="['/person', person.id, 'publications']"
|
[routerLink]="['/person', person().id, 'publications']"
|
||||||
class="action-btn">
|
class="action-btn">
|
||||||
<mat-icon>menu_book</mat-icon>
|
<mat-icon>menu_book</mat-icon>
|
||||||
<span>Publikationen</span>
|
<span>Publikationen</span>
|
||||||
</a>
|
</a>
|
||||||
<a [routerLink]="['/person', person.id, 'network']" class="action-btn">
|
<a [routerLink]="['/person', person().id, 'network']" class="action-btn">
|
||||||
<mat-icon>share</mat-icon>
|
<mat-icon>share</mat-icon>
|
||||||
<span>Netzwerk</span>
|
<span>Netzwerk</span>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -140,6 +140,9 @@
|
|||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
line-height: normal;
|
||||||
|
font-family: inherit;
|
||||||
|
|
||||||
.institution-name {
|
.institution-name {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -159,10 +162,15 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
background: var(--sg-primary);
|
background: var(--sg-primary);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-color: var(--sg-primary);
|
border-color: var(--sg-primary);
|
||||||
|
outline: none;
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 2px var(--sg-background),
|
||||||
|
0 0 0 4px var(--sg-primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,11 +231,36 @@
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
line-height: normal;
|
||||||
|
font-family: inherit;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
&:hover {
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
background: var(--sg-primary-soft);
|
background: var(--sg-primary-soft);
|
||||||
border-color: var(--sg-primary);
|
border-color: var(--sg-primary);
|
||||||
color: var(--sg-primary);
|
color: var(--sg-primary);
|
||||||
|
outline: none;
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 2px var(--sg-background),
|
||||||
|
0 0 0 4px var(--sg-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: var(--sg-primary-soft);
|
||||||
|
border-color: var(--sg-primary);
|
||||||
|
color: var(--sg-primary);
|
||||||
|
font-weight: 700;
|
||||||
|
box-shadow: 0 0 0 1.5px var(--sg-primary);
|
||||||
|
|
||||||
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 2px var(--sg-background),
|
||||||
|
0 0 0 4px var(--sg-primary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,104 @@
|
|||||||
import { Component, Input, Output, EventEmitter } from '@angular/core';
|
import { Component, input, computed, output } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api';
|
import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api';
|
||||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-person-card',
|
selector: 'app-person-card',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [CommonModule, RouterLink, MatIconModule, SkTextDirective],
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
RouterLink,
|
||||||
|
MatIconModule,
|
||||||
|
SkTextDirective,
|
||||||
|
MatTooltipModule,
|
||||||
|
],
|
||||||
templateUrl: './person-card.component.html',
|
templateUrl: './person-card.component.html',
|
||||||
styleUrl: './person-card.component.scss',
|
styleUrl: './person-card.component.scss',
|
||||||
})
|
})
|
||||||
export class PersonCardComponent {
|
export class PersonCardComponent {
|
||||||
@Input({ required: true }) person!: CustomAuthor;
|
person = input.required<CustomAuthor>();
|
||||||
@Input() isBookmarked = false;
|
isBookmarked = input<boolean>(false);
|
||||||
@Input() loading = false;
|
loading = input<boolean>(false);
|
||||||
@Output() bookmarkToggle = new EventEmitter<CustomAuthor>();
|
selectedTopics = input<Set<string>>(new Set<string>());
|
||||||
@Output() topicClick = new EventEmitter<string>();
|
|
||||||
@Output() institutionClick = new EventEmitter<string>();
|
|
||||||
|
|
||||||
getInitials(name: string | null | undefined): string {
|
bookmarkToggle = output<CustomAuthor>();
|
||||||
|
topicClick = output<string>();
|
||||||
|
institutionClick = output<string>();
|
||||||
|
|
||||||
|
initials = computed<string>(() => {
|
||||||
|
const name = this.person().display_name;
|
||||||
if (!name) return 'U';
|
if (!name) return 'U';
|
||||||
const cleanName = name.replace(/Prof\.|Dr\.|M\.Sc\./g, '').trim();
|
const cleanName = name.replace(/Prof\.|Dr\.|M\.Sc\./g, '').trim();
|
||||||
const parts = cleanName.split(' ');
|
const parts = cleanName.split(' ');
|
||||||
const first = parts[0]?.[0] || '';
|
const first = parts[0]?.[0] || '';
|
||||||
const last = parts[parts.length - 1]?.[0] || '';
|
const last = parts[parts.length - 1]?.[0] || '';
|
||||||
return (first + last).toUpperCase();
|
return (first + last).toUpperCase();
|
||||||
}
|
});
|
||||||
|
|
||||||
|
institution = computed<DehydratedInstitution | undefined>(() => {
|
||||||
|
const p = this.person();
|
||||||
|
if (p.last_known_institutions?.[0]) {
|
||||||
|
return p.last_known_institutions[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
const affiliations = p.affiliations ?? [];
|
||||||
|
let newestInstitution: DehydratedInstitution | undefined =
|
||||||
|
affiliations[0]?.institution ?? undefined;
|
||||||
|
let newestYear = -1;
|
||||||
|
|
||||||
|
for (const affiliation of affiliations) {
|
||||||
|
for (const jahr of affiliation.years ?? []) {
|
||||||
|
if (jahr > newestYear) {
|
||||||
|
newestYear = jahr;
|
||||||
|
newestInstitution = affiliation.institution ?? undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newestInstitution;
|
||||||
|
});
|
||||||
|
|
||||||
|
topics = computed<WorkTopic[]>(() => {
|
||||||
|
return (this.person().topics ?? [])
|
||||||
|
.filter((t): t is WorkTopic => !!t.display_name)
|
||||||
|
.slice(0, 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
distinguishingId = computed<string>(() => {
|
||||||
|
const p = this.person();
|
||||||
|
if (p.orcid) {
|
||||||
|
return p.orcid.replace('https://orcid.org/', '');
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
|
statsString = computed<string>(() => {
|
||||||
|
const works = this.person().works_count;
|
||||||
|
const citations = this.person().cited_by_count;
|
||||||
|
const hasWorks = works !== undefined && works !== null;
|
||||||
|
const hasCitations = citations !== undefined && citations !== null;
|
||||||
|
|
||||||
|
if (hasWorks && hasCitations) {
|
||||||
|
return `Publikationen: ${works} · Zitationen: ${citations}`;
|
||||||
|
} else if (hasWorks) {
|
||||||
|
return `Publikationen: ${works}`;
|
||||||
|
} else if (hasCitations) {
|
||||||
|
return `Zitationen: ${citations}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
|
hIndexString = computed<string>(() => {
|
||||||
|
const hIndex = this.person().summary_stats?.h_index;
|
||||||
|
if (hIndex !== undefined && hIndex !== null) {
|
||||||
|
return `h_index: ${hIndex}`;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
|
||||||
getRatingClass(rating: string | null | undefined): string {
|
getRatingClass(rating: string | null | undefined): string {
|
||||||
const r = (rating || '').toLowerCase();
|
const r = (rating || '').toLowerCase();
|
||||||
@@ -35,20 +107,6 @@ export class PersonCardComponent {
|
|||||||
return 'possible';
|
return 'possible';
|
||||||
}
|
}
|
||||||
|
|
||||||
institution(person: CustomAuthor): DehydratedInstitution | undefined {
|
|
||||||
return (
|
|
||||||
person.last_known_institutions?.[0] ||
|
|
||||||
person.affiliations?.[person.affiliations.length - 1]?.institution ||
|
|
||||||
undefined
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
topics(person: CustomAuthor): WorkTopic[] {
|
|
||||||
return (person.topics ?? [])
|
|
||||||
.filter((t): t is WorkTopic => !!t.display_name)
|
|
||||||
.slice(0, 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
getTopicTooltip(topic: WorkTopic): string {
|
getTopicTooltip(topic: WorkTopic): string {
|
||||||
const parts: string[] = [];
|
const parts: string[] = [];
|
||||||
if (topic.domain?.display_name) parts.push(topic.domain.display_name);
|
if (topic.domain?.display_name) parts.push(topic.domain.display_name);
|
||||||
@@ -62,39 +120,7 @@ export class PersonCardComponent {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDistinguishingId(person: CustomAuthor): string {
|
|
||||||
if (!person) return '';
|
|
||||||
if (person.orcid) {
|
|
||||||
return person.orcid.replace('https://orcid.org/', '');
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
getStatsString(): string {
|
|
||||||
const works = this.person.works_count;
|
|
||||||
const citations = this.person.cited_by_count;
|
|
||||||
const hasWorks = works !== undefined && works !== null;
|
|
||||||
const hasCitations = citations !== undefined && citations !== null;
|
|
||||||
|
|
||||||
if (hasWorks && hasCitations) {
|
|
||||||
return `Publikationen: ${works} · Zitationen: ${citations}`;
|
|
||||||
} else if (hasWorks) {
|
|
||||||
return `Publikationen: ${works}`;
|
|
||||||
} else if (hasCitations) {
|
|
||||||
return `Zitationen: ${citations}`;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
getHIndexString(): string {
|
|
||||||
const hIndex = this.person.summary_stats?.h_index;
|
|
||||||
if (hIndex !== undefined && hIndex !== null) {
|
|
||||||
return `h_index: ${hIndex}`;
|
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleBookmark(): void {
|
toggleBookmark(): void {
|
||||||
this.bookmarkToggle.emit(this.person);
|
this.bookmarkToggle.emit(this.person());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
(click)="clearSearch()"
|
(click)="clearSearch()"
|
||||||
matTooltip="Suche zurücksetzen">
|
matTooltip="Suche zurücksetzen"
|
||||||
|
aria-label="Suche zurücksetzen">
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,7 +43,10 @@
|
|||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
<button class="clear-all-btn" (click)="clearAllFilters()">
|
<button
|
||||||
|
class="clear-all-btn"
|
||||||
|
(click)="clearAllFilters()"
|
||||||
|
aria-label="Alle Filter zurücksetzen">
|
||||||
Filter zurücksetzen
|
Filter zurücksetzen
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -56,14 +60,18 @@
|
|||||||
<div class="sort-selector">
|
<div class="sort-selector">
|
||||||
<span class="sort-label">Sortierung:</span>
|
<span class="sort-label">Sortierung:</span>
|
||||||
<div class="select-wrapper">
|
<div class="select-wrapper">
|
||||||
<select [formControl]="sortValueControl">
|
<select
|
||||||
|
[formControl]="sortValueControl"
|
||||||
|
aria-label="Sortierkriterium">
|
||||||
<option [ngValue]="null">Beste Treffer (Relevanz)</option>
|
<option [ngValue]="null">Beste Treffer (Relevanz)</option>
|
||||||
<option value="works_count">Publikationen</option>
|
<option value="works_count">Publikationen</option>
|
||||||
<option value="cited_by_count">Zitierungen</option>
|
<option value="cited_by_count">Zitierungen</option>
|
||||||
<option value="summary_stats.h_index">h_index</option>
|
<option value="summary_stats.h_index">h_index</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select [formControl]="sortOrderControl">
|
<select
|
||||||
|
[formControl]="sortOrderControl"
|
||||||
|
aria-label="Sortierreihenfolge">
|
||||||
<option value="desc">Absteigend</option>
|
<option value="desc">Absteigend</option>
|
||||||
<option value="asc">Aufsteigend</option>
|
<option value="asc">Aufsteigend</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -87,6 +95,7 @@
|
|||||||
[loading]="loading"
|
[loading]="loading"
|
||||||
[person]="person"
|
[person]="person"
|
||||||
[isBookmarked]="isBookmarked(person)"
|
[isBookmarked]="isBookmarked(person)"
|
||||||
|
[selectedTopics]="selectedTopics()"
|
||||||
(bookmarkToggle)="toggleBookmark($event)"
|
(bookmarkToggle)="toggleBookmark($event)"
|
||||||
(topicClick)="onCardTopicClick($event)"
|
(topicClick)="onCardTopicClick($event)"
|
||||||
(institutionClick)="onCardInstitutionClick($event)">
|
(institutionClick)="onCardInstitutionClick($event)">
|
||||||
@@ -132,19 +141,23 @@
|
|||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
[formControl]="topicSearchControl"
|
[formControl]="topicSearchControl"
|
||||||
|
aria-label="Thema suchen"
|
||||||
placeholder="Thema suchen..." />
|
placeholder="Thema suchen..." />
|
||||||
@if (topicSearchControl.value) {
|
@if (topicSearchControl.value) {
|
||||||
<button
|
<button
|
||||||
class="clear-topic-search"
|
class="clear-topic-search"
|
||||||
(click)="topicSearchControl.setValue('')">
|
(click)="topicSearchControl.setValue('')"
|
||||||
|
aria-label="Themensuche zurücksetzen">
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<app-topic-hierarchy
|
<app-topic-hierarchy
|
||||||
[selectedTopics]="selectedTopics"
|
[selectedTopics]="selectedTopics()"
|
||||||
[searchQuery]="topicSearchControl.value"
|
[searchQuery]="topicSearchControl.value"
|
||||||
|
[searchType]="topicSearchType()"
|
||||||
|
(searchTypeChange)="onTopicSearchTypeChange($event)"
|
||||||
(selectionChange)="onTopicSelectionChange($event)">
|
(selectionChange)="onTopicSelectionChange($event)">
|
||||||
</app-topic-hierarchy>
|
</app-topic-hierarchy>
|
||||||
</div>
|
</div>
|
||||||
@@ -158,6 +171,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
[formControl]="institutionControl"
|
[formControl]="institutionControl"
|
||||||
[matAutocomplete]="auto"
|
[matAutocomplete]="auto"
|
||||||
|
aria-label="Institution suchen"
|
||||||
placeholder="Institution suchen..."
|
placeholder="Institution suchen..."
|
||||||
(keyup.enter)="applySidebarFilters()" />
|
(keyup.enter)="applySidebarFilters()" />
|
||||||
<mat-autocomplete
|
<mat-autocomplete
|
||||||
@@ -183,7 +197,8 @@
|
|||||||
@if (institutionControl.value) {
|
@if (institutionControl.value) {
|
||||||
<button
|
<button
|
||||||
class="clear-topic-search"
|
class="clear-topic-search"
|
||||||
(click)="clearInstitutionFilter()">
|
(click)="clearInstitutionFilter()"
|
||||||
|
aria-label="Institution zurücksetzen">
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
@@ -198,7 +213,8 @@
|
|||||||
">
|
">
|
||||||
<mat-checkbox
|
<mat-checkbox
|
||||||
[formControl]="yearFilterEnabledControl"
|
[formControl]="yearFilterEnabledControl"
|
||||||
(change)="applySidebarFilters()">
|
(change)="applySidebarFilters()"
|
||||||
|
aria-label="Zusammenarbeit nach Jahr filtern">
|
||||||
<span
|
<span
|
||||||
style="font-size: 12px; font-weight: 500; color: var(--sg-text)"
|
style="font-size: 12px; font-weight: 500; color: var(--sg-text)"
|
||||||
>Zusammenarbeit nach Jahr filtern</span
|
>Zusammenarbeit nach Jahr filtern</span
|
||||||
@@ -217,7 +233,8 @@
|
|||||||
<mat-radio-group
|
<mat-radio-group
|
||||||
[formControl]="filterModeControl"
|
[formControl]="filterModeControl"
|
||||||
(change)="applySidebarFilters()"
|
(change)="applySidebarFilters()"
|
||||||
style="display: flex; gap: 16px">
|
style="display: flex; gap: 16px"
|
||||||
|
aria-label="Modus für Jahresfilter">
|
||||||
<mat-radio-button value="in"
|
<mat-radio-button value="in"
|
||||||
><span style="font-size: 12px; color: var(--sg-text)"
|
><span style="font-size: 12px; color: var(--sg-text)"
|
||||||
>Genau in</span
|
>Genau in</span
|
||||||
@@ -240,6 +257,7 @@
|
|||||||
[formControl]="filterYearControl"
|
[formControl]="filterYearControl"
|
||||||
(change)="applySidebarFilters()"
|
(change)="applySidebarFilters()"
|
||||||
(keyup.enter)="applySidebarFilters()"
|
(keyup.enter)="applySidebarFilters()"
|
||||||
|
aria-label="Jahr"
|
||||||
placeholder="Z. B. 2025" />
|
placeholder="Z. B. 2025" />
|
||||||
@if (filterYearControl.hasError('min')) {
|
@if (filterYearControl.hasError('min')) {
|
||||||
<mat-error>Jahr muss ≥ 1900 sein</mat-error>
|
<mat-error>Jahr muss ≥ 1900 sein</mat-error>
|
||||||
@@ -255,7 +273,10 @@
|
|||||||
|
|
||||||
<!-- Sidebar Footer Action showing matches count -->
|
<!-- Sidebar Footer Action showing matches count -->
|
||||||
<div class="sidebar-footer">
|
<div class="sidebar-footer">
|
||||||
<button class="submit-btn" (click)="applySidebarFilters()">
|
<button
|
||||||
|
class="submit-btn"
|
||||||
|
(click)="applySidebarFilters()"
|
||||||
|
aria-label="Gefundene Personen anzeigen">
|
||||||
<span [skText]="loading"
|
<span [skText]="loading"
|
||||||
>{{ total | number: '1.0-0' }} Personen anzeigen</span
|
>{{ total | number: '1.0-0' }} Personen anzeigen</span
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -13,18 +13,64 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.results-column {
|
// Shared flex layouts
|
||||||
|
.page-header,
|
||||||
|
.sidebar-header,
|
||||||
|
.toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header,
|
||||||
|
.toolbar {
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-header,
|
||||||
|
.toolbar {
|
||||||
|
border-bottom: 1px solid var(--sg-border);
|
||||||
|
padding-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.selection-summary,
|
||||||
|
.active-filters-row,
|
||||||
|
.chips-container,
|
||||||
|
.sort-selector,
|
||||||
|
.topic-search-wrapper {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-chip {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shared column & sidebar column layouts
|
||||||
|
.results-column,
|
||||||
|
.empty-state,
|
||||||
|
.filters-sidebar,
|
||||||
|
.filter-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
min-width: 0;
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shared containers styling
|
||||||
|
.selection-summary,
|
||||||
|
.active-filters-row,
|
||||||
|
.filters-sidebar {
|
||||||
|
background: var(--sg-surface);
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Individual styles
|
||||||
|
.results-column {
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
@@ -42,13 +88,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.selection-summary {
|
.selection-summary {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
background: var(--sg-surface);
|
|
||||||
border: 1px solid var(--sg-border);
|
|
||||||
border-radius: var(--sg-radius-sm);
|
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
display: block;
|
display: block;
|
||||||
@@ -65,13 +106,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.active-filters-row {
|
.active-filters-row {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
background: var(--sg-surface);
|
|
||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
border: 1px solid var(--sg-border);
|
|
||||||
border-radius: var(--sg-radius-sm);
|
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
@@ -82,15 +118,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chips-container {
|
.chips-container {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-chip {
|
.filter-chip {
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
padding: 2px 8px;
|
padding: 2px 8px;
|
||||||
background: var(--sg-surface-soft);
|
background: var(--sg-surface-soft);
|
||||||
@@ -99,53 +131,53 @@
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--sg-text);
|
color: var(--sg-text);
|
||||||
|
|
||||||
button {
|
|
||||||
border: none;
|
|
||||||
background: transparent;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 0;
|
|
||||||
display: flex;
|
|
||||||
color: var(--sg-text-soft);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: var(--sg-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
font-size: 12px;
|
|
||||||
width: 12px;
|
|
||||||
height: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shared button resets
|
||||||
|
.filter-chip button,
|
||||||
|
.clear-topic-search,
|
||||||
.clear-all-btn {
|
.clear-all-btn {
|
||||||
border: none;
|
border: none;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-chip button,
|
||||||
|
.clear-topic-search {
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
color: var(--sg-text-soft);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-chip button mat-icon {
|
||||||
|
font-size: 12px;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear-topic-search mat-icon {
|
||||||
|
font-size: 14px;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear-all-btn {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--sg-warning);
|
color: var(--sg-warning);
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toolbar {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
border-bottom: 1px solid var(--sg-border);
|
|
||||||
padding-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.result-count {
|
.result-count {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: var(--sg-text-muted);
|
color: var(--sg-text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sort-selector {
|
.sort-selector {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
color: var(--sg-text-muted);
|
color: var(--sg-text-muted);
|
||||||
@@ -159,6 +191,14 @@
|
|||||||
color: var(--sg-text);
|
color: var(--sg-text);
|
||||||
outline: none;
|
outline: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
border-color 0.15s,
|
||||||
|
box-shadow 0.15s;
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
border-color: var(--sg-primary);
|
||||||
|
box-shadow: 0 0 0 2px var(--sg-primary-soft);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +209,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.empty-state {
|
.empty-state {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 48px 16px;
|
padding: 48px 16px;
|
||||||
background: var(--sg-surface);
|
background: var(--sg-surface);
|
||||||
@@ -204,24 +242,14 @@ mat-paginator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.filters-sidebar {
|
.filters-sidebar {
|
||||||
background: var(--sg-surface);
|
|
||||||
border: 1px solid var(--sg-border);
|
|
||||||
border-radius: var(--sg-radius-sm);
|
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
box-shadow: var(--sg-shadow-sm);
|
box-shadow: var(--sg-shadow-sm);
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 16px;
|
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: 16px;
|
top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-header {
|
.sidebar-header {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
padding-bottom: 12px;
|
|
||||||
border-bottom: 1px solid var(--sg-border);
|
|
||||||
|
|
||||||
mat-icon {
|
mat-icon {
|
||||||
color: var(--sg-primary);
|
color: var(--sg-primary);
|
||||||
@@ -238,8 +266,6 @@ mat-paginator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.filter-section {
|
.filter-section {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,13 +278,18 @@ mat-paginator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.topic-search-wrapper {
|
.topic-search-wrapper {
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
background: var(--sg-surface-soft);
|
background: var(--sg-surface-soft);
|
||||||
border: 1px solid var(--sg-border);
|
border: 1px solid var(--sg-border);
|
||||||
border-radius: var(--sg-radius-sm);
|
border-radius: var(--sg-radius-sm);
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
|
transition:
|
||||||
|
border-color 0.15s,
|
||||||
|
box-shadow 0.15s;
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
|
border-color: var(--sg-primary);
|
||||||
|
box-shadow: 0 0 0 2px var(--sg-primary-soft);
|
||||||
|
}
|
||||||
|
|
||||||
mat-icon {
|
mat-icon {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@@ -276,20 +307,6 @@ mat-paginator {
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
margin-left: 6px;
|
margin-left: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clear-topic-search {
|
|
||||||
border: none;
|
|
||||||
background: transparent;
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
color: var(--sg-text-soft);
|
|
||||||
|
|
||||||
mat-icon {
|
|
||||||
font-size: 14px;
|
|
||||||
width: 14px;
|
|
||||||
height: 14px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-footer {
|
.sidebar-footer {
|
||||||
@@ -307,12 +324,21 @@ mat-paginator {
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.15s;
|
transition:
|
||||||
|
background 0.15s,
|
||||||
|
box-shadow 0.15s;
|
||||||
|
|
||||||
&:hover:not(:disabled) {
|
&:hover:not(:disabled) {
|
||||||
background: var(--sg-primary-strong);
|
background: var(--sg-primary-strong);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:focus-visible {
|
||||||
|
outline: none;
|
||||||
|
box-shadow:
|
||||||
|
0 0 0 2px var(--sg-background),
|
||||||
|
0 0 0 4px var(--sg-primary);
|
||||||
|
}
|
||||||
|
|
||||||
&:disabled {
|
&:disabled {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
|
|||||||
@@ -13,11 +13,7 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
|
|||||||
import { MatRadioModule } from '@angular/material/radio';
|
import { MatRadioModule } from '@angular/material/radio';
|
||||||
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||||
|
|
||||||
import {
|
import { CustomAuthor, PersonsService, InstitutionsService } from '../../api';
|
||||||
CustomAuthor,
|
|
||||||
PersonsService,
|
|
||||||
InstitutionsService,
|
|
||||||
} from '../../api';
|
|
||||||
import { TopicsService } from '../../api/api/topics.service';
|
import { TopicsService } from '../../api/api/topics.service';
|
||||||
import { TopicHierarchyComponent } from '../topic-hierarchy/topic-hierarchy.component';
|
import { TopicHierarchyComponent } from '../topic-hierarchy/topic-hierarchy.component';
|
||||||
import { PersonCardComponent } from '../person-card/person-card.component';
|
import { PersonCardComponent } from '../person-card/person-card.component';
|
||||||
@@ -82,8 +78,9 @@ export class PersonListComponent {
|
|||||||
defaultOrderValue = 'desc';
|
defaultOrderValue = 'desc';
|
||||||
|
|
||||||
// Selected filter states
|
// Selected filter states
|
||||||
selectedTopics = new Set<string>();
|
readonly selectedTopics = signal<Set<string>>(new Set<string>());
|
||||||
searchValue = signal<string | null>(null);
|
readonly searchValue = signal<string | null>(null);
|
||||||
|
readonly topicSearchType = signal<'hybrid' | 'semantic'>('hybrid');
|
||||||
|
|
||||||
// Applied filter states (reflecting actual URL query params)
|
// Applied filter states (reflecting actual URL query params)
|
||||||
appliedInstitutionName = '';
|
appliedInstitutionName = '';
|
||||||
@@ -148,11 +145,14 @@ export class PersonListComponent {
|
|||||||
const filterYear = params['filterYear']
|
const filterYear = params['filterYear']
|
||||||
? Number.parseInt(params['filterYear'], 10)
|
? Number.parseInt(params['filterYear'], 10)
|
||||||
: new Date().getFullYear() - 1;
|
: new Date().getFullYear() - 1;
|
||||||
|
const topicSearch = params['topicSearch'] || '';
|
||||||
|
const topicSearchType =
|
||||||
|
params['topicSearchType'] === 'semantic' ? 'semantic' : 'hybrid';
|
||||||
|
|
||||||
const topics = this.parseQueryParamArray(params['topic']);
|
const topics = this.parseQueryParamArray(params['topic']);
|
||||||
|
|
||||||
// restore values from query params
|
// restore values from query params
|
||||||
this.selectedTopics = new Set(topics);
|
this.selectedTopics.set(new Set(topics));
|
||||||
this.currentPage = page;
|
this.currentPage = page;
|
||||||
this.paginationService.selection = pageSize;
|
this.paginationService.selection = pageSize;
|
||||||
|
|
||||||
@@ -181,6 +181,10 @@ export class PersonListComponent {
|
|||||||
if (this.filterYearControl.value !== filterYear) {
|
if (this.filterYearControl.value !== filterYear) {
|
||||||
this.filterYearControl.setValue(filterYear);
|
this.filterYearControl.setValue(filterYear);
|
||||||
}
|
}
|
||||||
|
if (this.topicSearchControl.value !== topicSearch) {
|
||||||
|
this.topicSearchControl.setValue(topicSearch, { emitEvent: false });
|
||||||
|
}
|
||||||
|
this.topicSearchType.set(topicSearchType);
|
||||||
|
|
||||||
// Update applied filter states
|
// Update applied filter states
|
||||||
this.appliedInstitutionName = institutionName;
|
this.appliedInstitutionName = institutionName;
|
||||||
@@ -218,6 +222,22 @@ export class PersonListComponent {
|
|||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.applySidebarFilters();
|
this.applySidebarFilters();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.topicSearchControl.valueChanges
|
||||||
|
.pipe(
|
||||||
|
debounceTime(300),
|
||||||
|
distinctUntilChanged(),
|
||||||
|
takeUntilDestroyed(this.destroyRef),
|
||||||
|
)
|
||||||
|
.subscribe((val) => {
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: {
|
||||||
|
topicSearch: val || null,
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
replaceUrl: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateSortOrderState(value: any) {
|
private updateSortOrderState(value: any) {
|
||||||
@@ -241,7 +261,7 @@ export class PersonListComponent {
|
|||||||
|
|
||||||
// Filter selection checks
|
// Filter selection checks
|
||||||
isTopicSelected(topic: string): boolean {
|
isTopicSelected(topic: string): boolean {
|
||||||
return this.selectedTopics.has(topic);
|
return this.selectedTopics().has(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
isRelevanceSelected(): boolean {
|
isRelevanceSelected(): boolean {
|
||||||
@@ -249,11 +269,15 @@ export class PersonListComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleTopic(topic: string): void {
|
toggleTopic(topic: string): void {
|
||||||
if (this.selectedTopics.has(topic)) {
|
this.selectedTopics.update((set) => {
|
||||||
this.selectedTopics.delete(topic);
|
const next = new Set(set);
|
||||||
} else {
|
if (next.has(topic)) {
|
||||||
this.selectedTopics.add(topic);
|
next.delete(topic);
|
||||||
}
|
} else {
|
||||||
|
next.add(topic);
|
||||||
|
}
|
||||||
|
return next;
|
||||||
|
});
|
||||||
this.applySidebarFilters();
|
this.applySidebarFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,7 +288,7 @@ export class PersonListComponent {
|
|||||||
label: string;
|
label: string;
|
||||||
}> {
|
}> {
|
||||||
const list: Array<{ category: string; value: string; label: string }> = [];
|
const list: Array<{ category: string; value: string; label: string }> = [];
|
||||||
this.selectedTopics.forEach((t) => {
|
this.selectedTopics().forEach((t) => {
|
||||||
list.push({ category: 'topic', value: t, label: `Thema: ${t}` });
|
list.push({ category: 'topic', value: t, label: `Thema: ${t}` });
|
||||||
});
|
});
|
||||||
if (this.appliedInstitutionName) {
|
if (this.appliedInstitutionName) {
|
||||||
@@ -284,7 +308,11 @@ export class PersonListComponent {
|
|||||||
|
|
||||||
removeFilter(filter: { category: string; value: string }): void {
|
removeFilter(filter: { category: string; value: string }): void {
|
||||||
if (filter.category === 'topic') {
|
if (filter.category === 'topic') {
|
||||||
this.selectedTopics.delete(filter.value);
|
this.selectedTopics.update((set) => {
|
||||||
|
const next = new Set(set);
|
||||||
|
next.delete(filter.value);
|
||||||
|
return next;
|
||||||
|
});
|
||||||
} else if (filter.category === 'institutionName') {
|
} else if (filter.category === 'institutionName') {
|
||||||
this.institutionControl.setValue('', { emitEvent: false });
|
this.institutionControl.setValue('', { emitEvent: false });
|
||||||
this.updateYearFilterState('');
|
this.updateYearFilterState('');
|
||||||
@@ -297,7 +325,7 @@ export class PersonListComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearAllFilters(): void {
|
clearAllFilters(): void {
|
||||||
this.selectedTopics.clear();
|
this.selectedTopics.set(new Set<string>());
|
||||||
this.institutionControl.setValue('', { emitEvent: false });
|
this.institutionControl.setValue('', { emitEvent: false });
|
||||||
this.updateYearFilterState('');
|
this.updateYearFilterState('');
|
||||||
this.institutionOptions.set([]);
|
this.institutionOptions.set([]);
|
||||||
@@ -313,9 +341,12 @@ export class PersonListComponent {
|
|||||||
}
|
}
|
||||||
this.router.navigate([], {
|
this.router.navigate([], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
topic: this.selectedTopics.size
|
topic: this.selectedTopics().size
|
||||||
? Array.from(this.selectedTopics)
|
? Array.from(this.selectedTopics())
|
||||||
: null,
|
: null,
|
||||||
|
topicSearch: this.topicSearchControl.value || null,
|
||||||
|
topicSearchType:
|
||||||
|
this.topicSearchType() === 'semantic' ? 'semantic' : null,
|
||||||
institutionName: this.institutionControl.value || null,
|
institutionName: this.institutionControl.value || null,
|
||||||
sortBy: this.sortValueControl.value || null,
|
sortBy: this.sortValueControl.value || null,
|
||||||
sortOrder: this.sortOrderControl.value || null,
|
sortOrder: this.sortOrderControl.value || null,
|
||||||
@@ -367,12 +398,17 @@ export class PersonListComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onTopicSelectionChange(newSelection: Set<string>): void {
|
onTopicSelectionChange(newSelection: Set<string>): void {
|
||||||
this.selectedTopics = newSelection;
|
this.selectedTopics.set(newSelection);
|
||||||
|
this.applySidebarFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
onTopicSearchTypeChange(type: 'hybrid' | 'semantic'): void {
|
||||||
|
this.topicSearchType.set(type);
|
||||||
this.applySidebarFilters();
|
this.applySidebarFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
onCardTopicClick(topic: string): void {
|
onCardTopicClick(topic: string): void {
|
||||||
this.topicSearchControl.setValue(topic);
|
this.toggleTopic(topic);
|
||||||
}
|
}
|
||||||
|
|
||||||
onCardInstitutionClick(institutionName: string): void {
|
onCardInstitutionClick(institutionName: string): void {
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
<div class="page">
|
||||||
|
<div>
|
||||||
|
<h6>Nachrichten</h6>
|
||||||
|
<p>Aktuelle Nachrichten zu dieser Person.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="news-toolbar">
|
||||||
|
<mat-form-field appearance="outline" class="search-field">
|
||||||
|
<mat-icon matPrefix>search</mat-icon>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[formControl]="searchControl"
|
||||||
|
placeholder="Nachrichten durchsuchen..." />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="sort-field">
|
||||||
|
<mat-select
|
||||||
|
[value]="sortOrder"
|
||||||
|
(selectionChange)="onSortChange($event.value)">
|
||||||
|
<mat-option value="desc">Neueste zuerst</mat-option>
|
||||||
|
<mat-option value="asc">Älteste zuerst</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-wrap">
|
||||||
|
@if (loading) {
|
||||||
|
<div class="loading">
|
||||||
|
<mat-spinner diameter="36"></mat-spinner>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<table mat-table [dataSource]="articles" class="mat-elevation-z2">
|
||||||
|
<ng-container matColumnDef="maintitle">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Titel</th>
|
||||||
|
<td mat-cell *matCellDef="let article">
|
||||||
|
<a class="article-title" [routerLink]="['/news', article.id]">{{
|
||||||
|
article.maintitle || 'Kein Titel'
|
||||||
|
}}</a>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="author">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Autor</th>
|
||||||
|
<td mat-cell *matCellDef="let article">
|
||||||
|
{{ article.author || '-' }}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="date">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Datum</th>
|
||||||
|
<td mat-cell *matCellDef="let article">
|
||||||
|
{{ formatDate(article.date) }}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@if (!loading && articles.length === 0) {
|
||||||
|
<div class="empty-state">
|
||||||
|
@if (isSearching) {
|
||||||
|
Keine Ergebnisse für „{{ searchControl.value.trim() }}" gefunden.
|
||||||
|
} @else {
|
||||||
|
Keine Nachrichten gefunden.
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-footer">
|
||||||
|
<span>{{ articleRange() }}</span>
|
||||||
|
<mat-paginator
|
||||||
|
[length]="total"
|
||||||
|
[pageIndex]="currentPageIndex"
|
||||||
|
[pageSize]="paginationService.selection"
|
||||||
|
[pageSizeOptions]="paginationService.options"
|
||||||
|
(page)="onPage($event)">
|
||||||
|
</mat-paginator>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
.page {
|
||||||
|
padding: 28px 32px 42px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
h6 {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
font-size: 22px;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page > div:first-child p {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.news-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-field {
|
||||||
|
max-width: 480px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mat-mdc-form-field-subscript-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mat-mdc-text-field-wrapper {
|
||||||
|
height: 42px;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mat-mdc-form-field-infix {
|
||||||
|
min-height: unset;
|
||||||
|
height: 42px;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar .mdc-notched-outline__leading,
|
||||||
|
::ng-deep .news-toolbar .mdc-notched-outline__notch,
|
||||||
|
::ng-deep .news-toolbar .mdc-notched-outline__trailing {
|
||||||
|
border-color: #d9e2f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar input.mat-mdc-input-element {
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .news-toolbar input.mat-mdc-input-element::placeholder {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
opacity: 1;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-field {
|
||||||
|
width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-wrap {
|
||||||
|
position: relative;
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 600px;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0 10px;
|
||||||
|
background: transparent;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-title {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 520px;
|
||||||
|
line-height: 1.35;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: var(--sg-text);
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 1;
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
background: rgba(255, 255, 255, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
padding: 28px;
|
||||||
|
text-align: center;
|
||||||
|
color: rgba(0, 0, 0, 0.6);
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-header-cell {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-row {
|
||||||
|
height: 72px;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-cell {
|
||||||
|
color: var(--sg-text);
|
||||||
|
border-bottom-color: var(--sg-border);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-paginator {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
min-height: 66px;
|
||||||
|
padding: 0 22px 0 28px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.page {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-footer {
|
||||||
|
align-items: stretch;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
|
||||||
|
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
|
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
||||||
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
import { MatTableModule } from '@angular/material/table';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
import { debounceTime, distinctUntilChanged } from 'rxjs';
|
||||||
|
|
||||||
|
import { PaginationService } from '../../shared/services/pagination.service';
|
||||||
|
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||||
|
import { NewsArticle, NewsPage } from '../../resolvers/person-news.resolver';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-person-news',
|
||||||
|
imports: [
|
||||||
|
MatIconModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatPaginatorModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
|
MatTableModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
RouterLink,
|
||||||
|
],
|
||||||
|
templateUrl: './person-news.component.html',
|
||||||
|
styleUrl: './person-news.component.scss',
|
||||||
|
})
|
||||||
|
export class PersonNewsComponent implements OnInit {
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
readonly paginationService = inject(PaginationService);
|
||||||
|
private readonly resolverStateService = inject(ResolverStateService);
|
||||||
|
|
||||||
|
readonly searchControl = new FormControl('', { nonNullable: true });
|
||||||
|
|
||||||
|
displayedColumns = ['maintitle', 'author', 'date'];
|
||||||
|
articles: NewsArticle[] = [];
|
||||||
|
total = 0;
|
||||||
|
currentPageIndex = 0;
|
||||||
|
sortOrder: 'desc' | 'asc' = 'desc';
|
||||||
|
|
||||||
|
get loading(): boolean {
|
||||||
|
return this.resolverStateService.isResolving();
|
||||||
|
}
|
||||||
|
|
||||||
|
get isSearching(): boolean {
|
||||||
|
return this.searchControl.value.trim().length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.data
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe(({ newsPage }) => {
|
||||||
|
const page = newsPage as NewsPage;
|
||||||
|
this.articles = page.results ?? [];
|
||||||
|
this.total = page.total ?? 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.route.queryParamMap
|
||||||
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
|
.subscribe((params) => {
|
||||||
|
const page = params.get('page')
|
||||||
|
? Number.parseInt(params.get('page')!, 10)
|
||||||
|
: 1;
|
||||||
|
const pageSize = params.get('pageSize')
|
||||||
|
? Number.parseInt(params.get('pageSize')!, 10)
|
||||||
|
: 10;
|
||||||
|
const sortOrder = params.get('sortOrder');
|
||||||
|
const query = params.get('query') ?? '';
|
||||||
|
|
||||||
|
this.currentPageIndex = page - 1;
|
||||||
|
this.paginationService.selection = pageSize;
|
||||||
|
this.sortOrder = sortOrder === 'asc' ? 'asc' : 'desc';
|
||||||
|
this.searchControl.setValue(query, { emitEvent: false });
|
||||||
|
});
|
||||||
|
|
||||||
|
this.searchControl.valueChanges
|
||||||
|
.pipe(
|
||||||
|
debounceTime(300),
|
||||||
|
distinctUntilChanged(),
|
||||||
|
takeUntilDestroyed(this.destroyRef),
|
||||||
|
)
|
||||||
|
.subscribe((value) => {
|
||||||
|
this.updateQueryParams({
|
||||||
|
query: value.trim() || null,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onPage(event: PageEvent): void {
|
||||||
|
this.paginationService.selection = event.pageSize;
|
||||||
|
this.updateQueryParams({
|
||||||
|
page: event.pageIndex + 1,
|
||||||
|
pageSize: event.pageSize,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onSortChange(order: 'desc' | 'asc'): void {
|
||||||
|
this.updateQueryParams({
|
||||||
|
sortOrder: order,
|
||||||
|
page: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
formatDate(dateStr?: string | null): string {
|
||||||
|
if (!dateStr) return '-';
|
||||||
|
const date = new Date(dateStr);
|
||||||
|
if (isNaN(date.getTime())) return dateStr;
|
||||||
|
return new Intl.DateTimeFormat('de-DE').format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
articleRange(): string {
|
||||||
|
if (this.total === 0) return 'Keine Nachrichten gefunden';
|
||||||
|
const start = this.currentPageIndex * this.paginationService.selection + 1;
|
||||||
|
const end = Math.min(
|
||||||
|
start + this.paginationService.selection - 1,
|
||||||
|
this.total,
|
||||||
|
);
|
||||||
|
return `Zeige ${start} bis ${end} von ${this.total} Nachrichten`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateQueryParams(
|
||||||
|
overrides: Record<string, string | number | null>,
|
||||||
|
): void {
|
||||||
|
void this.router.navigate([], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: overrides,
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (selectedPatent.assignees.length > 0) {
|
@if (hasAsignees(selectedPatent)) {
|
||||||
<div class="detail-section">
|
<div class="detail-section">
|
||||||
<h4>Anmelder</h4>
|
<h4>Anmelder</h4>
|
||||||
<ul class="tag-list">
|
<ul class="tag-list">
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (selectedPatent.ipc.length > 0) {
|
@if (hasIpcs(selectedPatent)) {
|
||||||
<div class="detail-section">
|
<div class="detail-section">
|
||||||
<h4>Klassifikation (IPC)</h4>
|
<h4>Klassifikation (IPC)</h4>
|
||||||
<ul class="tag-list tag-list--compact">
|
<ul class="tag-list tag-list--compact">
|
||||||
@@ -76,7 +76,9 @@
|
|||||||
<div class="patents-list-toolbar">
|
<div class="patents-list-toolbar">
|
||||||
<label class="sort-control">
|
<label class="sort-control">
|
||||||
<span>Filter nach Quelle:</span>
|
<span>Filter nach Quelle:</span>
|
||||||
<select [value]="activeFilter" (change)="setFilter($any($event.target).value)">
|
<select
|
||||||
|
[value]="activeFilter"
|
||||||
|
(change)="setFilter($any($event.target).value)">
|
||||||
<option value="all">Alle</option>
|
<option value="all">Alle</option>
|
||||||
<option value="EPO">EPO</option>
|
<option value="EPO">EPO</option>
|
||||||
<option value="USPTO">USPTO</option>
|
<option value="USPTO">USPTO</option>
|
||||||
@@ -84,7 +86,9 @@
|
|||||||
</label>
|
</label>
|
||||||
<label class="sort-control">
|
<label class="sort-control">
|
||||||
<span>Sortieren nach:</span>
|
<span>Sortieren nach:</span>
|
||||||
<select [value]="sortMode" (change)="setSortMode($any($event.target).value)">
|
<select
|
||||||
|
[value]="sortMode"
|
||||||
|
(change)="setSortMode($any($event.target).value)">
|
||||||
<option value="date">Datum</option>
|
<option value="date">Datum</option>
|
||||||
<option value="title">Titel</option>
|
<option value="title">Titel</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -104,9 +108,14 @@
|
|||||||
<tr
|
<tr
|
||||||
[class.selected]="selectedPatent === patent"
|
[class.selected]="selectedPatent === patent"
|
||||||
(click)="selectPatent(patent)">
|
(click)="selectPatent(patent)">
|
||||||
<td class="patent-title">{{ patent.title ?? patent.patent_id }}</td>
|
<td class="patent-title">
|
||||||
|
{{ patent.title ?? patent.patent_id }}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span class="source-badge source-badge--{{ patent.source.toLowerCase() }}">
|
<span
|
||||||
|
class="source-badge source-badge--{{
|
||||||
|
patent.source.toLowerCase()
|
||||||
|
}}">
|
||||||
{{ patent.source }}
|
{{ patent.source }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
@@ -118,9 +127,17 @@
|
|||||||
|
|
||||||
@if (hasPagination()) {
|
@if (hasPagination()) {
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<button [disabled]="selectedPage === 1" (click)="setPage(selectedPage - 1)">Zurück</button>
|
<button
|
||||||
|
[disabled]="selectedPage === 1"
|
||||||
|
(click)="setPage(selectedPage - 1)">
|
||||||
|
Zurück
|
||||||
|
</button>
|
||||||
<span>Seite {{ selectedPage }} von {{ getPageCount() }}</span>
|
<span>Seite {{ selectedPage }} von {{ getPageCount() }}</span>
|
||||||
<button [disabled]="selectedPage === getPageCount()" (click)="setPage(selectedPage + 1)">Weiter</button>
|
<button
|
||||||
|
[disabled]="selectedPage === getPageCount()"
|
||||||
|
(click)="setPage(selectedPage + 1)">
|
||||||
|
Weiter
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -132,7 +149,10 @@
|
|||||||
<div class="stat stat--clickable" (click)="openDetail()">
|
<div class="stat stat--clickable" (click)="openDetail()">
|
||||||
<span class="stat-label">Quelle</span>
|
<span class="stat-label">Quelle</span>
|
||||||
<span class="stat-value">
|
<span class="stat-value">
|
||||||
<span class="source-badge source-badge--{{ selectedPatent.source.toLowerCase() }}">
|
<span
|
||||||
|
class="source-badge source-badge--{{
|
||||||
|
selectedPatent.source.toLowerCase()
|
||||||
|
}}">
|
||||||
{{ selectedPatent.source }}
|
{{ selectedPatent.source }}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@@ -143,7 +163,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="stat">
|
<div class="stat">
|
||||||
<span class="stat-label">Datum</span>
|
<span class="stat-label">Datum</span>
|
||||||
<span class="stat-value">{{ formatDate(selectedPatent.publication_date) }}</span>
|
<span class="stat-value">{{
|
||||||
|
formatDate(selectedPatent.publication_date || '')
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -194,7 +194,9 @@
|
|||||||
|
|
||||||
.stat--clickable {
|
.stat--clickable {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: border-color 0.15s, background 0.15s;
|
transition:
|
||||||
|
border-color 0.15s,
|
||||||
|
background 0.15s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
border-color: #0b63ce;
|
border-color: #0b63ce;
|
||||||
@@ -239,7 +241,7 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
align-self: flex-start; // NEU
|
align-self: flex-start; // NEU
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Component, OnInit, inject } from '@angular/core';
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { PatentsService, PatentEntry } from '../../api/api/patents.service';
|
import { PatentsService } from '../../api/api/patents.service';
|
||||||
|
import { PatentEntry } from '../../api';
|
||||||
|
|
||||||
type SortMode = 'date' | 'title';
|
type SortMode = 'date' | 'title';
|
||||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||||
@@ -32,6 +33,14 @@ export class PersonPatentsComponent implements OnInit {
|
|||||||
selectedPage = 1;
|
selectedPage = 1;
|
||||||
readonly pageSize = 10;
|
readonly pageSize = 10;
|
||||||
|
|
||||||
|
hasAsignees(selectedPatent: PatentEntry | null): boolean {
|
||||||
|
return !!selectedPatent?.assignees && selectedPatent.assignees.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasIpcs(selectedPatent: PatentEntry | null): boolean {
|
||||||
|
return !!selectedPatent?.ipc && selectedPatent.ipc.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.route.parent?.paramMap.subscribe((params) => {
|
this.route.parent?.paramMap.subscribe((params) => {
|
||||||
const authorId = params.get('id') ?? '';
|
const authorId = params.get('id') ?? '';
|
||||||
@@ -101,9 +110,13 @@ export class PersonPatentsComponent implements OnInit {
|
|||||||
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
|
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
|
||||||
return [...patents].sort((a, b) => {
|
return [...patents].sort((a, b) => {
|
||||||
if (this.sortMode === 'date') {
|
if (this.sortMode === 'date') {
|
||||||
return (b.publication_date ?? '').localeCompare(a.publication_date ?? '');
|
return (b.publication_date ?? '').localeCompare(
|
||||||
|
a.publication_date ?? '',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return (a.title ?? '').localeCompare(b.title ?? '', 'de', { sensitivity: 'base' });
|
return (a.title ?? '').localeCompare(b.title ?? '', 'de', {
|
||||||
|
sensitivity: 'base',
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,7 @@
|
|||||||
<div class="metric-item">
|
<div class="metric-item">
|
||||||
<mat-icon>event_busy</mat-icon>
|
<mat-icon>event_busy</mat-icon>
|
||||||
<div class="metric-content">
|
<div class="metric-content">
|
||||||
<strong>{{
|
<strong>{{ getFundingStatus(getEndDate()) }}</strong>
|
||||||
getFundingStatus(getEndDate())
|
|
||||||
}}</strong>
|
|
||||||
<span>Enddatum</span>
|
<span>Enddatum</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -165,7 +163,6 @@
|
|||||||
<dt>Ausführende Stelle</dt>
|
<dt>Ausführende Stelle</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{{ bundProject.executing_agency }}
|
{{ bundProject.executing_agency }}
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -183,7 +180,6 @@
|
|||||||
bundProject.project_agency_fullname ||
|
bundProject.project_agency_fullname ||
|
||||||
bundProject.project_agency
|
bundProject.project_agency
|
||||||
}}
|
}}
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -225,7 +221,6 @@
|
|||||||
<dt>Standort</dt>
|
<dt>Standort</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{{ bundProject.location }}
|
{{ bundProject.location }}
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -328,7 +323,6 @@
|
|||||||
<dt>Förderart</dt>
|
<dt>Förderart</dt>
|
||||||
<dd>
|
<dd>
|
||||||
{{ bundProject.funding_type }}
|
{{ bundProject.funding_type }}
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,7 +136,9 @@
|
|||||||
@if (getInstitutions().length > 0) {
|
@if (getInstitutions().length > 0) {
|
||||||
<div class="institution-grid">
|
<div class="institution-grid">
|
||||||
@for (institution of getInstitutions(); track institution) {
|
@for (institution of getInstitutions(); track institution) {
|
||||||
<div (click)="searchForInstitutionName(institution)" class="institution-item">
|
<div
|
||||||
|
(click)="searchForInstitutionName(institution)"
|
||||||
|
class="institution-item">
|
||||||
<mat-icon>apartment</mat-icon>
|
<mat-icon>apartment</mat-icon>
|
||||||
<span>{{ institution }}</span>
|
<span>{{ institution }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -203,7 +205,7 @@
|
|||||||
<dt>Fördersende</dt>
|
<dt>Fördersende</dt>
|
||||||
<dd>{{ getFundingStatus(dfgProject.funding_end_date) }}</dd>
|
<dd>{{ getFundingStatus(dfgProject.funding_end_date) }}</dd>
|
||||||
</div>
|
</div>
|
||||||
@if (dfgProject.subproject_of ) {
|
@if (dfgProject.subproject_of) {
|
||||||
<div class="detail-row">
|
<div class="detail-row">
|
||||||
<dt>Teilprojekt von</dt>
|
<dt>Teilprojekt von</dt>
|
||||||
<dd>{{ dfgProject.subproject_of }}</dd>
|
<dd>{{ dfgProject.subproject_of }}</dd>
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.person-item:hover {
|
.person-item:hover {
|
||||||
cursor:pointer;
|
cursor: pointer;
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
border-color: #b8c5d6;
|
border-color: #b8c5d6;
|
||||||
}
|
}
|
||||||
@@ -302,14 +302,14 @@ h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.person-name {
|
.person-name {
|
||||||
cursor:pointer;
|
cursor: pointer;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: var(--sg-text);
|
color: var(--sg-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.institution-grid {
|
.institution-grid {
|
||||||
cursor:pointer;
|
cursor: pointer;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class DfgDetailsComponent implements OnInit {
|
|||||||
private route = inject(ActivatedRoute);
|
private route = inject(ActivatedRoute);
|
||||||
dfgProject: DfgProjectDetails | undefined;
|
dfgProject: DfgProjectDetails | undefined;
|
||||||
|
|
||||||
constructor (private router:Router){}
|
constructor(private router: Router) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.route.data.subscribe(({ dfgSingleProject }) => {
|
this.route.data.subscribe(({ dfgSingleProject }) => {
|
||||||
@@ -46,15 +46,15 @@ export class DfgDetailsComponent implements OnInit {
|
|||||||
searchForPersonName(personName: string): void {
|
searchForPersonName(personName: string): void {
|
||||||
this.router.navigate(['/persons'], {
|
this.router.navigate(['/persons'], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
query: personName
|
query: personName,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
searchForInstitutionName(institutionName: string): void {
|
searchForInstitutionName(institutionName: string): void {
|
||||||
this.router.navigate(['/institutions'], {
|
this.router.navigate(['/institutions'], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
search: institutionName
|
search: institutionName,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,35 +5,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<mat-card appearance="outlined">
|
<mat-card appearance="outlined">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<mat-form-field style="width: 100%">
|
<app-query-param-input label="Suche nach Titel" queryParamKey="search" />
|
||||||
<mat-label>Suche nach Titel</mat-label>
|
|
||||||
<input
|
|
||||||
matInput
|
|
||||||
type="search"
|
|
||||||
[debounceTime]="300"
|
|
||||||
[(debouncedValue)]="urlSearchTerm"
|
|
||||||
(debouncedValueChange)="handleSearchTermChange($event)" />
|
|
||||||
<mat-icon matPrefix>search</mat-icon>
|
|
||||||
<button matIconButton matSuffix (click)="clearSearchTerm()">
|
|
||||||
<mat-icon>clear</mat-icon>
|
|
||||||
</button>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="DFG">
|
<mat-tab label="DFG">
|
||||||
<app-data-table
|
<app-data-table
|
||||||
[columns]="dfgProjectColumns"
|
[columns]="dfgProjectColumns"
|
||||||
[data]="dfgProjectData"
|
[data]="dfgProjectData"
|
||||||
[detailTemplate]="dfgProjectDetailRowTmp"
|
[detailTemplate]="dfgProjectDetailRowTmp"
|
||||||
[activeSortKey]="urlSortKey()"
|
queryParamSortKey="sort_by"
|
||||||
[sortDirection]="urlSortDirection()"
|
queryParamSortDirectionKey="sort_direction" />
|
||||||
(sortChange)="handleSortChange($event)" />
|
</mat-tab>
|
||||||
|
<mat-tab label="EU">
|
||||||
|
<app-data-table
|
||||||
|
[columns]="personCordisEuProjectColumns"
|
||||||
|
[data]="personCordisEuProjectData"
|
||||||
|
queryParamSortKey="sort_by"
|
||||||
|
queryParamSortDirectionKey="sort_direction" />
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
<mat-paginator
|
<app-query-param-paginator
|
||||||
[length]="this.pageTotal()"
|
[total]="this.pageTotal()"
|
||||||
[pageSize]="this.pageSize()"
|
[pageSizeOptions]="[10]" />
|
||||||
[pageIndex]="this.pageIndex()"
|
|
||||||
(page)="handlePageChange($event)" />
|
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -66,3 +58,25 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #euProjectsFundingStartTmp let-element>
|
||||||
|
{{ element.startDate | date: 'dd.MM.yyyy' }}
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #euProjectsFundingEndTmp let-element>
|
||||||
|
{{ element.endDate | date: 'dd.MM.yyyy' }}
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #euProjectsFundingAmountTmp let-element>
|
||||||
|
{{ element.ecMaxContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template #euProjectsActionsTmp let-element>
|
||||||
|
<a
|
||||||
|
[routerLink]="['/projects/eu', element.id]"
|
||||||
|
target="_blank"
|
||||||
|
mat-icon-button
|
||||||
|
color="primary">
|
||||||
|
<mat-icon>open_in_new</mat-icon>
|
||||||
|
</a>
|
||||||
|
</ng-template>
|
||||||
|
|||||||
@@ -4,11 +4,15 @@ import {
|
|||||||
effect,
|
effect,
|
||||||
input,
|
input,
|
||||||
OnInit,
|
OnInit,
|
||||||
signal,
|
|
||||||
TemplateRef,
|
TemplateRef,
|
||||||
viewChild,
|
viewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { DfgProjectPage, DfgProjectSummary } from '../../api';
|
import {
|
||||||
|
CordisEuProject,
|
||||||
|
CordisEuProjectPage,
|
||||||
|
DfgProjectPage,
|
||||||
|
DfgProjectSummary,
|
||||||
|
} from '../../api';
|
||||||
import {
|
import {
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
GenericColumn,
|
GenericColumn,
|
||||||
@@ -19,11 +23,10 @@ import { MatCardModule } from '@angular/material/card';
|
|||||||
import { MatTabsModule } from '@angular/material/tabs';
|
import { MatTabsModule } from '@angular/material/tabs';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
import { MatInputModule } from '@angular/material/input';
|
||||||
import { DebounceDirective } from '../../directives/debounce.directive';
|
import { Router, RouterModule } from '@angular/router';
|
||||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
import { CurrencyPipe, DatePipe } from '@angular/common';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||||
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||||
import { Sort, SortDirection } from '@angular/material/sort';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-person-projects',
|
selector: 'app-person-projects',
|
||||||
@@ -35,9 +38,11 @@ import { Sort, SortDirection } from '@angular/material/sort';
|
|||||||
MatTabsModule,
|
MatTabsModule,
|
||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
DebounceDirective,
|
|
||||||
MatPaginatorModule,
|
|
||||||
RouterModule,
|
RouterModule,
|
||||||
|
DatePipe,
|
||||||
|
CurrencyPipe,
|
||||||
|
QueryParamPaginatorComponent,
|
||||||
|
QueryParamInputComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './person-projects.component.html',
|
templateUrl: './person-projects.component.html',
|
||||||
styleUrl: './person-projects.component.scss',
|
styleUrl: './person-projects.component.scss',
|
||||||
@@ -57,48 +62,35 @@ export class PersonProjectsComponent implements OnInit {
|
|||||||
'dfgProjectDetailRowTmp',
|
'dfgProjectDetailRowTmp',
|
||||||
);
|
);
|
||||||
|
|
||||||
urlSearchTerm = signal<string>('');
|
personCordisEuProjectPage = input.required<CordisEuProjectPage>();
|
||||||
urlSortKey = signal<string>('');
|
personCordisEuProjectColumns: GenericColumn<CordisEuProject>[] = [];
|
||||||
urlSortDirection = signal<SortDirection>('');
|
personCordisEuProjectData: CordisEuProject[] = [];
|
||||||
|
|
||||||
|
euProjectsFundingStartTmp = viewChild.required<TemplateRef<any>>(
|
||||||
|
'euProjectsFundingStartTmp',
|
||||||
|
);
|
||||||
|
euProjectsFundingEndTmp = viewChild.required<TemplateRef<any>>(
|
||||||
|
'euProjectsFundingEndTmp',
|
||||||
|
);
|
||||||
|
euProjectsFundingAmountTmp = viewChild.required<TemplateRef<any>>(
|
||||||
|
'euProjectsFundingAmountTmp',
|
||||||
|
);
|
||||||
|
euProjectsActionsTmp = viewChild.required<TemplateRef<any>>(
|
||||||
|
'euProjectsActionsTmp',
|
||||||
|
);
|
||||||
|
|
||||||
readonly pageTotal = computed(() => {
|
readonly pageTotal = computed(() => {
|
||||||
return this.dfgProjectPage()?.total ?? 0;
|
return this.dfgProjectPage()?.total ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
readonly pageSize = computed(() => {
|
constructor(private readonly router: Router) {
|
||||||
return this.dfgProjectPage()?.size ?? 10;
|
|
||||||
});
|
|
||||||
|
|
||||||
readonly pageIndex = computed(() => {
|
|
||||||
return this.dfgProjectPage()?.page ?? 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private readonly router: Router,
|
|
||||||
private readonly activatedRoute: ActivatedRoute,
|
|
||||||
) {
|
|
||||||
this.activatedRoute.queryParamMap
|
|
||||||
.pipe(takeUntilDestroyed())
|
|
||||||
.subscribe((params) => {
|
|
||||||
this.urlSearchTerm.set(params.get('search') || '');
|
|
||||||
});
|
|
||||||
|
|
||||||
effect(() => {
|
effect(() => {
|
||||||
console.log(
|
|
||||||
'PersonProjectsComponent: dfgProjectPage changed',
|
|
||||||
this.dfgProjectPage(),
|
|
||||||
);
|
|
||||||
this.dfgProjectData = this.dfgProjectPage().elements || [];
|
this.dfgProjectData = this.dfgProjectPage().elements || [];
|
||||||
});
|
});
|
||||||
|
|
||||||
effect(() => {
|
effect(() => {
|
||||||
const searchTerm = this.urlSearchTerm();
|
this.personCordisEuProjectData =
|
||||||
if (searchTerm) {
|
this.personCordisEuProjectPage().elements || [];
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: searchTerm },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,33 +123,38 @@ export class PersonProjectsComponent implements OnInit {
|
|||||||
cellTemplate: this.dfgProjectActionsTmp(),
|
cellTemplate: this.dfgProjectActionsTmp(),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
|
||||||
handleSearchTermChange(newTerm: string): void {
|
this.personCordisEuProjectColumns = [
|
||||||
this.router.navigate([], {
|
{
|
||||||
queryParams: { search: newTerm },
|
id: 'title',
|
||||||
queryParamsHandling: 'merge',
|
header: 'Titel',
|
||||||
});
|
type: 'accessor',
|
||||||
}
|
accessorKey: 'title',
|
||||||
|
},
|
||||||
clearSearchTerm(): void {
|
{
|
||||||
this.router.navigate([], {
|
id: 'startDate',
|
||||||
queryParams: { search: null },
|
header: 'Startdatum',
|
||||||
queryParamsHandling: 'merge',
|
type: 'display',
|
||||||
});
|
cellTemplate: this.euProjectsFundingStartTmp(),
|
||||||
}
|
},
|
||||||
|
{
|
||||||
handlePageChange(event: PageEvent): void {
|
id: 'endDate',
|
||||||
this.router.navigate([], {
|
header: 'Enddatum',
|
||||||
queryParams: { page: event.pageIndex, size: event.pageSize },
|
type: 'display',
|
||||||
queryParamsHandling: 'merge',
|
cellTemplate: this.euProjectsFundingEndTmp(),
|
||||||
});
|
},
|
||||||
}
|
{
|
||||||
|
id: 'ecMaxContribution',
|
||||||
handleSortChange(event: Sort): void {
|
header: 'Förderbetrag (EU)',
|
||||||
this.router.navigate([], {
|
type: 'display',
|
||||||
queryParams: { sort_by: event.active, sort_direction: event.direction },
|
cellTemplate: this.euProjectsFundingAmountTmp(),
|
||||||
queryParamsHandling: 'merge',
|
},
|
||||||
});
|
{
|
||||||
|
id: 'actions',
|
||||||
|
header: '',
|
||||||
|
type: 'display',
|
||||||
|
cellTemplate: this.euProjectsActionsTmp(),
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,15 +119,20 @@ export class PersonComponent {
|
|||||||
() => this.person()?.affiliations?.[0] ?? null,
|
() => this.person()?.affiliations?.[0] ?? null,
|
||||||
);
|
);
|
||||||
readonly lastAffiliation = computed(() => {
|
readonly lastAffiliation = computed(() => {
|
||||||
let lastAffiliation: number | undefined = 0;
|
const affiliations = this.person()?.affiliations ?? [];
|
||||||
if (this.person()?.affiliations?.length != undefined) {
|
let newestAffiliation = affiliations[0] ?? null;
|
||||||
lastAffiliation = this.person()?.affiliations?.length;
|
let newestYear = -1;
|
||||||
|
|
||||||
|
for (const affiliation of affiliations) {
|
||||||
|
for (const jahr of affiliation.years ?? []) {
|
||||||
|
if (jahr > newestYear) {
|
||||||
|
newestYear = jahr;
|
||||||
|
newestAffiliation = affiliation;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (
|
|
||||||
(lastAffiliation
|
return newestAffiliation;
|
||||||
? this.person()?.affiliations?.[lastAffiliation - 1]
|
|
||||||
: this.person()?.affiliations?.[0]) ?? null
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
readonly institution = computed(
|
readonly institution = computed(
|
||||||
() =>
|
() =>
|
||||||
@@ -186,6 +191,7 @@ export class PersonComponent {
|
|||||||
{ label: 'Netzwerk', path: 'network', disabled: false },
|
{ label: 'Netzwerk', path: 'network', disabled: false },
|
||||||
{ label: 'Unternehmen', path: 'company-connections', disabled: false },
|
{ label: 'Unternehmen', path: 'company-connections', disabled: false },
|
||||||
{ label: 'Förderungen', path: 'funding', disabled: false },
|
{ label: 'Förderungen', path: 'funding', disabled: false },
|
||||||
|
{ label: 'Nachrichten', path: 'news', disabled: false },
|
||||||
{ label: 'Patente', path: 'patents', disabled: false },
|
{ label: 'Patente', path: 'patents', disabled: false },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -4,19 +4,11 @@
|
|||||||
<mat-divider />
|
<mat-divider />
|
||||||
|
|
||||||
<div style="padding: 0 1rem">
|
<div style="padding: 0 1rem">
|
||||||
<mat-form-field style="width: 100%">
|
<app-query-param-input
|
||||||
<mat-label>Suche nach Namen</mat-label>
|
label="Suche nach Namen"
|
||||||
<input
|
[debounceTime]="400"
|
||||||
matInput
|
queryParamKey="search">
|
||||||
type="search"
|
</app-query-param-input>
|
||||||
[debounceTime]="300"
|
|
||||||
[(debouncedValue)]="urlSearchTerm"
|
|
||||||
(debouncedValueChange)="handleSearchTermChange($event)" />
|
|
||||||
<mat-icon matPrefix>search</mat-icon>
|
|
||||||
<button matIconButton matSuffix (click)="clearSearchTerm()">
|
|
||||||
<mat-icon>clear</mat-icon>
|
|
||||||
</button>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style="
|
style="
|
||||||
@@ -34,16 +26,13 @@
|
|||||||
</mat-chip-listbox>
|
</mat-chip-listbox>
|
||||||
|
|
||||||
<div class="sorting">
|
<div class="sorting">
|
||||||
<select (change)="handleSortFieldChange($event)" [value]="urlSortBy()">
|
<app-query-param-selector
|
||||||
<option value="title">Name</option>
|
[options]="sortingOptions"
|
||||||
</select>
|
queryParamKey="sort_by" />
|
||||||
|
|
||||||
<select
|
<app-query-param-selector
|
||||||
(change)="handleSortOrderChange($event)"
|
[options]="sortingDirectionOptions"
|
||||||
[value]="urlSortingOrder()">
|
queryParamKey="sorting_order" />
|
||||||
<option value="desc">Absteigend</option>
|
|
||||||
<option value="asc">Aufsteigend</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -102,11 +91,7 @@
|
|||||||
|
|
||||||
<mat-divider />
|
<mat-divider />
|
||||||
|
|
||||||
<mat-paginator
|
<app-query-param-paginator
|
||||||
[length]="fundingProjectPageValue.total"
|
[total]="fundingProjectPageValue.total || 0"
|
||||||
[pageSize]="fundingProjectPageValue.size"
|
[pageSizeOptions]="[10, 25, 50]" />
|
||||||
[pageSizeOptions]="[10, 20, 50]"
|
|
||||||
[pageIndex]="fundingProjectPageValue.page"
|
|
||||||
(page)="handlePageChange($event)">
|
|
||||||
</mat-paginator>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -25,22 +25,10 @@
|
|||||||
.cards {
|
.cards {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 900px) {
|
|
||||||
.cards {
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
.cards {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mat-paginator {
|
mat-paginator {
|
||||||
background-color: var(--sg-background);
|
background-color: var(--sg-background);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,34 @@
|
|||||||
import { Component, effect, input, signal } from '@angular/core';
|
import { Component, input, signal } from '@angular/core';
|
||||||
import { FundingProject, FundingProjectPage, ProjectType } from '../../api';
|
import { FundingProject, FundingProjectPage, ProjectType } from '../../api';
|
||||||
import { MatDividerModule } from '@angular/material/divider';
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
||||||
import { DebounceDirective } from '../../directives/debounce.directive';
|
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatCardModule } from '@angular/material/card';
|
import { MatCardModule } from '@angular/material/card';
|
||||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
import { MatPaginator, PageEvent } from '@angular/material/paginator';
|
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
import { MatInputModule } from '@angular/material/input';
|
|
||||||
import { MatButtonModule } from '@angular/material/button';
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
import { DatePipe, UpperCasePipe } from '@angular/common';
|
import { DatePipe, UpperCasePipe } from '@angular/common';
|
||||||
import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips';
|
import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips';
|
||||||
|
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||||
|
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||||
|
import {
|
||||||
|
QueryParamSelectorComponent,
|
||||||
|
SelectorOption,
|
||||||
|
} from '../../shared/ui/query-param-selector/query-param-selector.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-projects',
|
selector: 'app-projects',
|
||||||
imports: [
|
imports: [
|
||||||
MatDividerModule,
|
MatDividerModule,
|
||||||
MatFormFieldModule,
|
|
||||||
DebounceDirective,
|
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatCardModule,
|
MatCardModule,
|
||||||
RouterModule,
|
RouterModule,
|
||||||
MatPaginator,
|
|
||||||
MatInputModule,
|
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
UpperCasePipe,
|
UpperCasePipe,
|
||||||
DatePipe,
|
DatePipe,
|
||||||
MatChipsModule,
|
MatChipsModule,
|
||||||
|
QueryParamInputComponent,
|
||||||
|
QueryParamPaginatorComponent,
|
||||||
|
QueryParamSelectorComponent,
|
||||||
],
|
],
|
||||||
templateUrl: './projects.component.html',
|
templateUrl: './projects.component.html',
|
||||||
styleUrl: './projects.component.scss',
|
styleUrl: './projects.component.scss',
|
||||||
@@ -35,11 +36,14 @@ import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips';
|
|||||||
export class ProjectsComponent {
|
export class ProjectsComponent {
|
||||||
fundingProjectPage = input.required<FundingProjectPage>();
|
fundingProjectPage = input.required<FundingProjectPage>();
|
||||||
|
|
||||||
urlSearchTerm = signal<string>('');
|
|
||||||
urlSortBy = signal<string>('relevance');
|
|
||||||
urlSortingOrder = signal<string>('desc');
|
|
||||||
urlChips = signal<ProjectType[]>(['eu', 'bund', 'dfg']);
|
urlChips = signal<ProjectType[]>(['eu', 'bund', 'dfg']);
|
||||||
|
|
||||||
|
sortingOptions: SelectorOption[] = [{ value: 'title', display_name: 'Name' }];
|
||||||
|
sortingDirectionOptions: SelectorOption[] = [
|
||||||
|
{ value: 'asc', display_name: 'Aufsteigend' },
|
||||||
|
{ value: 'desc', display_name: 'Absteigend' },
|
||||||
|
];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly activatedRoute: ActivatedRoute,
|
private readonly activatedRoute: ActivatedRoute,
|
||||||
private readonly router: Router,
|
private readonly router: Router,
|
||||||
@@ -47,60 +51,10 @@ export class ProjectsComponent {
|
|||||||
this.activatedRoute.queryParams
|
this.activatedRoute.queryParams
|
||||||
.pipe(takeUntilDestroyed())
|
.pipe(takeUntilDestroyed())
|
||||||
.subscribe((params) => {
|
.subscribe((params) => {
|
||||||
this.urlSearchTerm.set(params['search'] || '');
|
|
||||||
this.urlSortBy.set(params['sort_by'] || 'relevance');
|
|
||||||
this.urlSortingOrder.set(params['sorting_order'] || 'desc');
|
|
||||||
this.urlChips.set(
|
this.urlChips.set(
|
||||||
(params['selected_project_types'] || 'eu,bund,dfg').split(','),
|
(params['selected_project_types'] || 'eu,bund,dfg').split(','),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
effect(() => {
|
|
||||||
const searchTerm = this.urlSearchTerm();
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: searchTerm },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSearchTermChange(newTerm: string): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: newTerm },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
clearSearchTerm(): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { search: null },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handlePageChange(event: PageEvent): void {
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { page: event.pageIndex, size: event.pageSize },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSortFieldChange(event: Event): void {
|
|
||||||
const selectElement = event.target as HTMLSelectElement;
|
|
||||||
const sortField = selectElement.value;
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { sort_by: sortField },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleSortOrderChange(event: Event): void {
|
|
||||||
const selectElement = event.target as HTMLSelectElement;
|
|
||||||
const sortOrder = selectElement.value;
|
|
||||||
this.router.navigate([], {
|
|
||||||
queryParams: { sorting_order: sortOrder },
|
|
||||||
queryParamsHandling: 'merge',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChipBoxChange(change: MatChipListboxChange): void {
|
handleChipBoxChange(change: MatChipListboxChange): void {
|
||||||
|
|||||||
@@ -1,11 +1,44 @@
|
|||||||
<div class="hierarchy-container">
|
<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 value="hybrid">
|
||||||
|
<span style="font-size: 12px; color: var(--sg-text)">Hybrid</span>
|
||||||
|
</mat-radio-button>
|
||||||
|
<mat-radio-button value="semantic">
|
||||||
|
<span style="font-size: 12px; color: var(--sg-text)">Semantisch</span>
|
||||||
|
</mat-radio-button>
|
||||||
|
</mat-radio-group>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@if (loading()) {
|
@if (loading()) {
|
||||||
<div class="loading-state">
|
<div class="loading-state">
|
||||||
<mat-spinner diameter="24"></mat-spinner>
|
<mat-spinner diameter="24"></mat-spinner>
|
||||||
<span>Lade Themen...</span>
|
<span>Lade Themen...</span>
|
||||||
</div>
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
@if (searchQuery) {
|
@if (searchQuery()) {
|
||||||
<!-- Flat Search Results Mode -->
|
<!-- Flat Search Results Mode -->
|
||||||
<div class="search-results">
|
<div class="search-results">
|
||||||
<span class="results-meta"
|
<span class="results-meta"
|
||||||
@@ -15,8 +48,13 @@
|
|||||||
@for (topic of filteredFlatTopics; track topic.id) {
|
@for (topic of filteredFlatTopics; track topic.id) {
|
||||||
<div class="flat-row">
|
<div class="flat-row">
|
||||||
<mat-checkbox
|
<mat-checkbox
|
||||||
[checked]="selectedTopics.has(topic.name)"
|
#tooltip="matTooltip"
|
||||||
(change)="toggleTopic(topic.name)">
|
[checked]="selectedTopics().has(topic.name)"
|
||||||
|
(change)="toggleTopic(topic.name)"
|
||||||
|
[matTooltip]="topic.name"
|
||||||
|
matTooltipPosition="above"
|
||||||
|
(focusin)="tooltip.show()"
|
||||||
|
(focusout)="tooltip.hide()">
|
||||||
<span class="topic-name">{{ topic.name }}</span>
|
<span class="topic-name">{{ topic.name }}</span>
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
<span class="topic-path" [title]="topic.path">{{
|
<span class="topic-path" [title]="topic.path">{{
|
||||||
@@ -103,13 +141,18 @@
|
|||||||
<!-- LEVEL 4: Topic Checkbox -->
|
<!-- LEVEL 4: Topic Checkbox -->
|
||||||
<div class="tree-leaf topic-node">
|
<div class="tree-leaf topic-node">
|
||||||
<mat-checkbox
|
<mat-checkbox
|
||||||
[checked]="selectedTopics.has(topic.name)"
|
#tooltip="matTooltip"
|
||||||
(change)="toggleTopic(topic.name)">
|
[checked]="
|
||||||
<span
|
selectedTopics().has(topic.name)
|
||||||
class="topic-label"
|
"
|
||||||
[title]="topic.name"
|
(change)="toggleTopic(topic.name)"
|
||||||
>{{ topic.name }}</span
|
[matTooltip]="topic.name"
|
||||||
>
|
matTooltipPosition="above"
|
||||||
|
(focusin)="tooltip.show()"
|
||||||
|
(focusout)="tooltip.hide()">
|
||||||
|
<span class="topic-label">{{
|
||||||
|
topic.name
|
||||||
|
}}</span>
|
||||||
</mat-checkbox>
|
</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
max-height: 400px;
|
max-height: 400px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
border: 1px solid var(--sg-border);
|
border: 1px solid var(--sg-border);
|
||||||
border-radius: var(--sg-radius-sm);
|
border-radius: var(--sg-radius-sm);
|
||||||
background: var(--sg-background);
|
background: var(--sg-background);
|
||||||
padding: 4px;
|
padding: 4px 8px 4px 4px;
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.loading-state {
|
.loading-state {
|
||||||
@@ -55,6 +57,11 @@
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: var(--sg-text);
|
color: var(--sg-text);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topic-path {
|
.topic-path {
|
||||||
@@ -92,7 +99,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: none;
|
border: none;
|
||||||
padding: 4px 6px;
|
padding: 4px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
@@ -122,6 +129,7 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,37 +166,62 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.domain-children {
|
.domain-children {
|
||||||
padding-left: 12px;
|
padding-left: 10px;
|
||||||
border-left: 1px solid var(--sg-border-soft);
|
border-left: 1px solid var(--sg-border-soft);
|
||||||
margin-left: 12px;
|
margin-left: 12px;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-children {
|
.field-children {
|
||||||
padding-left: 14px;
|
padding-left: 10px;
|
||||||
border-left: 1px solid var(--sg-border-soft);
|
border-left: 1px solid var(--sg-border-soft);
|
||||||
margin-left: 14px;
|
margin-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subfield-children {
|
.subfield-children {
|
||||||
padding-left: 14px;
|
padding-left: 10px;
|
||||||
border-left: 1px dashed var(--sg-border-soft);
|
border-left: 1px dashed var(--sg-border-soft);
|
||||||
margin-left: 14px;
|
margin-left: 12px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tree-leaf {
|
.tree-leaf {
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topic-node {
|
.topic-node {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
.topic-label {
|
.topic-label {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: var(--sg-text);
|
color: var(--sg-text);
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 190px;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mdc-label {
|
||||||
|
flex: 1 !important;
|
||||||
|
min-width: 0 !important;
|
||||||
|
overflow: hidden;
|
||||||
|
padding-left: 8px !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
import {
|
import { Component, input, model, output, OnInit, signal } from '@angular/core';
|
||||||
Component,
|
|
||||||
Input,
|
|
||||||
Output,
|
|
||||||
EventEmitter,
|
|
||||||
OnInit,
|
|
||||||
signal,
|
|
||||||
} from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
import { MatRadioModule } from '@angular/material/radio';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
import { TopicsService } from '../../api/api/topics.service';
|
import { TopicsService } from '../../api/api/topics.service';
|
||||||
import { Subject, of } from 'rxjs';
|
import { combineLatest, of } from 'rxjs';
|
||||||
|
import { toObservable } from '@angular/core/rxjs-interop';
|
||||||
import {
|
import {
|
||||||
debounceTime,
|
debounceTime,
|
||||||
distinctUntilChanged,
|
distinctUntilChanged,
|
||||||
@@ -53,28 +49,18 @@ interface FlatTopic {
|
|||||||
MatCheckboxModule,
|
MatCheckboxModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatProgressSpinnerModule,
|
MatProgressSpinnerModule,
|
||||||
|
MatRadioModule,
|
||||||
|
MatTooltipModule,
|
||||||
],
|
],
|
||||||
templateUrl: './topic-hierarchy.component.html',
|
templateUrl: './topic-hierarchy.component.html',
|
||||||
styleUrl: './topic-hierarchy.component.scss',
|
styleUrl: './topic-hierarchy.component.scss',
|
||||||
})
|
})
|
||||||
export class TopicHierarchyComponent implements OnInit {
|
export class TopicHierarchyComponent implements OnInit {
|
||||||
@Input() selectedTopics: Set<string> = new Set<string>();
|
selectedTopics = input<Set<string>>(new Set<string>());
|
||||||
|
searchQuery = input<string>('');
|
||||||
|
searchType = model<'hybrid' | 'semantic'>('hybrid');
|
||||||
|
|
||||||
private _searchQuery = '';
|
selectionChange = output<Set<string>>();
|
||||||
@Input()
|
|
||||||
set searchQuery(value: string) {
|
|
||||||
if (value.length < 2) {
|
|
||||||
this._searchQuery = '';
|
|
||||||
} else {
|
|
||||||
this._searchQuery = value;
|
|
||||||
}
|
|
||||||
this.filterFlatTopics();
|
|
||||||
}
|
|
||||||
get searchQuery(): string {
|
|
||||||
return this._searchQuery;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Output() selectionChange = new EventEmitter<Set<string>>();
|
|
||||||
|
|
||||||
domains: DomainNode[] = [];
|
domains: DomainNode[] = [];
|
||||||
flatTopics: FlatTopic[] = [];
|
flatTopics: FlatTopic[] = [];
|
||||||
@@ -86,32 +72,37 @@ export class TopicHierarchyComponent implements OnInit {
|
|||||||
expandedFields = new Set<string>();
|
expandedFields = new Set<string>();
|
||||||
expandedSubfields = new Set<string>();
|
expandedSubfields = new Set<string>();
|
||||||
|
|
||||||
private readonly searchSubject = new Subject<string>();
|
|
||||||
|
|
||||||
constructor(private topicsService: TopicsService) {
|
constructor(private topicsService: TopicsService) {
|
||||||
this.searchSubject
|
combineLatest([
|
||||||
|
toObservable(this.searchQuery),
|
||||||
|
toObservable(this.searchType),
|
||||||
|
])
|
||||||
.pipe(
|
.pipe(
|
||||||
debounceTime(300),
|
debounceTime(300),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(
|
||||||
switchMap((query) => {
|
(prev, curr) => prev[0] === curr[0] && prev[1] === curr[1],
|
||||||
if (!query) {
|
),
|
||||||
|
switchMap(([query, searchType]) => {
|
||||||
|
if (!query || query.length < 2) {
|
||||||
this.filteredFlatTopics = [];
|
this.filteredFlatTopics = [];
|
||||||
return of({ results: [] });
|
return of({ results: [] });
|
||||||
}
|
}
|
||||||
this.loading.set(true);
|
this.loading.set(true);
|
||||||
return this.topicsService.vectorSearchTopics(query, 50).pipe(
|
return this.topicsService
|
||||||
catchError((err) => {
|
.vectorSearchTopics(query, 50, searchType)
|
||||||
console.error('Error in semantic topic search:', err);
|
.pipe(
|
||||||
// Fallback to local filtering
|
catchError((err) => {
|
||||||
const q = query.toLowerCase();
|
console.error('Error in semantic topic search:', err);
|
||||||
this.filteredFlatTopics = this.flatTopics.filter(
|
// Fallback to local filtering
|
||||||
(t) =>
|
const q = query.toLowerCase();
|
||||||
t.name.toLowerCase().includes(q) ||
|
this.filteredFlatTopics = this.flatTopics.filter(
|
||||||
t.path.toLowerCase().includes(q),
|
(t) =>
|
||||||
);
|
t.name.toLowerCase().includes(q) ||
|
||||||
return of({ results: [] });
|
t.path.toLowerCase().includes(q),
|
||||||
}),
|
);
|
||||||
);
|
return of({ results: [] });
|
||||||
|
}),
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.subscribe((response) => {
|
.subscribe((response) => {
|
||||||
@@ -167,19 +158,14 @@ export class TopicHierarchyComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
this.flatTopics = flat;
|
this.flatTopics = flat;
|
||||||
this.filterFlatTopics();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filterFlatTopics(): void {
|
onSearchTypeChange(type: 'hybrid' | 'semantic'): void {
|
||||||
if (!this.searchQuery) {
|
this.searchType.set(type);
|
||||||
this.filteredFlatTopics = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.searchSubject.next(this.searchQuery);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleTopic(name: string): void {
|
toggleTopic(name: string): void {
|
||||||
const nextSelection = new Set(this.selectedTopics);
|
const nextSelection = new Set(this.selectedTopics());
|
||||||
if (nextSelection.has(name)) {
|
if (nextSelection.has(name)) {
|
||||||
nextSelection.delete(name);
|
nextSelection.delete(name);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -2,10 +2,13 @@
|
|||||||
import { inject, Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { InstitutionsService, RankingResponse } from '../../../api';
|
import { InstitutionsService, RankingResponse } from '../../../api';
|
||||||
export type ResearchTopic = 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology';
|
export type ResearchTopic =
|
||||||
|
| 'Artificial Intelligence'
|
||||||
|
| 'Quantum Computing'
|
||||||
|
| 'Renewable Energy'
|
||||||
|
| 'Biotechnology';
|
||||||
export type DashboardMetric = 'publications' | 'citations';
|
export type DashboardMetric = 'publications' | 'citations';
|
||||||
|
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class UniversityRankingService {
|
export class UniversityRankingService {
|
||||||
private apiService = inject(InstitutionsService);
|
private apiService = inject(InstitutionsService);
|
||||||
@@ -14,7 +17,13 @@ export class UniversityRankingService {
|
|||||||
* Fetches ranking and timeseries data directly from the backend.
|
* Fetches ranking and timeseries data directly from the backend.
|
||||||
* Calculations for growth and trends are now handled server-side.
|
* Calculations for growth and trends are now handled server-side.
|
||||||
*/
|
*/
|
||||||
getRankingData(topic: ResearchTopic, metric: DashboardMetric): Observable<RankingResponse> {
|
getRankingData(
|
||||||
return this.apiService.getRankingsApiInseServiceUniversityRankingsGet(topic, metric);
|
topic: ResearchTopic,
|
||||||
|
metric: DashboardMetric,
|
||||||
|
): Observable<RankingResponse> {
|
||||||
|
return this.apiService.getRankingsApiInseServiceUniversityRankingsGet(
|
||||||
|
topic,
|
||||||
|
metric,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -2,5 +2,4 @@
|
|||||||
echarts
|
echarts
|
||||||
[options]="chartOption"
|
[options]="chartOption"
|
||||||
[merge]="mergeOption"
|
[merge]="mergeOption"
|
||||||
class="chart-container">
|
class="chart-container"></div>
|
||||||
</div>
|
|
||||||
|
|||||||
+4
-1
@@ -1 +1,4 @@
|
|||||||
.chart-container { height: 500px; width: 100%; }
|
.chart-container {
|
||||||
|
height: 500px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|||||||
+17
-10
@@ -1,9 +1,13 @@
|
|||||||
// src/app/modules/university-ranking/components/line-chart/university-line-chart.component.ts
|
// src/app/modules/university-ranking/components/line-chart/university-line-chart.component.ts
|
||||||
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { EChartsOption } from 'echarts';
|
import { EChartsOption } from 'echarts';
|
||||||
import { NgxEchartsDirective} from 'ngx-echarts';
|
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||||
import { UniversityTopicData, YearlyData } from '../../../api';
|
import { UniversityTopicData, YearlyData } from '../../../api';
|
||||||
export type ResearchTopic = 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology';
|
export type ResearchTopic =
|
||||||
|
| 'Artificial Intelligence'
|
||||||
|
| 'Quantum Computing'
|
||||||
|
| 'Renewable Energy'
|
||||||
|
| 'Biotechnology';
|
||||||
export type DashboardMetric = 'publications' | 'citations';
|
export type DashboardMetric = 'publications' | 'citations';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -12,21 +16,24 @@ export type DashboardMetric = 'publications' | 'citations';
|
|||||||
styleUrl: './uni-line-chart.component.scss',
|
styleUrl: './uni-line-chart.component.scss',
|
||||||
imports: [NgxEchartsDirective],
|
imports: [NgxEchartsDirective],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
|
||||||
})
|
})
|
||||||
export class UniversityLineChartComponent implements OnChanges {
|
export class UniversityLineChartComponent implements OnChanges {
|
||||||
@Input() data: UniversityTopicData[] = [];
|
@Input() data: UniversityTopicData[] = [];
|
||||||
@Input() metric: DashboardMetric = 'publications';
|
@Input() metric: DashboardMetric = 'publications';
|
||||||
|
|
||||||
chartOption: EChartsOption = {
|
chartOption: EChartsOption = {
|
||||||
title: { text: 'Research Output Over Time', left: 'center', textStyle: { fontWeight: 'lighter' } },
|
title: {
|
||||||
|
text: 'Research Output Over Time',
|
||||||
|
left: 'center',
|
||||||
|
textStyle: { fontWeight: 'lighter' },
|
||||||
|
},
|
||||||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||||||
legend: { bottom: 0 },
|
legend: { bottom: 0 },
|
||||||
grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
|
grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
|
||||||
xAxis: { type: 'category', boundaryGap: false, data: [] },
|
xAxis: { type: 'category', boundaryGap: false, data: [] },
|
||||||
yAxis: { type: 'value', name: 'Volume' },
|
yAxis: { type: 'value', name: 'Volume' },
|
||||||
dataZoom: [{ type: 'slider', show: true, bottom: 40 }],
|
dataZoom: [{ type: 'slider', show: true, bottom: 40 }],
|
||||||
series: []
|
series: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
mergeOption: EChartsOption = {};
|
mergeOption: EChartsOption = {};
|
||||||
@@ -34,24 +41,24 @@ export class UniversityLineChartComponent implements OnChanges {
|
|||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
if (this.data.length > 0) {
|
if (this.data.length > 0) {
|
||||||
this.updateChart();
|
this.updateChart();
|
||||||
console.log("CHANGES!")
|
console.log('CHANGES!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateChart() {
|
private updateChart() {
|
||||||
const years = this.data[0].yearly_data.map(d => d.year);
|
const years = this.data[0].yearly_data.map((d) => d.year);
|
||||||
const series = this.data.map(uni => ({
|
const series = this.data.map((uni) => ({
|
||||||
name: uni.university,
|
name: uni.university,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
smooth: true,
|
smooth: true,
|
||||||
emphasis: { focus: 'series' },
|
emphasis: { focus: 'series' },
|
||||||
animationDuration: 2000,
|
animationDuration: 2000,
|
||||||
data: uni.yearly_data.map(d => d[this.metric])
|
data: uni.yearly_data.map((d) => d[this.metric]),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.mergeOption = {
|
this.mergeOption = {
|
||||||
xAxis: { data: years.map(String) },
|
xAxis: { data: years.map(String) },
|
||||||
series: series as any
|
series: series as any,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
<h4>Topic Rankings</h4>
|
<h4>Topic Rankings</h4>
|
||||||
@if (loading) {
|
@if (loading) {
|
||||||
<div class="skeleton-loader">Loading rankings...</div>
|
<div class="skeleton-loader">Loading rankings...</div>
|
||||||
} @else{
|
} @else {
|
||||||
<table class="ranking-table">
|
<table class="ranking-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
+1
-2
@@ -7,8 +7,7 @@ import { DecimalPipe } from '@angular/common';
|
|||||||
selector: 'app-university-ranking-table',
|
selector: 'app-university-ranking-table',
|
||||||
templateUrl: './uni-ranking-table.component.html',
|
templateUrl: './uni-ranking-table.component.html',
|
||||||
styleUrls: ['./uni-ranking-table.component.scss'],
|
styleUrls: ['./uni-ranking-table.component.scss'],
|
||||||
imports:[DecimalPipe],
|
imports: [DecimalPipe],
|
||||||
|
|
||||||
})
|
})
|
||||||
export class UniversityRankingTableComponent {
|
export class UniversityRankingTableComponent {
|
||||||
@Input() rankings: UniversityRanking[] = [];
|
@Input() rankings: UniversityRanking[] = [];
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ export const bundProjectPageResolver: ResolveFn<BundProjectPage> = (
|
|||||||
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortBy = (route.queryParamMap.get('sort_by') ??
|
const sortBy = (route.queryParamMap.get('sort_by') ||
|
||||||
'title') as ProjectsSortBy;
|
'title') as ProjectsSortBy;
|
||||||
const sortDirection = (route.queryParamMap.get('sort_direction') ??
|
const sortDirection = (route.queryParamMap.get('sort_direction') ||
|
||||||
'asc') as SortDirection;
|
'asc') as SortDirection;
|
||||||
|
|
||||||
const search = route.queryParamMap.get('search');
|
const search = route.queryParamMap.get('search');
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { ResolveFn } from '@angular/router';
|
import { ResolveFn } from '@angular/router';
|
||||||
import { CordisEuProjectPage, ProjectsService } from '../api';
|
import {
|
||||||
|
EuOrganizationProjectSummaryPage,
|
||||||
|
ProjectsService,
|
||||||
|
ProjectsSortBy,
|
||||||
|
SortDirection,
|
||||||
|
} from '../api';
|
||||||
import { inject } from '@angular/core';
|
import { inject } from '@angular/core';
|
||||||
|
|
||||||
export const cordisEuProjectPageResolver: ResolveFn<CordisEuProjectPage> = (
|
export const cordisEuProjectPageResolver: ResolveFn<
|
||||||
route,
|
EuOrganizationProjectSummaryPage
|
||||||
state,
|
> = (route, state) => {
|
||||||
) => {
|
|
||||||
const page = route.queryParamMap.get('page') ?? '1';
|
const page = route.queryParamMap.get('page') ?? '1';
|
||||||
const size = route.queryParamMap.get('size') ?? '10';
|
const size = route.queryParamMap.get('size') ?? '10';
|
||||||
let institutionId = route.paramMap.get('institutionId');
|
let institutionId = route.paramMap.get('institutionId');
|
||||||
@@ -13,8 +17,10 @@ export const cordisEuProjectPageResolver: ResolveFn<CordisEuProjectPage> = (
|
|||||||
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortBy = route.queryParamMap.get('sort_by') ?? 'title';
|
const sortBy = (route.queryParamMap.get('sort_by') ||
|
||||||
const sortDirection = route.queryParamMap.get('sort_direction') ?? 'asc';
|
'title') as ProjectsSortBy;
|
||||||
|
const sortDirection = (route.queryParamMap.get('sort_direction') ||
|
||||||
|
'asc') as SortDirection;
|
||||||
const search = route.queryParamMap.get('search');
|
const search = route.queryParamMap.get('search');
|
||||||
|
|
||||||
return inject(ProjectsService).searchCordisEuProjects({
|
return inject(ProjectsService).searchCordisEuProjects({
|
||||||
@@ -23,7 +29,7 @@ export const cordisEuProjectPageResolver: ResolveFn<CordisEuProjectPage> = (
|
|||||||
size: Number(size),
|
size: Number(size),
|
||||||
raw_oa_institution_id: institutionId,
|
raw_oa_institution_id: institutionId,
|
||||||
query: search,
|
query: search,
|
||||||
sort_by: sortBy as 'title' | 'funding_start' | 'funding_end',
|
sort_by: sortBy,
|
||||||
sort_direction: sortDirection as 'asc' | 'desc',
|
sort_direction: sortDirection,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { CordisEuProjectPage, ProjectsService } from '../api';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
|
||||||
|
export const personCordisEuProjectPageResolver: ResolveFn<
|
||||||
|
CordisEuProjectPage
|
||||||
|
> = (route, state) => {
|
||||||
|
const rawAuthorId = route.parent?.params['id'];
|
||||||
|
if (!rawAuthorId) {
|
||||||
|
throw new Error('Author ID is required to resolve collaboration network');
|
||||||
|
}
|
||||||
|
return inject(ProjectsService).getEuProjectsForAuthor(rawAuthorId);
|
||||||
|
};
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
|
import { WorksService } from '../api';
|
||||||
|
|
||||||
|
export interface NewsArticle {
|
||||||
|
id: string;
|
||||||
|
date?: string | null;
|
||||||
|
maintitle?: string | null;
|
||||||
|
author?: string | null;
|
||||||
|
url?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NewsPage {
|
||||||
|
total: number;
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
results: NewsArticle[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const personNewsResolver: ResolveFn<NewsPage> = (route) => {
|
||||||
|
const httpClient = inject(HttpClient);
|
||||||
|
const worksService = inject(WorksService);
|
||||||
|
|
||||||
|
const authorId = route.parent?.paramMap.get('id');
|
||||||
|
if (!authorId) {
|
||||||
|
return of({ total: 0, page: 1, page_size: 0, results: [] });
|
||||||
|
}
|
||||||
|
|
||||||
|
const queryParams = route.queryParamMap;
|
||||||
|
|
||||||
|
const page = queryParams.get('page')
|
||||||
|
? Number.parseInt(queryParams.get('page')!, 10)
|
||||||
|
: 1;
|
||||||
|
|
||||||
|
const pageSize = queryParams.get('pageSize')
|
||||||
|
? Number.parseInt(queryParams.get('pageSize')!, 10)
|
||||||
|
: 10;
|
||||||
|
|
||||||
|
const sortOrder = queryParams.get('sortOrder') || 'desc';
|
||||||
|
const query = queryParams.get('query') || '';
|
||||||
|
|
||||||
|
let params = new HttpParams()
|
||||||
|
.set('authorId', authorId)
|
||||||
|
.set('page', page)
|
||||||
|
.set('pageSize', pageSize)
|
||||||
|
.set('sortOrder', sortOrder);
|
||||||
|
|
||||||
|
if (query) {
|
||||||
|
params = params.set('query', query);
|
||||||
|
}
|
||||||
|
|
||||||
|
const basePath = worksService.configuration.basePath ?? '';
|
||||||
|
return httpClient.get<NewsPage>(`${basePath}/api/news/by-author`, { params });
|
||||||
|
};
|
||||||
@@ -6,7 +6,6 @@ export const personResolver: ResolveFn<AuthorsListResponse> = (
|
|||||||
route,
|
route,
|
||||||
state,
|
state,
|
||||||
) => {
|
) => {
|
||||||
|
|
||||||
const PERSON_INCLUDE_TAGS =
|
const PERSON_INCLUDE_TAGS =
|
||||||
'topics_full,topic_share,summary_stats,ids,last_known_institutions,' +
|
'topics_full,topic_share,summary_stats,ids,last_known_institutions,' +
|
||||||
'sources,counts_by_year,works_api_url,dates,cited_by_count_boost';
|
'sources,counts_by_year,works_api_url,dates,cited_by_count_boost';
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
icon="person"
|
icon="person"
|
||||||
[size]="200"
|
[size]="200"
|
||||||
[diameter]="200" />
|
[diameter]="200" />
|
||||||
} @else if (resolverState.isResolvingFromOutside('/projects/')){
|
} @else if (resolverState.isResolvingFromOutside('/projects/')) {
|
||||||
<app-loading
|
<app-loading
|
||||||
text="Projektdaten werden geladen..."
|
text="Projektdaten werden geladen..."
|
||||||
icon="article"
|
icon="article"
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ export class AppMenuComponent {
|
|||||||
},
|
},
|
||||||
disabled: false,
|
disabled: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'News',
|
||||||
|
icon: 'newspaper',
|
||||||
|
route: '/news',
|
||||||
|
disabled: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Institutionen',
|
label: 'Institutionen',
|
||||||
icon: 'apartment',
|
icon: 'apartment',
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user