Merge branch 'dev' into researchers-to-projects
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
Vendored
+3
@@ -28,6 +28,9 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Save Docker image') {
|
||||
when {
|
||||
branch 'main'
|
||||
}
|
||||
steps {
|
||||
sh 'docker save ${IMAGE_PREFIX}-app:${IMAGE_VERSION} | gzip > app-image.tar.gz'
|
||||
}
|
||||
|
||||
@@ -35,15 +35,6 @@ headers = {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
|
||||
def float_array_to_base64(vector):
|
||||
"""
|
||||
Convert a float vector into a Base64 string representing 32-bit big-endian float bytes.
|
||||
Elasticsearch expects big-endian floats for binary/Base64 dense_vector encoding.
|
||||
"""
|
||||
arr = np.asarray(vector, dtype=np.float32)
|
||||
big_endian_bytes = arr.astype('>f4').tobytes()
|
||||
return base64.b64encode(big_endian_bytes).decode('utf-8')
|
||||
|
||||
def split_into_sentences(text):
|
||||
if not text:
|
||||
return []
|
||||
@@ -52,77 +43,6 @@ def split_into_sentences(text):
|
||||
# Filter out empty or extremely short sentences
|
||||
return [s for s in sentences if len(s.strip()) > 3]
|
||||
|
||||
def check_and_update_mapping():
|
||||
print("Checking 'topicvectors' index...")
|
||||
|
||||
with httpx.Client(timeout=30.0) as client:
|
||||
exists_resp = client.head(f"{ELASTIC_URL}topicvectors", headers=headers)
|
||||
if exists_resp.status_code == 404:
|
||||
print("Index 'topicvectors' does not exist. Creating index with mapping...")
|
||||
create_payload = {
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"id": {"type": "keyword"},
|
||||
"display_name": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {"type": "keyword", "ignore_above": 256}
|
||||
}
|
||||
},
|
||||
"display_name_vector": {
|
||||
"type": "dense_vector",
|
||||
"dims": 768,
|
||||
"index": True,
|
||||
"similarity": "cosine",
|
||||
"index_options": {
|
||||
"type": "int8_hnsw",
|
||||
"m": 16,
|
||||
"ef_construction": 100
|
||||
}
|
||||
},
|
||||
"description": {"type": "text"},
|
||||
"description_vectors": {
|
||||
"type": "nested",
|
||||
"properties": {
|
||||
"vector": {
|
||||
"type": "dense_vector",
|
||||
"dims": 768,
|
||||
"index": True,
|
||||
"similarity": "cosine",
|
||||
"index_options": {
|
||||
"type": "int8_hnsw",
|
||||
"m": 16,
|
||||
"ef_construction": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"keywords": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {"type": "keyword"}
|
||||
}
|
||||
},
|
||||
"cited_by_count": {"type": "long"},
|
||||
"works_count": {"type": "long"},
|
||||
"updated_date": {"type": "date"},
|
||||
"created_date": {"type": "date"}
|
||||
}
|
||||
}
|
||||
}
|
||||
resp = client.put(
|
||||
f"{ELASTIC_URL}topicvectors",
|
||||
json=create_payload,
|
||||
headers=headers
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
print("Successfully created 'topicvectors' index.")
|
||||
else:
|
||||
print(f"Failed to create index: {resp.status_code} - {resp.text}")
|
||||
resp.raise_for_status()
|
||||
else:
|
||||
print("Index 'topicvectors' already exists.")
|
||||
|
||||
def fetch_all_topics():
|
||||
print("Fetching topics from 'openalex-topics'...")
|
||||
topics = []
|
||||
@@ -204,8 +124,6 @@ def bulk_index_topics(topics, display_name_vectors, nested_description_vectors):
|
||||
print(f"Indexed batch {i} to {i + len(batch_topics)}")
|
||||
|
||||
def main():
|
||||
check_and_update_mapping()
|
||||
|
||||
topics = fetch_all_topics()
|
||||
if not topics:
|
||||
print("No topics found. Exiting.")
|
||||
|
||||
+21
-17
@@ -1,18 +1,22 @@
|
||||
{
|
||||
"users": [
|
||||
{
|
||||
"account": 0,
|
||||
"organization": 0,
|
||||
"username": "superadmin",
|
||||
"password": "superadmin",
|
||||
"superadmin": true
|
||||
},
|
||||
{
|
||||
"account": 1,
|
||||
"organization": 1,
|
||||
"username": "user",
|
||||
"password": "user",
|
||||
"superadmin": false
|
||||
}
|
||||
]
|
||||
}
|
||||
"users": [
|
||||
{
|
||||
"username": "superadmin",
|
||||
"password": "superadmin",
|
||||
"email": "some_email@uni-due.de",
|
||||
"account": 0,
|
||||
"organization": 0,
|
||||
"organization_name": "University of Duisburg-Essen",
|
||||
"superadmin": true
|
||||
},
|
||||
{
|
||||
"username": "user",
|
||||
"password": "user",
|
||||
"email": "user_email@uni-due.de",
|
||||
"account": 1,
|
||||
"organization": 1,
|
||||
"organization_name": "University of Duisburg-Essen",
|
||||
"superadmin": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,12 +1,9 @@
|
||||
ELASTICSEARCH_URL=https://project.nes.uni-due.de/elastic/
|
||||
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_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
|
||||
|
||||
ELASTICSEARCH_INSE_URL=https://inse.nes.uni-due.de/elastic
|
||||
ELASTICSEARCH_INSE_API_KEY=bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
||||
LLM_MODEL=gemma4-e4b
|
||||
@@ -33,3 +33,34 @@ def validate_user(username: str, password: str) -> typing.Optional[model.User]:
|
||||
if user and user.password == password:
|
||||
return user
|
||||
return None
|
||||
|
||||
def create_user(username, password, email, institution, superadmin) -> typing.Optional[model.User]:
|
||||
''' Adds a new user to the user configuration file. '''
|
||||
users = _get_users()
|
||||
if any(u.username == username for u in users):
|
||||
logger.warning("Attempt to create duplicate user: %s", username)
|
||||
return None
|
||||
|
||||
# Determine new IDs
|
||||
next_account = max((u.account for u in users), default=0) + 1
|
||||
next_org = max((u.organization for u in users), default=0) + 1
|
||||
|
||||
new_user = model.User(
|
||||
username=username,
|
||||
password=password,
|
||||
email=email,
|
||||
account=next_account,
|
||||
organization=next_org,
|
||||
organization_name=institution,
|
||||
superadmin=superadmin
|
||||
)
|
||||
|
||||
users.append(new_user)
|
||||
user_file = model.UserFile(users=users)
|
||||
try:
|
||||
with open('../data/users.json', 'w') as file:
|
||||
file.write(user_file.model_dump_json(indent=4))
|
||||
return new_user
|
||||
except Exception as e:
|
||||
logger.error('Could not write user configuration file.', exc_info=e)
|
||||
return None
|
||||
|
||||
@@ -13,8 +13,10 @@ class User(BaseModel):
|
||||
''' An entry in the user configuration file. '''
|
||||
username: str = Field(description="The username of the user.")
|
||||
password: str = Field(description="The password of the user.")
|
||||
email: str = Field(description="The email of the user.")
|
||||
account: StrictInt = Field(description="The account id of the user.")
|
||||
organization: StrictInt = Field(description="The organization id of the user.")
|
||||
organization_name: str = Field(description="The organization name of the user.")
|
||||
superadmin: bool = Field(default=False, description="Indicates whether the user is a superadmin.")
|
||||
|
||||
|
||||
@@ -27,6 +29,8 @@ class AuthAccount(BaseModel):
|
||||
i: int
|
||||
l: str
|
||||
o: int
|
||||
e: str
|
||||
on: str
|
||||
|
||||
|
||||
class AuthScope(BaseModel):
|
||||
|
||||
@@ -27,6 +27,7 @@ router = fastapi.APIRouter(
|
||||
|
||||
@router.post(
|
||||
"/auth/id",
|
||||
operation_id="getIdentityGrant",
|
||||
responses={
|
||||
HTTP_200_OK: {"model": model.IdentityGrant},
|
||||
HTTP_400_BAD_REQUEST: {
|
||||
@@ -55,7 +56,11 @@ async def get_identity_grant(
|
||||
exp = 12 * 60 * 60
|
||||
token = security.id_token(user, exp=exp)
|
||||
account = model.AuthAccount(
|
||||
i=user.account, l=user.username, o=user.organization
|
||||
i=user.account,
|
||||
l=user.username,
|
||||
o=user.organization,
|
||||
e=user.email,
|
||||
on=user.organization_name,
|
||||
)
|
||||
scope = model.AuthScope(t="ID", a=account, d=None, r=[])
|
||||
grant = model.IdentityGrant(
|
||||
@@ -70,6 +75,7 @@ async def get_identity_grant(
|
||||
|
||||
@router.post(
|
||||
"/auth/access",
|
||||
operation_id="getAccessGrant",
|
||||
responses={
|
||||
HTTP_200_OK: {"model": model.AccessGrant},
|
||||
HTTP_400_BAD_REQUEST: {
|
||||
@@ -104,7 +110,11 @@ async def get_access_grant(
|
||||
token = security.access_token(user, exp=exp)
|
||||
refresh = security.refresh_token(user, exp=exp)
|
||||
auth_account = model.AuthAccount(
|
||||
i=user.account, l=user.username, o=user.organization
|
||||
i=user.account,
|
||||
l=user.username,
|
||||
o=user.organization,
|
||||
e=user.email,
|
||||
on=user.organization_name,
|
||||
)
|
||||
scope = model.AuthScope(
|
||||
t="ACCESS",
|
||||
@@ -124,3 +134,36 @@ async def get_access_grant(
|
||||
except Exception as e:
|
||||
logger.error("Token generation failed (%s).", user.username, exc_info=e)
|
||||
raise fastapi.HTTPException(status_code=HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/create",
|
||||
operation_id="createUser",
|
||||
responses={
|
||||
HTTP_200_OK: {"model": model.User},
|
||||
HTTP_400_BAD_REQUEST: {
|
||||
"model": None,
|
||||
"description": "User creation failed (e.g. duplicate username).",
|
||||
},
|
||||
HTTP_500_INTERNAL_SERVER_ERROR: {
|
||||
"model": None,
|
||||
"description": "Internal server error.",
|
||||
},
|
||||
},
|
||||
)
|
||||
async def create_user(
|
||||
username: typing.Annotated[str, fastapi.Body()],
|
||||
password: typing.Annotated[str, fastapi.Body()],
|
||||
email: typing.Annotated[str, fastapi.Body()],
|
||||
institution: typing.Annotated[str, fastapi.Body()],
|
||||
superadmin: typing.Annotated[bool, fastapi.Body()] = False,
|
||||
):
|
||||
user = logic.create_user(username, password, email, institution, superadmin)
|
||||
if user is None:
|
||||
logger.info("User creation failed for (%s).", username)
|
||||
raise fastapi.HTTPException(
|
||||
status_code=HTTP_400_BAD_REQUEST,
|
||||
detail="User creation failed. Username might already exist."
|
||||
)
|
||||
logger.info("User created successfully (%s).", username)
|
||||
return user
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import logging
|
||||
from typing import Any, Dict, List, Literal, Optional, Set
|
||||
from typing import List, Set
|
||||
from typing import Any, Dict, Literal, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from inse.models.openalex.institution import Institution
|
||||
from inse.exceptions import NotFoundException
|
||||
from inse.integrations import elasticsearch
|
||||
from inse.institutions.model import InstitutionPage
|
||||
|
||||
|
||||
@@ -12,54 +13,40 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class InstitutionsSearchClient:
|
||||
def __init__(
|
||||
self,
|
||||
base_url: str,
|
||||
api_key: str,
|
||||
):
|
||||
self.base_url = base_url
|
||||
self.api_key = api_key
|
||||
self.headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"ApiKey {self.api_key}",
|
||||
}
|
||||
def __init__(self):
|
||||
"""
|
||||
Initializes the client. Credentials and URLs are handled by the
|
||||
centralized elasticsearch integration.
|
||||
"""
|
||||
pass
|
||||
|
||||
async def get_institution_by_id(self, raw_institution_id: str) -> Institution:
|
||||
def get_institution_by_id(self, raw_institution_id: str) -> Institution:
|
||||
"""
|
||||
Retrieves a single institution by its OpenAlex ID from the local Elasticsearch cluster.
|
||||
"""
|
||||
query = {
|
||||
"query": {
|
||||
"match": {
|
||||
"id": f"https://openalex.org/{raw_institution_id.upper()}",
|
||||
}
|
||||
},
|
||||
"size": 1,
|
||||
"match": {
|
||||
"id": f"https://openalex.org/{raw_institution_id.upper()}",
|
||||
}
|
||||
}
|
||||
authors = await self.get_authors_by_institution_id(raw_institution_id)
|
||||
logger.debug(
|
||||
"Retrieved authors for institution_id=%s: %s", raw_institution_id, authors
|
||||
)
|
||||
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post(
|
||||
f"{self.base_url}/openalex-institutions/_search",
|
||||
json=query,
|
||||
headers=self.headers,
|
||||
res = elasticsearch.search(index="openalex-institutions", query=query, size=1)
|
||||
|
||||
hits = res.get("hits", {}).get("hits", [])
|
||||
if not hits:
|
||||
raise NotFoundException(
|
||||
f"Institution with ID '{raw_institution_id}' not found."
|
||||
)
|
||||
response.raise_for_status()
|
||||
hits = response.json().get("hits", {}).get("hits", [])
|
||||
if not hits:
|
||||
raise NotFoundException(
|
||||
f"Institution with ID '{raw_institution_id}' not found."
|
||||
)
|
||||
|
||||
institution = self._convert_hit_to_institution(hits[0])
|
||||
if not institution:
|
||||
raise NotFoundException(
|
||||
f"Institution with ID '{raw_institution_id}' could not be parsed."
|
||||
)
|
||||
institution = self._convert_hit_to_institution(hits[0])
|
||||
if not institution:
|
||||
raise NotFoundException(
|
||||
f"Institution with ID '{raw_institution_id}' could not be parsed."
|
||||
)
|
||||
|
||||
return institution
|
||||
return institution
|
||||
|
||||
async def get_institutions_by_name(
|
||||
def get_institutions_by_name(
|
||||
self,
|
||||
name: str,
|
||||
page: int = 0,
|
||||
@@ -86,14 +73,10 @@ class InstitutionsSearchClient:
|
||||
else:
|
||||
sort_config.append({"display_name.keyword": {"order": sorting_direction}})
|
||||
|
||||
query: Dict[str, Any] = {
|
||||
"from": page * size,
|
||||
"size": size,
|
||||
"sort": sort_config,
|
||||
}
|
||||
query: Dict[str, Any] = {"match_all": {}}
|
||||
|
||||
if len(name) > 0:
|
||||
query["query"] = {
|
||||
query = {
|
||||
"match_phrase_prefix": {
|
||||
"display_name": {
|
||||
"query": name,
|
||||
@@ -102,7 +85,7 @@ class InstitutionsSearchClient:
|
||||
}
|
||||
}
|
||||
elif sort_by == "relevance":
|
||||
query["sort"] = [{"display_name.keyword": {"order": sorting_direction}}]
|
||||
sort_config = [{"display_name.keyword": {"order": sorting_direction}}]
|
||||
|
||||
logger.debug(
|
||||
"Searching institutions with name='%s', page=%d, size=%d, sorting_direction='%s', query: %s",
|
||||
@@ -112,40 +95,25 @@ class InstitutionsSearchClient:
|
||||
sorting_direction,
|
||||
query,
|
||||
)
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post(
|
||||
"https://project.nes.uni-due.de/elastic/openalex-institutions/_search",
|
||||
json=query,
|
||||
headers=self.headers,
|
||||
try:
|
||||
response = elasticsearch.search(
|
||||
index="openalex-institutions",
|
||||
offset=page * size,
|
||||
size=size,
|
||||
sort=sort_config,
|
||||
query=query,
|
||||
)
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except httpx.HTTPStatusError as e:
|
||||
logger.exception(
|
||||
"Error searching institutions with name='%s': %s, response content: %s",
|
||||
name,
|
||||
str(e),
|
||||
response.text,
|
||||
)
|
||||
return InstitutionPage(elements=[], page=page, size=size, total=0)
|
||||
return self.response_to_institution_page(response.json(), page, size)
|
||||
except Exception as e:
|
||||
logger.exception("Error while searching for institutions: %s", e)
|
||||
raise
|
||||
|
||||
return self.response_to_institution_page(response, page, size)
|
||||
|
||||
def response_to_institution_page(
|
||||
self, response: Dict[str, Any], page: int, size: int
|
||||
) -> InstitutionPage:
|
||||
hits = response.get("hits", {}).get("hits", [])
|
||||
|
||||
ALLOWED_TYPES = {
|
||||
"education",
|
||||
"healthcare",
|
||||
"company",
|
||||
"archive",
|
||||
"nonprofit",
|
||||
"government",
|
||||
"facility",
|
||||
"other",
|
||||
}
|
||||
|
||||
institutions = []
|
||||
for hit in hits:
|
||||
institution = self._convert_hit_to_institution(hit)
|
||||
@@ -164,27 +132,29 @@ class InstitutionsSearchClient:
|
||||
)
|
||||
|
||||
async def get_authors_by_institution_id(self, raw_institution_id: str) -> List[str]:
|
||||
"""
|
||||
Fetches authors associated with an institution.
|
||||
Note: This query is specifically looking for current affiliations (2026).
|
||||
"""
|
||||
query = {
|
||||
"query": {
|
||||
"nested": {
|
||||
"path": "affiliations",
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"term": {
|
||||
"affiliations.institution.id": f"https://openalex.org/{raw_institution_id.upper()}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"range": {
|
||||
"affiliations.years": {"gte": 2026, "lte": 2026}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
"nested": {
|
||||
"path": "affiliations",
|
||||
"query": {
|
||||
"bool": {
|
||||
"must": [
|
||||
{
|
||||
"term": {
|
||||
"affiliations.institution.id": f"https://openalex.org/{raw_institution_id.upper()}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"range": {
|
||||
"affiliations.years": {"gte": 2026, "lte": 2026}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
logger.debug(
|
||||
@@ -192,32 +162,123 @@ class InstitutionsSearchClient:
|
||||
raw_institution_id,
|
||||
query,
|
||||
)
|
||||
async with httpx.AsyncClient() as client:
|
||||
response = await client.post(
|
||||
"https://project.nes.uni-due.de/elastic/openalex-authors/_search",
|
||||
json=query,
|
||||
headers=self.headers,
|
||||
)
|
||||
try:
|
||||
response.raise_for_status()
|
||||
except httpx.HTTPStatusError as e:
|
||||
logger.exception(
|
||||
"Error fetching authors for institution_id=%s: %s, response content: %s",
|
||||
raw_institution_id,
|
||||
str(e),
|
||||
response.text,
|
||||
)
|
||||
return []
|
||||
hits = response.json().get("hits", {}).get("hits", [])
|
||||
authors = set()
|
||||
for hit in hits:
|
||||
authors.update(
|
||||
auth["author"]["display_name"]
|
||||
for auth in hit["_source"].get("authorships", [])
|
||||
)
|
||||
return list(authors)
|
||||
|
||||
async def get_institution_aliases_by_id(self, raw_institution_id: str) -> List[str]:
|
||||
res = elasticsearch.search(index="openalex-authors", query=query)
|
||||
hits = res.get("hits", {}).get("hits", [])
|
||||
|
||||
# Extracting display_name directly from the author document source
|
||||
authors = {
|
||||
hit["_source"].get("display_name")
|
||||
for hit in hits
|
||||
if hit["_source"].get("display_name")
|
||||
}
|
||||
return list(authors)
|
||||
|
||||
def search_institutions(
|
||||
self,
|
||||
query_text: str,
|
||||
country_code: str | None = None,
|
||||
institution_type: str | None = None,
|
||||
limit: int = 10,
|
||||
) -> list[Institution]:
|
||||
"""
|
||||
Autocomplete search for institutions using multi_match on search_as_you_type fields.
|
||||
Falls back to fuzzy match for typo tolerance on longer queries.
|
||||
"""
|
||||
must = []
|
||||
|
||||
if query_text:
|
||||
stripped = query_text.strip()
|
||||
|
||||
must.append(
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
# Fast prefix matching via search_as_you_type shingles
|
||||
{
|
||||
"multi_match": {
|
||||
"query": stripped,
|
||||
"type": "bool_prefix",
|
||||
"fields": [
|
||||
"display_name.search",
|
||||
"display_name.search._2gram",
|
||||
"display_name.search._3gram",
|
||||
"display_name_alternatives.search",
|
||||
"display_name_alternatives.search._2gram",
|
||||
],
|
||||
"boost": 2,
|
||||
}
|
||||
},
|
||||
# Exact acronym match — high confidence signal
|
||||
{
|
||||
"term": {
|
||||
"display_name_acronyms.keyword": {
|
||||
"value": stripped.upper(),
|
||||
"boost": 10,
|
||||
}
|
||||
}
|
||||
},
|
||||
# Fuzzy fallback for typos (only worth it for longer input)
|
||||
*(
|
||||
[
|
||||
{
|
||||
"match": {
|
||||
"display_name": {
|
||||
"query": stripped,
|
||||
"fuzziness": "AUTO",
|
||||
"boost": 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
if len(stripped) >= 4
|
||||
else []
|
||||
),
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
filter_queries = []
|
||||
|
||||
if country_code:
|
||||
filter_queries.append({"term": {"country_code": country_code.upper()}})
|
||||
|
||||
if institution_type:
|
||||
filter_queries.append({"term": {"type": institution_type}})
|
||||
|
||||
query = {
|
||||
"bool": {
|
||||
"must": must,
|
||||
"filter": filter_queries,
|
||||
}
|
||||
}
|
||||
|
||||
res = elasticsearch.search(
|
||||
index="openalex-institutions",
|
||||
query=query,
|
||||
size=limit,
|
||||
# Blend relevance score with works_count popularity signal
|
||||
sort=[
|
||||
{"works_count": {"order": "desc"}},
|
||||
],
|
||||
source=[
|
||||
"id",
|
||||
"display_name",
|
||||
"country_code",
|
||||
"type",
|
||||
"works_count",
|
||||
"cited_by_count",
|
||||
"geo",
|
||||
],
|
||||
)
|
||||
|
||||
hits = res.get("hits", {}).get("hits", [])
|
||||
|
||||
return [Institution.from_dict(hit["_source"]) for hit in hits]
|
||||
|
||||
def get_institution_aliases_by_id(self, raw_institution_id: str) -> List[str]:
|
||||
"""Get a list of institution aliases for a given institution ID, including both display name alternatives and predefined aliases.
|
||||
|
||||
Args:
|
||||
@@ -226,7 +287,7 @@ class InstitutionsSearchClient:
|
||||
Returns:
|
||||
List[str]: A list of aliases for the given institution ID.
|
||||
"""
|
||||
institution = await self.get_institution_by_id(raw_institution_id)
|
||||
institution = self.get_institution_by_id(raw_institution_id)
|
||||
aliases = list(
|
||||
self.augment_aliases(set(institution.display_name_alternatives or []))
|
||||
| self.get_predefined_institution_aliases(raw_institution_id)
|
||||
|
||||
@@ -41,7 +41,7 @@ _VALID_INSTITUTION_TYPES = {
|
||||
async def get_institution_by_id(
|
||||
raw_institution_id: str, client: InstitutionsSearchClient
|
||||
) -> Institution:
|
||||
return await client.get_institution_by_id(raw_institution_id)
|
||||
return client.get_institution_by_id(raw_institution_id)
|
||||
|
||||
|
||||
async def list_institutions(
|
||||
@@ -114,34 +114,29 @@ async def autocomplete_institutions(
|
||||
country_code: str | None = None,
|
||||
institution_type: str | None = None,
|
||||
limit: int = 10,
|
||||
client: OpenAlexInstitutionsClient | None = None,
|
||||
client: InstitutionsSearchClient,
|
||||
) -> AutocompleteResponse:
|
||||
filters = []
|
||||
if country_code:
|
||||
filters.append(f"country_code:{country_code}")
|
||||
if institution_type:
|
||||
filters.append(f"type:{institution_type}")
|
||||
|
||||
response = await list_institutions(
|
||||
search=query,
|
||||
filter=",".join(filters) if filters else None,
|
||||
sort="works_count:desc",
|
||||
per_page=limit,
|
||||
page=1,
|
||||
select=("id,ror,display_name,country_code,type,works_count,cited_by_count,geo"),
|
||||
client=client,
|
||||
"""
|
||||
Returns institution options for autocomplete inputs using the local
|
||||
Elasticsearch cluster via the provided client.
|
||||
"""
|
||||
institutions = client.search_institutions(
|
||||
query_text=query,
|
||||
country_code=country_code,
|
||||
institution_type=institution_type,
|
||||
limit=limit,
|
||||
)
|
||||
|
||||
results = []
|
||||
for institution in response.results or []:
|
||||
for institution in institutions:
|
||||
if not institution.id or not institution.display_name:
|
||||
continue
|
||||
|
||||
hint_parts = []
|
||||
if institution.geo:
|
||||
if institution.geo.city:
|
||||
if hasattr(institution, "geo") and institution.geo:
|
||||
if hasattr(institution.geo, "city") and institution.geo.city:
|
||||
hint_parts.append(institution.geo.city)
|
||||
if institution.geo.country:
|
||||
if hasattr(institution.geo, "country") and institution.geo.country:
|
||||
hint_parts.append(institution.geo.country)
|
||||
elif institution.country_code:
|
||||
hint_parts.append(institution.country_code)
|
||||
@@ -161,12 +156,7 @@ async def autocomplete_institutions(
|
||||
)
|
||||
|
||||
return AutocompleteResponse(
|
||||
meta=AutocompleteResponseMeta(
|
||||
count=response.meta.count if response.meta else len(results),
|
||||
db_response_time_ms=(
|
||||
response.meta.db_response_time_ms if response.meta else None
|
||||
),
|
||||
),
|
||||
meta=AutocompleteResponseMeta(count=len(results)),
|
||||
results=results,
|
||||
)
|
||||
|
||||
|
||||
@@ -12,28 +12,18 @@ from fastapi import APIRouter, Depends, status, Query
|
||||
from inse.models.openalex.autocomplete_response import AutocompleteResponse
|
||||
from inse.models.openalex.institutions_list_response import InstitutionsListResponse
|
||||
from inse.tags import Tags
|
||||
from inse.config import get_settings
|
||||
from inse.models.openalex.institution import Institution
|
||||
from inse.institutions.model import InstitutionPage
|
||||
from . import logic
|
||||
from inse.institutions.institutions_search_client import InstitutionsSearchClient
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/institutions", tags=[Tags.INSTITUTIONS])
|
||||
router = APIRouter(prefix="/api/inse-service/institutions", tags=[Tags.INSTITUTIONS])
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_institutions_search_client() -> InstitutionsSearchClient:
|
||||
settings = get_settings()
|
||||
if not settings.elasticsearch_url:
|
||||
raise ValueError("Elasticsearch URL is missing in settings.")
|
||||
if not settings.elasticsearch_api_key:
|
||||
raise ValueError("Elasticsearch API key is missing in settings.")
|
||||
|
||||
return InstitutionsSearchClient(
|
||||
api_key=settings.elasticsearch_api_key,
|
||||
base_url=settings.elasticsearch_url,
|
||||
)
|
||||
return InstitutionsSearchClient()
|
||||
|
||||
|
||||
@router.get(
|
||||
@@ -82,7 +72,7 @@ async def search_institutions_by_name(
|
||||
),
|
||||
] = "asc",
|
||||
) -> InstitutionPage:
|
||||
return await client.get_institutions_by_name(
|
||||
return client.get_institutions_by_name(
|
||||
name=name,
|
||||
page=page,
|
||||
size=size,
|
||||
@@ -140,12 +130,16 @@ async def autocomplete_institutions(
|
||||
int,
|
||||
Query(description="Maximum number of autocomplete options.", ge=1, le=25),
|
||||
] = 10,
|
||||
client: Annotated[
|
||||
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||
] = None,
|
||||
):
|
||||
return await logic.autocomplete_institutions(
|
||||
query=query,
|
||||
country_code=country_code,
|
||||
institution_type=institution_type,
|
||||
limit=limit,
|
||||
client=client,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -176,61 +176,3 @@ async def test_list_institutions_accepts_practical_openalex_type_variants():
|
||||
assert result.results[0].counts_by_year[0].cited_by_count is None
|
||||
assert result.group_by[0].key == "true"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_autocomplete_institutions_returns_frontend_options():
|
||||
def handler(request: httpx.Request) -> httpx.Response:
|
||||
assert request.url.params["search"] == "Duisburg Essen"
|
||||
assert request.url.params["filter"] == "country_code:DE,type:education"
|
||||
assert request.url.params["sort"] == "works_count:desc"
|
||||
assert request.url.params["per_page"] == "5"
|
||||
assert request.url.params["select"] == (
|
||||
"id,ror,display_name,country_code,type,works_count,"
|
||||
"cited_by_count,geo"
|
||||
)
|
||||
return httpx.Response(
|
||||
200,
|
||||
json={
|
||||
"meta": {"count": 1, "db_response_time_ms": 12},
|
||||
"results": [
|
||||
{
|
||||
"id": "https://openalex.org/I123",
|
||||
"ror": "https://ror.org/04mz5ra38",
|
||||
"display_name": "University of Duisburg-Essen",
|
||||
"country_code": "DE",
|
||||
"type": "education",
|
||||
"works_count": 123,
|
||||
"cited_by_count": 456,
|
||||
"geo": {
|
||||
"city": "Duisburg",
|
||||
"country": "Germany",
|
||||
},
|
||||
}
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
client = OpenAlexInstitutionsClient(
|
||||
api_key="test-key",
|
||||
transport=httpx.MockTransport(handler),
|
||||
)
|
||||
|
||||
result = await logic.autocomplete_institutions(
|
||||
query="Duisburg Essen",
|
||||
country_code="DE",
|
||||
institution_type="education",
|
||||
limit=5,
|
||||
client=client,
|
||||
)
|
||||
|
||||
assert result.meta.count == 1
|
||||
assert result.meta.db_response_time_ms == 12
|
||||
assert len(result.results) == 1
|
||||
option = result.results[0]
|
||||
assert option.id == "https://openalex.org/I123"
|
||||
assert option.display_name == "University of Duisburg-Essen"
|
||||
assert option.hint == "Duisburg · Germany · education"
|
||||
assert option.works_count == 123
|
||||
assert option.cited_by_count == 456
|
||||
assert option.entity_type == "institution"
|
||||
assert option.external_id == "https://ror.org/04mz5ra38"
|
||||
|
||||
@@ -1,38 +1,87 @@
|
||||
from typing import Any, Optional
|
||||
import logging
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
import httpx
|
||||
from .. import config
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def _cluster_credentials(cluster: str) -> tuple[str, str]:
|
||||
|
||||
def _cluster_credentials(cluster: str) -> Tuple[str, str]:
|
||||
"""Retrieves the Elasticsearch URL and API key for the specified cluster from the configuration.
|
||||
|
||||
Args:
|
||||
cluster (str): The cluster for which to retrieve credentials. Allowed values are "nes" and "inse".
|
||||
|
||||
Raises:
|
||||
ValueError: If the cluster is unknown or the credentials are not set in the configuration.
|
||||
|
||||
Returns:
|
||||
Tuple[str, str]: The Elasticsearch URL and API key for the specified cluster.
|
||||
"""
|
||||
|
||||
if cluster == "nes":
|
||||
if (
|
||||
not config.settings.elasticsearch_url
|
||||
or not config.settings.elasticsearch_api_key
|
||||
):
|
||||
raise ValueError(
|
||||
"Elasticsearch URL and API key must be set in the configuration for cluster 'nes'"
|
||||
)
|
||||
return config.settings.elasticsearch_url, config.settings.elasticsearch_api_key
|
||||
elif cluster == "inse":
|
||||
return config.settings.elasticsearch_inse_url, config.settings.elasticsearch_inse_api_key
|
||||
if (
|
||||
not config.settings.elasticsearch_inse_url
|
||||
or not config.settings.elasticsearch_inse_api_key
|
||||
):
|
||||
raise ValueError(
|
||||
"Elasticsearch INSE URL and API key must be set in the configuration for cluster 'inse'"
|
||||
)
|
||||
|
||||
return (
|
||||
config.settings.elasticsearch_inse_url,
|
||||
config.settings.elasticsearch_inse_api_key,
|
||||
)
|
||||
else:
|
||||
raise ValueError(f"Unbekannter Cluster: {cluster!r} (erlaubt: 'nes', 'inse')")
|
||||
raise ValueError(f"Unknown cluster: {cluster!r} (allowed: 'nes', 'inse')")
|
||||
|
||||
|
||||
def search(
|
||||
index: str,
|
||||
query_field: str = None,
|
||||
query_value: str = None,
|
||||
query: dict = None,
|
||||
source = None,
|
||||
size: int = None,
|
||||
offset:int = None,
|
||||
sort: list = None,
|
||||
body: dict = None,
|
||||
track_total_hits = False,
|
||||
query_field: Optional[str] = None,
|
||||
query_value: Optional[str] = None,
|
||||
query: Optional[Dict] = None,
|
||||
source: Optional[List] = None,
|
||||
size: Optional[int] = None,
|
||||
offset: Optional[int] = None,
|
||||
sort: Optional[List] = None,
|
||||
body: Optional[Dict] = None,
|
||||
track_total_hits=False,
|
||||
cluster: str = "nes",
|
||||
) -> dict[str, Any]:
|
||||
) -> Dict[str, Any]:
|
||||
"""Searches the specified Elasticsearch index using either a simple query string or a full query body.
|
||||
|
||||
Args:
|
||||
index (str): The name of 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.
|
||||
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.
|
||||
offset (Optional[int], optional): The number of results to skip. 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.
|
||||
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".
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: The search results.
|
||||
"""
|
||||
|
||||
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]
|
||||
|
||||
if body is not None:
|
||||
payload = body
|
||||
@@ -51,18 +100,16 @@ def search(
|
||||
else:
|
||||
payload = {
|
||||
"query": {
|
||||
"query_string": {
|
||||
"default_field": query_field,
|
||||
"query": query_value
|
||||
}
|
||||
"query_string": {"default_field": query_field, "query": query_value}
|
||||
}
|
||||
}
|
||||
|
||||
with httpx.Client(timeout=httpx.Timeout(30.0)) as client:
|
||||
logger.debug(
|
||||
f"Sending search request to Elasticsearch cluster '{cluster}' at {elasticsearch_url} with payload: {payload}"
|
||||
)
|
||||
response = client.post(
|
||||
f"{elasticsearch_url}/{index}/_search",
|
||||
json=payload,
|
||||
headers=headers
|
||||
f"{elasticsearch_url}/{index}/_search", json=payload, headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
@@ -71,16 +118,13 @@ def search(
|
||||
def get(
|
||||
index: str,
|
||||
doc_id: str,
|
||||
source: list = None,
|
||||
source: Optional[list] = None,
|
||||
cluster: str = "nes",
|
||||
) -> dict[str, Any]:
|
||||
|
||||
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"}
|
||||
|
||||
params = {}
|
||||
if source is not None:
|
||||
@@ -88,9 +132,7 @@ def get(
|
||||
|
||||
with httpx.Client() as client:
|
||||
response = client.get(
|
||||
f"{elasticsearch_url}/{index}/_doc/{doc_id}",
|
||||
params=params,
|
||||
headers=headers
|
||||
f"{elasticsearch_url}/{index}/_doc/{doc_id}", params=params, headers=headers
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json()
|
||||
|
||||
@@ -55,13 +55,20 @@ class Institution(BaseModel):
|
||||
updated_date: Optional[datetime] = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).")
|
||||
__properties: ClassVar[List[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"]
|
||||
|
||||
@field_validator('created_date', mode='before')
|
||||
@classmethod
|
||||
def normalize_created_date(cls, v: Any) -> Any:
|
||||
if isinstance(v, str) and len(v) > 10:
|
||||
return v[:10]
|
||||
return v
|
||||
|
||||
@field_validator('type')
|
||||
def type_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']):
|
||||
if value not in set(['education','funder', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']):
|
||||
raise ValueError("must be one of enum values ('education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other')")
|
||||
return value
|
||||
|
||||
@@ -154,5 +161,3 @@ class Institution(BaseModel):
|
||||
"updated_date": obj.get("updated_date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ Business logic for persons / authors.
|
||||
import json
|
||||
import logging
|
||||
import time
|
||||
from datetime import datetime
|
||||
from typing import Optional, Callable, Any, List
|
||||
from elasticsearch import ApiError, NotFoundError
|
||||
import hashlib
|
||||
import httpx
|
||||
from fastapi import HTTPException
|
||||
@@ -24,8 +26,8 @@ from inse.persons.model import (
|
||||
CustomAuthor,
|
||||
CustomAuthorsListResponse,
|
||||
PersonSearchRequest,
|
||||
CareerMetrics,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
INDEX_NAME = "openalex-authors"
|
||||
|
||||
@@ -186,6 +188,120 @@ def _fetch_works_and_topics(author_id: str) -> tuple[list, list]:
|
||||
return works, topics
|
||||
|
||||
|
||||
def _get_publication_years_for_author(author_id: str) -> list[int]:
|
||||
author_url = f"https://openalex.org/{author_id.strip()}"
|
||||
|
||||
body = {
|
||||
"size": 0,
|
||||
"query": {
|
||||
"nested": {
|
||||
"path": "authorships",
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{"term": {"authorships.author.id": author_url}},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"aggs": {
|
||||
"publication_years": {
|
||||
"terms": {
|
||||
"field": "publication_year",
|
||||
"size": 1000,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
response = elasticsearch.search(
|
||||
index=config.settings.openalex_works_search_index,
|
||||
body=body,
|
||||
)
|
||||
|
||||
buckets = (
|
||||
response.get("aggregations", {})
|
||||
.get("publication_years", {})
|
||||
.get("buckets", [])
|
||||
)
|
||||
|
||||
publication_years: list[int] = []
|
||||
|
||||
for bucket in buckets:
|
||||
year = bucket.get("key")
|
||||
count = bucket.get("doc_count", 0)
|
||||
|
||||
if isinstance(year, int):
|
||||
publication_years.extend([year] * count)
|
||||
|
||||
return publication_years
|
||||
|
||||
def _classify_career_stage(active_years: int) -> str:
|
||||
if active_years <= 0:
|
||||
return "unknown"
|
||||
|
||||
if active_years <= 4:
|
||||
return "Early Researcher"
|
||||
|
||||
if active_years <= 10:
|
||||
return "Emerging Researcher"
|
||||
|
||||
if active_years <= 20:
|
||||
return "Established Researcher"
|
||||
|
||||
return "Senior Researcher"
|
||||
|
||||
|
||||
def _compute_career_metrics(publication_years: list[int]) -> CareerMetrics:
|
||||
current_year = datetime.now().year
|
||||
|
||||
if not publication_years:
|
||||
return CareerMetrics()
|
||||
|
||||
sorted_years = sorted(publication_years)
|
||||
unique_years = sorted(set(publication_years))
|
||||
|
||||
first_year = sorted_years[0]
|
||||
last_year = sorted_years[-1]
|
||||
|
||||
publication_count = len(sorted_years)
|
||||
active_years = len(unique_years)
|
||||
career_stage = _classify_career_stage(active_years)
|
||||
career_age = last_year - first_year
|
||||
career_span = last_year - first_year + 1
|
||||
|
||||
publications_per_active_year = (
|
||||
publication_count / active_years if active_years > 0 else None
|
||||
)
|
||||
|
||||
publications_per_career_year = (
|
||||
publication_count / career_span if career_span > 0 else None
|
||||
)
|
||||
|
||||
years_since_last_publication = current_year - last_year
|
||||
has_suspicious_publication_years = first_year < 1970 or career_span > 60
|
||||
|
||||
return CareerMetrics(
|
||||
first_publication_year=first_year,
|
||||
last_publication_year=last_year,
|
||||
career_age=career_age,
|
||||
career_span=career_span,
|
||||
career_stage=career_stage,
|
||||
active_years=active_years,
|
||||
publication_count=publication_count,
|
||||
publications_per_active_year=publications_per_active_year,
|
||||
publications_per_career_year=publications_per_career_year,
|
||||
years_since_last_publication=years_since_last_publication,
|
||||
has_suspicious_publication_years=has_suspicious_publication_years,
|
||||
)
|
||||
|
||||
|
||||
def get_career_metrics_for_author(author_id: str) -> CareerMetrics:
|
||||
publication_years = _get_publication_years_for_author(author_id)
|
||||
return _compute_career_metrics(publication_years)
|
||||
|
||||
|
||||
def _build_papers(works: list) -> list:
|
||||
|
||||
papers = []
|
||||
@@ -254,23 +370,34 @@ def generate_person_bio(author_id: str, include: Optional[set[str]] = None) -> s
|
||||
|
||||
def get_person_by_id(
|
||||
author_id: str, include: Optional[str] = None
|
||||
) -> AuthorsListResponse:
|
||||
) -> CustomAuthorsListResponse:
|
||||
body = {
|
||||
"_source": include.split(",") if include else True,
|
||||
}
|
||||
|
||||
try:
|
||||
hit = elasticsearch.get(index="openalex-authors", body=body, doc_id=author_id)
|
||||
hit = elasticsearch.get(
|
||||
index="openalex-authors",
|
||||
body=body,
|
||||
doc_id=author_id,
|
||||
)
|
||||
except NotFoundError:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"Person with id {author_id} not found"
|
||||
)
|
||||
|
||||
except ApiError as e:
|
||||
raise HTTPException(status_code=500, detail=f"Elasticsearch error: {str(e)}")
|
||||
persons = [util.get_persons_data(hit)]
|
||||
|
||||
return AuthorsListResponse(results=persons)
|
||||
author = util.get_persons_data(hit)
|
||||
career_metrics = get_career_metrics_for_author(author_id)
|
||||
|
||||
custom_author = CustomAuthor(
|
||||
**author.model_dump(),
|
||||
career_metrics=career_metrics,
|
||||
)
|
||||
|
||||
return CustomAuthorsListResponse(results=[custom_author])
|
||||
|
||||
|
||||
|
||||
def search_persons_by_name(
|
||||
|
||||
@@ -13,20 +13,59 @@ from inse.models.openalex.authors_list_response import AuthorsListResponse
|
||||
|
||||
from inse.models.openalex.group_by_result import GroupByResult
|
||||
|
||||
class CareerMetrics(BaseModel):
|
||||
first_publication_year: Optional[int] = Field(
|
||||
default=None, description="First publication year of the author."
|
||||
)
|
||||
last_publication_year: Optional[int] = Field(
|
||||
default=None, description="Last publication year of the author."
|
||||
)
|
||||
career_age: Optional[int] = Field(
|
||||
default=None, description="Difference between last and first publication year."
|
||||
)
|
||||
career_span: Optional[int] = Field(
|
||||
default=None, description="Inclusive span from first to last publication year."
|
||||
)
|
||||
career_stage: Optional[str] = Field(
|
||||
default=None,
|
||||
description="Threshold-based career stage derived from active publication years.",
|
||||
)
|
||||
active_years: int = Field(
|
||||
default=0, description="Number of distinct years with at least one publication."
|
||||
)
|
||||
publication_count: int = Field(
|
||||
default=0, description="Number of publications used for career metrics."
|
||||
)
|
||||
publications_per_active_year: Optional[float] = Field(
|
||||
default=None, description="Average publications per active publication year."
|
||||
)
|
||||
publications_per_career_year: Optional[float] = Field(
|
||||
default=None, description="Average publications per year over the full career span."
|
||||
)
|
||||
years_since_last_publication: Optional[int] = Field(
|
||||
default=None, description="Years since the last publication."
|
||||
)
|
||||
has_suspicious_publication_years: bool = Field(
|
||||
default=False, description="True if publication years look suspicious."
|
||||
)
|
||||
|
||||
|
||||
class CustomAuthor(Author):
|
||||
relevance_rating: Optional[str] = Field(
|
||||
default=None, description="The relevance suitability rating."
|
||||
)
|
||||
career_metrics: Optional[CareerMetrics] = Field(
|
||||
default=None, description="Publication-history-based career metrics."
|
||||
)
|
||||
|
||||
|
||||
class CustomAuthorsListResponse(AuthorsListResponse):
|
||||
placeholder: Optional[CustomAuthor] = Field(
|
||||
default=None, description="A placeholder field for generation."
|
||||
)
|
||||
# meta: Optional[Meta] = None
|
||||
# results: Optional[List[CustomAuthor]] = None
|
||||
# group_by: Optional[List[GroupByResult]] = None
|
||||
results: Optional[List[CustomAuthor]] = None
|
||||
meta: Optional[Meta] = None
|
||||
group_by: Optional[List[GroupByResult]] = None
|
||||
|
||||
|
||||
class PersonBio(BaseModel):
|
||||
|
||||
@@ -85,7 +85,7 @@ def generate_person_bio(
|
||||
@router.get(
|
||||
"/person/{id}",
|
||||
operation_id="getPersonByID",
|
||||
response_model=AuthorsListResponse,
|
||||
response_model=model.CustomAuthorsListResponse,
|
||||
summary="Searches for person by ID.",
|
||||
tags=["Persons"],
|
||||
)
|
||||
@@ -102,7 +102,7 @@ def get_person_by_id(
|
||||
),
|
||||
example="topics_full,topic_share",
|
||||
),
|
||||
],
|
||||
] = None,
|
||||
):
|
||||
return logic.get_person_by_id(author_id=id, include=include)
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ async def get_bund_projects_by_institution_id(
|
||||
logger.info(
|
||||
f"Fetching bund projects for institution_id={institution_id}, page={page}, size={size}"
|
||||
)
|
||||
institution_aliases = (
|
||||
await institutions_search_client.get_institution_aliases_by_id(institution_id)
|
||||
institution_aliases = institutions_search_client.get_institution_aliases_by_id(
|
||||
institution_id
|
||||
)
|
||||
logger.debug(
|
||||
f"Found institution aliases for institution_id={institution_id}: {institution_aliases}"
|
||||
@@ -60,8 +60,8 @@ async def get_eu_projects_by_institution_id(
|
||||
logger.info(
|
||||
f"Fetching EU projects for institution_id={institution_id}, page={page}, size={size}"
|
||||
)
|
||||
institution_aliases = (
|
||||
await institutions_search_client.get_institution_aliases_by_id(institution_id)
|
||||
institution_aliases = institutions_search_client.get_institution_aliases_by_id(
|
||||
institution_id
|
||||
)
|
||||
logger.debug(
|
||||
f"Found institution aliases for institution_id={institution_id}: {institution_aliases}"
|
||||
|
||||
+9
-1
@@ -813,10 +813,18 @@ Content-Type: application/json
|
||||
|
||||
###
|
||||
|
||||
GET https://project.nes.uni-due.de/elastic/openalex-institutions/_mapping
|
||||
GET https://project.nes.uni-due.de/elastic/openalex-institutions/_search
|
||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": {},
|
||||
"size": 10,
|
||||
"from": 0,
|
||||
"sort": [{ "works_count": { "order": "desc" } }]
|
||||
}
|
||||
|
||||
|
||||
###
|
||||
|
||||
GET https://project.nes.uni-due.de/elastic/openalex-awards/_search
|
||||
|
||||
@@ -36,8 +36,10 @@ model/autocompleteResponse.ts
|
||||
model/autocompleteResponseMeta.ts
|
||||
model/autocompleteResponseResultsInner.ts
|
||||
model/award.ts
|
||||
model/bodyCreateUser.ts
|
||||
model/bundProject.ts
|
||||
model/bundProjectPage.ts
|
||||
model/careerMetrics.ts
|
||||
model/categoryNested.ts
|
||||
model/collaborationNetwork.ts
|
||||
model/collaborationNetworkEdge.ts
|
||||
@@ -96,6 +98,7 @@ model/topicSubfield.ts
|
||||
model/topicsByTime.ts
|
||||
model/topicsByYear.ts
|
||||
model/topicsListResponse.ts
|
||||
model/user.ts
|
||||
model/validationError.ts
|
||||
model/validationErrorLocInner.ts
|
||||
model/value.ts
|
||||
|
||||
@@ -19,9 +19,13 @@ import { Observable } from 'rxjs';
|
||||
// @ts-ignore
|
||||
import { AccessGrant } from '../model/accessGrant';
|
||||
// @ts-ignore
|
||||
import { BodyCreateUser } from '../model/bodyCreateUser';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { IdentityGrant } from '../model/identityGrant';
|
||||
// @ts-ignore
|
||||
import { User } from '../model/user';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
@@ -39,6 +43,71 @@ export class INSEAccountServiceService extends BaseService {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create User
|
||||
* @endpoint post /inse-account/create
|
||||
* @param bodyCreateUser
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public createUser(bodyCreateUser: BodyCreateUser, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<User>;
|
||||
public createUser(bodyCreateUser: BodyCreateUser, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<User>>;
|
||||
public createUser(bodyCreateUser: BodyCreateUser, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<User>>;
|
||||
public createUser(bodyCreateUser: BodyCreateUser, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (bodyCreateUser === null || bodyCreateUser === undefined) {
|
||||
throw new Error('Required parameter bodyCreateUser was null or undefined when calling createUser.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/inse-account/create`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<User>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: bodyCreateUser,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Access Grant
|
||||
* @endpoint post /inse-account/auth/access
|
||||
@@ -48,18 +117,18 @@ export class INSEAccountServiceService extends BaseService {
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AccessGrant>;
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AccessGrant>>;
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AccessGrant>>;
|
||||
public getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public getAccessGrant(secret: string, account: number, organization: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AccessGrant>;
|
||||
public getAccessGrant(secret: string, account: number, organization: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AccessGrant>>;
|
||||
public getAccessGrant(secret: string, account: number, organization: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AccessGrant>>;
|
||||
public getAccessGrant(secret: string, account: number, organization: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (secret === null || secret === undefined) {
|
||||
throw new Error('Required parameter secret was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.');
|
||||
throw new Error('Required parameter secret was null or undefined when calling getAccessGrant.');
|
||||
}
|
||||
if (account === null || account === undefined) {
|
||||
throw new Error('Required parameter account was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.');
|
||||
throw new Error('Required parameter account was null or undefined when calling getAccessGrant.');
|
||||
}
|
||||
if (organization === null || organization === undefined) {
|
||||
throw new Error('Required parameter organization was null or undefined when calling getAccessGrantInseAccountAuthAccessPost.');
|
||||
throw new Error('Required parameter organization was null or undefined when calling getAccessGrant.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
@@ -136,15 +205,15 @@ export class INSEAccountServiceService extends BaseService {
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<IdentityGrant>;
|
||||
public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<IdentityGrant>>;
|
||||
public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<IdentityGrant>>;
|
||||
public getIdentityGrantInseAccountAuthIdPost(username: string, password: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public getIdentityGrant(username: string, password: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<IdentityGrant>;
|
||||
public getIdentityGrant(username: string, password: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<IdentityGrant>>;
|
||||
public getIdentityGrant(username: string, password: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<IdentityGrant>>;
|
||||
public getIdentityGrant(username: string, password: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (username === null || username === undefined) {
|
||||
throw new Error('Required parameter username was null or undefined when calling getIdentityGrantInseAccountAuthIdPost.');
|
||||
throw new Error('Required parameter username was null or undefined when calling getIdentityGrant.');
|
||||
}
|
||||
if (password === null || password === undefined) {
|
||||
throw new Error('Required parameter password was null or undefined when calling getIdentityGrantInseAccountAuthIdPost.');
|
||||
throw new Error('Required parameter password was null or undefined when calling getIdentityGrant.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
@@ -45,7 +45,7 @@ export class InstitutionsService extends BaseService {
|
||||
|
||||
/**
|
||||
* Returns institution options for autocomplete inputs.
|
||||
* @endpoint get /api/institutions/autocomplete
|
||||
* @endpoint get /api/inse-service/institutions/autocomplete
|
||||
* @param query Institution search text, for example \'Duisburg Essen\'.
|
||||
* @param countryCode Optional ISO country code filter.
|
||||
* @param type Optional institution type filter.
|
||||
@@ -96,7 +96,7 @@ export class InstitutionsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/institutions/autocomplete`;
|
||||
let localVarPath = `/api/inse-service/institutions/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AutocompleteResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
@@ -115,7 +115,7 @@ export class InstitutionsService extends BaseService {
|
||||
/**
|
||||
* Returns a single institution by ID.
|
||||
* Returns a single institution by its OpenAlex ID.
|
||||
* @endpoint get /api/institutions/{id}
|
||||
* @endpoint get /api/inse-service/institutions/{id}
|
||||
* @param id
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
@@ -153,7 +153,7 @@ export class InstitutionsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Institution>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
@@ -170,7 +170,7 @@ export class InstitutionsService extends BaseService {
|
||||
|
||||
/**
|
||||
* Returns a list of OpenAlex institutions.
|
||||
* @endpoint get /api/institutions
|
||||
* @endpoint get /api/inse-service/institutions
|
||||
* @param search Full-text search, for example \'Duisburg Essen\'.
|
||||
* @param filter OpenAlex filter, for example \'country_code:DE,type:education\'.
|
||||
* @param sort Sort field, for example \'works_count:desc\'.
|
||||
@@ -233,7 +233,7 @@ export class InstitutionsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/institutions`;
|
||||
let localVarPath = `/api/inse-service/institutions`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InstitutionsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
@@ -252,7 +252,7 @@ export class InstitutionsService extends BaseService {
|
||||
/**
|
||||
* Searches for institutions by name.
|
||||
* Searches for institutions by name with pagination.
|
||||
* @endpoint get /api/institutions/search
|
||||
* @endpoint get /api/inse-service/institutions/search
|
||||
* @param name Institution name to search for, for example \'University of Duisburg Essen\'.
|
||||
* @param page Page number (0-indexed).
|
||||
* @param size Number of institutions per page.
|
||||
@@ -303,7 +303,7 @@ export class InstitutionsService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/institutions/search`;
|
||||
let localVarPath = `/api/inse-service/institutions/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<InstitutionPage>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
|
||||
@@ -112,16 +112,13 @@ export class PersonsService extends BaseService {
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getPersonByID(id: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public getPersonByID(id: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public getPersonByID(id: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public getPersonByID(id: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public getPersonByID(id: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
|
||||
public getPersonByID(id: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public getPersonByID(id: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public getPersonByID(id: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling getPersonByID.');
|
||||
}
|
||||
if (include === null || include === undefined) {
|
||||
throw new Error('Required parameter include was null or undefined when calling getPersonByID.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
@@ -154,7 +151,7 @@ export class PersonsService extends BaseService {
|
||||
|
||||
let localVarPath = `/api/inse-service/person/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
return this.httpClient.request<CustomAuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
@@ -176,16 +173,13 @@ export class PersonsService extends BaseService {
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getPersonByID_1(id: string, include: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<AuthorsListResponse>;
|
||||
public getPersonByID_1(id: string, include: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<AuthorsListResponse>>;
|
||||
public getPersonByID_1(id: string, include: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<AuthorsListResponse>>;
|
||||
public getPersonByID_1(id: string, include: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
public getPersonByID_1(id: string, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
|
||||
public getPersonByID_1(id: string, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
|
||||
public getPersonByID_1(id: string, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
|
||||
public getPersonByID_1(id: string, include?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (id === null || id === undefined) {
|
||||
throw new Error('Required parameter id was null or undefined when calling getPersonByID_1.');
|
||||
}
|
||||
if (include === null || include === undefined) {
|
||||
throw new Error('Required parameter include was null or undefined when calling getPersonByID_1.');
|
||||
}
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
@@ -218,7 +212,7 @@ export class PersonsService extends BaseService {
|
||||
|
||||
let localVarPath = `/api/inse-service/person/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
return this.httpClient.request<CustomAuthorsListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
|
||||
@@ -13,5 +13,7 @@ export interface AuthAccount {
|
||||
i: number;
|
||||
l: string;
|
||||
o: number;
|
||||
e: string;
|
||||
on: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 BodyCreateUser {
|
||||
username: string;
|
||||
password: string;
|
||||
email: string;
|
||||
institution: string;
|
||||
superadmin?: boolean;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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 CareerMetrics {
|
||||
first_publication_year?: number | null;
|
||||
last_publication_year?: number | null;
|
||||
career_age?: number | null;
|
||||
career_span?: number | null;
|
||||
career_stage?: string | null;
|
||||
/**
|
||||
* Number of distinct years with at least one publication.
|
||||
*/
|
||||
active_years?: number;
|
||||
/**
|
||||
* Number of publications used for career metrics.
|
||||
*/
|
||||
publication_count?: number;
|
||||
publications_per_active_year?: number | null;
|
||||
publications_per_career_year?: number | null;
|
||||
years_since_last_publication?: number | null;
|
||||
/**
|
||||
* True if publication years look suspicious.
|
||||
*/
|
||||
has_suspicious_publication_years?: boolean;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
import { AuthorAffiliationsInner } from './authorAffiliationsInner';
|
||||
import { AuthorParsedLongestName } from './authorParsedLongestName';
|
||||
import { CareerMetrics } from './careerMetrics';
|
||||
import { DehydratedInstitution } from './dehydratedInstitution';
|
||||
import { AuthorCountsByYearInner } from './authorCountsByYearInner';
|
||||
import { AuthorIds } from './authorIds';
|
||||
@@ -35,5 +36,6 @@ export interface CustomAuthor {
|
||||
created_date?: string | null;
|
||||
updated_date?: string | null;
|
||||
relevance_rating?: string | null;
|
||||
career_metrics?: CareerMetrics | null;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
*/
|
||||
import { Meta } from './meta';
|
||||
import { CustomAuthor } from './customAuthor';
|
||||
import { Author } from './author';
|
||||
import { GroupByResult } from './groupByResult';
|
||||
|
||||
|
||||
export interface CustomAuthorsListResponse {
|
||||
meta?: Meta | null;
|
||||
results?: Array<Author> | null;
|
||||
results?: Array<CustomAuthor> | null;
|
||||
group_by?: Array<GroupByResult> | null;
|
||||
placeholder?: CustomAuthor | null;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ export * from './autocompleteResponse';
|
||||
export * from './autocompleteResponseMeta';
|
||||
export * from './autocompleteResponseResultsInner';
|
||||
export * from './award';
|
||||
export * from './bodyCreateUser';
|
||||
export * from './bundProject';
|
||||
export * from './bundProjectPage';
|
||||
export * from './careerMetrics';
|
||||
export * from './categoryNested';
|
||||
export * from './collaborationNetwork';
|
||||
export * from './collaborationNetworkEdge';
|
||||
@@ -75,6 +77,7 @@ export * from './topicSubfield';
|
||||
export * from './topicsByTime';
|
||||
export * from './topicsByYear';
|
||||
export * from './topicsListResponse';
|
||||
export * from './user';
|
||||
export * from './validationError';
|
||||
export * from './validationErrorLocInner';
|
||||
export * from './value';
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* An entry in the user configuration file.
|
||||
*/
|
||||
export interface User {
|
||||
/**
|
||||
* The username of the user.
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* The password of the user.
|
||||
*/
|
||||
password: string;
|
||||
/**
|
||||
* The email of the user.
|
||||
*/
|
||||
email: string;
|
||||
/**
|
||||
* The account id of the user.
|
||||
*/
|
||||
account: number;
|
||||
/**
|
||||
* The organization id of the user.
|
||||
*/
|
||||
organization: number;
|
||||
/**
|
||||
* The organization name of the user.
|
||||
*/
|
||||
organization_name: string;
|
||||
/**
|
||||
* Indicates whether the user is a superadmin.
|
||||
*/
|
||||
superadmin?: boolean;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@ import { dfgProjectsResolver } from './resolvers/dfg-projects.resolver';
|
||||
import { institutionsResolver } from './resolvers/institutions.resolver';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
redirectTo: 'dashboard',
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
loadComponent: () =>
|
||||
@@ -18,6 +23,13 @@ export const routes: Routes = [
|
||||
(mod) => mod.AppLoginComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'register',
|
||||
loadComponent: () =>
|
||||
import('./modules/app-register/app-register.component').then(
|
||||
(mod) => mod.AppRegisterComponent,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'dashboard',
|
||||
canActivate: [userGuard],
|
||||
@@ -255,5 +267,6 @@ export const routes: Routes = [
|
||||
routeMessage:
|
||||
'Die gesuchte Seite existiert leider nicht oder wurde verschoben.',
|
||||
},
|
||||
canActivate: [userGuard],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -42,6 +42,12 @@
|
||||
[disabled]="!loginForm.valid || (credentialService.validating | async)">
|
||||
Anmelden
|
||||
</button>
|
||||
|
||||
<div class="field" style="text-align: center; margin-top: -10px;">
|
||||
<button mat-button type="button" routerLink="/register">
|
||||
Noch kein Konto? <b>Registrieren</b>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<p class="progress">
|
||||
@if (credentialService.validating | async) {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
}
|
||||
|
||||
.field {
|
||||
width: 300px;
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.progress {
|
||||
|
||||
@@ -13,7 +13,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { Router } from '@angular/router';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-app-login',
|
||||
@@ -25,6 +25,7 @@ import { Router } from '@angular/router';
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatSnackBarModule,
|
||||
RouterLink,
|
||||
],
|
||||
templateUrl: './app-login.component.html',
|
||||
styleUrl: './app-login.component.scss',
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
<div class="container">
|
||||
<form class="form" [formGroup]="registerForm">
|
||||
<h3>Konto erstellen</h3>
|
||||
<p class="field">
|
||||
Bitte gib Deine Daten ein, um Dich zu registrieren.
|
||||
</p>
|
||||
|
||||
<mat-form-field class="field">
|
||||
<mat-label>Benutzername</mat-label>
|
||||
<input matInput formControlName="username" />
|
||||
@if (registerForm.controls['username'].hasError('required')) {
|
||||
<mat-error>Fehler: <b>Benutzername</b> erforderlich.</mat-error>
|
||||
} @else if (registerForm.controls['username'].hasError('minlength')) {
|
||||
<mat-error>Fehler: <b>Benutzername</b> ist unvollständig.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="field">
|
||||
<mat-label>E-Mail</mat-label>
|
||||
<input matInput type="email" formControlName="email" />
|
||||
@if (registerForm.controls['email'].hasError('required')) {
|
||||
<mat-error>Fehler: <b>E-Mail</b> erforderlich.</mat-error>
|
||||
} @else if (registerForm.controls['email'].hasError('email')) {
|
||||
<mat-error>Fehler: Ungültige <b>E-Mail</b> Adresse.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="field">
|
||||
<mat-label>Passwort</mat-label>
|
||||
<input
|
||||
matInput
|
||||
[type]="showPassword ? 'text' : 'password'"
|
||||
formControlName="password" />
|
||||
@if (showPassword) {
|
||||
<mat-icon matSuffix (click)="showPassword = false">visibility</mat-icon>
|
||||
} @else {
|
||||
<mat-icon matSuffix (click)="showPassword = true"
|
||||
>visibility_off</mat-icon
|
||||
>
|
||||
}
|
||||
@if (registerForm.controls['password'].hasError('required')) {
|
||||
<mat-error>Fehler: <b>Passwort</b> erforderlich.</mat-error>
|
||||
} @else if (registerForm.controls['password'].hasError('minlength')) {
|
||||
<mat-error>Fehler: <b>Passwort</b> ist unvollständig.</mat-error>
|
||||
}
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="field">
|
||||
<mat-label>Institution</mat-label>
|
||||
|
||||
<mat-icon matPrefix>apartment</mat-icon>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
formControlName="institution"
|
||||
[matAutocomplete]="auto"
|
||||
placeholder="Institution suchen..."
|
||||
/>
|
||||
@if (registerForm.controls['institution'].hasError('required')) {
|
||||
<mat-error>Fehler: <b>Institution</b> erforderlich.</mat-error>
|
||||
}
|
||||
<mat-autocomplete
|
||||
#auto="matAutocomplete"
|
||||
(optionSelected)="onInstitutionSelected($event)">
|
||||
@for (institution of institutionOptions(); track institution.id) {
|
||||
<mat-option [value]="institution.display_name" style="font-size: 16px;">
|
||||
<div><span>{{ institution.display_name }}</span></div>
|
||||
@if (institution.hint) {
|
||||
<small>{{ institution.hint }}</small>
|
||||
}
|
||||
</mat-option>
|
||||
}
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="field checkbox-container">
|
||||
<mat-checkbox formControlName="superadmin">Superadmin Rechte</mat-checkbox>
|
||||
</div>
|
||||
|
||||
<button
|
||||
mat-raised-button
|
||||
class="button"
|
||||
(click)="submit()"
|
||||
[disabled]="!registerForm.valid || (credentialService.validating | async)">
|
||||
Registrieren
|
||||
</button>
|
||||
|
||||
<div class="field" style="text-align: center; margin-top: -10px;">
|
||||
<button mat-button type="button" routerLink="/login">
|
||||
Bereits ein Konto? <b>Anmelden</b>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<p class="progress">
|
||||
<!-- Statusanzeige analog zum Login-Formular -->
|
||||
</p>
|
||||
</div>
|
||||
@@ -0,0 +1,56 @@
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(160deg, #f4f6fb, #e8ecf7);
|
||||
}
|
||||
|
||||
.form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
box-shadow:
|
||||
0 2px 12px #1a3a6e1a,
|
||||
0 1px 4px #0000000f;
|
||||
gap: 20px;
|
||||
padding: 36px 32px 28px;
|
||||
|
||||
h3 {
|
||||
margin: 0 0 4px;
|
||||
font-weight: 600;
|
||||
color: #1a3a6e;
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
min-height: 48px;
|
||||
min-width: 140px;
|
||||
border-radius: 8px;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.field {
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.checkbox-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.progress {
|
||||
padding-top: 5px;
|
||||
width: 300px;
|
||||
height: 2em;
|
||||
text-align: center;
|
||||
font-size: small;
|
||||
color: #585f71;
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
import { Component, inject, OnDestroy, signal, DestroyRef, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import {
|
||||
FormBuilder,
|
||||
FormGroup,
|
||||
ReactiveFormsModule,
|
||||
Validators,
|
||||
} from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { CredentialService } from '../../shared/services/credential.service';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { Subscription, map, switchMap, debounceTime, distinctUntilChanged, catchError,of} from 'rxjs';
|
||||
import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { InstitutionsService } from '../../api';
|
||||
@Component({
|
||||
selector: 'app-register',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
ReactiveFormsModule,
|
||||
MatButtonModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatIconModule,
|
||||
MatCheckboxModule,
|
||||
RouterLink,
|
||||
MatSnackBarModule,
|
||||
MatAutocompleteModule,
|
||||
],
|
||||
templateUrl: './app-register.component.html',
|
||||
styleUrl: './app-register.component.scss',
|
||||
})
|
||||
export class AppRegisterComponent implements OnDestroy, OnInit {
|
||||
private readonly fb = inject(FormBuilder);
|
||||
protected readonly credentialService = inject(CredentialService);
|
||||
private readonly router = inject(Router);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private subscription?: Subscription;
|
||||
private institutionsService = inject(InstitutionsService)
|
||||
registerForm: FormGroup = this.fb.group({
|
||||
username: ['', [Validators.required, Validators.minLength(4)]],
|
||||
email: ['', [Validators.required, Validators.email]],
|
||||
password: ['', [Validators.required, Validators.minLength(8)]],
|
||||
institution: ['', [Validators.required]],
|
||||
superadmin: [false],
|
||||
});
|
||||
readonly institutionOptions = signal<any[]>([]);
|
||||
showPassword = false;
|
||||
|
||||
constructor() {
|
||||
this.setupInstitutionAutocomplete();
|
||||
}
|
||||
ngOnInit(): void {
|
||||
this.subscription = this.credentialService.validating.subscribe(
|
||||
(validating) => {
|
||||
if (validating) {
|
||||
this.registerForm.disable();
|
||||
} else {
|
||||
this.registerForm.enable();
|
||||
this.checkEnter();
|
||||
}
|
||||
},
|
||||
);
|
||||
if (!this.credentialService.validating) {
|
||||
this.checkEnter();
|
||||
}
|
||||
}
|
||||
ngOnDestroy(): void {
|
||||
this.subscription?.unsubscribe();
|
||||
}
|
||||
|
||||
checkEnter(): void {
|
||||
if (this.credentialService.authenticated.value) {
|
||||
this.router.navigate(['/dashboard']);
|
||||
}
|
||||
}
|
||||
submit() {
|
||||
if (this.registerForm.valid) {
|
||||
this.credentialService.validating.next(true);
|
||||
this.registerForm.disable();
|
||||
|
||||
this.subscription = this.credentialService
|
||||
.registerAccount(this.registerForm.value)
|
||||
.subscribe({
|
||||
next: () => {
|
||||
this.credentialService.validating.next(false);
|
||||
this.snackBar.open(
|
||||
'Konto erfolgreich erstellt! Du kannst Dich jetzt anmelden.',
|
||||
'OK',
|
||||
{ duration: 5000 },
|
||||
);
|
||||
this.router.navigate(['/login']);
|
||||
},
|
||||
error: (err) => {
|
||||
this.credentialService.validating.next(false);
|
||||
this.registerForm.enable();
|
||||
const message =
|
||||
err.error?.message ||
|
||||
'Fehler bei der Registrierung. Bitte versuche es später erneut.';
|
||||
this.snackBar.open(message, 'Schließen', {
|
||||
panelClass: ['error-snackbar'],
|
||||
duration: 5000,
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private setupInstitutionAutocomplete(): void {
|
||||
this.registerForm.controls['institution'].valueChanges
|
||||
.pipe(
|
||||
debounceTime(250),
|
||||
map((value) => (typeof value === 'string' ? value.trim() : '')),
|
||||
distinctUntilChanged(),
|
||||
switchMap((query) => {
|
||||
if (query.length < 2) {
|
||||
this.institutionOptions.set([]);
|
||||
return of([]);
|
||||
}
|
||||
|
||||
return this.searchInstitutions(query).pipe(
|
||||
catchError((ev) => {console.log(ev);return of([])}),
|
||||
);
|
||||
}),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((options) => {
|
||||
this.institutionOptions.set(options);
|
||||
});
|
||||
}
|
||||
|
||||
private searchInstitutions(query: string) {
|
||||
return this.institutionsService
|
||||
.autocompleteInstitutions(query, undefined, undefined, 10)
|
||||
.pipe(map((response) => response.results ?? []));
|
||||
}
|
||||
|
||||
onInstitutionSelected(event: MatAutocompleteSelectedEvent): void {
|
||||
const val = event.option.value;
|
||||
this.registerForm.controls['institution'].setValue(val, { emitEvent: false });
|
||||
this.institutionOptions.set([]);
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,7 @@
|
||||
{{ getInitials(person.display_name) }}
|
||||
</div>
|
||||
<div class="header-main">
|
||||
<div class="rating-and-bookmark">
|
||||
@if (person.relevance_rating) {
|
||||
<span
|
||||
[skText]="loading"
|
||||
class="suitability-badge"
|
||||
[ngClass]="getRatingClass(person.relevance_rating)">
|
||||
{{ person.relevance_rating }}
|
||||
</span>
|
||||
}
|
||||
<div class="bookmark">
|
||||
<button
|
||||
class="bookmark-btn"
|
||||
(click)="
|
||||
@@ -26,16 +18,20 @@
|
||||
}}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
<h2 [skText]="loading" class="person-name">{{ person.display_name }}</h2>
|
||||
<h2
|
||||
[skText]="loading"
|
||||
class="person-name"
|
||||
[title]="person.display_name ?? ''">
|
||||
{{ person.display_name ?? '' }}
|
||||
</h2>
|
||||
<p [skText]="loading" class="person-id">
|
||||
{{ getDistinguishingId(person) }}
|
||||
{{ getDistinguishingId(person) ?? '' }}
|
||||
</p>
|
||||
<p [skText]="loading" class="stats">
|
||||
Publikationen: {{ person.works_count }} · Zitationen:
|
||||
{{ person.cited_by_count }}
|
||||
{{ getStatsString() }}
|
||||
</p>
|
||||
<p [skText]="loading" class="stats">
|
||||
h_index: {{person.summary_stats?.h_index }}
|
||||
<p [skText]="loading" class="stats">
|
||||
{{ getHIndexString() }}
|
||||
</p>
|
||||
</div>
|
||||
</a>
|
||||
@@ -60,9 +56,12 @@
|
||||
"
|
||||
>apartment</mat-icon
|
||||
>
|
||||
<span [skText]="loading" style="vertical-align: middle">{{
|
||||
inst.display_name ?? '' | truncate: 30
|
||||
}}</span>
|
||||
<span
|
||||
[skText]="loading"
|
||||
class="institution-name"
|
||||
style="vertical-align: middle"
|
||||
>{{ inst.display_name ?? '' }}</span
|
||||
>
|
||||
@if (inst.country_code && !loading) {
|
||||
<img
|
||||
alt=""
|
||||
@@ -71,6 +70,7 @@
|
||||
height="10"
|
||||
style="margin-left: 6px; vertical-align: middle" />
|
||||
<span
|
||||
class="country-code"
|
||||
style="font-size: 9px; margin-left: 2px; vertical-align: middle"
|
||||
>{{ inst.country_code.toUpperCase() }}</span
|
||||
>
|
||||
|
||||
@@ -108,6 +108,11 @@
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--sg-text);
|
||||
min-height: 24px;
|
||||
line-height: 24px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.institution {
|
||||
display: flex;
|
||||
@@ -133,6 +138,26 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
transition: all 0.2s ease;
|
||||
max-width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
||||
.institution-name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flag-img {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.country-code {
|
||||
display: inline-block;
|
||||
flex-shrink: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--sg-primary);
|
||||
@@ -143,13 +168,15 @@
|
||||
|
||||
.flag-img {
|
||||
border: 1px solid;
|
||||
vertical-align: -10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.person-id {
|
||||
margin: 2px 0 0;
|
||||
font-size: 10px;
|
||||
color: var(--sg-text-soft);
|
||||
min-height: 15px;
|
||||
line-height: 15px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
@@ -159,6 +186,11 @@
|
||||
margin: 4px 0 0;
|
||||
font-size: 10px;
|
||||
color: var(--sg-text-muted);
|
||||
min-height: 15px;
|
||||
line-height: 15px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
@@ -186,6 +218,11 @@
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
box-sizing: border-box;
|
||||
|
||||
&:hover {
|
||||
background: var(--sg-primary-soft);
|
||||
|
||||
@@ -3,18 +3,11 @@ import { CommonModule } from '@angular/common';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { CustomAuthor, DehydratedInstitution, WorkTopic } from '../../api';
|
||||
import { TruncatePipe } from '../../shared/pipes/truncate.pipe';
|
||||
import { SkTextDirective } from '../../custom-directives/sk-text.directive';
|
||||
@Component({
|
||||
selector: 'app-person-card',
|
||||
standalone: true,
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterLink,
|
||||
MatIconModule,
|
||||
TruncatePipe,
|
||||
SkTextDirective,
|
||||
],
|
||||
imports: [CommonModule, RouterLink, MatIconModule, SkTextDirective],
|
||||
templateUrl: './person-card.component.html',
|
||||
styleUrl: './person-card.component.scss',
|
||||
})
|
||||
@@ -62,8 +55,11 @@ export class PersonCardComponent {
|
||||
if (topic.field?.display_name) parts.push(topic.field.display_name);
|
||||
if (topic.subfield?.display_name) parts.push(topic.subfield.display_name);
|
||||
|
||||
if (parts.length === 0) return topic.display_name || '';
|
||||
return parts.join(' - ');
|
||||
const path = parts.join(' - ');
|
||||
if (topic.display_name) {
|
||||
return path ? `${topic.display_name}\n(${path})` : topic.display_name;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
getDistinguishingId(person: CustomAuthor): string {
|
||||
@@ -74,6 +70,30 @@ export class PersonCardComponent {
|
||||
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 {
|
||||
this.bookmarkToggle.emit(this.person);
|
||||
}
|
||||
|
||||
@@ -303,17 +303,6 @@
|
||||
}
|
||||
} @else {
|
||||
<div class="funding-container">
|
||||
<div class="funding-summary">
|
||||
<p class="summary-line">
|
||||
<span class="summary-value">{{ getUniquePublicationCount() }}</span>
|
||||
<span class="summary-label"> Einzigartige Publikationen</span>
|
||||
</p>
|
||||
<p class="summary-line">
|
||||
<span class="summary-value">{{ filteredFunders.length }}</span>
|
||||
<span class="summary-label"> Förderer</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="funding-content">
|
||||
<!-- Linke Seite: Tabelle -->
|
||||
<div class="funding-list">
|
||||
@@ -321,23 +310,35 @@
|
||||
<div class="filter-bar">
|
||||
<span>Filter nach Position:</span>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="activeFilter === 'all'"
|
||||
(click)="setFilter('all')">
|
||||
[attr.aria-pressed]="activeFilter === 'all'"
|
||||
(click)="setFilter('all')"
|
||||
>
|
||||
Alle
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="activeFilter === 'first'"
|
||||
(click)="setFilter('first')">
|
||||
[attr.aria-pressed]="activeFilter === 'first'"
|
||||
(click)="setFilter('first')"
|
||||
>
|
||||
Erstautor
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="activeFilter === 'middle'"
|
||||
(click)="setFilter('middle')">
|
||||
[attr.aria-pressed]="activeFilter === 'middle'"
|
||||
(click)="setFilter('middle')"
|
||||
>
|
||||
Mitautor
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
[class.active]="activeFilter === 'last'"
|
||||
(click)="setFilter('last')">
|
||||
[attr.aria-pressed]="activeFilter === 'last'"
|
||||
(click)="setFilter('last')"
|
||||
>
|
||||
Letztautor
|
||||
</button>
|
||||
</div>
|
||||
@@ -466,7 +467,44 @@
|
||||
</div>
|
||||
} @else {
|
||||
<div class="funding-detail empty">
|
||||
<p>Klicke auf einen Förderer für Details.</p>
|
||||
<div class="empty-overview">
|
||||
@if (activeFilter !== "all") {
|
||||
<span class="empty-overview__filter">
|
||||
Filter: {{ getPositionLabel(activeFilter) }}
|
||||
</span>
|
||||
}
|
||||
<h3 class="empty-overview__title">Förderübersicht</h3>
|
||||
<p class="empty-overview__subtitle">
|
||||
@if (activeFilter === "all") {
|
||||
Alle geförderten Publikationen dieser Person im Überblick.
|
||||
} @else {
|
||||
Nur Publikationen mit der gewählten Autorenposition.
|
||||
}
|
||||
</p>
|
||||
<div class="empty-overview__stats">
|
||||
<div class="empty-overview__stat">
|
||||
<span class="empty-overview__stat-value">{{
|
||||
getUniquePublicationCount()
|
||||
}}</span>
|
||||
<span class="empty-overview__stat-label"
|
||||
>Einzigartige Publikationen</span
|
||||
>
|
||||
</div>
|
||||
<div class="empty-overview__stat">
|
||||
<span class="empty-overview__stat-value">{{
|
||||
filteredFunders.length
|
||||
}}</span>
|
||||
<span class="empty-overview__stat-label">Förderer</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="empty-overview__hint">
|
||||
<span class="material-icons" aria-hidden="true">touch_app</span>
|
||||
<p>
|
||||
Wähle links einen Förderer aus, um die zugehörigen Publikationen
|
||||
anzuzeigen.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -23,38 +23,42 @@
|
||||
|
||||
button {
|
||||
padding: 6px 14px;
|
||||
border: 1px solid #ccc;
|
||||
border: 1px solid transparent;
|
||||
border-radius: 20px;
|
||||
background: white;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
|
||||
&:hover {
|
||||
background: #f0f0f0;
|
||||
&.active {
|
||||
font-weight: 600;
|
||||
border-width: 2px;
|
||||
padding: 5px 13px;
|
||||
}
|
||||
}
|
||||
|
||||
button:nth-child(2) {
|
||||
background: #f0f6ff;
|
||||
color: #0b63ce;
|
||||
border-color: #bdd4ff;
|
||||
color: #3b82c4;
|
||||
border-color: #c7dcfa;
|
||||
&.active { color: #0b4f9e; background: #e8f2ff; border-color: #3b82c4; }
|
||||
}
|
||||
|
||||
button:nth-child(3) {
|
||||
background: #effaf3;
|
||||
color: #24834f;
|
||||
border-color: #bdebcf;
|
||||
color: #3d9a66;
|
||||
border-color: #b8e6cb;
|
||||
&.active { color: #1a6b3f; background: #e8f7ee; border-color: #3d9a66; }
|
||||
}
|
||||
|
||||
button:nth-child(4) {
|
||||
background: #f6f0ff;
|
||||
color: #7255d9;
|
||||
border-color: #d8cafe;
|
||||
color: #7c65d9;
|
||||
border-color: #d5c8f8;
|
||||
&.active { color: #5b3fc9; background: #f0ebff; border-color: #7c65d9; }
|
||||
}
|
||||
|
||||
button:nth-child(5) {
|
||||
background: #fff7e8;
|
||||
color: #c67500;
|
||||
border-color: #ffd796;
|
||||
color: #d1435f;
|
||||
border-color: #f8c4ce;
|
||||
&.active { color: #a61e3a; background: #ffe8ec; border-color: #d1435f; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,9 +73,7 @@
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
|
||||
span {
|
||||
color: #555;
|
||||
}
|
||||
span { color: #555; }
|
||||
|
||||
select {
|
||||
border: 0;
|
||||
@@ -101,9 +103,7 @@
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.sort-control {
|
||||
margin-left: auto;
|
||||
}
|
||||
.sort-control { margin-left: auto; }
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
@@ -119,14 +119,7 @@
|
||||
|
||||
tr {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
&.selected {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
&.selected { background: #f0f0f0; }
|
||||
}
|
||||
|
||||
td {
|
||||
@@ -152,18 +145,22 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: #999;
|
||||
min-height: 200px;
|
||||
min-height: 280px;
|
||||
padding: 24px;
|
||||
background:
|
||||
radial-gradient(circle at 100% 0%, rgba(200, 217, 255, 0.35), transparent 45%),
|
||||
linear-gradient(160deg, #fff 0%, #f8faff 100%);
|
||||
border-color: #dbe3f2;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0 0 16px 0;
|
||||
margin: 0 0 16px;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
h4 {
|
||||
margin: 16px 0 8px 0;
|
||||
margin: 16px 0 8px;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
}
|
||||
@@ -172,16 +169,13 @@
|
||||
.position-stats {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
margin: 0 auto 16px;
|
||||
width: fit-content;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
.stat {
|
||||
flex: 0 auto;
|
||||
min-width: 100px;
|
||||
text-align: center;
|
||||
background: white;
|
||||
background: #fff;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
@@ -200,20 +194,48 @@
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.stat-first {
|
||||
background: #effaf3;
|
||||
border-color: #bdebcf;
|
||||
}
|
||||
}
|
||||
|
||||
.stat-middle {
|
||||
background: #f6f0ff;
|
||||
border-color: #d8cafe;
|
||||
}
|
||||
.stat-first,
|
||||
.position-badge--first,
|
||||
.hero-highlight--open,
|
||||
.publication-detail-grid .access-badge--open {
|
||||
background: #effaf3;
|
||||
}
|
||||
|
||||
.stat-last {
|
||||
background: #fff7e8;
|
||||
border-color: #ffd796;
|
||||
}
|
||||
.stat-first { border-color: #bdebcf; }
|
||||
|
||||
.position-badge--first {
|
||||
color: #24834f;
|
||||
border: 1px solid #bdebcf;
|
||||
}
|
||||
|
||||
.hero-highlight--open,
|
||||
.publication-detail-grid .access-badge--open {
|
||||
border-color: #bdebcf;
|
||||
color: #24834f;
|
||||
}
|
||||
|
||||
.stat-middle,
|
||||
.position-badge--middle {
|
||||
background: #f6f0ff;
|
||||
border-color: #d8cafe;
|
||||
}
|
||||
|
||||
.position-badge--middle {
|
||||
color: #7255d9;
|
||||
border: 1px solid #d8cafe;
|
||||
}
|
||||
|
||||
.stat-last,
|
||||
.position-badge--last {
|
||||
background: #fff1f2;
|
||||
border-color: #fda4af;
|
||||
}
|
||||
|
||||
.position-badge--last {
|
||||
color: #be123c;
|
||||
border: 1px solid #fda4af;
|
||||
}
|
||||
|
||||
.publication-list {
|
||||
@@ -241,7 +263,7 @@
|
||||
padding: 4px 10px;
|
||||
border: 1px solid #d0d0d0;
|
||||
border-radius: 6px;
|
||||
background: white;
|
||||
background: #fff;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
|
||||
@@ -257,38 +279,109 @@
|
||||
}
|
||||
}
|
||||
|
||||
.funding-summary {
|
||||
margin-bottom: 16px;
|
||||
.empty-overview {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
||||
.summary-line {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
&__filter {
|
||||
display: inline-block;
|
||||
margin-bottom: 12px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid #dbe3f2;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
color: #475569;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin: 0 0 8px;
|
||||
font-size: 1.125rem;
|
||||
color: #1e3a5f;
|
||||
}
|
||||
|
||||
&__subtitle {
|
||||
margin: 0 0 20px;
|
||||
color: #64748b;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
&__stats {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
&__stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 16px 12px;
|
||||
border: 1px solid #e0e6f0;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
}
|
||||
|
||||
&__stat-value {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.1;
|
||||
color: #1e3a5f;
|
||||
}
|
||||
|
||||
&__stat-label {
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.35;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
&__hint {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 12px 14px;
|
||||
border: 1px dashed #c7d5ea;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.7);
|
||||
text-align: left;
|
||||
|
||||
.material-icons {
|
||||
font-size: 20px;
|
||||
color: #3b82c4;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: #475569;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.45;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.funding-publication-page {
|
||||
padding: 16px;
|
||||
}
|
||||
.funding-publication-page { padding: 16px; }
|
||||
|
||||
.publication-detail-back {
|
||||
.publication-detail-back,
|
||||
.publication-more-info {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.publication-detail-back { gap: 6px; }
|
||||
|
||||
.publication-more-info {
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.publication-detail-hero {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -326,7 +419,6 @@
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +454,6 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
padding: 10px 16px;
|
||||
border: 1px solid #bdd4ff;
|
||||
border-radius: 8px;
|
||||
@@ -371,33 +462,14 @@
|
||||
font-weight: 600;
|
||||
font-size: 0.875rem;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
|
||||
&:hover {
|
||||
background: #e3efff;
|
||||
}
|
||||
|
||||
.material-icons {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.publication-detail-hero {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
||||
&__action {
|
||||
justify-content: center;
|
||||
}
|
||||
.material-icons { font-size: 18px; }
|
||||
}
|
||||
}
|
||||
|
||||
.hero-highlight {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
min-width: 72px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid #e0e6f0;
|
||||
border-radius: 8px;
|
||||
@@ -414,7 +486,6 @@
|
||||
font-size: 0.7rem;
|
||||
color: #64748b;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
&--badge {
|
||||
@@ -426,12 +497,6 @@
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
&--open {
|
||||
border-color: #bdebcf;
|
||||
background: #effaf3;
|
||||
color: #24834f;
|
||||
}
|
||||
|
||||
&--closed {
|
||||
border-color: #e0e6f0;
|
||||
background: #f8fafc;
|
||||
@@ -447,24 +512,6 @@
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
|
||||
&--first {
|
||||
background: #effaf3;
|
||||
color: #24834f;
|
||||
border: 1px solid #bdebcf;
|
||||
}
|
||||
|
||||
&--middle {
|
||||
background: #f6f0ff;
|
||||
color: #7255d9;
|
||||
border: 1px solid #d8cafe;
|
||||
}
|
||||
|
||||
&--last {
|
||||
background: #fff7e8;
|
||||
color: #c67500;
|
||||
border: 1px solid #ffd796;
|
||||
}
|
||||
|
||||
&--unknown {
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
@@ -472,179 +519,123 @@
|
||||
}
|
||||
}
|
||||
|
||||
.publication-detail-grid {
|
||||
$g: '.publication-detail-grid';
|
||||
|
||||
#{$g} {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.publication-detail-main,
|
||||
.publication-detail-side {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
#{$g} .publication-detail-main,
|
||||
#{$g} .publication-detail-side {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.publication-detail-section {
|
||||
border: 1px solid #e0e6f0;
|
||||
border-radius: 10px;
|
||||
padding: 18px;
|
||||
background: #fff;
|
||||
#{$g} .publication-detail-section {
|
||||
border: 1px solid #e0e6f0;
|
||||
border-radius: 10px;
|
||||
padding: 18px;
|
||||
background: #fff;
|
||||
|
||||
h3 {
|
||||
margin: 0 0 14px;
|
||||
font-size: 1rem;
|
||||
color: #1e3a5f;
|
||||
}
|
||||
|
||||
&--funding {
|
||||
background: #fafbfd;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-overview,
|
||||
.publication-abstract {
|
||||
margin: 0;
|
||||
color: #334155;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
.publication-detail-facts {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
margin: 0;
|
||||
|
||||
div {
|
||||
display: grid;
|
||||
grid-template-columns: 130px minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
dt {
|
||||
color: #64748b;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
dd {
|
||||
margin: 0;
|
||||
word-break: break-word;
|
||||
color: #1e293b;
|
||||
}
|
||||
}
|
||||
|
||||
.tag-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
|
||||
&--compact .tag {
|
||||
font-size: 0.75rem;
|
||||
padding: 3px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
background: #f0f6ff;
|
||||
border: 1px solid #dbeafe;
|
||||
color: #1e40af;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.access-badge {
|
||||
display: inline-flex;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
|
||||
&--open {
|
||||
background: #effaf3;
|
||||
color: #24834f;
|
||||
}
|
||||
|
||||
&--closed {
|
||||
background: #f8fafc;
|
||||
color: #475569;
|
||||
}
|
||||
}
|
||||
|
||||
.access-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.inline-action {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: #0b63ce;
|
||||
font-weight: 600;
|
||||
font-size: 0.875rem;
|
||||
text-decoration: none;
|
||||
|
||||
.material-icons {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.warning-badge {
|
||||
display: inline-flex;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
background: #fef2f2;
|
||||
border: 1px solid #fecaca;
|
||||
color: #b91c1c;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.citation-year-table {
|
||||
border-collapse: collapse;
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 2px 0;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
th {
|
||||
padding-right: 20px;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
td {
|
||||
color: #1e293b;
|
||||
}
|
||||
h3 {
|
||||
margin: 0 0 14px;
|
||||
font-size: 1rem;
|
||||
color: #1e3a5f;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.publication-detail-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
#{$g} .publication-overview,
|
||||
#{$g} .publication-abstract {
|
||||
margin: 0;
|
||||
color: #334155;
|
||||
line-height: 1.65;
|
||||
}
|
||||
|
||||
#{$g} .publication-detail-facts {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#{$g} .publication-detail-facts div {
|
||||
display: grid;
|
||||
grid-template-columns: 130px minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
#{$g} .publication-detail-facts dt {
|
||||
color: #64748b;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
#{$g} .publication-detail-facts dd {
|
||||
margin: 0;
|
||||
word-break: break-word;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
#{$g} .tag-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#{$g} .tag,
|
||||
#{$g} .access-badge,
|
||||
#{$g} .warning-badge {
|
||||
display: inline-flex;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
#{$g} .tag {
|
||||
background: #f0f6ff;
|
||||
border: 1px solid #dbeafe;
|
||||
color: #1e40af;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
#{$g} .access-badge {
|
||||
font-weight: 600;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
#{$g} .access-badge--closed {
|
||||
background: #f8fafc;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
#{$g} .inline-action {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
color: #0b63ce;
|
||||
font-weight: 600;
|
||||
font-size: 0.875rem;
|
||||
text-decoration: none;
|
||||
|
||||
.material-icons { font-size: 16px; }
|
||||
}
|
||||
|
||||
#{$g} .warning-badge {
|
||||
background: #fef2f2;
|
||||
border: 1px solid #fecaca;
|
||||
color: #b91c1c;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.publication-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 2px solid #5b5555;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
background: #f9f9f9;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-title {
|
||||
@@ -654,30 +645,31 @@
|
||||
word-break: break-word;
|
||||
display: block;
|
||||
}
|
||||
.publication-more-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mehr-infos-label,
|
||||
.publication-link-icon { color: #1976d2; }
|
||||
|
||||
.mehr-infos-label {
|
||||
font-size: 0.8rem;
|
||||
color: #1976d2;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.publication-link-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #1976d2;
|
||||
flex-shrink: 0;
|
||||
|
||||
.material-icons {
|
||||
font-size: 16px;
|
||||
.material-icons { font-size: 16px; }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.publication-detail-hero {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
||||
&__action { justify-content: center; }
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
#{$g} { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
+39
-6
@@ -225,6 +225,10 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!getMainTopicItem(item)?.id"
|
||||
[matTooltip]="getTopicDescription(getMainTopicItem(item))"
|
||||
[matTooltipDisabled]="
|
||||
!hasTopicDescription(getMainTopicItem(item))
|
||||
"
|
||||
(click)="
|
||||
selectTopic(getMainTopicItem(item), [item.year])
|
||||
">
|
||||
@@ -261,8 +265,17 @@
|
||||
[ngClass]="getColorClass(index)"
|
||||
[disabled]="!topic.id"
|
||||
(click)="selectTopic(topic, [item.year])">
|
||||
<span class="topic-name">{{ topic.name }}</span>
|
||||
<span class="topic-count">{{ topic.count }}</span>
|
||||
<span
|
||||
class="topic-name"
|
||||
[matTooltip]="getTopicDescription(topic)"
|
||||
[matTooltipDisabled]="!hasTopicDescription(topic)">
|
||||
{{ topic.name }}
|
||||
</span>
|
||||
<span
|
||||
class="topic-count"
|
||||
[matTooltip]="getYearTopicCountTooltip(topic, item)">
|
||||
{{ topic.count }}
|
||||
</span>
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
@@ -322,6 +335,10 @@
|
||||
type="button"
|
||||
class="main-topic-button"
|
||||
[disabled]="!phase.primaryTopic.id"
|
||||
[matTooltip]="getTopicDescription(phase.primaryTopic)"
|
||||
[matTooltipDisabled]="
|
||||
!hasTopicDescription(phase.primaryTopic)
|
||||
"
|
||||
(click)="
|
||||
selectTopic(phase.primaryTopic, getPhaseYears(phase))
|
||||
">
|
||||
@@ -341,8 +358,17 @@
|
||||
[ngClass]="getColorClass(index)"
|
||||
[disabled]="!topic.id"
|
||||
(click)="selectTopic(topic, getPhaseYears(phase))">
|
||||
<span class="topic-name">{{ topic.name }}</span>
|
||||
<span class="topic-count">{{ topic.count }}</span>
|
||||
<span
|
||||
class="topic-name"
|
||||
[matTooltip]="getTopicDescription(topic)"
|
||||
[matTooltipDisabled]="!hasTopicDescription(topic)">
|
||||
{{ topic.name }}
|
||||
</span>
|
||||
<span
|
||||
class="topic-count"
|
||||
[matTooltip]="getPhaseTopicCountTooltip(topic, phase)">
|
||||
{{ topic.count }}
|
||||
</span>
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
@@ -413,8 +439,15 @@
|
||||
class="mini-topic-chip"
|
||||
[disabled]="!topic.id"
|
||||
(click)="selectTopic(topic, [year.year])">
|
||||
<span>{{ topic.name }}</span>
|
||||
<strong>{{ topic.count }}</strong>
|
||||
<span
|
||||
[matTooltip]="getTopicDescription(topic)"
|
||||
[matTooltipDisabled]="!hasTopicDescription(topic)">
|
||||
{{ topic.name }}
|
||||
</span>
|
||||
<strong
|
||||
[matTooltip]="getYearTopicCountTooltip(topic, year)">
|
||||
{{ topic.count }}
|
||||
</strong>
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
|
||||
+3
-3
@@ -409,7 +409,6 @@
|
||||
|
||||
.topic-count {
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 18px;
|
||||
@@ -453,7 +452,6 @@
|
||||
}
|
||||
|
||||
.phase-marker {
|
||||
flex: 0 0 auto;
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
margin-top: 5px;
|
||||
@@ -493,7 +491,6 @@
|
||||
|
||||
.phase-publications-button {
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
width: fit-content;
|
||||
color: #68748f;
|
||||
font-size: 12px;
|
||||
@@ -602,6 +599,9 @@
|
||||
}
|
||||
|
||||
strong {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
color: var(--accent);
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
+49
@@ -17,6 +17,7 @@ export interface TopicTimelineTopic {
|
||||
id?: string;
|
||||
name: string;
|
||||
count: number;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export interface TopicTimelineElement {
|
||||
@@ -330,6 +331,31 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
);
|
||||
}
|
||||
|
||||
getTopicDescription(topic: TopicTimelineTopic | undefined): string {
|
||||
return (topic?.description ?? '').trim();
|
||||
}
|
||||
|
||||
hasTopicDescription(topic: TopicTimelineTopic | undefined): boolean {
|
||||
return this.getTopicDescription(topic).length > 0;
|
||||
}
|
||||
|
||||
getYearTopicCountTooltip(
|
||||
topic: TopicTimelineTopic,
|
||||
item: TopicTimelineElement,
|
||||
): string {
|
||||
return this.getTopicCountTooltip(topic, `im Jahr ${item.year}`);
|
||||
}
|
||||
|
||||
getPhaseTopicCountTooltip(
|
||||
topic: TopicTimelineTopic,
|
||||
phase: ResearchTimelinePhase,
|
||||
): string {
|
||||
return this.getTopicCountTooltip(
|
||||
topic,
|
||||
this.getPhasePublicationTooltipPeriod(phase),
|
||||
);
|
||||
}
|
||||
|
||||
togglePhase(phase: ResearchTimelinePhase): void {
|
||||
if (this.expandedPhaseIds.has(phase.id)) {
|
||||
this.expandedPhaseIds.delete(phase.id);
|
||||
@@ -462,6 +488,17 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
return `Insgesamt ${count} ${publicationLabel} ${period} veröffentlicht.`;
|
||||
}
|
||||
|
||||
private getTopicCountTooltip(
|
||||
topic: TopicTimelineTopic,
|
||||
period: string,
|
||||
): string {
|
||||
const publicationLabel =
|
||||
topic.count === 1 ? 'Publikation' : 'Publikationen';
|
||||
const verb = topic.count === 1 ? 'hat' : 'haben';
|
||||
|
||||
return `${topic.count} ${publicationLabel} ${period} ${verb} das Topic ${topic.name}.`;
|
||||
}
|
||||
|
||||
private getPhasePublicationTooltipPeriod(
|
||||
phase: ResearchTimelinePhase,
|
||||
): string {
|
||||
@@ -608,6 +645,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
const primaryTopicName = primaryTopic.name;
|
||||
let count = 0;
|
||||
let id = primaryTopic.id;
|
||||
let description = primaryTopic.description;
|
||||
|
||||
for (const year of years) {
|
||||
for (const topic of year.primary_topics ?? []) {
|
||||
@@ -620,6 +658,10 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
if (!id && topic.id) {
|
||||
id = topic.id;
|
||||
}
|
||||
|
||||
if (!description && topic.description) {
|
||||
description = topic.description;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,6 +669,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
id,
|
||||
name: primaryTopicName,
|
||||
count: count > 0 ? count : primaryTopic.count,
|
||||
description,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -637,6 +680,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
const counts = new Map<string, number>();
|
||||
const originalNames = new Map<string, string>();
|
||||
const ids = new Map<string, string>();
|
||||
const descriptions = new Map<string, string>();
|
||||
|
||||
for (const year of years) {
|
||||
for (const topic of year.topics ?? []) {
|
||||
@@ -652,6 +696,10 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
ids.set(normalizedName, topic.id);
|
||||
}
|
||||
|
||||
if (topic.description) {
|
||||
descriptions.set(normalizedName, topic.description);
|
||||
}
|
||||
|
||||
counts.set(
|
||||
normalizedName,
|
||||
(counts.get(normalizedName) ?? 0) + topic.count,
|
||||
@@ -664,6 +712,7 @@ export class ResearchTimelineComponent implements OnChanges, AfterViewChecked {
|
||||
id: ids.get(normalizedName),
|
||||
name: originalNames.get(normalizedName) ?? normalizedName,
|
||||
count,
|
||||
description: descriptions.get(normalizedName),
|
||||
}))
|
||||
.sort((left, right) => {
|
||||
if (right.count !== left.count) {
|
||||
|
||||
@@ -453,6 +453,7 @@ export class PersonOverviewComponent implements OnInit {
|
||||
id: topic.id ?? undefined,
|
||||
name: topic.name,
|
||||
count: topic.count ?? 0,
|
||||
description: topic.description ?? undefined,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ import { switchMap, throwError } from 'rxjs';
|
||||
|
||||
export const authenticationInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
if (
|
||||
req.method == 'POST' &&
|
||||
(req.url.endsWith('/auth/id') || req.url.endsWith('/auth/access'))
|
||||
(req.method == 'POST' &&
|
||||
(req.url.endsWith('/auth/id') ||
|
||||
req.url.endsWith('/auth/access') ||
|
||||
req.url.endsWith('/inse-account/create'))) ||
|
||||
req.url.endsWith('/institutions/autocomplete')
|
||||
) {
|
||||
return next(req);
|
||||
} else {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
//import { BehaviorSubject, Observable, takeWhile } from 'rxjs';
|
||||
import { Injectable,inject } from '@angular/core';
|
||||
import { filter, take, map } from 'rxjs/operators'; //TODO: review by arman
|
||||
import { Observable, of } from 'rxjs'; // review
|
||||
import { BehaviorSubject } from 'rxjs'; //review
|
||||
import { INSEAccountServiceService, IdentityGrant as ApiIdentityGrant, AccessGrant as ApiAccessGrant } from '../../api';
|
||||
|
||||
export interface AuthAccount {
|
||||
i: number;
|
||||
l: string;
|
||||
o: number;
|
||||
e: string;
|
||||
on: string;
|
||||
}
|
||||
|
||||
export interface AuthScope {
|
||||
@@ -47,6 +48,8 @@ interface TimedAccessGrant {
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CredentialService {
|
||||
private accountService = inject(INSEAccountServiceService);
|
||||
|
||||
private static readonly KEY_GRANT = 'grant';
|
||||
|
||||
public readonly validating = new BehaviorSubject<boolean>(false);
|
||||
@@ -57,6 +60,8 @@ export class CredentialService {
|
||||
undefined,
|
||||
);
|
||||
public readonly login = new BehaviorSubject<string>('');
|
||||
public readonly email = new BehaviorSubject<string>('');
|
||||
public readonly organizationName = new BehaviorSubject<string>('');
|
||||
|
||||
private readonly identityToken = new BehaviorSubject<
|
||||
TimedIdentityGrant | undefined
|
||||
@@ -67,17 +72,21 @@ export class CredentialService {
|
||||
|
||||
private request = 0;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
constructor() {
|
||||
this.accessToken.subscribe((token) => {
|
||||
if (token) {
|
||||
const r = token.grant.scope.r as string[];
|
||||
this.superadmin.next(r.includes('SUPER_ADMIN'));
|
||||
this.universityadmin.next(r.includes('UNI_ADMIN'));
|
||||
this.login.next(token.grant.scope.a?.l ?? '');
|
||||
this.email.next(token.grant.scope.a?.e ?? '');
|
||||
this.organizationName.next(token.grant.scope.a?.on ?? '');
|
||||
} else {
|
||||
this.superadmin.next(false);
|
||||
this.universityadmin.next(false);
|
||||
this.login.next('');
|
||||
this.email.next('');
|
||||
this.organizationName.next('');
|
||||
}
|
||||
});
|
||||
const data = localStorage.getItem(CredentialService.KEY_GRANT);
|
||||
@@ -104,15 +113,12 @@ export class CredentialService {
|
||||
body.set('username', login);
|
||||
body.set('password', password);
|
||||
|
||||
this.http
|
||||
.post<IdentityGrant>('/inse-account/auth/id', body.toString(), {
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
})
|
||||
this.accountService.getIdentityGrant(login,password)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
if (this.request != request) return;
|
||||
const token = {
|
||||
grant: result,
|
||||
const token: TimedIdentityGrant = {
|
||||
grant: result as any as IdentityGrant,
|
||||
expiration: result.expires_in * 1000 + now,
|
||||
};
|
||||
this.identityToken.next(token);
|
||||
@@ -137,20 +143,12 @@ export class CredentialService {
|
||||
const uid = identityToken.grant.scope.a!.i;
|
||||
const org = identityToken.grant.scope.a!.o;
|
||||
|
||||
const body = new URLSearchParams();
|
||||
body.set('secret', identityToken.grant.access_token);
|
||||
body.set('account', uid.toString());
|
||||
body.set('organization', org.toString());
|
||||
|
||||
this.http
|
||||
.post<AccessGrant>('/inse-account/auth/access', body.toString(), {
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
})
|
||||
this.accountService.getAccessGrant(identityToken.grant.access_token, uid, org)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
if (this.request != request) return;
|
||||
const token = {
|
||||
grant: result,
|
||||
const token: TimedAccessGrant = {
|
||||
grant: result as any as AccessGrant,
|
||||
expiration: result.expires_in * 1000 + now,
|
||||
};
|
||||
this.accessToken.next(token);
|
||||
@@ -180,6 +178,11 @@ export class CredentialService {
|
||||
this.identityToken.next(undefined);
|
||||
this.accessToken.next(undefined);
|
||||
this.validating.next(false);
|
||||
|
||||
}
|
||||
|
||||
public registerAccount(data: any): Observable<any> {
|
||||
return this.accountService.createUser(data)
|
||||
}
|
||||
|
||||
//review: arman (generated fix)
|
||||
|
||||
@@ -15,45 +15,51 @@
|
||||
</mat-drawer>
|
||||
}
|
||||
<mat-drawer-content class="content-shell">
|
||||
<mat-toolbar class="main">
|
||||
<div class="topbar-left">
|
||||
@if (
|
||||
mediaQuery.matches && (credentialService.authenticated | async)
|
||||
) {
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="toggle()"
|
||||
matTooltip="Navigation">
|
||||
<mat-icon>menu</mat-icon>
|
||||
@if (credentialService.authenticated | async) {
|
||||
<mat-toolbar class="main">
|
||||
<div class="topbar-left">
|
||||
@if (mediaQuery.matches) {
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="toggle()"
|
||||
matTooltip="Navigation">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
}
|
||||
<button (click)="navigateBack()" class="back-link" type="button">
|
||||
<mat-icon>arrow_back</mat-icon>
|
||||
<span>Zurück</span>
|
||||
</button>
|
||||
}
|
||||
<button (click)="navigateBack()" class="back-link" type="button">
|
||||
<mat-icon>arrow_back</mat-icon>
|
||||
<span>Zurück zur Suche</span>
|
||||
</button>
|
||||
</div>
|
||||
<app-searchbar />
|
||||
<div class="topbar-actions">
|
||||
<ng-content select="[menu]"></ng-content>
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
</div>
|
||||
<app-searchbar />
|
||||
<div class="topbar-actions">
|
||||
<ng-content select="[menu]"></ng-content>
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
}
|
||||
|
||||
<main class="content">
|
||||
@if (resolverState.isResolvingFromOutside('/persons')) {
|
||||
<app-loading
|
||||
text="Personenliste wird geladen..."
|
||||
icon="group"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/person/')) {
|
||||
<app-loading
|
||||
text="Personendaten werden geladen..."
|
||||
icon="person"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else {
|
||||
<ng-content></ng-content>
|
||||
}
|
||||
<div class="main-content-body">
|
||||
@if (resolverState.isResolvingFromOutside('/persons')) {
|
||||
<app-loading
|
||||
text="Personenliste wird geladen..."
|
||||
icon="group"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/person/')) {
|
||||
<app-loading
|
||||
text="Personendaten werden geladen..."
|
||||
icon="person"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else {
|
||||
<ng-content></ng-content>
|
||||
}
|
||||
</div>
|
||||
|
||||
<footer class="footer-container">
|
||||
<div class="footer">Networked Embedded Systems 2026</div>
|
||||
</footer>
|
||||
</main>
|
||||
</mat-drawer-content>
|
||||
</mat-drawer-container>
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
}
|
||||
|
||||
.content-shell {
|
||||
min-height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
@@ -34,10 +37,9 @@ mat-toolbar.main {
|
||||
gap: 24px;
|
||||
height: 76px;
|
||||
padding: 0 32px;
|
||||
background: rgba(255, 255, 255, 0.92);
|
||||
background: var(--sg-surface-soft);
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
color: var(--sg-text);
|
||||
backdrop-filter: blur(16px);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
@@ -82,10 +84,30 @@ mat-toolbar.main {
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: calc(100svh - 76px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
background: var(--sg-background);
|
||||
}
|
||||
|
||||
.main-content-body {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.footer-container {
|
||||
flex-shrink: 0;
|
||||
padding: 12px 32px;
|
||||
background: var(--sg-surface-soft);
|
||||
border-top: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.footer {
|
||||
font-size: 12px;
|
||||
color: var(--sg-text-muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
mat-toolbar.main {
|
||||
grid-template-columns: auto 1fr auto;
|
||||
@@ -115,7 +137,7 @@ mat-toolbar.main {
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: calc(100svh - 124px);
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
.search-wrapper {
|
||||
|
||||
@@ -37,11 +37,12 @@
|
||||
</div>
|
||||
|
||||
<div class="account-card">
|
||||
<div class="avatar">M</div>
|
||||
<div class="avatar">{{ (credentialService.login | async)?.charAt(0) }}</div>
|
||||
<div>
|
||||
<strong>{{
|
||||
(credentialService.login | async) || 'Max Mustermann'
|
||||
}}</strong>
|
||||
<strong>{{ credentialService.organizationName | async }}</strong>
|
||||
<span>Startup Coach</span>
|
||||
</div>
|
||||
<mat-icon>expand_more</mat-icon>
|
||||
@@ -51,7 +52,7 @@
|
||||
<button
|
||||
class="utility-link"
|
||||
type="button"
|
||||
(click)="credentialService.logoutAcount()">
|
||||
(click)="onLogout()">
|
||||
<mat-icon>logout</mat-icon>
|
||||
<span>Abmelden</span>
|
||||
</button>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { Component, computed } from '@angular/core';
|
||||
import { Component, computed ,inject} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Router, RouterLink, RouterLinkActive } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
@@ -32,7 +34,7 @@ export class AppMenuComponent {
|
||||
label: 'Personen',
|
||||
icon: 'groups',
|
||||
route: '/persons',
|
||||
queryParams: { institutionName: 'University of Duisburg-Essen' },
|
||||
queryParams: { institutionName: this.credentialService.organizationName.value },
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
@@ -56,4 +58,21 @@ export class AppMenuComponent {
|
||||
) {}
|
||||
|
||||
isNavigating = computed(() => !!this.router.currentNavigation());
|
||||
private readonly dialog = inject(MatDialog);
|
||||
|
||||
onLogout() {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
title: 'Abmelden',
|
||||
message: 'Möchtest Du Dich wirklich abmelden?',
|
||||
confirmText: 'Abmelden',
|
||||
cancelText: 'Abbrechen',
|
||||
},
|
||||
});
|
||||
|
||||
dialogRef.componentInstance.confirmDelete.subscribe(() => {
|
||||
this.credentialService.logoutAcount();
|
||||
this.router.navigate(['/login']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
height: 44px;
|
||||
align-self: center;
|
||||
padding: 0 18px;
|
||||
background: var(--sg-surface-muted);
|
||||
background: white;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text-soft);
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<h3 mat-dialog-title>Daten löschen</h3>
|
||||
<mat-dialog-content
|
||||
>Bist Du sicher, dass Du die Daten löschen möchtest? Diesen Vorgang kannst Du
|
||||
nicht mehr rückgängig machen.</mat-dialog-content
|
||||
>
|
||||
<h3 mat-dialog-title>{{ data.title }}</h3>
|
||||
<mat-dialog-content>{{ data.message }}</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions class="action">
|
||||
<button mat-flat-button class="secondary-button" (click)="onCancelClick()">
|
||||
Abbrechen
|
||||
{{ data.cancelText }}
|
||||
</button>
|
||||
<button mat-flat-button class="primary-button" (click)="onConfirmClick()">
|
||||
Löschen
|
||||
{{ data.confirmText }}
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
import { Component, EventEmitter } from '@angular/core';
|
||||
import { Component, EventEmitter, inject, Inject, Optional } from '@angular/core';
|
||||
import {
|
||||
MatDialogRef,
|
||||
MatDialogActions,
|
||||
MatDialogClose,
|
||||
MatDialogTitle,
|
||||
MatDialogContent,
|
||||
MAT_DIALOG_DATA,
|
||||
} from '@angular/material/dialog';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
export interface ConfirmationData {
|
||||
title: string;
|
||||
message: string;
|
||||
confirmText: string;
|
||||
cancelText: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirmation-dialog',
|
||||
imports: [
|
||||
MatDialogActions,
|
||||
MatDialogClose,
|
||||
MatDialogContent,
|
||||
MatDialogTitle,
|
||||
MatButtonModule,
|
||||
@@ -22,9 +29,20 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
standalone: true,
|
||||
})
|
||||
export class ConfirmationDialogComponent {
|
||||
confirmDelete = new EventEmitter<void>();
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<ConfirmationDialogComponent>) {}
|
||||
confirmDelete = new EventEmitter<void>();
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
|
||||
@Optional() @Inject(MAT_DIALOG_DATA) public data: ConfirmationData
|
||||
) {
|
||||
this.data = data || {
|
||||
title: 'Daten löschen',
|
||||
message: 'Bist Du sicher, dass Du die Daten löschen möchtest? Diesen Vorgang kannst Du nicht mehr rückgängig machen.',
|
||||
confirmText: 'Löschen',
|
||||
cancelText: 'Abbrechen'
|
||||
};
|
||||
}
|
||||
|
||||
onCancelClick(): void {
|
||||
this.dialogRef.close();
|
||||
|
||||
Reference in New Issue
Block a user