Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import uuid
|
||||
from typing import List, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, model_validator
|
||||
|
||||
from inse.auth.model import UserRole
|
||||
from inse.auth.model import UserRole, normalize_roles
|
||||
|
||||
|
||||
class OrganizationProfile(BaseModel):
|
||||
@@ -16,7 +16,7 @@ class AccountProfile(BaseModel):
|
||||
id: uuid.UUID
|
||||
email: str
|
||||
name: str
|
||||
role: UserRole
|
||||
roles: List[UserRole]
|
||||
organization_id: uuid.UUID
|
||||
organization_name: str
|
||||
deleted: bool
|
||||
@@ -34,20 +34,45 @@ class AccountPage(BaseModel):
|
||||
|
||||
|
||||
class CreateAccountRequest(BaseModel):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _role_to_roles(cls, values):
|
||||
if isinstance(values, dict) and "roles" not in values and "role" in values:
|
||||
values = {**values, "roles": [values["role"]]}
|
||||
return values
|
||||
|
||||
email: str = Field(min_length=3)
|
||||
name: str = Field(min_length=1)
|
||||
role: UserRole = UserRole.USER
|
||||
roles: List[UserRole] = Field(default_factory=lambda: [UserRole.USER])
|
||||
organization_id: uuid.UUID
|
||||
password: str = Field(min_length=8)
|
||||
openalex_person_id: Optional[str] = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _normalize_roles(self):
|
||||
self.roles = normalize_roles(self.roles)
|
||||
return self
|
||||
|
||||
|
||||
class UpdateAccountRequest(BaseModel):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _role_to_roles(cls, values):
|
||||
if isinstance(values, dict) and "roles" not in values and "role" in values:
|
||||
values = {**values, "roles": [values["role"]]}
|
||||
return values
|
||||
|
||||
email: Optional[str] = Field(default=None, min_length=3)
|
||||
name: Optional[str] = Field(default=None, min_length=1)
|
||||
role: Optional[UserRole] = None
|
||||
roles: Optional[List[UserRole]] = None
|
||||
organization_id: Optional[uuid.UUID] = None
|
||||
password: Optional[str] = Field(default=None, min_length=8)
|
||||
openalex_person_id: Optional[str] = None
|
||||
deleted: Optional[bool] = None
|
||||
activated: Optional[bool] = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def _normalize_roles(self):
|
||||
if self.roles is not None:
|
||||
self.roles = normalize_roles(self.roles)
|
||||
return self
|
||||
|
||||
@@ -5,7 +5,13 @@ from fastapi import HTTPException, status
|
||||
from sqlmodel import Session, func, or_, select
|
||||
|
||||
from inse.auth import service as auth_service
|
||||
from inse.auth.model import AccessTokenMetadata, Account, Organization, UserRole
|
||||
from inse.auth.model import (
|
||||
AccessTokenMetadata,
|
||||
Account,
|
||||
Organization,
|
||||
UserRole,
|
||||
normalize_roles,
|
||||
)
|
||||
|
||||
from .model import (
|
||||
AccountPage,
|
||||
@@ -28,13 +34,17 @@ def _role_allowed_for_editor(editor_role: UserRole, role: UserRole) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def _roles_allowed_for_editor(editor_role: UserRole, roles: list[UserRole]) -> bool:
|
||||
return all(_role_allowed_for_editor(editor_role, role) for role in roles)
|
||||
|
||||
|
||||
def _account_to_profile(account: Account, token: AccessTokenMetadata) -> AccountProfile:
|
||||
organization_name = account.organization.name if account.organization else ""
|
||||
return AccountProfile(
|
||||
id=account.id,
|
||||
email=account.email,
|
||||
name=account.name,
|
||||
role=account.role,
|
||||
roles=normalize_roles(account.roles),
|
||||
organization_id=account.organization_id,
|
||||
organization_name=organization_name,
|
||||
deleted=account.deleted,
|
||||
@@ -175,7 +185,7 @@ def create_account(
|
||||
detail="Admins can only create accounts in their own organization.",
|
||||
)
|
||||
|
||||
if not _role_allowed_for_editor(access_token.effective_role, payload.role):
|
||||
if not _roles_allowed_for_editor(access_token.effective_role, payload.roles):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="You cannot assign this role.",
|
||||
@@ -194,7 +204,7 @@ def create_account(
|
||||
account = Account(
|
||||
email=email,
|
||||
name=payload.name.strip(),
|
||||
role=payload.role,
|
||||
roles=payload.roles,
|
||||
organization_id=payload.organization_id,
|
||||
password_hash=auth_service._hash_password(payload.password),
|
||||
openalex_person_id=payload.openalex_person_id,
|
||||
@@ -261,15 +271,15 @@ def update_account(
|
||||
if payload.openalex_person_id is not None:
|
||||
account.openalex_person_id = payload.openalex_person_id
|
||||
|
||||
if payload.role is not None:
|
||||
if payload.roles is not None:
|
||||
if not can_admin_update:
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
if not _role_allowed_for_editor(access_token.effective_role, payload.role):
|
||||
if not _roles_allowed_for_editor(access_token.effective_role, payload.roles):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail="You cannot assign this role.",
|
||||
)
|
||||
account.role = payload.role
|
||||
account.roles = payload.roles
|
||||
account.epoch += 1
|
||||
|
||||
if payload.organization_id is not None:
|
||||
|
||||
@@ -3,8 +3,8 @@ from datetime import datetime
|
||||
from enum import StrEnum
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel
|
||||
from sqlalchemy import UniqueConstraint
|
||||
from pydantic import BaseModel, model_validator
|
||||
from sqlalchemy import JSON, Column, UniqueConstraint
|
||||
from sqlmodel import Field, Relationship, SQLModel
|
||||
|
||||
|
||||
@@ -15,6 +15,35 @@ class UserRole(StrEnum):
|
||||
USER = "USER"
|
||||
|
||||
|
||||
ROLE_PRIORITY = {
|
||||
UserRole.SUPER_ADMIN: 0,
|
||||
UserRole.ADMIN: 1,
|
||||
UserRole.MANAGER: 2,
|
||||
UserRole.USER: 3,
|
||||
}
|
||||
|
||||
|
||||
def normalize_roles(roles: List[UserRole] | List[str] | UserRole | str | None) -> List[UserRole]:
|
||||
if roles is None:
|
||||
return [UserRole.USER]
|
||||
if isinstance(roles, (str, UserRole)):
|
||||
roles = [roles]
|
||||
|
||||
normalized = []
|
||||
seen = set()
|
||||
for role in roles:
|
||||
user_role = role if isinstance(role, UserRole) else UserRole(role)
|
||||
if user_role not in seen:
|
||||
normalized.append(user_role)
|
||||
seen.add(user_role)
|
||||
|
||||
return sorted(normalized or [UserRole.USER], key=lambda role: ROLE_PRIORITY[role])
|
||||
|
||||
|
||||
def effective_role_for_roles(roles: List[UserRole] | List[str] | UserRole | str | None) -> UserRole:
|
||||
return normalize_roles(roles)[0]
|
||||
|
||||
|
||||
class TokenType(StrEnum):
|
||||
ID_TOKEN = "ID_TOKEN"
|
||||
REFRESH_TOKEN = "REFRESH_TOKEN"
|
||||
@@ -57,6 +86,13 @@ class Organization(Durable, table=True):
|
||||
|
||||
|
||||
class Account(Durable, table=True):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _role_to_roles(cls, values):
|
||||
if isinstance(values, dict) and "roles" not in values and "role" in values:
|
||||
values = {**values, "roles": [values["role"]]}
|
||||
return values
|
||||
|
||||
id: uuid.UUID | None = Field(
|
||||
default_factory=uuid.uuid4,
|
||||
primary_key=True,
|
||||
@@ -101,15 +137,22 @@ class Account(Durable, table=True):
|
||||
nullable=False,
|
||||
description="The unique identifier of the organization strictly associated with this account.",
|
||||
)
|
||||
role: UserRole = Field(
|
||||
default=UserRole.USER,
|
||||
index=True,
|
||||
nullable=False,
|
||||
description="The specific role this account holds within its organization.",
|
||||
roles: List[UserRole] = Field(
|
||||
default_factory=lambda: [UserRole.USER],
|
||||
sa_column=Column(JSON, nullable=False, default=lambda: [UserRole.USER.value]),
|
||||
description="The roles this account holds within its organization.",
|
||||
)
|
||||
|
||||
organization: Organization = Relationship(back_populates="accounts")
|
||||
|
||||
@property
|
||||
def role(self) -> UserRole:
|
||||
return effective_role_for_roles(self.roles)
|
||||
|
||||
@role.setter
|
||||
def role(self, value: UserRole) -> None:
|
||||
self.roles = normalize_roles(value)
|
||||
|
||||
|
||||
class Secret(SQLModel, table=True):
|
||||
__table_args__ = (
|
||||
@@ -176,6 +219,17 @@ class IdTokenMetadata(BaseTokenData):
|
||||
|
||||
|
||||
class AccessTokenMetadata(BaseTokenData):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _effective_role_to_roles(cls, values):
|
||||
if (
|
||||
isinstance(values, dict)
|
||||
and "effective_roles" not in values
|
||||
and "effective_role" in values
|
||||
):
|
||||
values = {**values, "effective_roles": [values["effective_role"]]}
|
||||
return values
|
||||
|
||||
token_type: TokenType = Field(
|
||||
default=TokenType.ACCESS_TOKEN,
|
||||
const=True,
|
||||
@@ -191,6 +245,10 @@ class AccessTokenMetadata(BaseTokenData):
|
||||
default=UserRole.USER,
|
||||
description="The specific role this access token grants within its organization.",
|
||||
)
|
||||
effective_roles: List[UserRole] = Field(
|
||||
default_factory=lambda: [UserRole.USER],
|
||||
description="The roles this access token grants within its organization.",
|
||||
)
|
||||
effective_organization_id: uuid.UUID = Field(
|
||||
description="The unique identifier of the organization associated with this access token.",
|
||||
)
|
||||
@@ -211,6 +269,17 @@ class AccessToken(AccessTokenMetadata):
|
||||
|
||||
|
||||
class RefreshTokenMetadata(BaseTokenData):
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _effective_role_to_roles(cls, values):
|
||||
if (
|
||||
isinstance(values, dict)
|
||||
and "effective_roles" not in values
|
||||
and "effective_role" in values
|
||||
):
|
||||
values = {**values, "effective_roles": [values["effective_role"]]}
|
||||
return values
|
||||
|
||||
token_type: TokenType = Field(
|
||||
default=TokenType.REFRESH_TOKEN,
|
||||
const=True,
|
||||
@@ -223,6 +292,10 @@ class RefreshTokenMetadata(BaseTokenData):
|
||||
default=UserRole.USER,
|
||||
description="The specific role this access token grants within its organization.",
|
||||
)
|
||||
effective_roles: List[UserRole] = Field(
|
||||
default_factory=lambda: [UserRole.USER],
|
||||
description="The roles this access token grants within its organization.",
|
||||
)
|
||||
effective_organization_id: uuid.UUID = Field(
|
||||
description="The unique identifier of the organization associated with this access token.",
|
||||
)
|
||||
|
||||
@@ -28,6 +28,8 @@ from inse.auth.model import (
|
||||
SecretPurpose,
|
||||
TokenType,
|
||||
UserRole,
|
||||
effective_role_for_roles,
|
||||
normalize_roles,
|
||||
)
|
||||
from inse.config import get_settings
|
||||
from inse.database import get_session
|
||||
@@ -44,6 +46,7 @@ PASSWORD_RESET_MAX_REQUESTS_PER_WINDOW = 3 # 3 minutes
|
||||
REAL_ACCOUNT_ID_KEY = "real_account_id"
|
||||
EFFECTIVE_ACCOUNT_ID_KEY = "effective_account_id"
|
||||
EFFECTIVE_ROLE_KEY = "effective_role"
|
||||
EFFECTIVE_ROLES_KEY = "effective_roles"
|
||||
EFFECTIVE_ORGANIZATION_ID_KEY = "effective_organization_id"
|
||||
EPOCH_KEY = "epoch"
|
||||
USER_FINGERPRINT_HASH_KEY = "user_fingerprint_hash"
|
||||
@@ -110,14 +113,14 @@ def create_predefined_accounts(session: Session, file_path: str):
|
||||
session.add(organization)
|
||||
for account_data in data.get("accounts", []):
|
||||
organization_id = uuid.UUID(account_data["organization_id"])
|
||||
role = UserRole(account_data["role"])
|
||||
roles = normalize_roles(account_data.get("roles", account_data.get("role")))
|
||||
email = account_data["email"]
|
||||
password_hash = _hash_password(account_data["password"])
|
||||
account = Account(
|
||||
email=email,
|
||||
name=account_data["name"],
|
||||
organization_id=organization_id,
|
||||
role=role,
|
||||
roles=roles,
|
||||
password_hash=password_hash,
|
||||
epoch=0,
|
||||
)
|
||||
@@ -609,6 +612,11 @@ def _get_current_user_access_token_payload(
|
||||
),
|
||||
epoch=access_token_payload[EPOCH_KEY],
|
||||
effective_role=UserRole(access_token_payload[EFFECTIVE_ROLE_KEY]),
|
||||
effective_roles=normalize_roles(
|
||||
access_token_payload.get(
|
||||
EFFECTIVE_ROLES_KEY, access_token_payload[EFFECTIVE_ROLE_KEY]
|
||||
)
|
||||
),
|
||||
effective_organization_id=uuid.UUID(
|
||||
access_token_payload[EFFECTIVE_ORGANIZATION_ID_KEY]
|
||||
),
|
||||
@@ -649,6 +657,11 @@ def _get_current_user_refresh_token_payload(
|
||||
),
|
||||
epoch=refresh_token_payload[EPOCH_KEY],
|
||||
effective_role=UserRole(refresh_token_payload[EFFECTIVE_ROLE_KEY]),
|
||||
effective_roles=normalize_roles(
|
||||
refresh_token_payload.get(
|
||||
EFFECTIVE_ROLES_KEY, refresh_token_payload[EFFECTIVE_ROLE_KEY]
|
||||
)
|
||||
),
|
||||
effective_organization_id=uuid.UUID(
|
||||
refresh_token_payload[EFFECTIVE_ORGANIZATION_ID_KEY]
|
||||
),
|
||||
@@ -728,7 +741,7 @@ def _get_account_epoch(
|
||||
return account.epoch
|
||||
|
||||
|
||||
def _get_account_role(session: Session, account_id: uuid.UUID) -> UserRole:
|
||||
def _get_account_roles(session: Session, account_id: uuid.UUID) -> list[UserRole]:
|
||||
"""Retrieves the role for the given account ID.
|
||||
|
||||
Args:
|
||||
@@ -736,14 +749,14 @@ def _get_account_role(session: Session, account_id: uuid.UUID) -> UserRole:
|
||||
account_id (uuid.UUID): The unique identifier of the account for which to retrieve the role.
|
||||
|
||||
Returns:
|
||||
UserRole: The role associated with the given account ID.
|
||||
list[UserRole]: The roles associated with the given account ID.
|
||||
"""
|
||||
account = session.get(Account, account_id)
|
||||
|
||||
if not account or account.deleted or not account.activated or account.id is None:
|
||||
raise AccountNotFoundException
|
||||
|
||||
return account.role
|
||||
return normalize_roles(account.roles)
|
||||
|
||||
|
||||
def _get_account_organization(session: Session, account_id: uuid.UUID) -> uuid.UUID:
|
||||
@@ -794,13 +807,16 @@ def _is_valid_impersonation(
|
||||
):
|
||||
raise AccountNotFoundException
|
||||
|
||||
if real_account.role == UserRole.SUPER_ADMIN:
|
||||
real_account_role = effective_role_for_roles(real_account.roles)
|
||||
effective_account_role = effective_role_for_roles(effective_account.roles)
|
||||
|
||||
if real_account_role == UserRole.SUPER_ADMIN:
|
||||
return True # Super admins can impersonate any account
|
||||
|
||||
if real_account.organization_id != effective_account.organization_id:
|
||||
return False # Cannot impersonate accounts from different organizations
|
||||
|
||||
if real_account.role == UserRole.ADMIN and effective_account.role in [
|
||||
if real_account_role == UserRole.ADMIN and effective_account_role in [
|
||||
UserRole.MANAGER,
|
||||
UserRole.USER,
|
||||
]:
|
||||
@@ -847,7 +863,8 @@ def get_access_token(
|
||||
detail="Impersonation not allowed",
|
||||
)
|
||||
|
||||
role = _get_account_role(session=session, account_id=effective_account_id)
|
||||
roles = _get_account_roles(session=session, account_id=effective_account_id)
|
||||
role = effective_role_for_roles(roles)
|
||||
epoch = _get_account_epoch(account_id=effective_account_id, session=session)
|
||||
organization_id = _get_account_organization(
|
||||
session=session, account_id=effective_account_id
|
||||
@@ -862,6 +879,7 @@ def get_access_token(
|
||||
effective_organization_id=organization_id,
|
||||
epoch=epoch,
|
||||
user_fingerprint_hash=user_fingerprint_hash,
|
||||
effective_roles=roles,
|
||||
)
|
||||
_set_refresh_token(
|
||||
response=response,
|
||||
@@ -870,6 +888,7 @@ def get_access_token(
|
||||
effective_role=role,
|
||||
effective_organization_id=organization_id,
|
||||
epoch=epoch,
|
||||
effective_roles=roles,
|
||||
)
|
||||
return AccessResponse(
|
||||
access_token=access_token,
|
||||
@@ -974,6 +993,7 @@ def refresh_access_token(
|
||||
effective_organization_id=refresh_token.effective_organization_id,
|
||||
epoch=refresh_token.epoch,
|
||||
user_fingerprint_hash=user_fingerprint_hash,
|
||||
effective_roles=refresh_token.effective_roles,
|
||||
)
|
||||
|
||||
|
||||
@@ -1020,6 +1040,7 @@ def _set_refresh_token(
|
||||
effective_role: UserRole,
|
||||
effective_organization_id: uuid.UUID,
|
||||
epoch: int,
|
||||
effective_roles: list[UserRole] | None = None,
|
||||
) -> RefreshTokenMetadata:
|
||||
"""Builds a refresh token for the specified account IDs, role, organization ID, epoch, and fingerprint hash.
|
||||
|
||||
@@ -1038,10 +1059,12 @@ def _set_refresh_token(
|
||||
expires_at = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
|
||||
minutes=REFRESH_TOKEN_EXPIRATION_MINUTES
|
||||
)
|
||||
effective_roles = normalize_roles(effective_roles or effective_role)
|
||||
payload = {
|
||||
REAL_ACCOUNT_ID_KEY: str(real_account_id),
|
||||
EFFECTIVE_ACCOUNT_ID_KEY: str(effective_account_id),
|
||||
EFFECTIVE_ROLE_KEY: effective_role.value,
|
||||
EFFECTIVE_ROLES_KEY: [role.value for role in effective_roles],
|
||||
EFFECTIVE_ORGANIZATION_ID_KEY: str(effective_organization_id),
|
||||
EPOCH_KEY: epoch,
|
||||
}
|
||||
@@ -1058,6 +1081,7 @@ def _set_refresh_token(
|
||||
expires_at=expires_at,
|
||||
epoch=epoch,
|
||||
effective_role=effective_role,
|
||||
effective_roles=effective_roles,
|
||||
effective_organization_id=effective_organization_id,
|
||||
)
|
||||
|
||||
@@ -1069,6 +1093,7 @@ def _build_access_token(
|
||||
effective_organization_id: uuid.UUID,
|
||||
epoch: int,
|
||||
user_fingerprint_hash: str,
|
||||
effective_roles: list[UserRole] | None = None,
|
||||
) -> AccessToken:
|
||||
"""Builds an access token for the specified account IDs, role, organization ID, epoch, and fingerprint hash.
|
||||
|
||||
@@ -1087,10 +1112,12 @@ def _build_access_token(
|
||||
expires_at = datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(
|
||||
minutes=ACCESS_TOKEN_EXPIRATION_MINUTES
|
||||
)
|
||||
effective_roles = normalize_roles(effective_roles or effective_role)
|
||||
payload = {
|
||||
REAL_ACCOUNT_ID_KEY: str(real_account_id),
|
||||
EFFECTIVE_ACCOUNT_ID_KEY: str(effective_account_id),
|
||||
EFFECTIVE_ROLE_KEY: effective_role.value,
|
||||
EFFECTIVE_ROLES_KEY: [role.value for role in effective_roles],
|
||||
EFFECTIVE_ORGANIZATION_ID_KEY: str(effective_organization_id),
|
||||
EPOCH_KEY: epoch,
|
||||
USER_FINGERPRINT_HASH_KEY: user_fingerprint_hash,
|
||||
@@ -1108,6 +1135,7 @@ def _build_access_token(
|
||||
expires_at=expires_at,
|
||||
epoch=epoch,
|
||||
effective_role=effective_role,
|
||||
effective_roles=effective_roles,
|
||||
effective_organization_id=effective_organization_id,
|
||||
user_fingerprint_hash=user_fingerprint_hash,
|
||||
raw_token=raw_token,
|
||||
|
||||
@@ -91,6 +91,21 @@ def create_db_and_tables():
|
||||
"BOOLEAN NOT NULL DEFAULT TRUE"
|
||||
)
|
||||
)
|
||||
if "roles" not in columns:
|
||||
with engine.begin() as connection:
|
||||
connection.execute(
|
||||
text(
|
||||
"ALTER TABLE account ADD COLUMN roles "
|
||||
"JSON NOT NULL DEFAULT '[\"USER\"]'"
|
||||
)
|
||||
)
|
||||
if "role" in columns:
|
||||
connection.execute(
|
||||
text(
|
||||
"UPDATE account SET roles = '[\"' || role || '\"]' "
|
||||
"WHERE role IS NOT NULL"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def get_session():
|
||||
|
||||
@@ -92,6 +92,7 @@ def _index_to_cluster(index: ESIndex) -> Optional[ESCluster]:
|
||||
ESIndex.OPENALEX_AUTHORS,
|
||||
ESIndex.OPENALEX_INSTITUTIONS,
|
||||
ESIndex.OPENALEX_PUBLICATIONS,
|
||||
ESIndex.WORK_CLASSIFICATIONS,
|
||||
}:
|
||||
return ESCluster.NES
|
||||
elif index in {
|
||||
|
||||
@@ -98,3 +98,5 @@ class ESIndex(StrEnum):
|
||||
CORDIS_EU_HORIZON_EUROPE_WEB_LINKS = "cordis_eu_horizon_europe_web_links"
|
||||
CORDIS_EU_HORIZON_EUROPE_EUROSCIVOC = "cordis_eu_horizon_europe_euroscivoc"
|
||||
CORDIS_EU_HORIZON_EUROPE_LEGAL_BASIS = "cordis_eu_horizon_europe_legal_basis"
|
||||
|
||||
WORK_CLASSIFICATIONS = "work-classifications"
|
||||
|
||||
@@ -45,10 +45,12 @@ class WorkList(BaseModel):
|
||||
|
||||
|
||||
class WorkPurpose(StrEnum):
|
||||
"""Represents the purpose of a work. Either a foundation work or an application work."""
|
||||
"""Represents the purpose of a work."""
|
||||
|
||||
FOUNDATION = "Foundation"
|
||||
APPLICATION = "Application"
|
||||
BASIC_RESEARCH = "Basic Research"
|
||||
APPLIED_RESEARCH = "Applied Research"
|
||||
NON_RESEARCH = "Non-Research"
|
||||
EXPERIMENTAL_DEVELOPMENT = "Experimental Development"
|
||||
|
||||
|
||||
class SpecificWorkPurpose(BaseModel):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import logging
|
||||
import random
|
||||
from typing import List
|
||||
from typing import Dict, List
|
||||
|
||||
|
||||
from inse.exceptions import NotFoundException
|
||||
@@ -9,7 +8,8 @@ from inse.model import ESIndex
|
||||
from inse.works.model import AuthorWorkPurposes, SpecificWorkPurpose, WorkPurpose
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.INFO)
|
||||
# logger.setLevel(logging.INFO)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
async def get_work_purpose(raw_oa_work_id: str) -> SpecificWorkPurpose:
|
||||
@@ -32,13 +32,64 @@ async def get_work_purpose(raw_oa_work_id: str) -> SpecificWorkPurpose:
|
||||
return SpecificWorkPurpose(
|
||||
raw_oa_work_id=raw_oa_work_id,
|
||||
publication_year=source.get("publication_year"),
|
||||
purpose=WorkPurpose.FOUNDATION, # TODO: Replace with actual purpose determination logic
|
||||
purpose=WorkPurpose.NON_RESEARCH, # TODO: Replace with actual purpose determination logic
|
||||
reasoning="This is a placeholder reasoning for the purpose determination.",
|
||||
)
|
||||
|
||||
|
||||
async def get_author_work_purposes(raw_oa_author_id: str) -> AuthorWorkPurposes:
|
||||
raw_oa_author_id = raw_oa_author_id.strip().upper()
|
||||
logger.debug(f"Retrieving work purposes for author {raw_oa_author_id}")
|
||||
relevant_work_information = await get_relevant_work_information(raw_oa_author_id)
|
||||
logger.debug(
|
||||
f"Retrieved work ids for author {raw_oa_author_id}: {list(relevant_work_information.keys())}"
|
||||
)
|
||||
raw_work_ids = list(map(_extract_raw_work_id, relevant_work_information.keys()))
|
||||
logger.debug(
|
||||
f"Extracted raw work ids for author {raw_oa_author_id}: {raw_work_ids}"
|
||||
)
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.WORK_CLASSIFICATIONS,
|
||||
source=["work_id", "classification"],
|
||||
query={"terms": {"work_id": raw_work_ids}},
|
||||
size=10000,
|
||||
)
|
||||
logger.debug(f"Elasticsearch response for work classifications v2FOO: {response}")
|
||||
|
||||
purposes: List[SpecificWorkPurpose] = []
|
||||
|
||||
hits_block = response.get("hits", {})
|
||||
hits = hits_block.get("hits", [])
|
||||
total_hits = hits_block.get("total", {}).get("value", 0)
|
||||
for hit in hits:
|
||||
source = hit.get("_source", {})
|
||||
work_id = source.get("work_id")
|
||||
classification = source.get("classification")
|
||||
if work_id:
|
||||
work_purpose = _primary_classification_category_to_work_purpose(
|
||||
classification.get("primary_category", "")
|
||||
)
|
||||
purposes.append(
|
||||
SpecificWorkPurpose(
|
||||
raw_oa_work_id=work_id,
|
||||
publication_year=relevant_work_information.get(
|
||||
f"https://openalex.org/{work_id}"
|
||||
),
|
||||
purpose=work_purpose,
|
||||
reasoning=classification.get("classification_reason"),
|
||||
)
|
||||
)
|
||||
else:
|
||||
logger.warning(f"Work hit without id for author {raw_oa_author_id}: {hit}")
|
||||
|
||||
return AuthorWorkPurposes(
|
||||
raw_oa_author_id=raw_oa_author_id, total=total_hits, purposes=purposes
|
||||
)
|
||||
|
||||
|
||||
async def get_relevant_work_information(raw_oa_author_id: str) -> Dict[str, int]:
|
||||
raw_oa_author_id = raw_oa_author_id.strip().upper()
|
||||
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.OPENALEX_WORKS_WILDCARD,
|
||||
@@ -64,38 +115,40 @@ async def get_author_work_purposes(raw_oa_author_id: str) -> AuthorWorkPurposes:
|
||||
|
||||
logger.debug(f"Elasticsearch response for author id {raw_oa_author_id}: {response}")
|
||||
|
||||
purposes: List[SpecificWorkPurpose] = []
|
||||
|
||||
# TODO: implement actual retrieval of previously determined purposes for the author's works
|
||||
|
||||
hits_block = response.get("hits", {})
|
||||
hits = hits_block.get("hits", [])
|
||||
total_hits = hits_block.get("total", {}).get("value", 0)
|
||||
d: Dict[str, int] = {}
|
||||
for hit in hits:
|
||||
source = hit.get("_source", {})
|
||||
work_id = source.get("id")
|
||||
publication_year = source.get("publication_year")
|
||||
if work_id:
|
||||
# TODO: Remove random based purpose assignment
|
||||
if random.choice([True, False]):
|
||||
purpose = SpecificWorkPurpose(
|
||||
raw_oa_work_id=work_id,
|
||||
publication_year=publication_year,
|
||||
purpose=WorkPurpose.FOUNDATION,
|
||||
reasoning=f"Placeholder reasoning for work {work_id}.",
|
||||
)
|
||||
else:
|
||||
purpose = SpecificWorkPurpose(
|
||||
raw_oa_work_id=work_id,
|
||||
publication_year=publication_year,
|
||||
purpose=WorkPurpose.APPLICATION,
|
||||
reasoning=f"Placeholder reasoning for work {work_id}.",
|
||||
)
|
||||
|
||||
purposes.append(purpose)
|
||||
d[work_id] = int(publication_year) if publication_year is not None else 0
|
||||
else:
|
||||
logger.warning(f"Work hit without id for author {raw_oa_author_id}: {hit}")
|
||||
|
||||
return AuthorWorkPurposes(
|
||||
raw_oa_author_id=raw_oa_author_id, total=total_hits, purposes=purposes
|
||||
)
|
||||
return d
|
||||
|
||||
|
||||
def _extract_raw_work_id(work_id: str) -> str:
|
||||
"""
|
||||
Extracts the raw work ID from a full OpenAlex work ID.
|
||||
For example, given "https://openalex.org/W1234567890", it returns "W1234567890".
|
||||
"""
|
||||
if not work_id:
|
||||
return ""
|
||||
return work_id.split("/")[-1]
|
||||
|
||||
|
||||
def _primary_classification_category_to_work_purpose(
|
||||
primary_category: str,
|
||||
) -> WorkPurpose:
|
||||
mapping = {
|
||||
"basic_research": WorkPurpose.BASIC_RESEARCH,
|
||||
"applied_research": WorkPurpose.APPLIED_RESEARCH,
|
||||
"non_research": WorkPurpose.NON_RESEARCH,
|
||||
"experimental_development": WorkPurpose.EXPERIMENTAL_DEVELOPMENT,
|
||||
}
|
||||
return mapping.get(
|
||||
primary_category, WorkPurpose.NON_RESEARCH
|
||||
) # Default to NON_RESEARCH if not found
|
||||
|
||||
@@ -1141,6 +1141,30 @@ Content-Type: application/json
|
||||
|
||||
###
|
||||
|
||||
GET https://project.nes.uni-due.de/elastic/work-classifications/_search
|
||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||
Content-Type: application/json
|
||||
|
||||
###
|
||||
|
||||
GET https://project.nes.uni-due.de/elastic/work-classifications/_search
|
||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"size": 0,
|
||||
"aggs": {
|
||||
"primary_categories": {
|
||||
"terms": {
|
||||
"field": "classification.primary_category",
|
||||
"size": 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
###
|
||||
|
||||
GET https://project.nes.uni-due.de/elastic/openalex-authors/_mapping
|
||||
Authorization: ApiKey am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ==
|
||||
Content-Type: application/json
|
||||
|
||||
@@ -5,7 +5,9 @@ api.base.service.ts
|
||||
api.module.ts
|
||||
api/api.ts
|
||||
api/auth.service.ts
|
||||
api/bookmarks.service.ts
|
||||
api/companyConnections.service.ts
|
||||
api/dashboard.service.ts
|
||||
api/funding.service.ts
|
||||
api/iNSEService.service.ts
|
||||
api/institutions.service.ts
|
||||
@@ -69,8 +71,11 @@ model/cordisEuProjectPage.ts
|
||||
model/costUsd.ts
|
||||
model/createAccountRequest.ts
|
||||
model/createOrganizationRequest.ts
|
||||
model/createPersonBookmark.ts
|
||||
model/customAuthor.ts
|
||||
model/customAuthorsListResponse.ts
|
||||
model/dashboardStatisticValue.ts
|
||||
model/dashboardStatistics.ts
|
||||
model/dehydratedAuthor.ts
|
||||
model/dehydratedFunder.ts
|
||||
model/dehydratedInstitution.ts
|
||||
@@ -170,6 +175,7 @@ model/patentsByInstitutionResponse.ts
|
||||
model/patentsByKeywordsRequest.ts
|
||||
model/patentsByKeywordsResponse.ts
|
||||
model/personBio.ts
|
||||
model/personBookmarkResponse.ts
|
||||
model/projectType.ts
|
||||
model/projectsFilteringProperties.ts
|
||||
model/projectsSortBy.ts
|
||||
@@ -182,11 +188,16 @@ model/score.ts
|
||||
model/sortDirection.ts
|
||||
model/specificWorkPurpose.ts
|
||||
model/tokenType.ts
|
||||
model/topAuthor.ts
|
||||
model/topAuthorStatistics.ts
|
||||
model/topInstitutionItem.ts
|
||||
model/topic.ts
|
||||
model/topicCount.ts
|
||||
model/topicDomain.ts
|
||||
model/topicField.ts
|
||||
model/topicHeatmap.ts
|
||||
model/topicHeatmapField.ts
|
||||
model/topicHeatmapValue.ts
|
||||
model/topicIds.ts
|
||||
model/topicSubfield.ts
|
||||
model/topicYearlyData.ts
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
export * from './auth.service';
|
||||
import { AuthService } from './auth.service';
|
||||
export * from './bookmarks.service';
|
||||
import { BookmarksService } from './bookmarks.service';
|
||||
export * from './companyConnections.service';
|
||||
import { CompanyConnectionsService } from './companyConnections.service';
|
||||
export * from './dashboard.service';
|
||||
import { DashboardService } from './dashboard.service';
|
||||
export * from './funding.service';
|
||||
import { FundingService } from './funding.service';
|
||||
export * from './iNSEService.service';
|
||||
@@ -30,4 +34,4 @@ export * from './works.service';
|
||||
import { WorksService } from './works.service';
|
||||
export * from './worksV2.service';
|
||||
import { WorksV2Service } from './worksV2.service';
|
||||
export const APIS = [AuthService, CompanyConnectionsService, FundingService, INSEServiceService, InstitutionsService, KeywordsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, UniversityRankingsService, WorksService, WorksV2Service];
|
||||
export const APIS = [AuthService, BookmarksService, CompanyConnectionsService, DashboardService, FundingService, INSEServiceService, InstitutionsService, KeywordsService, NewsService, OrganizationService, PatentsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, UniversityRankingsService, WorksService, WorksV2Service];
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { CreatePersonBookmark } from '../model/createPersonBookmark';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { PersonBookmarkResponse } from '../model/personBookmarkResponse';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BookmarksService extends BaseService {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bookmark Person
|
||||
* @endpoint put /api/bookmarks/persons/{person_id}
|
||||
* @param personId
|
||||
* @param createPersonBookmark
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<PersonBookmarkResponse>;
|
||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<PersonBookmarkResponse>>;
|
||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<PersonBookmarkResponse>>;
|
||||
public bookmarkPerson(personId: string, createPersonBookmark: CreatePersonBookmark, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (personId === null || personId === undefined) {
|
||||
throw new Error('Required parameter personId was null or undefined when calling bookmarkPerson.');
|
||||
}
|
||||
if (createPersonBookmark === null || createPersonBookmark === undefined) {
|
||||
throw new Error('Required parameter createPersonBookmark was null or undefined when calling bookmarkPerson.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// 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 = `/api/bookmarks/persons/${this.configuration.encodeParam({name: "personId", value: personId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<PersonBookmarkResponse>('put', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: createPersonBookmark,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List Person Bookmarks
|
||||
* @endpoint get /api/bookmarks/persons
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<PersonBookmarkResponse>>;
|
||||
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<PersonBookmarkResponse>>>;
|
||||
public listPersonBookmarks(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<PersonBookmarkResponse>>>;
|
||||
public listPersonBookmarks(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/bookmarks/persons`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<PersonBookmarkResponse>>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Person Bookmark
|
||||
* @endpoint delete /api/bookmarks/persons/{person_id}
|
||||
* @param personId
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public removePersonBookmark(personId: string, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (personId === null || personId === undefined) {
|
||||
throw new Error('Required parameter personId was null or undefined when calling removePersonBookmark.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/bookmarks/persons/${this.configuration.encodeParam({name: "personId", value: personId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>('delete', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,504 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { DashboardStatisticValue } from '../model/dashboardStatisticValue';
|
||||
// @ts-ignore
|
||||
import { DashboardStatistics } from '../model/dashboardStatistics';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { TopAuthorStatistics } from '../model/topAuthorStatistics';
|
||||
// @ts-ignore
|
||||
import { TopicHeatmap } from '../model/topicHeatmap';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DashboardService extends BaseService {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Bmbf Projects
|
||||
* @endpoint get /api/dashboard/statistics/projects/bmbf
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardBmbfProjects(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DashboardStatisticValue>;
|
||||
public getDashboardBmbfProjects(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DashboardStatisticValue>>;
|
||||
public getDashboardBmbfProjects(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DashboardStatisticValue>>;
|
||||
public getDashboardBmbfProjects(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/statistics/projects/bmbf`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<DashboardStatisticValue>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Dfg Projects
|
||||
* @endpoint get /api/dashboard/statistics/projects/dfg
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardDfgProjects(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DashboardStatisticValue>;
|
||||
public getDashboardDfgProjects(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DashboardStatisticValue>>;
|
||||
public getDashboardDfgProjects(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DashboardStatisticValue>>;
|
||||
public getDashboardDfgProjects(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/statistics/projects/dfg`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<DashboardStatisticValue>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Eu Projects
|
||||
* @endpoint get /api/dashboard/statistics/projects/eu
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardEuProjects(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DashboardStatisticValue>;
|
||||
public getDashboardEuProjects(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DashboardStatisticValue>>;
|
||||
public getDashboardEuProjects(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DashboardStatisticValue>>;
|
||||
public getDashboardEuProjects(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/statistics/projects/eu`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<DashboardStatisticValue>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Persons
|
||||
* @endpoint get /api/dashboard/statistics/persons
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardPersons(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DashboardStatisticValue>;
|
||||
public getDashboardPersons(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DashboardStatisticValue>>;
|
||||
public getDashboardPersons(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DashboardStatisticValue>>;
|
||||
public getDashboardPersons(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/statistics/persons`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<DashboardStatisticValue>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Publications
|
||||
* @endpoint get /api/dashboard/statistics/publications
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardPublications(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DashboardStatisticValue>;
|
||||
public getDashboardPublications(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DashboardStatisticValue>>;
|
||||
public getDashboardPublications(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DashboardStatisticValue>>;
|
||||
public getDashboardPublications(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/statistics/publications`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<DashboardStatisticValue>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Statistics
|
||||
* @endpoint get /api/dashboard/statistics
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardStatistics(secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DashboardStatistics>;
|
||||
public getDashboardStatistics(secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DashboardStatistics>>;
|
||||
public getDashboardStatistics(secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DashboardStatistics>>;
|
||||
public getDashboardStatistics(secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/statistics`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<DashboardStatistics>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Top Authors
|
||||
* @endpoint get /api/dashboard/top-authors
|
||||
* @param worksPeriod
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardTopAuthors(worksPeriod?: 'all_time' | 'last_5_years', secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<TopAuthorStatistics>;
|
||||
public getDashboardTopAuthors(worksPeriod?: 'all_time' | 'last_5_years', secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<TopAuthorStatistics>>;
|
||||
public getDashboardTopAuthors(worksPeriod?: 'all_time' | 'last_5_years', secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<TopAuthorStatistics>>;
|
||||
public getDashboardTopAuthors(worksPeriod?: 'all_time' | 'last_5_years', secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>worksPeriod, 'works_period');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/top-authors`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<TopAuthorStatistics>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Topic Heatmap
|
||||
* @endpoint get /api/dashboard/topic-heatmap
|
||||
* @param fromYear
|
||||
* @param toYear
|
||||
* @param limit
|
||||
* @param secureFgpAcc
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
*/
|
||||
public getDashboardTopicHeatmap(fromYear?: number, toYear?: number, limit?: number, secureFgpAcc?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<TopicHeatmap>;
|
||||
public getDashboardTopicHeatmap(fromYear?: number, toYear?: number, limit?: number, secureFgpAcc?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<TopicHeatmap>>;
|
||||
public getDashboardTopicHeatmap(fromYear?: number, toYear?: number, limit?: number, secureFgpAcc?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<TopicHeatmap>>;
|
||||
public getDashboardTopicHeatmap(fromYear?: number, toYear?: number, limit?: number, secureFgpAcc?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>fromYear, 'from_year');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>toYear, 'to_year');
|
||||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
||||
<any>limit, 'limit');
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
// authentication (HTTPBearer) required
|
||||
localVarHeaders = this.configuration.addCredentialToHeaders('HTTPBearer', 'Authorization', localVarHeaders, 'Bearer ');
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/api/dashboard/topic-heatmap`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<TopicHeatmap>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -40,6 +40,7 @@ export interface AccessToken {
|
||||
* The specific role this access token grants within its organization.
|
||||
*/
|
||||
effective_role?: UserRole;
|
||||
effective_roles?: Array<UserRole>;
|
||||
/**
|
||||
* The unique identifier of the organization associated with this access token.
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface AccountProfile {
|
||||
id: string;
|
||||
email: string;
|
||||
name: string;
|
||||
role: UserRole;
|
||||
roles: Array<UserRole>;
|
||||
organization_id: string;
|
||||
organization_name: string;
|
||||
deleted: boolean;
|
||||
|
||||
@@ -13,7 +13,7 @@ import { UserRole } from './userRole';
|
||||
export interface CreateAccountRequest {
|
||||
email: string;
|
||||
name: string;
|
||||
role?: UserRole;
|
||||
roles?: Array<UserRole>;
|
||||
organization_id: string;
|
||||
password: string;
|
||||
openalex_person_id?: string | null;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface CreatePersonBookmark {
|
||||
person_name?: string | null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface DashboardStatisticValue {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface DashboardStatistics {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
publications: number;
|
||||
persons: number;
|
||||
projects: number;
|
||||
dfg_projects: number;
|
||||
eu_projects: number;
|
||||
bmbf_projects: number;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -9,18 +9,20 @@
|
||||
*/
|
||||
import { FileUpload } from './fileUpload';
|
||||
|
||||
export interface KeywordsRequest {
|
||||
/**
|
||||
* The input text from which to extract keywords.
|
||||
*/
|
||||
query: string;
|
||||
files?: Array<FileUpload> | null;
|
||||
/**
|
||||
* The mode of keyword extraction, e.g., \'url\', \'text\', or \'keywords\'.
|
||||
*/
|
||||
mode: string;
|
||||
/**
|
||||
* The maximum number of keywords to extract.
|
||||
*/
|
||||
limit?: number;
|
||||
|
||||
export interface KeywordsRequest {
|
||||
/**
|
||||
* The input text from which to extract keywords.
|
||||
*/
|
||||
query: string;
|
||||
files?: Array<FileUpload> | null;
|
||||
/**
|
||||
* The mode of keyword extraction, e.g., \'url\', \'text\', or \'keywords\'.
|
||||
*/
|
||||
mode: string;
|
||||
/**
|
||||
* The maximum number of keywords to extract.
|
||||
*/
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,8 +43,11 @@ export * from './cordisEuProjectPage';
|
||||
export * from './costUsd';
|
||||
export * from './createAccountRequest';
|
||||
export * from './createOrganizationRequest';
|
||||
export * from './createPersonBookmark';
|
||||
export * from './customAuthor';
|
||||
export * from './customAuthorsListResponse';
|
||||
export * from './dashboardStatisticValue';
|
||||
export * from './dashboardStatistics';
|
||||
export * from './dehydratedAuthor';
|
||||
export * from './dehydratedFunder';
|
||||
export * from './dehydratedInstitution';
|
||||
@@ -59,6 +62,7 @@ export * from './euProjectData';
|
||||
export * from './extractedKeywords';
|
||||
export * from './extractedKeywordsLLM';
|
||||
export * from './extractedKeywordsResponse';
|
||||
export * from './fileUpload';
|
||||
export * from './filterInformation';
|
||||
export * from './filterProperties';
|
||||
export * from './fp7EurosciVoc';
|
||||
@@ -142,6 +146,7 @@ export * from './patentsByInstitutionResponse';
|
||||
export * from './patentsByKeywordsRequest';
|
||||
export * from './patentsByKeywordsResponse';
|
||||
export * from './personBio';
|
||||
export * from './personBookmarkResponse';
|
||||
export * from './projectType';
|
||||
export * from './projectsFilteringProperties';
|
||||
export * from './projectsSortBy';
|
||||
@@ -154,11 +159,16 @@ export * from './score';
|
||||
export * from './sortDirection';
|
||||
export * from './specificWorkPurpose';
|
||||
export * from './tokenType';
|
||||
export * from './topAuthor';
|
||||
export * from './topAuthorStatistics';
|
||||
export * from './topInstitutionItem';
|
||||
export * from './topic';
|
||||
export * from './topicCount';
|
||||
export * from './topicDomain';
|
||||
export * from './topicField';
|
||||
export * from './topicHeatmap';
|
||||
export * from './topicHeatmapField';
|
||||
export * from './topicHeatmapValue';
|
||||
export * from './topicIds';
|
||||
export * from './topicSubfield';
|
||||
export * from './topicYearlyData';
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface PersonBookmarkResponse {
|
||||
person_id: string;
|
||||
person_name: string | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface TopAuthor {
|
||||
id?: string | null;
|
||||
name: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { TopAuthor } from './topAuthor';
|
||||
|
||||
|
||||
export interface TopAuthorStatistics {
|
||||
institution_id: string;
|
||||
works: Array<TopAuthor>;
|
||||
projects: Array<TopAuthor>;
|
||||
patents: Array<TopAuthor>;
|
||||
news: Array<TopAuthor>;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
import { TopicHeatmapField } from './topicHeatmapField';
|
||||
|
||||
|
||||
export interface TopicHeatmap {
|
||||
institution_id: string;
|
||||
organization_name: string;
|
||||
years: Array<number>;
|
||||
fields: Array<TopicHeatmapField>;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
import { TopicHeatmapValue } from './topicHeatmapValue';
|
||||
|
||||
|
||||
export interface TopicHeatmapField {
|
||||
id: string;
|
||||
name: string;
|
||||
total: number;
|
||||
values: Array<TopicHeatmapValue>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface TopicHeatmapValue {
|
||||
year: number;
|
||||
count: number;
|
||||
share: number;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { UserRole } from './userRole';
|
||||
export interface UpdateAccountRequest {
|
||||
email?: string | null;
|
||||
name?: string | null;
|
||||
role?: UserRole | null;
|
||||
roles?: Array<UserRole> | null;
|
||||
organization_id?: string | null;
|
||||
password?: string | null;
|
||||
openalex_person_id?: string | null;
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
|
||||
|
||||
/**
|
||||
* Represents the purpose of a work. Either a foundation work or an application work.
|
||||
* Represents the purpose of a work.
|
||||
*/
|
||||
export const WorkPurpose = {
|
||||
Foundation: 'Foundation',
|
||||
Application: 'Application'
|
||||
BasicResearch: 'Basic Research',
|
||||
AppliedResearch: 'Applied Research',
|
||||
NonResearch: 'Non-Research',
|
||||
ExperimentalDevelopment: 'Experimental Development'
|
||||
} as const;
|
||||
export type WorkPurpose = typeof WorkPurpose[keyof typeof WorkPurpose];
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ export class AccountComponent {
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
this.roles = [this.accountProfile().role];
|
||||
this.roles = this.accountProfile().roles;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
<mat-form-field appearance="outline">
|
||||
<mat-label>Rolle</mat-label>
|
||||
<mat-select formControlName="role">
|
||||
<mat-select formControlName="roles" multiple>
|
||||
@for (role of data.roles; track role) {
|
||||
<mat-option [value]="role">{{ role }}</mat-option>
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export interface AccountDialogData {
|
||||
export interface AccountPayload {
|
||||
email?: string;
|
||||
name?: string;
|
||||
role?: UserRole;
|
||||
roles?: UserRole[];
|
||||
organization_id?: string;
|
||||
password?: string;
|
||||
deleted?: boolean;
|
||||
@@ -45,7 +45,7 @@ export interface AccountPayload {
|
||||
export interface CreateAccountPayload {
|
||||
email: string;
|
||||
name: string;
|
||||
role: UserRole;
|
||||
roles: UserRole[];
|
||||
organization_id: string;
|
||||
password: string;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ export class AccountDialogComponent {
|
||||
name: new FormControl<string>(this.data.account?.name ?? '', [
|
||||
Validators.required,
|
||||
]),
|
||||
role: new FormControl<UserRole>(this.data.account?.role ?? 'USER', [
|
||||
roles: new FormControl<UserRole[]>(this.data.account?.roles ?? ['USER'], [
|
||||
Validators.required,
|
||||
]),
|
||||
organizationId: new FormControl<string>(
|
||||
@@ -115,7 +115,7 @@ export class AccountDialogComponent {
|
||||
payload: {
|
||||
email: value.email ?? '',
|
||||
name: value.name ?? '',
|
||||
role: value.role ?? 'USER',
|
||||
roles: value.roles ?? ['USER'],
|
||||
organization_id: value.organizationId ?? '',
|
||||
password: value.password ?? '',
|
||||
},
|
||||
@@ -128,7 +128,7 @@ export class AccountDialogComponent {
|
||||
|
||||
const email = (value.email ?? '').trim();
|
||||
const name = (value.name ?? '').trim();
|
||||
const role = value.role ?? account.role;
|
||||
const roles = value.roles ?? account.roles;
|
||||
const organizationId = value.organizationId ?? account.organization_id;
|
||||
const password = value.password?.trim() ?? '';
|
||||
|
||||
@@ -140,8 +140,8 @@ export class AccountDialogComponent {
|
||||
payload.name = name;
|
||||
}
|
||||
|
||||
if (role !== account.role) {
|
||||
payload.role = role;
|
||||
if (!this.sameRoles(roles, account.roles)) {
|
||||
payload.roles = roles;
|
||||
}
|
||||
|
||||
if (password) {
|
||||
@@ -166,4 +166,10 @@ export class AccountDialogComponent {
|
||||
protected close(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
private sameRoles(left: UserRole[], right: UserRole[]): boolean {
|
||||
return (
|
||||
left.length === right.length && left.every((role) => right.includes(role))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@
|
||||
</section>
|
||||
|
||||
<ng-template #accountRoleTmp let-row>
|
||||
<span class="role">{{ row.role | role }}</span>
|
||||
@for (role of row.roles; track role) {
|
||||
<span class="role">{{ role | role }}</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #accountStatusTmp let-row>
|
||||
|
||||
@@ -126,10 +126,10 @@ export class AccountsComponent implements OnInit {
|
||||
accessorKey: 'organization_name',
|
||||
},
|
||||
{
|
||||
id: 'role',
|
||||
id: 'roles',
|
||||
header: 'Rolle',
|
||||
type: 'accessor',
|
||||
accessorKey: 'role',
|
||||
accessorKey: 'roles',
|
||||
cellTemplate: this.accountRoleTmp(),
|
||||
},
|
||||
{
|
||||
@@ -325,7 +325,22 @@ export class AccountsComponent implements OnInit {
|
||||
|
||||
return (
|
||||
this.credentialService.isEffectiveAdmin() &&
|
||||
(account.role === 'MANAGER' || account.role === 'USER')
|
||||
(this.effectiveRole(account) === 'MANAGER' ||
|
||||
this.effectiveRole(account) === 'USER')
|
||||
);
|
||||
}
|
||||
|
||||
protected effectiveRole(account: AccountProfile): UserRole {
|
||||
const roles = account.roles;
|
||||
if (roles.includes('SUPER_ADMIN')) {
|
||||
return 'SUPER_ADMIN';
|
||||
}
|
||||
if (roles.includes('ADMIN')) {
|
||||
return 'ADMIN';
|
||||
}
|
||||
if (roles.includes('MANAGER')) {
|
||||
return 'MANAGER';
|
||||
}
|
||||
return 'USER';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,25 +43,25 @@
|
||||
</mat-card>
|
||||
|
||||
<div class="funding-info-cards">
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Gesamte Förderung durch Bund'"
|
||||
[value]="
|
||||
(bundTotalFunding()
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
||||
" />
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Durchschnittliche jährliche Förderung durch Bund'"
|
||||
[value]="
|
||||
(bundAverageAnnualFunding()
|
||||
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
|
||||
" />
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Gesamte Förderung durch die Europäische Union'"
|
||||
[value]="
|
||||
(euTotalFunding() | currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ??
|
||||
undefined
|
||||
" />
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[description]="'Durchschnittliche jährliche Förderung durch die Europäische Union'"
|
||||
[value]="
|
||||
(euAverageAnnualFunding()
|
||||
|
||||
@@ -24,7 +24,7 @@ mat-paginator {
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
|
||||
app-person-network-info-card {
|
||||
app-info-card {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { InstitutionProjectsFundingGraphComponent } from '../institution-projects-funding-graph/institution-projects-funding-graph.component';
|
||||
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
|
||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||
|
||||
@@ -64,7 +64,7 @@ type EuProjectRow = {
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
InstitutionProjectsFundingGraphComponent,
|
||||
PersonNetworkInfoCardComponent,
|
||||
AppInfoCardComponent,
|
||||
RouterModule,
|
||||
QueryParamPaginatorComponent,
|
||||
QueryParamInputComponent,
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<div class="summary-container">
|
||||
@for (summary of this.summaryCards(); track $index) {
|
||||
<app-person-network-info-card
|
||||
<app-info-card
|
||||
[icon]="summary.icon"
|
||||
[value]="summary.value.toString()"
|
||||
[description]="summary.description" />
|
||||
|
||||
@@ -47,7 +47,7 @@ form > div > mat-button-toggle-group {
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.summary-container app-person-network-info-card {
|
||||
.summary-container app-info-card {
|
||||
flex: 1 1 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { PersonNetworkFilterDialogComponent } from '../person-network-filter-dialog/person-network-filter-dialog.component';
|
||||
import { PersonNetworkInfoCardComponent } from '../person-network-info-card/person-network-info-card.component';
|
||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||
import {
|
||||
GenericColumn,
|
||||
DataTableComponent,
|
||||
@@ -95,7 +95,7 @@ type IInstitution = {
|
||||
MatSelectModule,
|
||||
MatExpansionModule,
|
||||
MatDialogModule,
|
||||
PersonNetworkInfoCardComponent,
|
||||
AppInfoCardComponent,
|
||||
DataTableComponent,
|
||||
],
|
||||
templateUrl: './person-network.component.html',
|
||||
|
||||
@@ -7,16 +7,38 @@
|
||||
<mat-expansion-panel class="mat-elevation-z1">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Forschungszwecke</mat-panel-title>
|
||||
<mat-panel-description
|
||||
>{{ foundationAmount() }} Grundlagenforschung,
|
||||
{{ applicationAmount() }} anwendungsbasierte
|
||||
Forschung</mat-panel-description
|
||||
>
|
||||
</mat-expansion-panel-header>
|
||||
@if (this.authorWorkPurposes().purposes?.length === 0) {
|
||||
<div class="no-results">
|
||||
Keine klassifizierten Publikationen gefunden.
|
||||
</div>
|
||||
} @else {
|
||||
<div
|
||||
echarts
|
||||
[options]="chartOption"
|
||||
style="height: 300px; width: 100%"></div>
|
||||
}
|
||||
<div
|
||||
echarts
|
||||
[options]="chartOption"
|
||||
style="height: 300px; width: 100%"></div>
|
||||
style="
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 1rem;
|
||||
">
|
||||
<app-info-card
|
||||
[value]="this.basicResearchAmount() + ''"
|
||||
description="Grundlagenforschung" />
|
||||
<app-info-card
|
||||
[value]="this.appliedResearchAmount() + ''"
|
||||
description="Anwendungsbasierte Forschung" />
|
||||
<app-info-card
|
||||
[value]="this.nonResearchAmount() + ''"
|
||||
description="Nicht-forschende Tätigkeit" />
|
||||
<app-info-card
|
||||
[value]="this.experimentalDevelopmentAmount() + ''"
|
||||
description="Experimentelle Entwicklung" />
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
|
||||
<mat-expansion-panel-header>
|
||||
|
||||
@@ -11,18 +11,14 @@ import {
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, ParamMap, Router, RouterLink } from '@angular/router';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import {
|
||||
MatAutocompleteModule,
|
||||
MatAutocompleteSelectedEvent,
|
||||
} from '@angular/material/autocomplete';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import {
|
||||
MatPaginator,
|
||||
MatPaginatorModule,
|
||||
PageEvent,
|
||||
} from '@angular/material/paginator';
|
||||
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
@@ -34,7 +30,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
||||
import {
|
||||
catchError,
|
||||
combineLatest,
|
||||
debounceTime,
|
||||
distinctUntilChanged,
|
||||
finalize,
|
||||
@@ -78,6 +73,7 @@ import {
|
||||
import { WorkTypePipe } from '../../shared/pipes/work-type.pipe';
|
||||
import { LanguageCodePipe } from '../../shared/pipes/language-code.pipe';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||
echarts.use([
|
||||
GridComponent,
|
||||
CanvasRenderer,
|
||||
@@ -114,17 +110,25 @@ interface TopicAutocompleteResponse {
|
||||
results?: TopicAutocompleteOption[] | null;
|
||||
}
|
||||
|
||||
type PublicationSort = 'year' | 'citations';
|
||||
|
||||
interface YearlyPurposeCounts {
|
||||
year: number;
|
||||
FOUNDATION: number;
|
||||
APPLICATION: number;
|
||||
basicResearch: number;
|
||||
appliedResearch: number;
|
||||
nonResearch: number;
|
||||
experimentalDevelopment: number;
|
||||
}
|
||||
|
||||
const PURPOSE_LABELS: Record<'FOUNDATION' | 'APPLICATION', string> = {
|
||||
FOUNDATION: 'Grundlagenforschung',
|
||||
APPLICATION: 'anwendungsbasierte Forschung',
|
||||
const PURPOSE_LABELS: Record<
|
||||
| 'BASIC_RESEARCH'
|
||||
| 'APPLIED_RESEARCH'
|
||||
| 'NON_RESEARCH'
|
||||
| 'EXPERIMENTAL_DEVELOPMENT',
|
||||
string
|
||||
> = {
|
||||
BASIC_RESEARCH: 'Grundlagenforschung',
|
||||
APPLIED_RESEARCH: 'anwendungsbasierte Forschung',
|
||||
NON_RESEARCH: 'nicht-forschende Tätigkeit',
|
||||
EXPERIMENTAL_DEVELOPMENT: 'experimentelle Entwicklung',
|
||||
};
|
||||
@Component({
|
||||
selector: 'app-person-publications',
|
||||
@@ -151,12 +155,12 @@ const PURPOSE_LABELS: Record<'FOUNDATION' | 'APPLICATION', string> = {
|
||||
WorkTypePipe,
|
||||
LanguageCodePipe,
|
||||
QueryParamPaginatorComponent,
|
||||
AppInfoCardComponent,
|
||||
],
|
||||
templateUrl: './person-publications.component.html',
|
||||
styleUrl: './person-publications.component.scss',
|
||||
})
|
||||
export class PersonPublicationsComponent implements OnInit {
|
||||
@ViewChild(MatPaginator) paginator?: MatPaginator;
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
private readonly worksService = inject(WorksService);
|
||||
@@ -173,26 +177,43 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
const authorWorkPurposes = this.authorWorkPurposes();
|
||||
return this.getAuthorSpecificWorkPurposesByYear(authorWorkPurposes);
|
||||
});
|
||||
foundationAmount = computed(() => {
|
||||
const authorWorkPurposes = this.authorWorkPurposes();
|
||||
basicResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.BasicResearch,
|
||||
);
|
||||
});
|
||||
appliedResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.AppliedResearch,
|
||||
);
|
||||
});
|
||||
nonResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.NonResearch,
|
||||
);
|
||||
});
|
||||
experimentalDevelopmentAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.ExperimentalDevelopment,
|
||||
);
|
||||
});
|
||||
|
||||
countPurpose = (
|
||||
specificWorkPurposes: SpecificWorkPurpose[],
|
||||
purpose: WorkPurpose,
|
||||
) => {
|
||||
let count = 0;
|
||||
for (const purpose of authorWorkPurposes.purposes ?? []) {
|
||||
if (purpose.purpose === WorkPurpose.Foundation) {
|
||||
for (const specificWorkPurpose of specificWorkPurposes) {
|
||||
if (specificWorkPurpose.purpose == purpose) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
});
|
||||
applicationAmount = computed(() => {
|
||||
const authorWorkPurposes = this.authorWorkPurposes();
|
||||
let count = 0;
|
||||
for (const purpose of authorWorkPurposes.purposes ?? []) {
|
||||
if (purpose.purpose === WorkPurpose.Application) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
});
|
||||
};
|
||||
|
||||
chartOption!: echarts.EChartsCoreOption;
|
||||
|
||||
@@ -223,9 +244,6 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
readonly yearSearchControl = new FormControl('', { nonNullable: true });
|
||||
readonly typeSearchControl = new FormControl('', { nonNullable: true });
|
||||
readonly languageSearchControl = new FormControl('', { nonNullable: true });
|
||||
readonly sortControl = new FormControl<PublicationSort>('year', {
|
||||
nonNullable: true,
|
||||
});
|
||||
|
||||
readonly publicationYearOptions = this.createPublicationYearOptions();
|
||||
|
||||
@@ -379,14 +397,20 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
.map(([year, purposes]) => {
|
||||
const counts: YearlyPurposeCounts = {
|
||||
year: Number(year),
|
||||
FOUNDATION: 0,
|
||||
APPLICATION: 0,
|
||||
basicResearch: 0,
|
||||
appliedResearch: 0,
|
||||
nonResearch: 0,
|
||||
experimentalDevelopment: 0,
|
||||
};
|
||||
for (const purpose of purposes) {
|
||||
if (purpose.purpose === WorkPurpose.Foundation) {
|
||||
counts.FOUNDATION++;
|
||||
} else if (purpose.purpose === WorkPurpose.Application) {
|
||||
counts.APPLICATION++;
|
||||
if (purpose.purpose == WorkPurpose.BasicResearch) {
|
||||
counts.basicResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.AppliedResearch) {
|
||||
counts.appliedResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.NonResearch) {
|
||||
counts.nonResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.ExperimentalDevelopment) {
|
||||
counts.experimentalDevelopment++;
|
||||
}
|
||||
}
|
||||
return counts;
|
||||
@@ -398,15 +422,20 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
return {
|
||||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||||
legend: {
|
||||
data: [PURPOSE_LABELS.FOUNDATION, PURPOSE_LABELS.APPLICATION],
|
||||
top: 0,
|
||||
data: [
|
||||
PURPOSE_LABELS.BASIC_RESEARCH,
|
||||
PURPOSE_LABELS.APPLIED_RESEARCH,
|
||||
PURPOSE_LABELS.NON_RESEARCH,
|
||||
PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
|
||||
],
|
||||
bottom: 0,
|
||||
itemGap: 40,
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '4%',
|
||||
bottom: '3%',
|
||||
top: '10%',
|
||||
bottom: '10%',
|
||||
top: '3%',
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: {
|
||||
@@ -416,18 +445,32 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
yAxis: { type: 'value' },
|
||||
series: [
|
||||
{
|
||||
name: PURPOSE_LABELS.FOUNDATION,
|
||||
name: PURPOSE_LABELS.BASIC_RESEARCH,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.FOUNDATION),
|
||||
data: data.map((d) => d.basicResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.APPLICATION,
|
||||
name: PURPOSE_LABELS.APPLIED_RESEARCH,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.APPLICATION),
|
||||
data: data.map((d) => d.appliedResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.NON_RESEARCH,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.nonResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.experimentalDevelopment),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
<mat-card appearance="outlined" class="info-card">
|
||||
<mat-card-content>
|
||||
<mat-icon>{{ icon() }}</mat-icon>
|
||||
@if (icon()) {
|
||||
<mat-icon>{{ icon() }}</mat-icon>
|
||||
}
|
||||
<div>
|
||||
<span class="number">{{ value() }}</span>
|
||||
<span class="description">{{ description() }}</span>
|
||||
+4
-4
@@ -3,12 +3,12 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-network-info-card',
|
||||
selector: 'app-info-card',
|
||||
imports: [MatIconModule, MatCardModule],
|
||||
templateUrl: './person-network-info-card.component.html',
|
||||
styleUrl: './person-network-info-card.component.scss',
|
||||
templateUrl: './app-info-card.component.html',
|
||||
styleUrl: './app-info-card.component.scss',
|
||||
})
|
||||
export class PersonNetworkInfoCardComponent {
|
||||
export class AppInfoCardComponent {
|
||||
readonly icon = input<string>();
|
||||
readonly value = input<string>();
|
||||
readonly description = input<string>();
|
||||
Reference in New Issue
Block a user