Compare commits
1
Commits
dev
...
security-config
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50912dbac1 |
@@ -11,6 +11,12 @@ __pycache__
|
|||||||
# Ignore generated python code
|
# Ignore generated python code
|
||||||
src/python/account/
|
src/python/account/
|
||||||
|
|
||||||
|
# Ignore local environment files
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
!.env.*.example
|
||||||
|
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -61,7 +61,7 @@ task exportOpenApiSpec(type: Exec) {
|
|||||||
|
|
||||||
task runServeContainer(type: Exec) {
|
task runServeContainer(type: Exec) {
|
||||||
dependsOn createImage
|
dependsOn createImage
|
||||||
commandLine 'docker', 'run', '--rm', '-v', "${projectDir}/src/main:/home", '-v', "${projectDir}/src/data:/data", '-p', '8000:8000', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '-e', "INSE_AUTH_STANDALONE=true", '-e', 'INSE_OPENALEX_WORKS_API_KEY', '--name', "${imageName}-service-serve", '--detach', "${imagePrefix}-service:${imageVersion}", 'run', '--reload', '--reload-dir', './inse'
|
commandLine 'docker', 'run', '--rm', '-v', "${projectDir}/src/main:/home", '-v', "${projectDir}/src/data:/data", '-p', '8000:8000', '-e', "DOCKER_DEFAULT_PLATFORM='${targetPlatform}'", '-e', "INSE_AUTH_STANDALONE=true", '-e', 'INSE_ELASTICSEARCH_API_KEY', '--name', "${imageName}-service-serve", '--detach', "${imagePrefix}-service:${imageVersion}", 'run', '--reload', '--reload-dir', './inse'
|
||||||
}
|
}
|
||||||
|
|
||||||
task stopServeContainer(type: Exec) {
|
task stopServeContainer(type: Exec) {
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
ELASTICSEARCH_URL=https://project.nes.uni-due.de/elastic/
|
|
||||||
ELASTICSEARCH_API_KEY=am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ
|
|
||||||
|
|
||||||
LLM_API_URL=https://project.nes.uni-due.de/llm2/v1/
|
|
||||||
LLM_API_KEY=c2d5e7ccf7a4760dd3d19bed2caed9d85ff7437400e0ea82a6d6f912ebc2f212
|
|
||||||
LLM_MODEL=gemma4-e4b
|
|
||||||
|
|
||||||
# Patent search (EPO + USPTO)
|
|
||||||
PATENT_ELASTICSEARCH_URL=https://inse.nes.uni-due.de/elastic
|
|
||||||
PATENT_ELASTICSEARCH_API_KEY=bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
|
||||||
ELASTICSEARCH_URL=https://project.nes.uni-due.de/elastic
|
|
||||||
ELASTICSEARCH_API_KEY=am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ
|
|
||||||
|
|
||||||
ELASTICSEARCH_INSE_URL=https://inse.nes.uni-due.de/elastic
|
|
||||||
ELASTICSEARCH_INSE_API_KEY=bG1NSWc1NEJPZ3FnTGZCZXRSSEg6VnJXRFd5SnpSTTNWc1VPT01FMEhMZw==
|
|
||||||
|
|
||||||
LLM_API_URL=https://project.nes.uni-due.de/llm2/v1/
|
|
||||||
LLM_API_KEY=c2d5e7ccf7a4760dd3d19bed2caed9d85ff7437400e0ea82a6d6f912ebc2f212
|
|
||||||
LLM_MODEL=gemma4-e4b
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# Database config
|
||||||
|
DATABASE_URL=sqlite:///path/to/local.db
|
||||||
|
DATABASE_DEBUG=false
|
||||||
|
DATABASE_INIT=true
|
||||||
|
|
||||||
|
# Authorization config
|
||||||
|
AUTH_DISABLED=false
|
||||||
|
AUTH_STANDALONE=true
|
||||||
|
AUTH_SECRET=your-auth-secret
|
||||||
|
|
||||||
|
# OpenAlex works search config
|
||||||
|
OPENALEX_WORKS_SEARCH_INDEX=your-openalex-index*
|
||||||
|
OPENALEX_WORKS_SEARCH_TIMEOUT_SECONDS=30.0
|
||||||
|
|
||||||
|
# OpenAlex public API config
|
||||||
|
OPENALEX_API_BASE_URL=https://api.openalex.org
|
||||||
|
OPENALEX_API_KEY=your-openalex-api-key
|
||||||
|
OPENALEX_API_TIMEOUT_SECONDS=30.0
|
||||||
|
|
||||||
|
# Patent Elasticsearch config
|
||||||
|
PATENT_ELASTICSEARCH_URL=https://example.com/patent-elastic
|
||||||
|
PATENT_ELASTICSEARCH_API_KEY=your-patent-elasticsearch-api-key
|
||||||
|
|
||||||
|
# LLM config
|
||||||
|
LLM_API_URL=https://example.com/llm-api
|
||||||
|
LLM_API_KEY=your-llm-api-key
|
||||||
|
LLM_MODEL=your-llm-model
|
||||||
|
|
||||||
|
# Elasticsearch config
|
||||||
|
ELASTICSEARCH_URL=https://example.com/elasticsearch
|
||||||
|
ELASTICSEARCH_API_KEY=your-elasticsearch-api-key
|
||||||
|
ELASTICSEARCH_INSE_URL=https://example.com/inse-elasticsearch
|
||||||
|
ELASTICSEARCH_INSE_API_KEY=your-inse-elasticsearch-api-key
|
||||||
|
|
||||||
|
# API metadata
|
||||||
|
ALLOWED_ORIGINS=["http://localhost:4200"]
|
||||||
|
SERVERS=[{"url":"http://localhost:8000","description":"Local development server"}]
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
LOGGING_LEVEL=DEBUG
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
from fastapi import HTTPException
|
||||||
|
from starlette.status import HTTP_502_BAD_GATEWAY, HTTP_503_SERVICE_UNAVAILABLE
|
||||||
|
|
||||||
|
from . import model
|
||||||
|
from .search_client import CompanyConnectionsSearchClient, MissingApiKeyError
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
UDE_OPENALEX_ID = "https://openalex.org/I62318514"
|
||||||
|
UDE_ROR = "https://ror.org/04mz5ra38"
|
||||||
|
UDE_DISPLAY_NAME = "University of Duisburg-Essen"
|
||||||
|
|
||||||
|
MATCHING_METHOD = "exact_openalex_display_name_to_handelsregister_officer_name"
|
||||||
|
|
||||||
|
|
||||||
|
async def get_company_connections_by_author_id(
|
||||||
|
author_id: str,
|
||||||
|
client: CompanyConnectionsSearchClient | None = None,
|
||||||
|
) -> model.CompanyConnectionsResponse:
|
||||||
|
search_client = client or CompanyConnectionsSearchClient()
|
||||||
|
|
||||||
|
try:
|
||||||
|
author_hit = await search_client.get_openalex_author(author_id)
|
||||||
|
except MissingApiKeyError as exc:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTP_503_SERVICE_UNAVAILABLE,
|
||||||
|
detail="Elasticsearch is not configured.",
|
||||||
|
) from exc
|
||||||
|
except httpx.HTTPError as exc:
|
||||||
|
logger.exception("OpenAlex author lookup failed for %s.", author_id)
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="OpenAlex author lookup failed.",
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
if author_hit is None:
|
||||||
|
raise HTTPException(status_code=404, detail=f"Author {author_id} not found.")
|
||||||
|
|
||||||
|
source = author_hit.get("_source", {})
|
||||||
|
display_name = _clean(source.get("display_name"))
|
||||||
|
institution_scope, matching_institutions = _get_ude_institution_scope(source)
|
||||||
|
is_ude_author = institution_scope is not None
|
||||||
|
|
||||||
|
if not is_ude_author or not display_name:
|
||||||
|
return model.CompanyConnectionsResponse(
|
||||||
|
author_id=author_id,
|
||||||
|
display_name=display_name or None,
|
||||||
|
is_ude_author=is_ude_author,
|
||||||
|
institution_scope=institution_scope,
|
||||||
|
matching_institutions=matching_institutions,
|
||||||
|
matching_method=None,
|
||||||
|
company_count=0,
|
||||||
|
has_more_results=False,
|
||||||
|
common_name_warning=False,
|
||||||
|
connections=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
hr_response = await search_client.search_handelsregister_by_officer_name(
|
||||||
|
display_name
|
||||||
|
)
|
||||||
|
except MissingApiKeyError as exc:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTP_503_SERVICE_UNAVAILABLE,
|
||||||
|
detail="Elasticsearch is not configured.",
|
||||||
|
) from exc
|
||||||
|
except httpx.HTTPError as exc:
|
||||||
|
logger.exception("Handelsregister lookup failed for %s.", display_name)
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="Handelsregister lookup failed.",
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
company_count, company_count_relation = _parse_total(hr_response)
|
||||||
|
connections = _parse_company_connections(
|
||||||
|
response=hr_response,
|
||||||
|
matched_person_name=display_name,
|
||||||
|
)
|
||||||
|
|
||||||
|
has_more_results = company_count_relation == "gte" or company_count > len(
|
||||||
|
connections
|
||||||
|
)
|
||||||
|
common_name_warning = has_more_results or company_count > 3
|
||||||
|
|
||||||
|
return model.CompanyConnectionsResponse(
|
||||||
|
author_id=author_id,
|
||||||
|
display_name=display_name,
|
||||||
|
is_ude_author=True,
|
||||||
|
institution_scope=institution_scope,
|
||||||
|
matching_institutions=matching_institutions,
|
||||||
|
matching_method=MATCHING_METHOD,
|
||||||
|
company_count=company_count,
|
||||||
|
has_more_results=has_more_results,
|
||||||
|
common_name_warning=common_name_warning,
|
||||||
|
connections=connections,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _get_ude_institution_scope(source: dict[str, Any]) -> tuple[str | None, list[str]]:
|
||||||
|
institutions = source.get("last_known_institutions") or []
|
||||||
|
|
||||||
|
direct_matches: list[str] = []
|
||||||
|
child_matches: list[str] = []
|
||||||
|
|
||||||
|
for institution in institutions:
|
||||||
|
if not isinstance(institution, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
institution_id = _clean(institution.get("id"))
|
||||||
|
ror = _clean(institution.get("ror"))
|
||||||
|
name = _clean(institution.get("display_name"))
|
||||||
|
lineage = institution.get("lineage") or []
|
||||||
|
|
||||||
|
label = name or institution_id or ror
|
||||||
|
|
||||||
|
is_direct = (
|
||||||
|
institution_id == UDE_OPENALEX_ID
|
||||||
|
or ror == UDE_ROR
|
||||||
|
or name == UDE_DISPLAY_NAME
|
||||||
|
)
|
||||||
|
is_child = UDE_OPENALEX_ID in lineage and not is_direct
|
||||||
|
|
||||||
|
if is_direct:
|
||||||
|
direct_matches.append(label)
|
||||||
|
elif is_child:
|
||||||
|
child_matches.append(label)
|
||||||
|
|
||||||
|
if direct_matches:
|
||||||
|
return "direct_ude", sorted(set(direct_matches))
|
||||||
|
|
||||||
|
if child_matches:
|
||||||
|
return "child_of_ude", sorted(set(child_matches))
|
||||||
|
|
||||||
|
return None, []
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_total(response: dict[str, Any]) -> tuple[int, str]:
|
||||||
|
total = response.get("hits", {}).get("total", 0)
|
||||||
|
|
||||||
|
if isinstance(total, dict):
|
||||||
|
return int(total.get("value") or 0), total.get("relation") or "eq"
|
||||||
|
|
||||||
|
return int(total or 0), "eq"
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_company_connections(
|
||||||
|
response: dict[str, Any],
|
||||||
|
matched_person_name: str,
|
||||||
|
) -> list[model.CompanyConnection]:
|
||||||
|
connections: list[model.CompanyConnection] = []
|
||||||
|
|
||||||
|
hits = response.get("hits", {}).get("hits", [])
|
||||||
|
|
||||||
|
for hit in hits:
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
|
||||||
|
matched_officers = _parse_inner_hit_officers(hit)
|
||||||
|
officers = _parse_source_officers(
|
||||||
|
source=source,
|
||||||
|
matched_person_name=matched_person_name,
|
||||||
|
)
|
||||||
|
|
||||||
|
connections.append(
|
||||||
|
model.CompanyConnection(
|
||||||
|
company_number=source.get("company_number"),
|
||||||
|
company_name=source.get("name"),
|
||||||
|
company_status=source.get("current_status"),
|
||||||
|
register_art=source.get("register_art"),
|
||||||
|
register_nummer=source.get("register_nummer"),
|
||||||
|
native_company_number=source.get("native_company_number"),
|
||||||
|
registrar=source.get("registrar"),
|
||||||
|
registered_office=source.get("registered_office"),
|
||||||
|
registered_address=source.get("registered_address"),
|
||||||
|
retrieved_at=source.get("retrieved_at"),
|
||||||
|
matched_officers=matched_officers,
|
||||||
|
officers=officers,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return connections
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_inner_hit_officers(hit: dict[str, Any]) -> list[model.MatchedOfficer]:
|
||||||
|
inner_hits = (
|
||||||
|
hit.get("inner_hits", {}).get("officers", {}).get("hits", {}).get("hits", [])
|
||||||
|
)
|
||||||
|
|
||||||
|
officers: list[model.MatchedOfficer] = []
|
||||||
|
|
||||||
|
for inner_hit in inner_hits:
|
||||||
|
source = inner_hit.get("_source", {})
|
||||||
|
officer_source = _normalize_officer_source(source)
|
||||||
|
|
||||||
|
officers.append(
|
||||||
|
_to_officer(
|
||||||
|
officer_source,
|
||||||
|
is_matched_person=True,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return _deduplicate_officers(officers)
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_source_officers(
|
||||||
|
source: dict[str, Any],
|
||||||
|
matched_person_name: str,
|
||||||
|
) -> list[model.MatchedOfficer]:
|
||||||
|
raw_officers = source.get("officers") or []
|
||||||
|
|
||||||
|
if not isinstance(raw_officers, list):
|
||||||
|
return []
|
||||||
|
|
||||||
|
officers: list[model.MatchedOfficer] = []
|
||||||
|
|
||||||
|
for raw_officer in raw_officers:
|
||||||
|
if not isinstance(raw_officer, dict):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if _clean(raw_officer.get("type")) != "person":
|
||||||
|
continue
|
||||||
|
|
||||||
|
officer_name = _clean(raw_officer.get("name"))
|
||||||
|
is_matched_person = officer_name == matched_person_name
|
||||||
|
|
||||||
|
officers.append(
|
||||||
|
_to_officer(
|
||||||
|
raw_officer,
|
||||||
|
is_matched_person=is_matched_person,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
return _deduplicate_officers(officers)
|
||||||
|
|
||||||
|
|
||||||
|
def _to_officer(
|
||||||
|
source: dict[str, Any],
|
||||||
|
is_matched_person: bool,
|
||||||
|
) -> model.MatchedOfficer:
|
||||||
|
return model.MatchedOfficer(
|
||||||
|
name=_clean_or_none(source.get("name")),
|
||||||
|
firstname=_clean_or_none(source.get("firstname")),
|
||||||
|
lastname=_clean_or_none(source.get("lastname")),
|
||||||
|
city=_clean_or_none(source.get("city")),
|
||||||
|
position=_clean_or_none(source.get("position")),
|
||||||
|
start_date=_clean_or_none(source.get("start_date")),
|
||||||
|
type=_clean_or_none(source.get("type")),
|
||||||
|
flag=_clean_or_none(source.get("flag")),
|
||||||
|
is_matched_person=is_matched_person,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _deduplicate_officers(
|
||||||
|
officers: list[model.MatchedOfficer],
|
||||||
|
) -> list[model.MatchedOfficer]:
|
||||||
|
seen: set[tuple[str, str, str, str]] = set()
|
||||||
|
deduplicated: list[model.MatchedOfficer] = []
|
||||||
|
|
||||||
|
for officer in officers:
|
||||||
|
key = (
|
||||||
|
officer.name or "",
|
||||||
|
officer.position or "",
|
||||||
|
officer.city or "",
|
||||||
|
officer.start_date or "",
|
||||||
|
)
|
||||||
|
|
||||||
|
if key in seen:
|
||||||
|
continue
|
||||||
|
|
||||||
|
seen.add(key)
|
||||||
|
deduplicated.append(officer)
|
||||||
|
|
||||||
|
return deduplicated
|
||||||
|
|
||||||
|
|
||||||
|
def _normalize_officer_source(source: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
officers = source.get("officers")
|
||||||
|
|
||||||
|
if isinstance(officers, dict):
|
||||||
|
return officers
|
||||||
|
|
||||||
|
return source
|
||||||
|
|
||||||
|
|
||||||
|
def _clean_or_none(value: Any) -> str | None:
|
||||||
|
cleaned = _clean(value)
|
||||||
|
|
||||||
|
return cleaned or None
|
||||||
|
|
||||||
|
|
||||||
|
def _clean(value: Any) -> str:
|
||||||
|
if value is None:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
return str(value).strip()
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class MatchedOfficer(BaseModel):
|
||||||
|
name: str | None = None
|
||||||
|
firstname: str | None = None
|
||||||
|
lastname: str | None = None
|
||||||
|
city: str | None = None
|
||||||
|
position: str | None = None
|
||||||
|
start_date: str | None = None
|
||||||
|
type: str | None = None
|
||||||
|
flag: str | None = None
|
||||||
|
is_matched_person: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
class CompanyConnection(BaseModel):
|
||||||
|
company_number: str | None = None
|
||||||
|
company_name: str | None = None
|
||||||
|
company_status: str | None = None
|
||||||
|
register_art: str | None = None
|
||||||
|
register_nummer: str | None = None
|
||||||
|
native_company_number: str | None = None
|
||||||
|
registrar: str | None = None
|
||||||
|
registered_office: str | None = None
|
||||||
|
registered_address: str | None = None
|
||||||
|
retrieved_at: str | None = None
|
||||||
|
matched_officers: list[MatchedOfficer] = Field(default_factory=list)
|
||||||
|
officers: list[MatchedOfficer] = Field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
class CompanyConnectionsResponse(BaseModel):
|
||||||
|
author_id: str
|
||||||
|
display_name: str | None = None
|
||||||
|
is_ude_author: bool
|
||||||
|
institution_scope: str | None = None
|
||||||
|
matching_institutions: list[str] = Field(default_factory=list)
|
||||||
|
|
||||||
|
matching_method: str | None = None
|
||||||
|
|
||||||
|
company_count: int
|
||||||
|
has_more_results: bool
|
||||||
|
common_name_warning: bool
|
||||||
|
|
||||||
|
connections: list[CompanyConnection] = Field(default_factory=list)
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from .. import config
|
||||||
|
|
||||||
|
|
||||||
|
class MissingApiKeyError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class CompanyConnectionsSearchClient:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
base_url: str | None = None,
|
||||||
|
api_key: str | None = None,
|
||||||
|
openalex_index: str = "openalex-authors",
|
||||||
|
handelsregister_index: str = "handelsregister",
|
||||||
|
timeout: float = 30.0,
|
||||||
|
transport: httpx.AsyncBaseTransport | None = None,
|
||||||
|
):
|
||||||
|
self.base_url = (
|
||||||
|
base_url
|
||||||
|
or config.settings.elasticsearch_url
|
||||||
|
or config.settings.openalex_works_search_base_url
|
||||||
|
).rstrip("/")
|
||||||
|
self.api_key = (
|
||||||
|
api_key
|
||||||
|
if api_key is not None
|
||||||
|
else config.settings.elasticsearch_api_key
|
||||||
|
or config.settings.openalex_works_api_key
|
||||||
|
)
|
||||||
|
self.openalex_index = openalex_index
|
||||||
|
self.handelsregister_index = handelsregister_index
|
||||||
|
self.timeout = timeout
|
||||||
|
self.transport = transport
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def openalex_doc_id(author_id: str) -> str:
|
||||||
|
return author_id.strip().removeprefix("https://openalex.org/")
|
||||||
|
|
||||||
|
async def get_openalex_author(self, author_id: str) -> dict[str, Any] | None:
|
||||||
|
if not self.api_key:
|
||||||
|
raise MissingApiKeyError("Elasticsearch API key is not configured.")
|
||||||
|
|
||||||
|
doc_id = self.openalex_doc_id(author_id)
|
||||||
|
|
||||||
|
async with httpx.AsyncClient(
|
||||||
|
base_url=self.base_url,
|
||||||
|
timeout=self.timeout,
|
||||||
|
transport=self.transport,
|
||||||
|
) as client:
|
||||||
|
response = await client.get(
|
||||||
|
f"/{self.openalex_index}/_doc/{doc_id}",
|
||||||
|
headers={"Authorization": f"ApiKey {self.api_key}"},
|
||||||
|
)
|
||||||
|
|
||||||
|
if response.status_code == 404:
|
||||||
|
return None
|
||||||
|
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
async def search_handelsregister_by_officer_name(
|
||||||
|
self,
|
||||||
|
officer_name: str,
|
||||||
|
size: int = 10000,
|
||||||
|
track_total_hits: bool = True,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
if not self.api_key:
|
||||||
|
raise MissingApiKeyError("Elasticsearch API key is not configured.")
|
||||||
|
|
||||||
|
payload = self.handelsregister_officer_name_query(
|
||||||
|
officer_name=officer_name,
|
||||||
|
size=size,
|
||||||
|
track_total_hits=track_total_hits,
|
||||||
|
)
|
||||||
|
|
||||||
|
async with httpx.AsyncClient(
|
||||||
|
base_url=self.base_url,
|
||||||
|
timeout=self.timeout,
|
||||||
|
transport=self.transport,
|
||||||
|
) as client:
|
||||||
|
response = await client.post(
|
||||||
|
f"/{self.handelsregister_index}/_search",
|
||||||
|
headers={"Authorization": f"ApiKey {self.api_key}"},
|
||||||
|
json=payload,
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def handelsregister_officer_name_query(
|
||||||
|
officer_name: str,
|
||||||
|
size: int,
|
||||||
|
track_total_hits: bool,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
return {
|
||||||
|
"track_total_hits": track_total_hits,
|
||||||
|
"size": size,
|
||||||
|
"_source": [
|
||||||
|
"company_number",
|
||||||
|
"name",
|
||||||
|
"current_status",
|
||||||
|
"registered_address",
|
||||||
|
"registered_office",
|
||||||
|
"registrar",
|
||||||
|
"register_art",
|
||||||
|
"register_nummer",
|
||||||
|
"native_company_number",
|
||||||
|
"retrieved_at",
|
||||||
|
"officers",
|
||||||
|
],
|
||||||
|
"query": {
|
||||||
|
"nested": {
|
||||||
|
"path": "officers",
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"filter": [
|
||||||
|
{"term": {"officers.type": "person"}},
|
||||||
|
{"term": {"officers.name.keyword": officer_name}},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inner_hits": {
|
||||||
|
"size": 10,
|
||||||
|
"_source": [
|
||||||
|
"officers.name",
|
||||||
|
"officers.firstname",
|
||||||
|
"officers.lastname",
|
||||||
|
"officers.city",
|
||||||
|
"officers.position",
|
||||||
|
"officers.start_date",
|
||||||
|
"officers.type",
|
||||||
|
"officers.flag",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sort": [{"company_number": {"order": "asc"}}],
|
||||||
|
}
|
||||||
@@ -22,13 +22,12 @@ class CompanyConnectionsSearchClient:
|
|||||||
self.base_url = (
|
self.base_url = (
|
||||||
base_url
|
base_url
|
||||||
or config.settings.elasticsearch_url
|
or config.settings.elasticsearch_url
|
||||||
or config.settings.openalex_works_search_base_url
|
or ""
|
||||||
).rstrip("/")
|
).rstrip("/")
|
||||||
self.api_key = (
|
self.api_key = (
|
||||||
api_key
|
api_key
|
||||||
if api_key is not None
|
if api_key is not None
|
||||||
else config.settings.elasticsearch_api_key
|
else config.settings.elasticsearch_api_key
|
||||||
or config.settings.openalex_works_api_key
|
|
||||||
)
|
)
|
||||||
self.openalex_index = openalex_index
|
self.openalex_index = openalex_index
|
||||||
self.handelsregister_index = handelsregister_index
|
self.handelsregister_index = handelsregister_index
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
REST API for possible company connections of OpenAlex authors.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from fastapi import APIRouter
|
||||||
|
|
||||||
|
from . import logic, model
|
||||||
|
|
||||||
|
router = APIRouter(
|
||||||
|
prefix="/api/inse-service/authors",
|
||||||
|
tags=["Company Connections"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/{author_id}/company-connections",
|
||||||
|
operation_id="getCompanyConnectionsByAuthor",
|
||||||
|
response_model=model.CompanyConnectionsResponse,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Get possible company connections by OpenAlex author ID.",
|
||||||
|
)
|
||||||
|
async def get_company_connections_by_author(author_id: str):
|
||||||
|
return await logic.get_company_connections_by_author_id(author_id)
|
||||||
@@ -27,12 +27,8 @@ class Settings(BaseSettings):
|
|||||||
auth_standalone: bool = True
|
auth_standalone: bool = True
|
||||||
auth_secret: str = "change-me-to-a-secure-secret-key"
|
auth_secret: str = "change-me-to-a-secure-secret-key"
|
||||||
# OpenAlex works search config
|
# OpenAlex works search config
|
||||||
openalex_works_search_base_url: str = "https://project.nes.uni-due.de/elastic"
|
|
||||||
# IMPORTANT: wildcard * needed to query all work indices
|
# IMPORTANT: wildcard * needed to query all work indices
|
||||||
openalex_works_search_index: str = "openalex-works*"
|
openalex_works_search_index: str = "openalex-works*"
|
||||||
openalex_works_api_key: str = (
|
|
||||||
"am1wWXBaMEJEVWJoZkE5MnBaUlk6TWlvbW1LRlMzNjdDUHgzYmVkUmI5UQ=="
|
|
||||||
)
|
|
||||||
openalex_works_search_timeout_seconds: float = 30.0
|
openalex_works_search_timeout_seconds: float = 30.0
|
||||||
# OpenAlex public API config
|
# OpenAlex public API config
|
||||||
openalex_api_base_url: str = "https://api.openalex.org"
|
openalex_api_base_url: str = "https://api.openalex.org"
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ class FundedPublicationsSearchClient:
|
|||||||
timeout: float | None = None,
|
timeout: float | None = None,
|
||||||
transport: httpx.AsyncBaseTransport | None = None,
|
transport: httpx.AsyncBaseTransport | None = None,
|
||||||
):
|
):
|
||||||
self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/")
|
self.base_url = (base_url or config.settings.elasticsearch_url or "").rstrip("/")
|
||||||
self.index = index or config.settings.openalex_works_search_index
|
self.index = index or config.settings.openalex_works_search_index
|
||||||
self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key
|
self.api_key = api_key if api_key is not None else config.settings.elasticsearch_api_key
|
||||||
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
from typing import List
|
||||||
|
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
from inse.models.openalex.institution import Institution
|
||||||
|
|
||||||
|
|
||||||
|
class InstitutionPage(BaseModel):
|
||||||
|
elements: List[Institution] = Field(
|
||||||
|
default_factory=list, description="List of institutions in the current page."
|
||||||
|
)
|
||||||
|
page: int = Field(default=0, description="Current page number. (0-indexed)")
|
||||||
|
size: int = Field(default=10, description="Number of institutions per page.")
|
||||||
|
total: int = Field(
|
||||||
|
default=0,
|
||||||
|
description="Total number of institutions matching the search criteria.",
|
||||||
|
)
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
REST API for OpenAlex institutions.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from functools import lru_cache
|
||||||
|
from typing import Annotated, Literal
|
||||||
|
|
||||||
|
from fastapi import APIRouter, Depends, status, Query
|
||||||
|
|
||||||
|
from inse.models.openalex.autocomplete_response import AutocompleteResponse
|
||||||
|
from inse.models.openalex.institutions_list_response import InstitutionsListResponse
|
||||||
|
from inse.tags import Tags
|
||||||
|
from inse.models.openalex.institution import Institution
|
||||||
|
from inse.institutions.model import InstitutionPage
|
||||||
|
from . import logic
|
||||||
|
from inse.institutions.institutions_search_client import InstitutionsSearchClient
|
||||||
|
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/api/inse-service/institutions", tags=[Tags.INSTITUTIONS])
|
||||||
|
|
||||||
|
|
||||||
|
@lru_cache
|
||||||
|
def get_institutions_search_client() -> InstitutionsSearchClient:
|
||||||
|
return InstitutionsSearchClient()
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/search",
|
||||||
|
summary="Searches for institutions by name.",
|
||||||
|
description="Searches for institutions by name with pagination.",
|
||||||
|
operation_id="searchInstitutionsByName",
|
||||||
|
responses={
|
||||||
|
status.HTTP_200_OK: {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"model": InstitutionPage,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
)
|
||||||
|
async def search_institutions_by_name(
|
||||||
|
client: Annotated[
|
||||||
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
|
],
|
||||||
|
name: Annotated[
|
||||||
|
str,
|
||||||
|
Query(
|
||||||
|
description="Institution name to search for, for example 'University of Duisburg Essen'.",
|
||||||
|
),
|
||||||
|
] = "",
|
||||||
|
page: Annotated[
|
||||||
|
int,
|
||||||
|
Query(description="Page number (0-indexed).", ge=0),
|
||||||
|
] = 0,
|
||||||
|
size: Annotated[
|
||||||
|
int,
|
||||||
|
Query(description="Number of institutions per page.", ge=1, le=100),
|
||||||
|
] = 10,
|
||||||
|
sort_by: Annotated[
|
||||||
|
Literal["relevance", "name", "works_count", "citations_count"],
|
||||||
|
Query(
|
||||||
|
description="Field to sort by, either 'relevance', 'name', 'works_count', or 'citations_count'.",
|
||||||
|
regex="^(relevance|name|works_count|citations_count)$",
|
||||||
|
),
|
||||||
|
] = "name",
|
||||||
|
sorting_direction: Annotated[
|
||||||
|
Literal["asc", "desc"],
|
||||||
|
Query(
|
||||||
|
description="Sorting direction, either 'asc' or 'desc'.",
|
||||||
|
regex="^(asc|desc)$",
|
||||||
|
),
|
||||||
|
] = "asc",
|
||||||
|
) -> InstitutionPage:
|
||||||
|
return client.get_institutions_by_name(
|
||||||
|
name=name,
|
||||||
|
page=page,
|
||||||
|
size=size,
|
||||||
|
sort_by=sort_by,
|
||||||
|
sorting_direction=sorting_direction,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/autocomplete",
|
||||||
|
operation_id="autocompleteInstitutions",
|
||||||
|
response_model=AutocompleteResponse,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Returns institution options for autocomplete inputs.",
|
||||||
|
)
|
||||||
|
async def autocomplete_institutions(
|
||||||
|
query: Annotated[
|
||||||
|
str,
|
||||||
|
Query(
|
||||||
|
description="Institution search text, for example 'Duisburg Essen'.",
|
||||||
|
min_length=1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
country_code: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(alias="countryCode", description="Optional ISO country code filter."),
|
||||||
|
] = None,
|
||||||
|
institution_type: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(alias="type", description="Optional institution type filter."),
|
||||||
|
] = None,
|
||||||
|
limit: Annotated[
|
||||||
|
int,
|
||||||
|
Query(description="Maximum number of autocomplete options.", ge=1, le=25),
|
||||||
|
] = 10,
|
||||||
|
client: Annotated[
|
||||||
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
|
] = None,
|
||||||
|
):
|
||||||
|
return await logic.autocomplete_institutions(
|
||||||
|
query=query,
|
||||||
|
country_code=country_code,
|
||||||
|
institution_type=institution_type,
|
||||||
|
limit=limit,
|
||||||
|
client=client,
|
||||||
|
)
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/{id}",
|
||||||
|
summary="Returns a single institution by ID.",
|
||||||
|
description="Returns a single institution by its OpenAlex ID.",
|
||||||
|
operation_id="getInstitutionById",
|
||||||
|
responses={
|
||||||
|
status.HTTP_200_OK: {
|
||||||
|
"description": "Successful Response",
|
||||||
|
"model": Institution,
|
||||||
|
},
|
||||||
|
status.HTTP_404_NOT_FOUND: {"description": "Institution not found"},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
async def get_institution(
|
||||||
|
id: str,
|
||||||
|
client: Annotated[
|
||||||
|
InstitutionsSearchClient, Depends(get_institutions_search_client)
|
||||||
|
],
|
||||||
|
) -> Institution:
|
||||||
|
return await logic.get_institution_by_id(raw_institution_id=id, client=client)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"",
|
||||||
|
operation_id="listInstitutions",
|
||||||
|
response_model=InstitutionsListResponse,
|
||||||
|
response_model_exclude_none=True,
|
||||||
|
summary="Returns a list of OpenAlex institutions.",
|
||||||
|
)
|
||||||
|
async def list_institutions(
|
||||||
|
search: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(description="Full-text search, for example 'Duisburg Essen'."),
|
||||||
|
] = None,
|
||||||
|
filter: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(
|
||||||
|
description="OpenAlex filter, for example 'country_code:DE,type:education'."
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
sort: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(description="Sort field, for example 'works_count:desc'."),
|
||||||
|
] = "works_count:desc",
|
||||||
|
group_by: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(description="OpenAlex group_by field, for example 'country_code'."),
|
||||||
|
] = None,
|
||||||
|
per_page: Annotated[
|
||||||
|
int,
|
||||||
|
Query(description="Results per page.", ge=1, le=100),
|
||||||
|
] = 25,
|
||||||
|
page: Annotated[
|
||||||
|
int | None,
|
||||||
|
Query(description="Page number. Use cursor for deep pagination.", ge=1),
|
||||||
|
] = 1,
|
||||||
|
cursor: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(description="Cursor pagination token. Use '*' to start."),
|
||||||
|
] = None,
|
||||||
|
sample: Annotated[
|
||||||
|
int | None,
|
||||||
|
Query(
|
||||||
|
description="Random sample size. Cannot be combined with sort or page.",
|
||||||
|
ge=1,
|
||||||
|
le=10000,
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
select: Annotated[
|
||||||
|
str | None,
|
||||||
|
Query(description="Comma-separated fields to return."),
|
||||||
|
] = None,
|
||||||
|
):
|
||||||
|
return await logic.list_institutions(
|
||||||
|
search=search,
|
||||||
|
filter=filter,
|
||||||
|
sort=sort,
|
||||||
|
group_by=group_by,
|
||||||
|
per_page=per_page,
|
||||||
|
page=page,
|
||||||
|
cursor=cursor,
|
||||||
|
sample=sample,
|
||||||
|
select=select,
|
||||||
|
)
|
||||||
@@ -0,0 +1,337 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
Bund Project Clean Model
|
||||||
|
|
||||||
|
Summary model that consolidates scattered fields from the raw projects_bund index
|
||||||
|
into clean, semantic field names with proper native Python types.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from datetime import date, datetime
|
||||||
|
from typing import Optional, List, Set, Any
|
||||||
|
|
||||||
|
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
||||||
|
|
||||||
|
|
||||||
|
class BundProjectDetails(BaseModel):
|
||||||
|
"""
|
||||||
|
Clean summary model for a Bund (federal) project, consolidating all fields
|
||||||
|
into semantic English names with proper native types.
|
||||||
|
"""
|
||||||
|
|
||||||
|
model_config = ConfigDict(
|
||||||
|
populate_by_name=True,
|
||||||
|
validate_assignment=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Core identifiers
|
||||||
|
id: str = Field(description="The ID of the Bund project")
|
||||||
|
funding_reference: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="The funding reference number (Förderkennzeichen)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Project metadata
|
||||||
|
title: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="The project topic/title",
|
||||||
|
)
|
||||||
|
description: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Plain text description of the performance plan classification",
|
||||||
|
)
|
||||||
|
joint_project: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Parent joint project if this is a sub-project",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Funding information
|
||||||
|
funding_type: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Type of funding (Förderart)",
|
||||||
|
)
|
||||||
|
funding_profile: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Funding profile (Förderprofil)",
|
||||||
|
)
|
||||||
|
funding_amount: Optional[float] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Funding amount in EUR",
|
||||||
|
)
|
||||||
|
funding_start_date: Optional[date] = Field(
|
||||||
|
default=None,
|
||||||
|
description="Funding start date",
|
||||||
|
)
|
||||||
|
funding_end_date: Optional[date] = Field(
|
||||||
|
default=None,
|
||||||
|
description="Funding end date",
|
||||||
|
)
|
||||||
|
duration: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Project duration (Laufzeit)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Classification
|
||||||
|
performance_plan_code: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Performance plan classification code",
|
||||||
|
)
|
||||||
|
performance_plan_fullname: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Full name of the performance plan classification",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Organizational
|
||||||
|
executing_agency: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Executing agency",
|
||||||
|
)
|
||||||
|
funding_recipient: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Funding recipient",
|
||||||
|
)
|
||||||
|
project_agency: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Project management agency",
|
||||||
|
)
|
||||||
|
project_agency_fullname: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Full name of the project management agency",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Government hierarchy
|
||||||
|
department: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Government department code",
|
||||||
|
)
|
||||||
|
department_fullname: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Full name of the government department",
|
||||||
|
)
|
||||||
|
division: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Division/unit reference",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Location
|
||||||
|
location: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Location/city",
|
||||||
|
)
|
||||||
|
municipality: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="City/Municipality",
|
||||||
|
)
|
||||||
|
state: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Federal state",
|
||||||
|
)
|
||||||
|
country: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Country",
|
||||||
|
)
|
||||||
|
municipality_code: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Municipality code",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Publication
|
||||||
|
publication_date: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Publication date",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Additional
|
||||||
|
is_new: Optional[bool] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Flag indicating if the project is new",
|
||||||
|
)
|
||||||
|
record_date: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="Record date",
|
||||||
|
)
|
||||||
|
unix_timestamp: Optional[int] = Field(
|
||||||
|
default=None,
|
||||||
|
description="Unix timestamp of the record",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Unified lists for aggregation
|
||||||
|
associated_persons: List[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="All persons associated with the Bund project (from nested Arb object)",
|
||||||
|
)
|
||||||
|
institutions: List[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="All institutions associated with the Bund project",
|
||||||
|
)
|
||||||
|
|
||||||
|
# --- Validators for type coercion ---
|
||||||
|
|
||||||
|
@field_validator("funding_amount", mode="before")
|
||||||
|
@classmethod
|
||||||
|
def parse_funding_amount(cls, v: Any) -> Optional[float]:
|
||||||
|
"""Parse funding amount from string or number."""
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
if isinstance(v, (int, float)):
|
||||||
|
return float(v)
|
||||||
|
if isinstance(v, str):
|
||||||
|
# Remove thousands separators and trim
|
||||||
|
cleaned = v.replace(".", "").replace(",", ".").strip()
|
||||||
|
try:
|
||||||
|
return float(cleaned)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
return None
|
||||||
|
|
||||||
|
@field_validator("funding_start_date", "funding_end_date", mode="before")
|
||||||
|
@classmethod
|
||||||
|
def parse_german_date(cls, v: Any) -> Optional[date]:
|
||||||
|
"""Parse date from German format (dd.MM.yyyy) or date/datetime object."""
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
if isinstance(v, datetime):
|
||||||
|
return v.date()
|
||||||
|
if isinstance(v, date):
|
||||||
|
return v
|
||||||
|
if isinstance(v, str):
|
||||||
|
v = v.strip()
|
||||||
|
# Try German format first: dd.MM.yyyy
|
||||||
|
try:
|
||||||
|
return datetime.strptime(v, "%d.%m.%Y").date()
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
# Try ISO format: yyyy-MM-dd
|
||||||
|
try:
|
||||||
|
return datetime.strptime(v, "%Y-%m-%d").date()
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
# Try with time component
|
||||||
|
try:
|
||||||
|
return datetime.fromisoformat(v).date()
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
return None
|
||||||
|
|
||||||
|
@field_validator("is_new", mode="before")
|
||||||
|
@classmethod
|
||||||
|
def parse_is_new(cls, v: Any) -> Optional[bool]:
|
||||||
|
"""Parse is_new from bool or string."""
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
if isinstance(v, bool):
|
||||||
|
return v
|
||||||
|
if isinstance(v, str):
|
||||||
|
return v.lower() in ("true", "1", "yes", "ja")
|
||||||
|
if isinstance(v, (int, float)):
|
||||||
|
return bool(v)
|
||||||
|
return None
|
||||||
|
|
||||||
|
@field_validator("unix_timestamp", mode="before")
|
||||||
|
@classmethod
|
||||||
|
def parse_unix_timestamp(cls, v: Any) -> Optional[int]:
|
||||||
|
"""Parse unix timestamp from int, float, or string."""
|
||||||
|
if v is None:
|
||||||
|
return None
|
||||||
|
if isinstance(v, (int, float)):
|
||||||
|
return int(v)
|
||||||
|
if isinstance(v, str):
|
||||||
|
try:
|
||||||
|
return int(v)
|
||||||
|
except ValueError:
|
||||||
|
return None
|
||||||
|
return None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_elastic_hit(cls, hit: dict) -> "BundProject":
|
||||||
|
"""
|
||||||
|
Create a BundProject from an Elasticsearch hit, consolidating all fields.
|
||||||
|
"""
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
|
||||||
|
# --- Extract persons from nested Arb object ---
|
||||||
|
persons: Set[str] = set()
|
||||||
|
arb = source.get("Arb")
|
||||||
|
if arb and isinstance(arb, dict):
|
||||||
|
for key, value in arb.items():
|
||||||
|
if isinstance(value, str) and value.strip():
|
||||||
|
for person in value.split(";"):
|
||||||
|
person = person.strip()
|
||||||
|
if person:
|
||||||
|
persons.add(person)
|
||||||
|
|
||||||
|
# --- Extract institutions ---
|
||||||
|
institutions: Set[str] = set()
|
||||||
|
inst_fields = [
|
||||||
|
"Ausführende Stelle",
|
||||||
|
"Zuwendungsempfänger",
|
||||||
|
"Projektträger",
|
||||||
|
]
|
||||||
|
for field in inst_fields:
|
||||||
|
if field in source and source[field]:
|
||||||
|
for inst in source[field].split(";"):
|
||||||
|
inst = inst.strip()
|
||||||
|
if inst:
|
||||||
|
institutions.add(inst)
|
||||||
|
|
||||||
|
if source.get("PT_fullname"):
|
||||||
|
institutions.add(source["PT_fullname"].strip())
|
||||||
|
|
||||||
|
return cls(
|
||||||
|
id=hit["_id"],
|
||||||
|
funding_reference=source.get("Förderkennzeichen"),
|
||||||
|
title=source.get("Thema"),
|
||||||
|
description=source.get("Klartext Leistungsplansystematik"),
|
||||||
|
joint_project=source.get("Verbundprojekt"),
|
||||||
|
funding_type=source.get("Förderart"),
|
||||||
|
funding_profile=source.get("Förderprofil"),
|
||||||
|
funding_amount=source.get("Fördersumme"),
|
||||||
|
funding_start_date=source.get("funding_start"),
|
||||||
|
funding_end_date=source.get("funding_end"),
|
||||||
|
duration=source.get("Laufzeit"),
|
||||||
|
performance_plan_code=source.get("Leistungsplansystematik"),
|
||||||
|
performance_plan_fullname=source.get("Leistungsplansystematik_fullname"),
|
||||||
|
executing_agency=source.get("Ausführende Stelle"),
|
||||||
|
funding_recipient=source.get("Zuwendungsempfänger"),
|
||||||
|
project_agency=source.get("Projektträger"),
|
||||||
|
project_agency_fullname=source.get("PT_fullname"),
|
||||||
|
department=source.get("Ressort"),
|
||||||
|
department_fullname=source.get("Ressort_fullname"),
|
||||||
|
division=source.get("Referat"),
|
||||||
|
location=source.get("Ort"),
|
||||||
|
municipality=source.get("Stadt/Gemeinde"),
|
||||||
|
state=source.get("Bundesland"),
|
||||||
|
country=source.get("Staat"),
|
||||||
|
municipality_code=source.get("Gemeindekennziffer"),
|
||||||
|
publication_date=source.get("Publikationsdatum"),
|
||||||
|
is_new=source.get("new"),
|
||||||
|
record_date=source.get("datum"),
|
||||||
|
unix_timestamp=source.get("unix_timestamp"),
|
||||||
|
associated_persons=sorted(persons),
|
||||||
|
institutions=sorted(institutions),
|
||||||
|
)
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
from typing import Optional, List, Union
|
||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class CordisEuProject(BaseModel):
|
||||||
|
id: str = Field(
|
||||||
|
description="Unique identifier for the project, typically the CORDIS ID"
|
||||||
|
)
|
||||||
|
rcn: Optional[str] = Field(
|
||||||
|
None, description="Research and Innovation project number (CORDIS RCN)"
|
||||||
|
)
|
||||||
|
acronym: Optional[str] = Field(None, description="Acronym for the project")
|
||||||
|
title: Optional[str] = Field(None, description="Title of the project")
|
||||||
|
objective: Optional[str] = Field(None, description="Objective of the project")
|
||||||
|
|
||||||
|
frameworkProgramme: Optional[str] = Field(
|
||||||
|
None, description="Framework Programme under which the project was funded"
|
||||||
|
)
|
||||||
|
fundingScheme: Optional[str] = Field(
|
||||||
|
None, description="Funding scheme of the project"
|
||||||
|
)
|
||||||
|
legalBasis: Optional[str] = Field(
|
||||||
|
None, description="Legal basis for the project funding"
|
||||||
|
)
|
||||||
|
masterCall: Optional[str] = Field(
|
||||||
|
None, description="Master call identifier if applicable"
|
||||||
|
)
|
||||||
|
subCall: Optional[str] = Field(
|
||||||
|
None, description="Sub call identifier if applicable"
|
||||||
|
)
|
||||||
|
topics: Optional[Union[str, List[str]]] = (
|
||||||
|
None # Elastic keyword can map to a single string or list of strings
|
||||||
|
)
|
||||||
|
nature: Optional[str] = Field(None, description="Nature of the project")
|
||||||
|
status: Optional[str] = Field(None, description="Status of the project")
|
||||||
|
|
||||||
|
ecMaxContribution: Optional[float] = Field(
|
||||||
|
None, description="Maximum European Commission contribution"
|
||||||
|
)
|
||||||
|
totalCost: Optional[float] = Field(None, description="Total cost of the project")
|
||||||
|
|
||||||
|
startDate: Optional[datetime] = Field(None, description="Start date of the project")
|
||||||
|
endDate: Optional[datetime] = Field(None, description="End date of the project")
|
||||||
|
ecSignatureDate: Optional[datetime] = Field(
|
||||||
|
None, description="Date of the European Commission signature"
|
||||||
|
)
|
||||||
|
contentUpdateDate: Optional[datetime] = Field(
|
||||||
|
None, description="Date when the project content was last updated"
|
||||||
|
)
|
||||||
|
|
||||||
|
grantDoi: Optional[str] = Field(None, description="DOI for the project grant")
|
||||||
|
humanValidated: Optional[bool] = Field(
|
||||||
|
None,
|
||||||
|
description="Indicates if the project information has been human validated",
|
||||||
|
)
|
||||||
|
keywords: Optional[Union[str, List[str]]] = Field(
|
||||||
|
None, description="Keywords associated with the project"
|
||||||
|
)
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
populate_by_name = True
|
||||||
@@ -0,0 +1,275 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
|
||||||
|
"""
|
||||||
|
DFG Project Clean Model
|
||||||
|
|
||||||
|
Summary model that consolidates all scattered person and institution fields
|
||||||
|
from the raw projects_dfg_all index into clean, unified lists.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Optional, List, Set
|
||||||
|
|
||||||
|
from pydantic import BaseModel, ConfigDict, Field
|
||||||
|
|
||||||
|
|
||||||
|
class DfgProjectDetails(BaseModel):
|
||||||
|
"""
|
||||||
|
Clean summary model for a DFG project, consolidating all person roles
|
||||||
|
and institution references into unified lists.
|
||||||
|
"""
|
||||||
|
model_config = ConfigDict(
|
||||||
|
populate_by_name=True,
|
||||||
|
validate_assignment=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
id: str = Field(description="The ID of the DFG project")
|
||||||
|
link: Optional[str] = Field(default=None, description="The link to the DFG project")
|
||||||
|
title: Optional[str] = Field(
|
||||||
|
default=None, description="The title of the DFG project"
|
||||||
|
)
|
||||||
|
description: Optional[str] = Field(
|
||||||
|
default=None, description="The description of the DFG project"
|
||||||
|
)
|
||||||
|
|
||||||
|
project_identifier: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
description="The project identifier of the DFG project",
|
||||||
|
)
|
||||||
|
|
||||||
|
funding_start_date: Optional[str] = Field(
|
||||||
|
default=None, description="The funding start date of the DFG project"
|
||||||
|
)
|
||||||
|
funding_end_date: Optional[str] = Field(
|
||||||
|
default=None, description="The funding end date of the DFG project"
|
||||||
|
)
|
||||||
|
|
||||||
|
dfg_procedure: Optional[str] = Field(
|
||||||
|
default=None, description="The DFG procedure"
|
||||||
|
)
|
||||||
|
subject_area: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
description="The subject area classification",
|
||||||
|
)
|
||||||
|
funding_type: Optional[str] = Field(
|
||||||
|
default=None, description="The type of funding"
|
||||||
|
)
|
||||||
|
international_reference: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
|
||||||
|
description="International reference",
|
||||||
|
)
|
||||||
|
|
||||||
|
website: Optional[str] = Field(
|
||||||
|
default=None, description="The project website"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Unified person list: all person names from any role
|
||||||
|
associated_persons: List[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="All persons associated with the DFG project (any role)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Unified institution list: all institutions involved
|
||||||
|
institutions: List[str] = Field(
|
||||||
|
default_factory=list,
|
||||||
|
description="All institutions associated with the DFG project",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Sub-project reference
|
||||||
|
subproject_of: Optional[str] = Field(
|
||||||
|
default=None,
|
||||||
|
description="Parent project this is a sub-project of",
|
||||||
|
)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_elastic_hit(cls, hit: dict) -> "DfgProjectDetails":
|
||||||
|
"""
|
||||||
|
Create a DfgProject from an Elasticsearch hit, consolidating all
|
||||||
|
person and institution fields into unified lists.
|
||||||
|
"""
|
||||||
|
|
||||||
|
source = hit.get("_source", {})
|
||||||
|
|
||||||
|
associated_persons: Set[str] = set()
|
||||||
|
institutions: Set[str] = set()
|
||||||
|
|
||||||
|
# --- Collect all persons from every person-related field ---
|
||||||
|
|
||||||
|
# Applicant fields
|
||||||
|
_add_persons(source, associated_persons, "Antragsteller") # semicolon-separated
|
||||||
|
_add_person(source, associated_persons, "Antragstellerin")
|
||||||
|
_add_persons(
|
||||||
|
source, associated_persons, "Antragstellerinnen"
|
||||||
|
) # semicolon-separated
|
||||||
|
_add_persons(
|
||||||
|
source, associated_persons, "Antragstellerinnen / Antragsteller"
|
||||||
|
) # semicolon-separated
|
||||||
|
|
||||||
|
# Co-applicant fields
|
||||||
|
_add_persons(source, associated_persons, "Mitantragsteller")
|
||||||
|
_add_person(source, associated_persons, "Mitantragstellerin")
|
||||||
|
_add_persons(source, associated_persons, "Mitantragstellerinnen")
|
||||||
|
_add_persons(
|
||||||
|
source, associated_persons, "Mitantragstellerinnen / Mitantragsteller"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Former applicant fields
|
||||||
|
_add_persons(source, associated_persons, "Ehemalige Antragsteller")
|
||||||
|
_add_person(source, associated_persons, "Ehemalige Antragstellerin")
|
||||||
|
_add_persons(source, associated_persons, "Ehemalige Antragstellerinnen")
|
||||||
|
_add_persons(
|
||||||
|
source,
|
||||||
|
associated_persons,
|
||||||
|
"Ehemalige Antragstellerinnen / Ehemalige Antragsteller",
|
||||||
|
)
|
||||||
|
_add_person(source, associated_persons, "Ehemaliger Antragsteller")
|
||||||
|
|
||||||
|
# Speaker / coordinator fields
|
||||||
|
_add_person(source, associated_persons, "Sprecher")
|
||||||
|
_add_person(source, associated_persons, "Sprecherin")
|
||||||
|
_add_persons(source, associated_persons, "Sprecherinnen")
|
||||||
|
_add_persons(source, associated_persons, "Sprecherinnen / Sprecher")
|
||||||
|
_add_person(source, associated_persons, "Co-Sprecher")
|
||||||
|
_add_persons(source, associated_persons, "Co-Sprecherinnen / Co-Sprecher")
|
||||||
|
|
||||||
|
# IGK partner speaker fields
|
||||||
|
_add_person(source, associated_persons, "Sprecher (IGK-Partner)")
|
||||||
|
_add_person(source, associated_persons, "Sprecherin (IGK-Partner)")
|
||||||
|
_add_persons(
|
||||||
|
source,
|
||||||
|
associated_persons,
|
||||||
|
"Sprecherinnen (IGK-Partner) / Sprecher (IGK-Partner)",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Leader fields
|
||||||
|
_add_person(source, associated_persons, "Leiter")
|
||||||
|
_add_person(source, associated_persons, "Leiterin")
|
||||||
|
_add_persons(source, associated_persons, "Leiterinnen")
|
||||||
|
_add_persons(source, associated_persons, "Leiterinnen / Leiter")
|
||||||
|
|
||||||
|
# Sub-project leader fields
|
||||||
|
_add_persons(source, associated_persons, "Teilprojektleiter")
|
||||||
|
_add_person(source, associated_persons, "Teilprojektleiterin")
|
||||||
|
_add_persons(source, associated_persons, "Teilprojektleiterinnen")
|
||||||
|
_add_persons(
|
||||||
|
source, associated_persons, "Teilprojektleiterinnen / Teilprojektleiter"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Participating scientist fields
|
||||||
|
_add_persons(source, associated_persons, "beteiligte Wissenschaftler")
|
||||||
|
_add_person(source, associated_persons, "beteiligte Wissenschaftlerin")
|
||||||
|
_add_persons(source, associated_persons, "beteiligte Wissenschaftlerinnen")
|
||||||
|
_add_persons(
|
||||||
|
source,
|
||||||
|
associated_persons,
|
||||||
|
"beteiligte Wissenschaftlerinnen / beteiligte Wissenschaftler",
|
||||||
|
)
|
||||||
|
_add_person(source, associated_persons, "beteiligter Wissenschaftler")
|
||||||
|
|
||||||
|
# Participating person fields
|
||||||
|
_add_person(source, associated_persons, "Beteiligte Person")
|
||||||
|
_add_persons(source, associated_persons, "Beteiligte Personen")
|
||||||
|
|
||||||
|
# Host fields (for guest researchers)
|
||||||
|
_add_person(source, associated_persons, "Gastgeber")
|
||||||
|
_add_person(source, associated_persons, "Gastgeberin")
|
||||||
|
_add_persons(source, associated_persons, "Gastgeberinnen")
|
||||||
|
_add_persons(source, associated_persons, "Gastgeberinnen / Gastgeber")
|
||||||
|
|
||||||
|
# Cooperation partner fields
|
||||||
|
_add_person(source, associated_persons, "Kooperationspartner")
|
||||||
|
_add_person(source, associated_persons, "Kooperationspartnerin")
|
||||||
|
_add_persons(source, associated_persons, "Kooperationspartnerinnen")
|
||||||
|
_add_persons(
|
||||||
|
source, associated_persons, "Kooperationspartnerinnen / Kooperationspartner"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Co-responsible fields
|
||||||
|
_add_person(source, associated_persons, "Mitverantwortlich")
|
||||||
|
_add_person(source, associated_persons, "Mitverantwortlich(e)")
|
||||||
|
_add_persons(source, associated_persons, "Mitverantwortliche")
|
||||||
|
|
||||||
|
# Application partner
|
||||||
|
_add_person(source, associated_persons, "Anwendungspartner")
|
||||||
|
|
||||||
|
# Foreign co-applicant fields
|
||||||
|
_add_persons(source, associated_persons, "ausländische Mitantragsteller")
|
||||||
|
_add_person(source, associated_persons, "ausländischer Mitantragsteller")
|
||||||
|
|
||||||
|
# Person creator (from nested fields)
|
||||||
|
if "person_creater_name" in source and source["person_creater_name"]:
|
||||||
|
associated_persons.add(source["person_creater_name"].strip())
|
||||||
|
|
||||||
|
# Deputy (stellvertr) - nested object
|
||||||
|
stellvertr = source.get("stellvertr")
|
||||||
|
if stellvertr and isinstance(stellvertr, dict):
|
||||||
|
for field in ["stellvertreter", "stellvertreterin"]:
|
||||||
|
if field in stellvertr and stellvertr[field]:
|
||||||
|
associated_persons.add(stellvertr[field].strip())
|
||||||
|
|
||||||
|
# --- Collect all institutions ---
|
||||||
|
|
||||||
|
_add_institution(source, institutions, "Antragstellende Institution")
|
||||||
|
_add_institution(source, institutions, "Mitantragstellende Institution")
|
||||||
|
_add_institution(source, institutions, "Beteiligte Einrichtung")
|
||||||
|
_add_institution(source, institutions, "Beteiligte Hochschule")
|
||||||
|
_add_institution(source, institutions, "Beteiligte Institution")
|
||||||
|
_add_institution(source, institutions, "IGK-Partnerinstitution")
|
||||||
|
_add_institution(source, institutions, "Partnerorganisation")
|
||||||
|
_add_institution(source, institutions, "Unternehmen")
|
||||||
|
|
||||||
|
# Foreign institution (nested object)
|
||||||
|
auslaend = source.get("ausländ")
|
||||||
|
if auslaend and isinstance(auslaend, dict):
|
||||||
|
for field in [
|
||||||
|
"auslaendischeInstitution",
|
||||||
|
"auslaendischeInstitution2",
|
||||||
|
"auslaendischesUnternehmen",
|
||||||
|
"auslaendischesUnternehmen2",
|
||||||
|
]:
|
||||||
|
if field in auslaend and auslaend[field]:
|
||||||
|
institutions.add(auslaend[field].strip())
|
||||||
|
return cls(
|
||||||
|
id=hit["_id"],
|
||||||
|
link=source.get("link"),
|
||||||
|
title=source.get("title"),
|
||||||
|
description=source.get("description"),
|
||||||
|
project_identifier=source.get("Projektkennung"),
|
||||||
|
funding_start_date=source.get("funding_start"),
|
||||||
|
funding_end_date=source.get("funding_end"),
|
||||||
|
dfg_procedure=source.get("DFG-Verfahren"),
|
||||||
|
subject_area=source.get("Fachliche Zuordnung"),
|
||||||
|
funding_type=source.get("Förderung"),
|
||||||
|
international_reference=source.get("Internationaler Bezug"),
|
||||||
|
website=source.get("Webseite"),
|
||||||
|
associated_persons=sorted(associated_persons), # sorted for consistency
|
||||||
|
institutions=sorted(institutions),
|
||||||
|
subproject_of=source.get("Teilprojekt zu"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# --- Helper functions for parsing source fields ---
|
||||||
|
|
||||||
|
def _add_person(source: dict, persons: Set[str], field: str) -> None:
|
||||||
|
"""Add a single person value from a field."""
|
||||||
|
if field in source and source[field]:
|
||||||
|
value = source[field].strip()
|
||||||
|
if value:
|
||||||
|
persons.add(value)
|
||||||
|
|
||||||
|
|
||||||
|
def _add_persons(source: dict, persons: Set[str], field: str) -> None:
|
||||||
|
"""Add persons from a semicolon-separated field."""
|
||||||
|
if field in source and source[field]:
|
||||||
|
for person in source[field].split(";"):
|
||||||
|
cleaned = person.strip()
|
||||||
|
if cleaned:
|
||||||
|
persons.add(cleaned)
|
||||||
|
|
||||||
|
|
||||||
|
def _add_institution(source: dict, institutions: Set[str], field: str) -> None:
|
||||||
|
"""Add a single institution value from a field."""
|
||||||
|
if field in source and source[field]:
|
||||||
|
value = source[field].strip()
|
||||||
|
if value:
|
||||||
|
institutions.add(value)
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Patents domain package.
|
||||||
|
"""
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
HTTP client for patent searches in EPO and USPTO Elasticsearch indices.
|
||||||
|
"""
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
|
||||||
|
from .. import config
|
||||||
|
from .name_matching import search_name_variants
|
||||||
|
|
||||||
|
EPO_INDEX = "epo_index_1.0"
|
||||||
|
USPTO_INDEX = "uspto_patents_3.0"
|
||||||
|
|
||||||
|
DEFAULT_SEARCH_SIZE = 100
|
||||||
|
|
||||||
|
|
||||||
|
def _match_name_field(field: str, name: str) -> dict[str, Any]:
|
||||||
|
"""Match a name field, including transliterated variants (Müller/Mueller)."""
|
||||||
|
variants = search_name_variants(name)
|
||||||
|
if len(variants) <= 1:
|
||||||
|
return {"match": {field: variants[0] if variants else name}}
|
||||||
|
return {
|
||||||
|
"bool": {
|
||||||
|
"should": [{"match": {field: variant}} for variant in variants],
|
||||||
|
"minimum_should_match": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class MissingApiKeyError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class PatentSearchClient:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
base_url: str | None = None,
|
||||||
|
api_key: str | None = None,
|
||||||
|
timeout: float = 30.0,
|
||||||
|
transport: httpx.AsyncBaseTransport | None = None,
|
||||||
|
):
|
||||||
|
self.base_url = (base_url or config.settings.patent_elasticsearch_url).rstrip("/")
|
||||||
|
self.api_key = api_key if api_key is not None else config.settings.patent_elasticsearch_api_key
|
||||||
|
self.timeout = timeout
|
||||||
|
self.transport = transport
|
||||||
|
|
||||||
|
def _headers(self) -> dict[str, str]:
|
||||||
|
if not self.api_key:
|
||||||
|
raise MissingApiKeyError("Patent Elasticsearch API key is not configured.")
|
||||||
|
return {
|
||||||
|
"Authorization": f"ApiKey {self.api_key}",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
}
|
||||||
|
|
||||||
|
def epo_query_by_inventor(
|
||||||
|
self,
|
||||||
|
last_name: str,
|
||||||
|
first_name: str | None = None,
|
||||||
|
size: int = DEFAULT_SEARCH_SIZE,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""Search EPO index: first AND last name in the SAME inventor entry."""
|
||||||
|
if first_name:
|
||||||
|
query = {
|
||||||
|
"nested": {
|
||||||
|
"path": "inventors_name_nested",
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
_match_name_field("inventors_name_nested.inventor", last_name),
|
||||||
|
_match_name_field("inventors_name_nested.inventor", first_name),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
query = {
|
||||||
|
"nested": {
|
||||||
|
"path": "inventors_name_nested",
|
||||||
|
"query": _match_name_field("inventors_name_nested.inventor", last_name),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"size": size,
|
||||||
|
"track_total_hits": True,
|
||||||
|
"sort": [
|
||||||
|
{"_score": {"order": "desc"}},
|
||||||
|
{"date_publication": {"order": "desc", "missing": "_last"}},
|
||||||
|
"_doc",
|
||||||
|
],
|
||||||
|
"_source": [
|
||||||
|
"doc_number",
|
||||||
|
"country",
|
||||||
|
"kind",
|
||||||
|
"date_publication",
|
||||||
|
"date_publication_year",
|
||||||
|
"title_en",
|
||||||
|
"title_de",
|
||||||
|
"abstract",
|
||||||
|
"inventors_name",
|
||||||
|
"applicants_name",
|
||||||
|
"ipc",
|
||||||
|
"ipc_text",
|
||||||
|
],
|
||||||
|
"query": query,
|
||||||
|
}
|
||||||
|
|
||||||
|
def uspto_query_by_inventor(
|
||||||
|
self,
|
||||||
|
last_name: str,
|
||||||
|
first_name: str | None = None,
|
||||||
|
size: int = DEFAULT_SEARCH_SIZE,
|
||||||
|
) -> dict[str, Any]:
|
||||||
|
"""Search USPTO index: first AND last name in the SAME inventor entry."""
|
||||||
|
if first_name:
|
||||||
|
query = {
|
||||||
|
"nested": {
|
||||||
|
"path": "inventors",
|
||||||
|
"query": {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
_match_name_field("inventors.name", last_name),
|
||||||
|
_match_name_field("inventors.name", first_name),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
query = {
|
||||||
|
"nested": {
|
||||||
|
"path": "inventors",
|
||||||
|
"query": _match_name_field("inventors.name", last_name),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
"size": size,
|
||||||
|
"track_total_hits": True,
|
||||||
|
"sort": [
|
||||||
|
{"_score": {"order": "desc"}},
|
||||||
|
{"publication_date": {"order": "desc", "missing": "_last"}},
|
||||||
|
"_doc",
|
||||||
|
],
|
||||||
|
"_source": [
|
||||||
|
"publication_number",
|
||||||
|
"country",
|
||||||
|
"publication_date",
|
||||||
|
"publication_year",
|
||||||
|
"title",
|
||||||
|
"abstract",
|
||||||
|
"inventors_names",
|
||||||
|
"inventors_names_text",
|
||||||
|
"assignees_orgs",
|
||||||
|
"ipcr",
|
||||||
|
"ipcr_text",
|
||||||
|
],
|
||||||
|
"query": query,
|
||||||
|
}
|
||||||
|
|
||||||
|
async def search_epo(self, payload: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
return await self._search(EPO_INDEX, payload)
|
||||||
|
|
||||||
|
async def search_uspto(self, payload: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
return await self._search(USPTO_INDEX, payload)
|
||||||
|
|
||||||
|
async def _search(self, index: str, payload: dict[str, Any]) -> dict[str, Any]:
|
||||||
|
async with httpx.AsyncClient(
|
||||||
|
base_url=self.base_url,
|
||||||
|
timeout=self.timeout,
|
||||||
|
transport=self.transport,
|
||||||
|
) as client:
|
||||||
|
response = await client.post(
|
||||||
|
f"/{index}/_search",
|
||||||
|
headers=self._headers(),
|
||||||
|
json=payload,
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Business logic for patent matching by author name.
|
||||||
|
"""
|
||||||
|
import logging
|
||||||
|
|
||||||
|
import httpx
|
||||||
|
from fastapi import HTTPException
|
||||||
|
from starlette.status import HTTP_502_BAD_GATEWAY
|
||||||
|
from starlette.status import HTTP_503_SERVICE_UNAVAILABLE
|
||||||
|
|
||||||
|
from ..persons import logic as person_logic
|
||||||
|
from ..models.openalex.author import Author
|
||||||
|
from . import model
|
||||||
|
from .elastic_search_client import MissingApiKeyError
|
||||||
|
from .elastic_search_client import PatentSearchClient
|
||||||
|
from .name_matching import name_matches
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
async def get_patents_by_author_id(
|
||||||
|
author_id: str,
|
||||||
|
client: PatentSearchClient | None = None,
|
||||||
|
) -> model.PatentsByAuthorResponse:
|
||||||
|
search_client = client or PatentSearchClient()
|
||||||
|
|
||||||
|
author = _get_author(author_id)
|
||||||
|
if not author:
|
||||||
|
return model.PatentsByAuthorResponse(
|
||||||
|
author_id=author_id,
|
||||||
|
author_name=None,
|
||||||
|
patent_count=0,
|
||||||
|
patents=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
author_name = author.display_name
|
||||||
|
last_name = _extract_last_name(author_name)
|
||||||
|
first_name = _extract_first_name(author_name)
|
||||||
|
|
||||||
|
if not last_name:
|
||||||
|
return model.PatentsByAuthorResponse(
|
||||||
|
author_id=author_id,
|
||||||
|
author_name=author_name,
|
||||||
|
patent_count=0,
|
||||||
|
patents=[],
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
epo_data, uspto_data = await _search_both_indices(
|
||||||
|
search_client, last_name, first_name
|
||||||
|
)
|
||||||
|
except MissingApiKeyError as exc:
|
||||||
|
raise HTTPException(status_code=HTTP_503_SERVICE_UNAVAILABLE,
|
||||||
|
detail="Patent search is not configured.") from exc
|
||||||
|
except httpx.HTTPError as exc:
|
||||||
|
raise HTTPException(status_code=HTTP_502_BAD_GATEWAY,
|
||||||
|
detail="Patent search request failed.") from exc
|
||||||
|
|
||||||
|
all_patents = _parse_epo_hits(epo_data) + _parse_uspto_hits(uspto_data)
|
||||||
|
|
||||||
|
if first_name and last_name:
|
||||||
|
all_patents = _filter_patents_by_name(all_patents, first_name, last_name)
|
||||||
|
|
||||||
|
return model.PatentsByAuthorResponse(
|
||||||
|
author_id=author_id,
|
||||||
|
author_name=author_name,
|
||||||
|
patent_count=len(all_patents),
|
||||||
|
patents=all_patents,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def _search_both_indices(client, last_name, first_name):
|
||||||
|
import asyncio
|
||||||
|
epo_result, uspto_result = await asyncio.gather(
|
||||||
|
client.search_epo(client.epo_query_by_inventor(last_name, first_name)),
|
||||||
|
client.search_uspto(client.uspto_query_by_inventor(last_name, first_name)),
|
||||||
|
)
|
||||||
|
return epo_result, uspto_result
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_epo_hits(data: dict) -> list[model.PatentEntry]:
|
||||||
|
patents = []
|
||||||
|
for hit in data.get("hits", {}).get("hits", []):
|
||||||
|
src = hit.get("_source", {})
|
||||||
|
inventors = src.get("inventors_name") or []
|
||||||
|
applicants = src.get("applicants_name") or []
|
||||||
|
ipc = src.get("ipc") or []
|
||||||
|
patents.append(model.PatentEntry(
|
||||||
|
patent_id=f"EP{src.get('doc_number', hit.get('_id', ''))}",
|
||||||
|
source="EPO",
|
||||||
|
title=src.get("title_en") or src.get("title_de"),
|
||||||
|
abstract=src.get("abstract"),
|
||||||
|
publication_date=str(src.get("date_publication")) if src.get("date_publication") else None,
|
||||||
|
publication_year=str(src.get("date_publication_year")) if src.get("date_publication_year") else None,
|
||||||
|
inventors=inventors if isinstance(inventors, list) else [inventors],
|
||||||
|
assignees=applicants if isinstance(applicants, list) else [applicants],
|
||||||
|
ipc=ipc if isinstance(ipc, list) else [ipc],
|
||||||
|
country=src.get("country", "EP"),
|
||||||
|
))
|
||||||
|
return patents
|
||||||
|
|
||||||
|
|
||||||
|
def _parse_uspto_hits(data: dict) -> list[model.PatentEntry]:
|
||||||
|
patents = []
|
||||||
|
for hit in data.get("hits", {}).get("hits", []):
|
||||||
|
src = hit.get("_source", {})
|
||||||
|
inventors = src.get("inventors_names") or []
|
||||||
|
assignees = src.get("assignees_orgs") or []
|
||||||
|
ipc = src.get("ipcr") or []
|
||||||
|
patents.append(model.PatentEntry(
|
||||||
|
patent_id=f"US{src.get('publication_number', hit.get('_id', ''))}",
|
||||||
|
source="USPTO",
|
||||||
|
title=src.get("title"),
|
||||||
|
abstract=src.get("abstract"),
|
||||||
|
publication_date=str(src.get("publication_date")) if src.get("publication_date") else None,
|
||||||
|
publication_year=str(src.get("publication_year")) if src.get("publication_year") else None,
|
||||||
|
inventors=inventors if isinstance(inventors, list) else [inventors],
|
||||||
|
assignees=assignees if isinstance(assignees, list) else [assignees],
|
||||||
|
ipc=ipc if isinstance(ipc, list) else [ipc],
|
||||||
|
country=src.get("country", "US"),
|
||||||
|
))
|
||||||
|
return patents
|
||||||
|
|
||||||
|
|
||||||
|
def _filter_patents_by_name(
|
||||||
|
patents: list[model.PatentEntry],
|
||||||
|
first_name: str,
|
||||||
|
last_name: str,
|
||||||
|
) -> list[model.PatentEntry]:
|
||||||
|
"""Keep patents where at least one inventor matches the author name."""
|
||||||
|
return [
|
||||||
|
patent for patent in patents
|
||||||
|
if any(name_matches(inventor, first_name, last_name) for inventor in patent.inventors)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _get_author(author_id: str) -> Author | None:
|
||||||
|
short_id = author_id.replace("https://openalex.org/", "")
|
||||||
|
result = person_logic.search_persons(author_id=short_id)
|
||||||
|
return result.results[0] if result.results else None
|
||||||
|
|
||||||
|
|
||||||
|
def _extract_last_name(name: str | None) -> str | None:
|
||||||
|
if not name:
|
||||||
|
return None
|
||||||
|
parts = name.strip().split()
|
||||||
|
return parts[-1] if parts else None
|
||||||
|
|
||||||
|
|
||||||
|
def _extract_first_name(name: str | None) -> str | None:
|
||||||
|
if not name:
|
||||||
|
return None
|
||||||
|
parts = name.strip().split()
|
||||||
|
return parts[0] if len(parts) > 1 else None
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
|
|
||||||
|
class PatentEntry(BaseModel):
|
||||||
|
patent_id: str
|
||||||
|
source: str # "EPO" or "USPTO"
|
||||||
|
title: str | None = None
|
||||||
|
abstract: str | None = None
|
||||||
|
publication_date: str | None = None
|
||||||
|
publication_year: str | None = None
|
||||||
|
inventors: list[str] = Field(default_factory=list)
|
||||||
|
assignees: list[str] = Field(default_factory=list)
|
||||||
|
ipc: list[str] = Field(default_factory=list)
|
||||||
|
country: str | None = None
|
||||||
|
|
||||||
|
class PatentsByAuthorResponse(BaseModel):
|
||||||
|
author_id: str
|
||||||
|
author_name: str | None = None
|
||||||
|
patent_count: int
|
||||||
|
patents: list[PatentEntry]
|
||||||
@@ -0,0 +1,242 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Name normalization and matching for patent inventor lookup.
|
||||||
|
|
||||||
|
Handles umlauts, diacritics, and common Latin transliterations so that
|
||||||
|
e.g. 'Müller' matches 'Mueller' and 'Muller'.
|
||||||
|
"""
|
||||||
|
import re
|
||||||
|
import unicodedata
|
||||||
|
|
||||||
|
# Characters that NFKD does not map to ASCII-friendly forms.
|
||||||
|
_CHAR_REPLACEMENTS: dict[str, str] = {
|
||||||
|
"ß": "ss",
|
||||||
|
"ẞ": "ss",
|
||||||
|
"æ": "ae",
|
||||||
|
"Æ": "ae",
|
||||||
|
"œ": "oe",
|
||||||
|
"Œ": "oe",
|
||||||
|
"ø": "o",
|
||||||
|
"Ø": "o",
|
||||||
|
"đ": "d",
|
||||||
|
"Đ": "d",
|
||||||
|
"ð": "d",
|
||||||
|
"Ð": "d",
|
||||||
|
"þ": "th",
|
||||||
|
"Þ": "th",
|
||||||
|
"ł": "l",
|
||||||
|
"Ł": "l",
|
||||||
|
"ı": "i",
|
||||||
|
"ſ": "s",
|
||||||
|
}
|
||||||
|
|
||||||
|
# German patent transliterations: ae/oe/ue often stand in for ä/ö/ü.
|
||||||
|
_DIGRAPH_COLLAPSES: tuple[tuple[str, str], ...] = (
|
||||||
|
("ae", "a"),
|
||||||
|
("oe", "o"),
|
||||||
|
("ue", "u"),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Common ASCII spellings in patent records for umlaut-derived vowels.
|
||||||
|
_PATENT_VOWEL_EXPANSIONS: tuple[tuple[str, str], ...] = (
|
||||||
|
(r"u([lmnrt])", r"ue\1"),
|
||||||
|
(r"o([lmnrt])", r"oe\1"),
|
||||||
|
(r"a([lmnrt])", r"ae\1"),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def normalize_name_part(value: str | None) -> str:
|
||||||
|
"""
|
||||||
|
Normalize a single name token for comparison.
|
||||||
|
|
||||||
|
Steps: transliteration map -> NFKD -> strip diacritics -> lowercase
|
||||||
|
-> remove apostrophes/punctuation -> collapse whitespace.
|
||||||
|
"""
|
||||||
|
if not value:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
text = value.strip()
|
||||||
|
for src, dst in _CHAR_REPLACEMENTS.items():
|
||||||
|
text = text.replace(src, dst)
|
||||||
|
|
||||||
|
text = unicodedata.normalize("NFKD", text)
|
||||||
|
text = "".join(c for c in text if not unicodedata.combining(c))
|
||||||
|
text = text.lower()
|
||||||
|
text = re.sub(r"[''`´]", "", text)
|
||||||
|
text = re.sub(r"[^\w\s-]", "", text)
|
||||||
|
text = re.sub(r"\s+", " ", text).strip()
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
def name_token_variants(value: str | None) -> set[str]:
|
||||||
|
"""
|
||||||
|
Return equivalent forms of a name token.
|
||||||
|
|
||||||
|
Includes the normalized base plus German digraph collapses
|
||||||
|
(Mueller -> muller) and hyphen Relaxed forms (Jean-Pierre -> jean pierre).
|
||||||
|
"""
|
||||||
|
base = normalize_name_part(value)
|
||||||
|
if not base:
|
||||||
|
return set()
|
||||||
|
|
||||||
|
variants = {base}
|
||||||
|
|
||||||
|
for src, dst in _DIGRAPH_COLLAPSES:
|
||||||
|
if src in base:
|
||||||
|
variants.add(base.replace(src, dst))
|
||||||
|
|
||||||
|
if "-" in base:
|
||||||
|
variants.add(base.replace("-", ""))
|
||||||
|
variants.add(base.replace("-", " "))
|
||||||
|
|
||||||
|
return {v for v in variants if v}
|
||||||
|
|
||||||
|
|
||||||
|
def _patent_transliteration_expansions(normalized: str) -> set[str]:
|
||||||
|
"""
|
||||||
|
ASCII spellings used in patent records (e.g. Müller indexed as Mueller).
|
||||||
|
|
||||||
|
Used for Elasticsearch recall only; post-filter applies stricter matching.
|
||||||
|
"""
|
||||||
|
expanded = {normalized}
|
||||||
|
for pattern, repl in _PATENT_VOWEL_EXPANSIONS:
|
||||||
|
if re.search(pattern, normalized):
|
||||||
|
expanded.add(re.sub(pattern, repl, normalized))
|
||||||
|
return expanded
|
||||||
|
|
||||||
|
|
||||||
|
def tokens_equal(
|
||||||
|
left: str | None,
|
||||||
|
right: str | None,
|
||||||
|
*,
|
||||||
|
allow_initial: bool = True,
|
||||||
|
) -> bool:
|
||||||
|
"""True when two name tokens are equivalent after normalization."""
|
||||||
|
left_variants = name_token_variants(left)
|
||||||
|
right_variants = name_token_variants(right)
|
||||||
|
if not left_variants or not right_variants:
|
||||||
|
return False
|
||||||
|
if left_variants & right_variants:
|
||||||
|
return True
|
||||||
|
|
||||||
|
if not allow_initial:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return _initial_tokens_match(left, right)
|
||||||
|
|
||||||
|
|
||||||
|
def _initial_letter(token: str | None) -> str | None:
|
||||||
|
normalized = normalize_name_part(token)
|
||||||
|
if len(normalized) == 1 and normalized.isalpha():
|
||||||
|
return normalized
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def _initial_tokens_match(left: str | None, right: str | None) -> bool:
|
||||||
|
"""True when one token is a single-letter initial matching the other token."""
|
||||||
|
left_initial = _initial_letter(left)
|
||||||
|
right_initial = _initial_letter(right)
|
||||||
|
left_full = normalize_name_part(left)
|
||||||
|
right_full = normalize_name_part(right)
|
||||||
|
|
||||||
|
if left_initial and right_full and len(right_full) > 1:
|
||||||
|
return right_full.startswith(left_initial)
|
||||||
|
if right_initial and left_full and len(left_full) > 1:
|
||||||
|
return left_full.startswith(right_initial)
|
||||||
|
if left_initial and right_initial:
|
||||||
|
return left_initial == right_initial
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def _inventor_first_token(inventor_name: str) -> str:
|
||||||
|
if "," in inventor_name:
|
||||||
|
_, first_part = [p.strip() for p in inventor_name.split(",", 1)]
|
||||||
|
return first_part.split()[0] if first_part else ""
|
||||||
|
parts = inventor_name.split()
|
||||||
|
return parts[0] if parts else ""
|
||||||
|
|
||||||
|
|
||||||
|
def first_name_match_kind(
|
||||||
|
inventor_name: str,
|
||||||
|
first_name: str,
|
||||||
|
last_name: str,
|
||||||
|
) -> str:
|
||||||
|
"""
|
||||||
|
Match quality for the inventor first name: 'full', 'initial', or 'none'.
|
||||||
|
"""
|
||||||
|
if not name_matches(inventor_name, first_name, last_name):
|
||||||
|
return "none"
|
||||||
|
|
||||||
|
inventor_first = _inventor_first_token(inventor_name)
|
||||||
|
if tokens_equal(inventor_first, first_name, allow_initial=False):
|
||||||
|
return "full"
|
||||||
|
return "initial"
|
||||||
|
|
||||||
|
|
||||||
|
def search_name_variants(value: str | None) -> list[str]:
|
||||||
|
"""
|
||||||
|
Distinct search strings for Elasticsearch, preserving original casing
|
||||||
|
where useful but including normalized and transliterated forms.
|
||||||
|
"""
|
||||||
|
if not value or not value.strip():
|
||||||
|
return []
|
||||||
|
|
||||||
|
seen: set[str] = set()
|
||||||
|
ordered: list[str] = []
|
||||||
|
|
||||||
|
def _add(candidate: str) -> None:
|
||||||
|
key = candidate.casefold()
|
||||||
|
if candidate.strip() and key not in seen:
|
||||||
|
seen.add(key)
|
||||||
|
ordered.append(candidate.strip())
|
||||||
|
|
||||||
|
_add(value.strip())
|
||||||
|
|
||||||
|
normalized = normalize_name_part(value)
|
||||||
|
if normalized:
|
||||||
|
_add(normalized.title())
|
||||||
|
|
||||||
|
for variant in name_token_variants(value):
|
||||||
|
_add(variant.title())
|
||||||
|
|
||||||
|
for variant in _patent_transliteration_expansions(normalized):
|
||||||
|
_add(variant.title())
|
||||||
|
|
||||||
|
if normalized and len(normalized) > 1:
|
||||||
|
_add(normalized[0].upper())
|
||||||
|
|
||||||
|
return ordered
|
||||||
|
|
||||||
|
|
||||||
|
def name_matches(inventor_name: str, first_name: str, last_name: str) -> bool:
|
||||||
|
"""
|
||||||
|
True when an inventor entry matches first_name + last_name.
|
||||||
|
|
||||||
|
Supports:
|
||||||
|
- USPTO: 'Christian Weber', 'Christian Hans Weber'
|
||||||
|
- EPO: 'Weber, Christian', 'Weber, Christian Hans'
|
||||||
|
"""
|
||||||
|
if not inventor_name or not last_name:
|
||||||
|
return False
|
||||||
|
|
||||||
|
name = inventor_name.strip()
|
||||||
|
|
||||||
|
if "," in name:
|
||||||
|
last_part, first_part = [p.strip() for p in name.split(",", 1)]
|
||||||
|
first_token = first_part.split()[0] if first_part else ""
|
||||||
|
return (
|
||||||
|
tokens_equal(last_part, last_name, allow_initial=False)
|
||||||
|
and bool(first_name)
|
||||||
|
and tokens_equal(first_token, first_name)
|
||||||
|
)
|
||||||
|
|
||||||
|
parts = name.split()
|
||||||
|
if len(parts) < 2:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return (
|
||||||
|
tokens_equal(parts[-1], last_name, allow_initial=False)
|
||||||
|
and bool(first_name)
|
||||||
|
and tokens_equal(parts[0], first_name)
|
||||||
|
)
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
REST API for patent matching by author.
|
||||||
|
"""
|
||||||
|
from fastapi import APIRouter
|
||||||
|
from . import logic
|
||||||
|
from . import model
|
||||||
|
|
||||||
|
router = APIRouter(prefix="/api/inse-service/authors", tags=["Patents"])
|
||||||
|
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"/{author_id}/patents",
|
||||||
|
operation_id="getPatentsByAuthor",
|
||||||
|
response_model=model.PatentsByAuthorResponse,
|
||||||
|
summary="Get patents matched to an author by name.",
|
||||||
|
)
|
||||||
|
async def get_patents_by_author(author_id: str):
|
||||||
|
return await logic.get_patents_by_author_id(author_id)
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import httpx
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from inse.patents.elastic_search_client import (
|
||||||
|
DEFAULT_SEARCH_SIZE,
|
||||||
|
EPO_INDEX,
|
||||||
|
PatentSearchClient,
|
||||||
|
USPTO_INDEX,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def anyio_backend():
|
||||||
|
return "asyncio"
|
||||||
|
|
||||||
|
|
||||||
|
def test_epo_query_uses_nested_search_and_name_variants():
|
||||||
|
client = PatentSearchClient(api_key="test-key")
|
||||||
|
payload = client.epo_query_by_inventor("Müller", "Christian")
|
||||||
|
|
||||||
|
assert payload["size"] == DEFAULT_SEARCH_SIZE
|
||||||
|
assert payload["sort"][0] == {"_score": {"order": "desc"}}
|
||||||
|
nested = payload["query"]["nested"]
|
||||||
|
assert nested["path"] == "inventors_name_nested"
|
||||||
|
must = nested["query"]["bool"]["must"]
|
||||||
|
assert len(must) == 2
|
||||||
|
assert "should" in must[0]["bool"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_uspto_index_is_3_0():
|
||||||
|
assert USPTO_INDEX == "uspto_patents_3.0"
|
||||||
|
assert EPO_INDEX == "epo_index_1.0"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.anyio
|
||||||
|
async def test_search_epo_posts_to_correct_index():
|
||||||
|
requests: list[str] = []
|
||||||
|
|
||||||
|
def handler(request: httpx.Request) -> httpx.Response:
|
||||||
|
requests.append(request.url.path)
|
||||||
|
return httpx.Response(200, json={"hits": {"hits": []}})
|
||||||
|
|
||||||
|
transport = httpx.MockTransport(handler)
|
||||||
|
client = PatentSearchClient(api_key="test-key", transport=transport)
|
||||||
|
|
||||||
|
await client.search_epo(client.epo_query_by_inventor("Weber", "Christian"))
|
||||||
|
|
||||||
|
assert len(requests) == 1
|
||||||
|
assert requests[0].endswith(f"/{EPO_INDEX}/_search")
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from inse.patents.name_matching import (
|
||||||
|
first_name_match_kind,
|
||||||
|
name_matches,
|
||||||
|
name_token_variants,
|
||||||
|
normalize_name_part,
|
||||||
|
search_name_variants,
|
||||||
|
tokens_equal,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("left", "right"),
|
||||||
|
[
|
||||||
|
("Müller", "Mueller"),
|
||||||
|
("Müller", "Muller"),
|
||||||
|
("Schöning", "Schoening"),
|
||||||
|
("François", "Francois"),
|
||||||
|
("José", "Jose"),
|
||||||
|
("García", "Garcia"),
|
||||||
|
("Bräun", "Braun"),
|
||||||
|
("Straß", "Strass"),
|
||||||
|
("Grøn", "Gron"),
|
||||||
|
("Małgorzata", "Malgorzata"),
|
||||||
|
("Øystein", "Oystein"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_tokens_equal_transliteration(left: str, right: str) -> None:
|
||||||
|
assert tokens_equal(left, right)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("left", "right"),
|
||||||
|
[
|
||||||
|
("Christian", "Marc"),
|
||||||
|
("Weber", "Wagner"),
|
||||||
|
("Müller", "Meier"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_tokens_equal_rejects_different_names(left: str, right: str) -> None:
|
||||||
|
assert not tokens_equal(left, right)
|
||||||
|
|
||||||
|
|
||||||
|
def test_hyphenated_first_name() -> None:
|
||||||
|
assert tokens_equal("Jean-Pierre", "Jean Pierre")
|
||||||
|
assert tokens_equal("Jean-Pierre", "JeanPierre")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("inventor", "first", "last", "expected"),
|
||||||
|
[
|
||||||
|
("Christian Weber", "Christian", "Weber", True),
|
||||||
|
("Weber, Christian", "Christian", "Weber", True),
|
||||||
|
("Marc Christian Weber", "Christian", "Weber", False),
|
||||||
|
("Müller, Hans", "Hans", "Müller", True),
|
||||||
|
("Mueller, Hans", "Hans", "Müller", True),
|
||||||
|
("Hans Mueller", "Hans", "Müller", True),
|
||||||
|
("Weber, Christian Hans", "Christian", "Weber", True),
|
||||||
|
("Schoening, Klaus", "Klaus", "Schöning", True),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_name_matches(inventor: str, first: str, last: str, expected: bool) -> None:
|
||||||
|
assert name_matches(inventor, first, last) is expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_normalize_name_part_strips_diacritics() -> None:
|
||||||
|
assert normalize_name_part("François") == "francois"
|
||||||
|
assert normalize_name_part(" O'Brien ") == "obrien"
|
||||||
|
|
||||||
|
|
||||||
|
def test_search_name_variants_includes_transliterations() -> None:
|
||||||
|
variants = search_name_variants("Müller")
|
||||||
|
folded = {v.casefold() for v in variants}
|
||||||
|
assert "müller" in folded or "Müller".casefold() in folded
|
||||||
|
assert "mueller" in folded
|
||||||
|
assert "muller" in folded
|
||||||
|
|
||||||
|
|
||||||
|
def test_name_token_variants_mueller() -> None:
|
||||||
|
variants = name_token_variants("Mueller")
|
||||||
|
assert "mueller" in variants
|
||||||
|
assert "muller" in variants
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("left", "right"),
|
||||||
|
[
|
||||||
|
("C", "Christian"),
|
||||||
|
("C.", "Christian"),
|
||||||
|
("Christian", "C"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_tokens_equal_initials(left: str, right: str) -> None:
|
||||||
|
assert tokens_equal(left, right)
|
||||||
|
|
||||||
|
|
||||||
|
def test_tokens_equal_initials_not_for_last_names_by_default() -> None:
|
||||||
|
assert not tokens_equal("W", "Weber", allow_initial=False)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("inventor", "first", "last", "expected"),
|
||||||
|
[
|
||||||
|
("C. Weber", "Christian", "Weber", True),
|
||||||
|
("Weber, C.", "Christian", "Weber", True),
|
||||||
|
("Weber, C", "Christian", "Weber", True),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
def test_name_matches_initials(inventor: str, first: str, last: str, expected: bool) -> None:
|
||||||
|
assert name_matches(inventor, first, last) is expected
|
||||||
|
|
||||||
|
|
||||||
|
def test_first_name_match_kind() -> None:
|
||||||
|
assert first_name_match_kind("Christian Weber", "Christian", "Weber") == "full"
|
||||||
|
assert first_name_match_kind("C. Weber", "Christian", "Weber") == "initial"
|
||||||
|
assert first_name_match_kind("Marc Christian Weber", "Christian", "Weber") == "none"
|
||||||
|
|
||||||
|
|
||||||
|
def test_search_name_variants_includes_initial() -> None:
|
||||||
|
variants = search_name_variants("Christian")
|
||||||
|
assert "C" in variants
|
||||||
|
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
import logging
|
||||||
|
from typing import List, Dict, Any
|
||||||
|
from .model import UniversityTopicData, YearlyData, UniversityRanking, ResearchTopic, DashboardMetric, RankingResponse
|
||||||
|
from inse.integrations import elasticsearch
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
START_YEAR = 2015
|
||||||
|
END_YEAR = 2026
|
||||||
|
|
||||||
|
async def get_ranking_data(topic: ResearchTopic, metric: DashboardMetric) -> RankingResponse:
|
||||||
|
"""
|
||||||
|
Fetches real data from Elasticsearch and computes metrics for the dashboard.
|
||||||
|
"""
|
||||||
|
query = {
|
||||||
|
"bool": {
|
||||||
|
"must": [
|
||||||
|
{
|
||||||
|
"match_phrase": {
|
||||||
|
"topics.display_name": topic
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"term": {
|
||||||
|
"geo.country_code": "DE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Fetch top institutions for the topic by works_count
|
||||||
|
res = elasticsearch.search(
|
||||||
|
index="openalex-institutions",
|
||||||
|
query=query,
|
||||||
|
size=10,
|
||||||
|
sort=[{"works_count": "desc"}],
|
||||||
|
cluster="nes"
|
||||||
|
)
|
||||||
|
|
||||||
|
hits = res.get("hits", {}).get("hits", [])
|
||||||
|
timeseries: List[UniversityTopicData] = []
|
||||||
|
|
||||||
|
for hit in hits:
|
||||||
|
source = hit["_source"]
|
||||||
|
# Map the counts_by_year from ES to our model
|
||||||
|
# We ensure every year from START_YEAR to END_YEAR is present, defaulting to 0
|
||||||
|
es_counts = {c["year"]: c for c in source.get("counts_by_year", [])}
|
||||||
|
|
||||||
|
yearly_data = []
|
||||||
|
for year in range(START_YEAR, END_YEAR + 1):
|
||||||
|
count_item = es_counts.get(year, {})
|
||||||
|
yearly_data.append(YearlyData(
|
||||||
|
year=year,
|
||||||
|
publications=count_item.get("works_count", 0),
|
||||||
|
citations=count_item.get("cited_by_count", 0)
|
||||||
|
))
|
||||||
|
|
||||||
|
timeseries.append(UniversityTopicData(
|
||||||
|
university=source.get("display_name", "Unknown"),
|
||||||
|
topic=topic,
|
||||||
|
yearly_data=yearly_data
|
||||||
|
))
|
||||||
|
|
||||||
|
rankings = _compute_rankings(timeseries, metric)
|
||||||
|
|
||||||
|
return RankingResponse(timeseries=timeseries, rankings=rankings)
|
||||||
|
|
||||||
|
def _compute_rankings(data: List[UniversityTopicData], metric: DashboardMetric) -> List[UniversityRanking]:
|
||||||
|
"""Computes ranking metrics based on the timeseries data."""
|
||||||
|
latest_year = END_YEAR
|
||||||
|
five_years_ago = latest_year - 5
|
||||||
|
three_years_ago = latest_year - 3
|
||||||
|
|
||||||
|
processed: List[Dict[str, Any]] = []
|
||||||
|
for item in data:
|
||||||
|
latest = next((d for d in item.yearly_data if d.year == latest_year), YearlyData(year=latest_year, publications=0, citations=0))
|
||||||
|
prev = next((d for d in item.yearly_data if d.year == latest_year - 1), YearlyData(year=latest_year-1, publications=0, citations=0))
|
||||||
|
start_range = next((d for d in item.yearly_data if d.year == five_years_ago), YearlyData(year=five_years_ago, publications=0, citations=0))
|
||||||
|
mover_range = next((d for d in item.yearly_data if d.year == three_years_ago), YearlyData(year=three_years_ago, publications=0, citations=0))
|
||||||
|
|
||||||
|
curr_val = getattr(latest, metric) or 0
|
||||||
|
prev_val = getattr(prev, metric) or 0
|
||||||
|
old_val = getattr(start_range, metric) or 0
|
||||||
|
mover_old_val = getattr(mover_range, metric) or 0
|
||||||
|
|
||||||
|
growth_rate = ((curr_val - old_val) / old_val * 100) if old_val > 0 else 0
|
||||||
|
recent_growth = ((curr_val - mover_old_val) / mover_old_val * 100) if mover_old_val > 0 else 0
|
||||||
|
|
||||||
|
processed.append({
|
||||||
|
"university": item.university,
|
||||||
|
"publications": latest.publications,
|
||||||
|
"citations": latest.citations,
|
||||||
|
"growth_rate": growth_rate,
|
||||||
|
"trend": 'up' if curr_val > prev_val else ('down' if curr_val < prev_val else 'stable'),
|
||||||
|
"recent_growth": recent_growth,
|
||||||
|
"sort_val": curr_val
|
||||||
|
})
|
||||||
|
|
||||||
|
processed.sort(key=lambda x: x["sort_val"], reverse=True)
|
||||||
|
# Top movers: top 2 by recent growth
|
||||||
|
growth_sorted = sorted([p["recent_growth"] for p in processed], reverse=True)
|
||||||
|
threshold = growth_sorted[1] if len(growth_sorted) > 1 else 0
|
||||||
|
|
||||||
|
return [
|
||||||
|
UniversityRanking(
|
||||||
|
rank=i + 1,
|
||||||
|
is_top_mover=p["recent_growth"] >= threshold and p["recent_growth"] > 0,
|
||||||
|
**{k: v for k, v in p.items() if k != "sort_val" and k != "recent_growth"}
|
||||||
|
)
|
||||||
|
for i, p in enumerate(processed)
|
||||||
|
]
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
from pydantic import BaseModel
|
||||||
|
from typing import List, Literal
|
||||||
|
|
||||||
|
ResearchTopic = Literal['Artificial Intelligence', 'Quantum Computing', 'Renewable Energy', 'Biotechnology']
|
||||||
|
DashboardMetric = Literal['publications', 'citations']
|
||||||
|
|
||||||
|
class YearlyData(BaseModel):
|
||||||
|
year: int
|
||||||
|
publications: int
|
||||||
|
citations: int
|
||||||
|
|
||||||
|
class UniversityTopicData(BaseModel):
|
||||||
|
university: str
|
||||||
|
topic: ResearchTopic
|
||||||
|
yearly_data: List[YearlyData]
|
||||||
|
|
||||||
|
class UniversityRanking(BaseModel):
|
||||||
|
rank: int
|
||||||
|
university: str
|
||||||
|
publications: int
|
||||||
|
citations: int
|
||||||
|
growth_rate: float
|
||||||
|
trend: Literal['up', 'down', 'stable']
|
||||||
|
is_top_mover: bool
|
||||||
|
|
||||||
|
class RankingResponse(BaseModel):
|
||||||
|
# Raw timeseries data for the ECharts line race
|
||||||
|
timeseries: List[UniversityTopicData]
|
||||||
|
# Computed metrics for the ranking table
|
||||||
|
rankings: List[UniversityRanking]
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
from fastapi import APIRouter, Query
|
||||||
|
from . import service
|
||||||
|
from .model import RankingResponse, ResearchTopic, DashboardMetric
|
||||||
|
from inse.tags import Tags
|
||||||
|
|
||||||
|
router = APIRouter(
|
||||||
|
prefix="/api/inse-service/university-rankings",
|
||||||
|
tags=[Tags.INSTITUTIONS]
|
||||||
|
)
|
||||||
|
|
||||||
|
@router.get(
|
||||||
|
"",
|
||||||
|
response_model=RankingResponse,
|
||||||
|
summary="Returns data for the University Ranking Dashboard."
|
||||||
|
)
|
||||||
|
async def get_rankings(
|
||||||
|
topic: ResearchTopic = Query(
|
||||||
|
...,
|
||||||
|
description="Research topic (e.g., 'Artificial Intelligence')"
|
||||||
|
),
|
||||||
|
metric: DashboardMetric = Query("publications", description="Metric to rank by")
|
||||||
|
):
|
||||||
|
return await service.get_university_dashboard_data(topic, metric)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
from . import logic
|
||||||
|
from .model import RankingResponse, ResearchTopic, DashboardMetric
|
||||||
|
|
||||||
|
async def get_university_dashboard_data(topic: ResearchTopic, metric: DashboardMetric) -> RankingResponse:
|
||||||
|
"""Orchestrates data retrieval and computation for the dashboard."""
|
||||||
|
return await logic.get_ranking_data(topic, metric)
|
||||||
@@ -26,9 +26,9 @@ class OpenAlexWorksSearchClient:
|
|||||||
timeout: float | None = None,
|
timeout: float | None = None,
|
||||||
transport: httpx.AsyncBaseTransport | None = None,
|
transport: httpx.AsyncBaseTransport | None = None,
|
||||||
):
|
):
|
||||||
self.base_url = (base_url or config.settings.openalex_works_search_base_url).rstrip("/")
|
self.base_url = (base_url or config.settings.elasticsearch_url or "").rstrip("/")
|
||||||
self.index = index or config.settings.openalex_works_search_index
|
self.index = index or config.settings.openalex_works_search_index
|
||||||
self.api_key = api_key if api_key is not None else config.settings.openalex_works_api_key
|
self.api_key = api_key if api_key is not None else config.settings.elasticsearch_api_key
|
||||||
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
self.timeout = timeout if timeout is not None else config.settings.openalex_works_search_timeout_seconds
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,95 @@
|
|||||||
|
/**
|
||||||
|
* 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 { CompanyConnectionsResponse } from '../model/companyConnectionsResponse';
|
||||||
|
// @ts-ignore
|
||||||
|
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class CompanyConnectionsService extends BaseService {
|
||||||
|
|
||||||
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get possible company connections by OpenAlex author ID.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
|
||||||
|
* @param authorId
|
||||||
|
* @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 getCompanyConnectionsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CompanyConnectionsResponse>;
|
||||||
|
public getCompanyConnectionsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CompanyConnectionsResponse>>;
|
||||||
|
public getCompanyConnectionsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||||
|
if (authorId === null || authorId === undefined) {
|
||||||
|
throw new Error('Required parameter authorId was null or undefined when calling getCompanyConnectionsByAuthor.');
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||||
|
'application/json'
|
||||||
|
]);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/company-connections`;
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<CompanyConnectionsResponse>('get', `${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||||
|
reportProgress: reportProgress
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*/
|
||||||
|
/* 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 { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||||
|
import { Configuration } from '../configuration';
|
||||||
|
import { BaseService } from '../api.base.service';
|
||||||
|
|
||||||
|
export interface PatentEntry {
|
||||||
|
patent_id: string;
|
||||||
|
source: string;
|
||||||
|
title: string | null;
|
||||||
|
abstract: string | null;
|
||||||
|
publication_date: string | null;
|
||||||
|
publication_year: string | null;
|
||||||
|
inventors: string[];
|
||||||
|
assignees: string[];
|
||||||
|
ipc: string[];
|
||||||
|
country: string | null;
|
||||||
|
confidence_score: number;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PatentsByAuthorResponse {
|
||||||
|
author_id: string;
|
||||||
|
author_name: string | null;
|
||||||
|
patent_count: number;
|
||||||
|
patents: PatentEntry[];
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetPatentsByAuthorOptions = {
|
||||||
|
httpHeaderAccept?: 'application/json';
|
||||||
|
context?: HttpContext;
|
||||||
|
transferCache?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class PatentsService extends BaseService {
|
||||||
|
constructor(
|
||||||
|
protected httpClient: HttpClient,
|
||||||
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
||||||
|
@Optional() configuration?: Configuration,
|
||||||
|
) {
|
||||||
|
super(basePath, configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get patents by author.
|
||||||
|
* @endpoint get /api/inse-service/authors/{author_id}/patents
|
||||||
|
* @param authorId
|
||||||
|
* @param observe
|
||||||
|
* @param reportProgress
|
||||||
|
*/
|
||||||
|
public getPatentsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'body',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: GetPatentsByAuthorOptions,
|
||||||
|
): Observable<PatentsByAuthorResponse>;
|
||||||
|
public getPatentsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'response',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: GetPatentsByAuthorOptions,
|
||||||
|
): Observable<HttpResponse<PatentsByAuthorResponse>>;
|
||||||
|
public getPatentsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe?: 'events',
|
||||||
|
reportProgress?: boolean,
|
||||||
|
options?: GetPatentsByAuthorOptions,
|
||||||
|
): Observable<HttpEvent<PatentsByAuthorResponse>>;
|
||||||
|
public getPatentsByAuthor(
|
||||||
|
authorId: string,
|
||||||
|
observe: any = 'body',
|
||||||
|
reportProgress: boolean = false,
|
||||||
|
options?: GetPatentsByAuthorOptions,
|
||||||
|
): Observable<any> {
|
||||||
|
if (authorId === null || authorId === undefined) {
|
||||||
|
throw new Error(
|
||||||
|
'Required parameter authorId was null or undefined when calling getPatentsByAuthor.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarHeaders = this.defaultHeaders;
|
||||||
|
|
||||||
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
||||||
|
options?.httpHeaderAccept ??
|
||||||
|
this.configuration.selectHeaderAccept(['application/json']);
|
||||||
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||||
|
localVarHeaders = localVarHeaders.set(
|
||||||
|
'Accept',
|
||||||
|
localVarHttpHeaderAcceptSelected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localVarHttpContext: HttpContext =
|
||||||
|
options?.context ?? new HttpContext();
|
||||||
|
|
||||||
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||||
|
|
||||||
|
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||||
|
if (localVarHttpHeaderAcceptSelected) {
|
||||||
|
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||||
|
responseType_ = 'text';
|
||||||
|
} else if (
|
||||||
|
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
|
||||||
|
) {
|
||||||
|
responseType_ = 'json';
|
||||||
|
} else {
|
||||||
|
responseType_ = 'blob';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({
|
||||||
|
name: 'authorId',
|
||||||
|
value: authorId,
|
||||||
|
in: 'path',
|
||||||
|
style: 'simple',
|
||||||
|
explode: false,
|
||||||
|
dataType: 'string',
|
||||||
|
dataFormat: undefined,
|
||||||
|
})}/patents`;
|
||||||
|
|
||||||
|
const { basePath, withCredentials } = this.configuration;
|
||||||
|
return this.httpClient.request<PatentsByAuthorResponse>(
|
||||||
|
'get',
|
||||||
|
`${basePath}${localVarPath}`,
|
||||||
|
{
|
||||||
|
context: localVarHttpContext,
|
||||||
|
responseType: <any>responseType_,
|
||||||
|
...(withCredentials ? { withCredentials } : {}),
|
||||||
|
headers: localVarHeaders,
|
||||||
|
observe: observe,
|
||||||
|
...(localVarTransferCache !== undefined
|
||||||
|
? { transferCache: localVarTransferCache }
|
||||||
|
: {}),
|
||||||
|
reportProgress: reportProgress,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export interface BodyCreateUser {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
email: string;
|
||||||
|
institution: string;
|
||||||
|
superadmin?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean summary model for a Bund (federal) project, consolidating all fields into semantic English names with proper native types.
|
||||||
|
*/
|
||||||
|
export interface BundProjectDetails {
|
||||||
|
/**
|
||||||
|
* The ID of the Bund project
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
funding_reference?: string | null;
|
||||||
|
title?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
joint_project?: string | null;
|
||||||
|
funding_type?: string | null;
|
||||||
|
funding_profile?: string | null;
|
||||||
|
funding_amount?: number | null;
|
||||||
|
funding_start_date?: string | null;
|
||||||
|
funding_end_date?: string | null;
|
||||||
|
duration?: string | null;
|
||||||
|
performance_plan_code?: string | null;
|
||||||
|
performance_plan_fullname?: string | null;
|
||||||
|
executing_agency?: string | null;
|
||||||
|
funding_recipient?: string | null;
|
||||||
|
project_agency?: string | null;
|
||||||
|
project_agency_fullname?: string | null;
|
||||||
|
department?: string | null;
|
||||||
|
department_fullname?: string | null;
|
||||||
|
division?: string | null;
|
||||||
|
location?: string | null;
|
||||||
|
municipality?: string | null;
|
||||||
|
state?: string | null;
|
||||||
|
country?: string | null;
|
||||||
|
municipality_code?: string | null;
|
||||||
|
publication_date?: string | null;
|
||||||
|
is_new?: boolean | null;
|
||||||
|
record_date?: string | null;
|
||||||
|
unix_timestamp?: number | null;
|
||||||
|
/**
|
||||||
|
* All persons associated with the Bund project (from nested Arb object)
|
||||||
|
*/
|
||||||
|
associated_persons?: Array<string>;
|
||||||
|
/**
|
||||||
|
* All institutions associated with the Bund project
|
||||||
|
*/
|
||||||
|
institutions?: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export interface CareerMetrics {
|
||||||
|
first_publication_year?: number | null;
|
||||||
|
last_publication_year?: number | null;
|
||||||
|
career_age?: number | null;
|
||||||
|
career_span?: number | null;
|
||||||
|
career_stage?: string | null;
|
||||||
|
/**
|
||||||
|
* Number of distinct years with at least one publication.
|
||||||
|
*/
|
||||||
|
active_years?: number;
|
||||||
|
/**
|
||||||
|
* Number of publications used for career metrics.
|
||||||
|
*/
|
||||||
|
publication_count?: number;
|
||||||
|
publications_per_active_year?: number | null;
|
||||||
|
publications_per_career_year?: number | null;
|
||||||
|
years_since_last_publication?: number | null;
|
||||||
|
/**
|
||||||
|
* True if publication years look suspicious.
|
||||||
|
*/
|
||||||
|
has_suspicious_publication_years?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* 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 { MatchedOfficer } from './matchedOfficer';
|
||||||
|
|
||||||
|
|
||||||
|
export interface CompanyConnection {
|
||||||
|
company_number?: string | null;
|
||||||
|
company_name?: string | null;
|
||||||
|
company_status?: string | null;
|
||||||
|
register_art?: string | null;
|
||||||
|
register_nummer?: string | null;
|
||||||
|
native_company_number?: string | null;
|
||||||
|
registrar?: string | null;
|
||||||
|
registered_office?: string | null;
|
||||||
|
registered_address?: string | null;
|
||||||
|
retrieved_at?: string | null;
|
||||||
|
matched_officers?: Array<MatchedOfficer>;
|
||||||
|
officers?: Array<MatchedOfficer>;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { CompanyConnection } from './companyConnection';
|
||||||
|
|
||||||
|
|
||||||
|
export interface CompanyConnectionsResponse {
|
||||||
|
author_id: string;
|
||||||
|
display_name?: string | null;
|
||||||
|
is_ude_author: boolean;
|
||||||
|
institution_scope?: string | null;
|
||||||
|
matching_institutions?: Array<string>;
|
||||||
|
matching_method?: string | null;
|
||||||
|
company_count: number;
|
||||||
|
has_more_results: boolean;
|
||||||
|
common_name_warning: boolean;
|
||||||
|
connections?: Array<CompanyConnection>;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* 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 { Keywords } from './keywords';
|
||||||
|
import { Topics } from './topics';
|
||||||
|
|
||||||
|
|
||||||
|
export interface CordisEuProject {
|
||||||
|
/**
|
||||||
|
* Unique identifier for the project, typically the CORDIS ID
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
rcn?: string | null;
|
||||||
|
acronym?: string | null;
|
||||||
|
title?: string | null;
|
||||||
|
objective?: string | null;
|
||||||
|
frameworkProgramme?: string | null;
|
||||||
|
fundingScheme?: string | null;
|
||||||
|
legalBasis?: string | null;
|
||||||
|
masterCall?: string | null;
|
||||||
|
subCall?: string | null;
|
||||||
|
topics?: Topics | null;
|
||||||
|
nature?: string | null;
|
||||||
|
status?: string | null;
|
||||||
|
ecMaxContribution?: number | null;
|
||||||
|
totalCost?: number | null;
|
||||||
|
startDate?: string | null;
|
||||||
|
endDate?: string | null;
|
||||||
|
ecSignatureDate?: string | null;
|
||||||
|
contentUpdateDate?: string | null;
|
||||||
|
grantDoi?: string | null;
|
||||||
|
humanValidated?: boolean | null;
|
||||||
|
keywords?: Keywords | null;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { CordisEuProject } from './cordisEuProject';
|
||||||
|
|
||||||
|
|
||||||
|
export interface CordisEuProjectPage {
|
||||||
|
/**
|
||||||
|
* The current page number.
|
||||||
|
*/
|
||||||
|
page?: number;
|
||||||
|
/**
|
||||||
|
* The requested page size.
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
|
/**
|
||||||
|
* The total number of items.
|
||||||
|
*/
|
||||||
|
total?: number;
|
||||||
|
/**
|
||||||
|
* The CORDIS EU projects on this page.
|
||||||
|
*/
|
||||||
|
elements?: Array<CordisEuProject>;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clean summary model for a DFG project, consolidating all person roles and institution references into unified lists.
|
||||||
|
*/
|
||||||
|
export interface DfgProjectDetails {
|
||||||
|
/**
|
||||||
|
* The ID of the DFG project
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
link?: string | null;
|
||||||
|
title?: string | null;
|
||||||
|
description?: string | null;
|
||||||
|
project_identifier?: string | null;
|
||||||
|
funding_start_date?: string | null;
|
||||||
|
funding_end_date?: string | null;
|
||||||
|
dfg_procedure?: string | null;
|
||||||
|
subject_area?: string | null;
|
||||||
|
funding_type?: string | null;
|
||||||
|
international_reference?: string | null;
|
||||||
|
website?: string | null;
|
||||||
|
/**
|
||||||
|
* All persons associated with the DFG project (any role)
|
||||||
|
*/
|
||||||
|
associated_persons?: Array<string>;
|
||||||
|
/**
|
||||||
|
* All institutions associated with the DFG project
|
||||||
|
*/
|
||||||
|
institutions?: Array<string>;
|
||||||
|
subproject_of?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* 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 { ProjectType } from './projectType';
|
||||||
|
|
||||||
|
|
||||||
|
export interface FundingProject {
|
||||||
|
/**
|
||||||
|
* The type of the project.
|
||||||
|
*/
|
||||||
|
type: ProjectType;
|
||||||
|
/**
|
||||||
|
* The unique identifier of the project.
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
title?: string | null;
|
||||||
|
start_date?: string | null;
|
||||||
|
end_date?: string | null;
|
||||||
|
funding_amount?: number | null;
|
||||||
|
}
|
||||||
|
export namespace FundingProject {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { FundingProject } from './fundingProject';
|
||||||
|
|
||||||
|
|
||||||
|
export interface FundingProjectPage {
|
||||||
|
/**
|
||||||
|
* The current page number.
|
||||||
|
*/
|
||||||
|
page?: number;
|
||||||
|
/**
|
||||||
|
* The requested page size.
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
|
/**
|
||||||
|
* The total number of items.
|
||||||
|
*/
|
||||||
|
total?: number;
|
||||||
|
/**
|
||||||
|
* The funding projects on this page.
|
||||||
|
*/
|
||||||
|
elements?: Array<FundingProject>;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* 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 { ProjectType } from './projectType';
|
||||||
|
|
||||||
|
|
||||||
|
export interface InstitutionFunderSummary {
|
||||||
|
/**
|
||||||
|
* The type of funding data (e.g., \'bund\', \'eu\', \'dfg\').
|
||||||
|
*/
|
||||||
|
type: ProjectType;
|
||||||
|
/**
|
||||||
|
* A dictionary mapping years to total funding amounts for that year.
|
||||||
|
*/
|
||||||
|
funding_per_year?: object;
|
||||||
|
/**
|
||||||
|
* The average annual funding over the continuous period covered by the data.
|
||||||
|
*/
|
||||||
|
annual_average_over_period?: number;
|
||||||
|
}
|
||||||
|
export namespace InstitutionFunderSummary {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
import { Institution } from './institution';
|
||||||
|
|
||||||
|
|
||||||
|
export interface InstitutionPage {
|
||||||
|
/**
|
||||||
|
* List of institutions in the current page.
|
||||||
|
*/
|
||||||
|
elements?: Array<Institution>;
|
||||||
|
/**
|
||||||
|
* Current page number. (0-indexed)
|
||||||
|
*/
|
||||||
|
page?: number;
|
||||||
|
/**
|
||||||
|
* Number of institutions per page.
|
||||||
|
*/
|
||||||
|
size?: number;
|
||||||
|
/**
|
||||||
|
* Total number of institutions matching the search criteria.
|
||||||
|
*/
|
||||||
|
total?: number;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keywords associated with the project
|
||||||
|
*/
|
||||||
|
export interface Keywords {
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* 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 MatchedOfficer {
|
||||||
|
name?: string | null;
|
||||||
|
firstname?: string | null;
|
||||||
|
lastname?: string | null;
|
||||||
|
city?: string | null;
|
||||||
|
position?: string | null;
|
||||||
|
start_date?: string | null;
|
||||||
|
type?: string | null;
|
||||||
|
flag?: string | null;
|
||||||
|
is_matched_person?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* 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 const ProjectType = {
|
||||||
|
Bund: 'bund',
|
||||||
|
Eu: 'eu',
|
||||||
|
Dfg: 'dfg'
|
||||||
|
} as const;
|
||||||
|
export type ProjectType = typeof ProjectType[keyof typeof ProjectType];
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* 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 { SortDirection } from './sortDirection';
|
||||||
|
import { ProjectsSortBy } from './projectsSortBy';
|
||||||
|
import { ProjectType } from './projectType';
|
||||||
|
|
||||||
|
|
||||||
|
export interface ProjectsFilteringProperties {
|
||||||
|
/**
|
||||||
|
* The type of projects to filter by.
|
||||||
|
*/
|
||||||
|
project_type: ProjectType;
|
||||||
|
/**
|
||||||
|
* The page number for pagination.
|
||||||
|
*/
|
||||||
|
page: number;
|
||||||
|
/**
|
||||||
|
* The page size for pagination.
|
||||||
|
*/
|
||||||
|
size: number;
|
||||||
|
raw_oa_institution_id?: string | null;
|
||||||
|
query?: string | null;
|
||||||
|
/**
|
||||||
|
* The field to sort by.
|
||||||
|
*/
|
||||||
|
sort_by?: ProjectsSortBy;
|
||||||
|
/**
|
||||||
|
* The sort direction (asc or desc).
|
||||||
|
*/
|
||||||
|
sort_direction?: SortDirection;
|
||||||
|
}
|
||||||
|
export namespace ProjectsFilteringProperties {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export const ProjectsSortBy = {
|
||||||
|
Title: 'title',
|
||||||
|
FundingStart: 'funding_start',
|
||||||
|
FundingEnd: 'funding_end',
|
||||||
|
FundingAmount: 'funding_amount'
|
||||||
|
} as const;
|
||||||
|
export type ProjectsSortBy = typeof ProjectsSortBy[keyof typeof ProjectsSortBy];
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/**
|
||||||
|
* 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 { UniversityRanking } from './universityRanking';
|
||||||
|
import { UniversityTopicData } from './universityTopicData';
|
||||||
|
|
||||||
|
|
||||||
|
export interface RankingResponse {
|
||||||
|
timeseries: Array<UniversityTopicData>;
|
||||||
|
rankings: Array<UniversityRanking>;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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 const SortDirection = {
|
||||||
|
Asc: 'asc',
|
||||||
|
Desc: 'desc'
|
||||||
|
} as const;
|
||||||
|
export type SortDirection = typeof SortDirection[keyof typeof SortDirection];
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
export interface Topics {
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* 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 UniversityRanking {
|
||||||
|
rank: number;
|
||||||
|
university: string;
|
||||||
|
publications: number;
|
||||||
|
citations: number;
|
||||||
|
growth_rate: number;
|
||||||
|
trend: UniversityRanking.TrendEnum;
|
||||||
|
is_top_mover: boolean;
|
||||||
|
}
|
||||||
|
export namespace UniversityRanking {
|
||||||
|
export const TrendEnum = {
|
||||||
|
Up: 'up',
|
||||||
|
Down: 'down',
|
||||||
|
Stable: 'stable'
|
||||||
|
} as const;
|
||||||
|
export type TrendEnum = typeof TrendEnum[keyof typeof TrendEnum];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* 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 { YearlyData } from './yearlyData';
|
||||||
|
|
||||||
|
|
||||||
|
export interface UniversityTopicData {
|
||||||
|
university: string;
|
||||||
|
topic: UniversityTopicData.TopicEnum;
|
||||||
|
yearly_data: Array<YearlyData>;
|
||||||
|
}
|
||||||
|
export namespace UniversityTopicData {
|
||||||
|
export const TopicEnum = {
|
||||||
|
ArtificialIntelligence: 'Artificial Intelligence',
|
||||||
|
QuantumComputing: 'Quantum Computing',
|
||||||
|
RenewableEnergy: 'Renewable Energy',
|
||||||
|
Biotechnology: 'Biotechnology'
|
||||||
|
} as const;
|
||||||
|
export type TopicEnum = typeof TopicEnum[keyof typeof TopicEnum];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Innovation Search Engine API
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An entry in the user configuration file.
|
||||||
|
*/
|
||||||
|
export interface User {
|
||||||
|
/**
|
||||||
|
* The username of the user.
|
||||||
|
*/
|
||||||
|
username: string;
|
||||||
|
/**
|
||||||
|
* The password of the user.
|
||||||
|
*/
|
||||||
|
password: string;
|
||||||
|
/**
|
||||||
|
* The email of the user.
|
||||||
|
*/
|
||||||
|
email: string;
|
||||||
|
/**
|
||||||
|
* The account id of the user.
|
||||||
|
*/
|
||||||
|
account: number;
|
||||||
|
/**
|
||||||
|
* The organization id of the user.
|
||||||
|
*/
|
||||||
|
organization: number;
|
||||||
|
/**
|
||||||
|
* The organization name of the user.
|
||||||
|
*/
|
||||||
|
organization_name: string;
|
||||||
|
/**
|
||||||
|
* Indicates whether the user is a superadmin.
|
||||||
|
*/
|
||||||
|
superadmin?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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 YearlyData {
|
||||||
|
year: number;
|
||||||
|
publications: number;
|
||||||
|
citations: number;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
<div class="container">
|
||||||
|
<form class="form" [formGroup]="registerForm">
|
||||||
|
<h3>Konto erstellen</h3>
|
||||||
|
<p class="field">Bitte gib Deine Daten ein, um Dich zu registrieren.</p>
|
||||||
|
|
||||||
|
<mat-form-field class="field">
|
||||||
|
<mat-label>Benutzername</mat-label>
|
||||||
|
<input matInput formControlName="username" />
|
||||||
|
@if (registerForm.controls['username'].hasError('required')) {
|
||||||
|
<mat-error>Fehler: <b>Benutzername</b> erforderlich.</mat-error>
|
||||||
|
} @else if (registerForm.controls['username'].hasError('minlength')) {
|
||||||
|
<mat-error>Fehler: <b>Benutzername</b> ist unvollständig.</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="field">
|
||||||
|
<mat-label>E-Mail</mat-label>
|
||||||
|
<input matInput type="email" formControlName="email" />
|
||||||
|
@if (registerForm.controls['email'].hasError('required')) {
|
||||||
|
<mat-error>Fehler: <b>E-Mail</b> erforderlich.</mat-error>
|
||||||
|
} @else if (registerForm.controls['email'].hasError('email')) {
|
||||||
|
<mat-error>Fehler: Ungültige <b>E-Mail</b> Adresse.</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="field">
|
||||||
|
<mat-label>Passwort</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[type]="showPassword ? 'text' : 'password'"
|
||||||
|
formControlName="password" />
|
||||||
|
@if (showPassword) {
|
||||||
|
<mat-icon matSuffix (click)="showPassword = false">visibility</mat-icon>
|
||||||
|
} @else {
|
||||||
|
<mat-icon matSuffix (click)="showPassword = true"
|
||||||
|
>visibility_off</mat-icon
|
||||||
|
>
|
||||||
|
}
|
||||||
|
@if (registerForm.controls['password'].hasError('required')) {
|
||||||
|
<mat-error>Fehler: <b>Passwort</b> erforderlich.</mat-error>
|
||||||
|
} @else if (registerForm.controls['password'].hasError('minlength')) {
|
||||||
|
<mat-error>Fehler: <b>Passwort</b> ist unvollständig.</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="field">
|
||||||
|
<mat-label>Institution</mat-label>
|
||||||
|
|
||||||
|
<mat-icon matPrefix>apartment</mat-icon>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
matInput
|
||||||
|
formControlName="institution"
|
||||||
|
[matAutocomplete]="auto"
|
||||||
|
placeholder="Institution suchen..." />
|
||||||
|
@if (registerForm.controls['institution'].hasError('required')) {
|
||||||
|
<mat-error>Fehler: <b>Institution</b> erforderlich.</mat-error>
|
||||||
|
}
|
||||||
|
<mat-autocomplete
|
||||||
|
#auto="matAutocomplete"
|
||||||
|
(optionSelected)="onInstitutionSelected($event)">
|
||||||
|
@for (institution of institutionOptions(); track institution.id) {
|
||||||
|
<mat-option
|
||||||
|
[value]="institution.display_name"
|
||||||
|
style="font-size: 16px">
|
||||||
|
<div>
|
||||||
|
<span>{{ institution.display_name }}</span>
|
||||||
|
</div>
|
||||||
|
@if (institution.hint) {
|
||||||
|
<small>{{ institution.hint }}</small>
|
||||||
|
}
|
||||||
|
</mat-option>
|
||||||
|
}
|
||||||
|
</mat-autocomplete>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div class="field checkbox-container">
|
||||||
|
<mat-checkbox formControlName="superadmin"
|
||||||
|
>Superadmin Rechte</mat-checkbox
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
mat-raised-button
|
||||||
|
class="button"
|
||||||
|
(click)="submit()"
|
||||||
|
[disabled]="
|
||||||
|
!registerForm.valid || (credentialService.validating | async)
|
||||||
|
">
|
||||||
|
Registrieren
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="field" style="text-align: center; margin-top: -10px">
|
||||||
|
<button mat-button type="button" routerLink="/login">
|
||||||
|
Bereits ein Konto? <b>Anmelden</b>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<p class="progress">
|
||||||
|
<!-- Statusanzeige analog zum Login-Formular -->
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: linear-gradient(160deg, #f4f6fb, #e8ecf7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
background: #fff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow:
|
||||||
|
0 2px 12px #1a3a6e1a,
|
||||||
|
0 1px 4px #0000000f;
|
||||||
|
gap: 20px;
|
||||||
|
padding: 36px 32px 28px;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 4px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1a3a6e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
min-height: 48px;
|
||||||
|
min-width: 140px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress {
|
||||||
|
padding-top: 5px;
|
||||||
|
width: 300px;
|
||||||
|
height: 2em;
|
||||||
|
text-align: center;
|
||||||
|
font-size: small;
|
||||||
|
color: #585f71;
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
import {
|
||||||
|
Component,
|
||||||
|
inject,
|
||||||
|
OnDestroy,
|
||||||
|
signal,
|
||||||
|
DestroyRef,
|
||||||
|
OnInit,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
import { Router, RouterLink } from '@angular/router';
|
||||||
|
import {
|
||||||
|
FormBuilder,
|
||||||
|
FormGroup,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
Validators,
|
||||||
|
} from '@angular/forms';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
|
import { CredentialService } from '../../shared/services/credential.service';
|
||||||
|
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||||
|
import {
|
||||||
|
Subscription,
|
||||||
|
map,
|
||||||
|
switchMap,
|
||||||
|
debounceTime,
|
||||||
|
distinctUntilChanged,
|
||||||
|
catchError,
|
||||||
|
of,
|
||||||
|
} from 'rxjs';
|
||||||
|
import {
|
||||||
|
MatAutocompleteModule,
|
||||||
|
MatAutocompleteSelectedEvent,
|
||||||
|
} from '@angular/material/autocomplete';
|
||||||
|
import { InstitutionsService } from '../../api';
|
||||||
|
@Component({
|
||||||
|
selector: 'app-register',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatCheckboxModule,
|
||||||
|
RouterLink,
|
||||||
|
MatSnackBarModule,
|
||||||
|
MatAutocompleteModule,
|
||||||
|
],
|
||||||
|
templateUrl: './app-register.component.html',
|
||||||
|
styleUrl: './app-register.component.scss',
|
||||||
|
})
|
||||||
|
export class AppRegisterComponent implements OnDestroy, OnInit {
|
||||||
|
private readonly fb = inject(FormBuilder);
|
||||||
|
protected readonly credentialService = inject(CredentialService);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly snackBar = inject(MatSnackBar);
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
private subscription?: Subscription;
|
||||||
|
private institutionsService = inject(InstitutionsService);
|
||||||
|
registerForm: FormGroup = this.fb.group({
|
||||||
|
username: ['', [Validators.required, Validators.minLength(4)]],
|
||||||
|
email: ['', [Validators.required, Validators.email]],
|
||||||
|
password: ['', [Validators.required, Validators.minLength(8)]],
|
||||||
|
institution: ['', [Validators.required]],
|
||||||
|
superadmin: [false],
|
||||||
|
});
|
||||||
|
readonly institutionOptions = signal<any[]>([]);
|
||||||
|
showPassword = false;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.setupInstitutionAutocomplete();
|
||||||
|
}
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.subscription = this.credentialService.validating.subscribe(
|
||||||
|
(validating) => {
|
||||||
|
if (validating) {
|
||||||
|
this.registerForm.disable();
|
||||||
|
} else {
|
||||||
|
this.registerForm.enable();
|
||||||
|
this.checkEnter();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (!this.credentialService.validating) {
|
||||||
|
this.checkEnter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.subscription?.unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnter(): void {
|
||||||
|
if (this.credentialService.authenticated.value) {
|
||||||
|
this.router.navigate(['/dashboard']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
submit() {
|
||||||
|
if (this.registerForm.valid) {
|
||||||
|
this.credentialService.validating.next(true);
|
||||||
|
this.registerForm.disable();
|
||||||
|
|
||||||
|
this.subscription = this.credentialService
|
||||||
|
.registerAccount(this.registerForm.value)
|
||||||
|
.subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.credentialService.validating.next(false);
|
||||||
|
this.snackBar.open(
|
||||||
|
'Konto erfolgreich erstellt! Du kannst Dich jetzt anmelden.',
|
||||||
|
'OK',
|
||||||
|
{ duration: 5000 },
|
||||||
|
);
|
||||||
|
this.router.navigate(['/login']);
|
||||||
|
},
|
||||||
|
error: (err) => {
|
||||||
|
this.credentialService.validating.next(false);
|
||||||
|
this.registerForm.enable();
|
||||||
|
const message =
|
||||||
|
err.error?.message ||
|
||||||
|
'Fehler bei der Registrierung. Bitte versuche es später erneut.';
|
||||||
|
this.snackBar.open(message, 'Schließen', {
|
||||||
|
panelClass: ['error-snackbar'],
|
||||||
|
duration: 5000,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private setupInstitutionAutocomplete(): void {
|
||||||
|
this.registerForm.controls['institution'].valueChanges
|
||||||
|
.pipe(
|
||||||
|
debounceTime(250),
|
||||||
|
map((value) => (typeof value === 'string' ? value.trim() : '')),
|
||||||
|
distinctUntilChanged(),
|
||||||
|
switchMap((query) => {
|
||||||
|
if (query.length < 2) {
|
||||||
|
this.institutionOptions.set([]);
|
||||||
|
return of([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.searchInstitutions(query).pipe(
|
||||||
|
catchError((ev) => {
|
||||||
|
console.log(ev);
|
||||||
|
return of([]);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
takeUntilDestroyed(this.destroyRef),
|
||||||
|
)
|
||||||
|
.subscribe((options) => {
|
||||||
|
this.institutionOptions.set(options);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private searchInstitutions(query: string) {
|
||||||
|
return this.institutionsService
|
||||||
|
.autocompleteInstitutions(query, undefined, undefined, 10)
|
||||||
|
.pipe(map((response) => response.results ?? []));
|
||||||
|
}
|
||||||
|
|
||||||
|
onInstitutionSelected(event: MatAutocompleteSelectedEvent): void {
|
||||||
|
const val = event.option.value;
|
||||||
|
this.registerForm.controls['institution'].setValue(val, {
|
||||||
|
emitEvent: false,
|
||||||
|
});
|
||||||
|
this.institutionOptions.set([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
<div echarts [options]="options"></div>
|
||||||
+153
@@ -0,0 +1,153 @@
|
|||||||
|
import { Component, effect, input } from '@angular/core';
|
||||||
|
|
||||||
|
import * as echarts from 'echarts/core';
|
||||||
|
import { EChartsOption } from 'echarts';
|
||||||
|
|
||||||
|
import { GridComponent, LegendComponent } from 'echarts/components';
|
||||||
|
import { CanvasRenderer } from 'echarts/renderers';
|
||||||
|
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||||
|
import { InstitutionFunderSummary } from '../../api';
|
||||||
|
|
||||||
|
echarts.use([GridComponent, CanvasRenderer, LegendComponent]);
|
||||||
|
|
||||||
|
type FunderData = {
|
||||||
|
funderName: string;
|
||||||
|
fundingMap: Record<number, number>;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-institution-projects-funding-graph',
|
||||||
|
imports: [NgxEchartsDirective],
|
||||||
|
templateUrl: './institution-projects-funding-graph.component.html',
|
||||||
|
styleUrl: './institution-projects-funding-graph.component.scss',
|
||||||
|
})
|
||||||
|
export class InstitutionProjectsFundingGraphComponent {
|
||||||
|
options!: EChartsOption;
|
||||||
|
|
||||||
|
fundings = input.required<InstitutionFunderSummary[]>();
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
effect(() => {
|
||||||
|
const fundings = this.fundings();
|
||||||
|
this.generateChartOptions(fundings);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
generateChartOptions(fundings: InstitutionFunderSummary[]): void {
|
||||||
|
const floorToTwoDecimals = (value: number): string => {
|
||||||
|
const floored = Math.floor(value * 100) / 100;
|
||||||
|
return floored.toLocaleString(undefined, {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'EUR',
|
||||||
|
minimumFractionDigits: 2,
|
||||||
|
maximumFractionDigits: 2,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const yearsSet = new Set<string>();
|
||||||
|
|
||||||
|
fundings.forEach((series) => {
|
||||||
|
if (series.funding_per_year) {
|
||||||
|
Object.keys(series.funding_per_year).forEach((year) =>
|
||||||
|
yearsSet.add(year),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const xAxisYears = Array.from(yearsSet).sort(
|
||||||
|
(a, b) => Number(a) - Number(b),
|
||||||
|
);
|
||||||
|
|
||||||
|
const currentYearStr = new Date().getFullYear().toString();
|
||||||
|
|
||||||
|
const chartSeries = fundings.map((series, index) => {
|
||||||
|
const fundingMap = (series.funding_per_year || {}) as Record<
|
||||||
|
string,
|
||||||
|
number
|
||||||
|
>;
|
||||||
|
const dataPoints = xAxisYears.map((year) => fundingMap[year] ?? 0);
|
||||||
|
|
||||||
|
const baseSeries: any = {
|
||||||
|
name: series.type.toUpperCase(),
|
||||||
|
type: 'line',
|
||||||
|
stack: 'TotalInstitutionalFunding',
|
||||||
|
areaStyle: {},
|
||||||
|
emphasis: { focus: 'series' },
|
||||||
|
data: dataPoints,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (index === 0) {
|
||||||
|
baseSeries.markLine = {
|
||||||
|
symbol: ['none', 'none'],
|
||||||
|
silent: true,
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'end',
|
||||||
|
formatter: 'Aktuelles Jahr',
|
||||||
|
backgroundColor: '#333',
|
||||||
|
color: '#fff',
|
||||||
|
padding: [4, 6],
|
||||||
|
borderRadius: 4,
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
color: '#ff4d4f',
|
||||||
|
type: 'dashed',
|
||||||
|
width: 2,
|
||||||
|
},
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
xAxis: currentYearStr,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseSeries;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.options = {
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'cross',
|
||||||
|
label: { backgroundColor: '#6a7985' },
|
||||||
|
},
|
||||||
|
valueFormatter: (value) => {
|
||||||
|
const numericValue = Array.isArray(value) ? 0 : Number(value ?? 0);
|
||||||
|
return floorToTwoDecimals(numericValue);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: fundings.map((series) => series.type.toUpperCase()),
|
||||||
|
top: '10%',
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '4%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '5%',
|
||||||
|
containLabel: true,
|
||||||
|
},
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: 'category',
|
||||||
|
boundaryGap: false,
|
||||||
|
data: xAxisYears,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value',
|
||||||
|
axisLabel: {
|
||||||
|
formatter: (value: number) =>
|
||||||
|
value.toLocaleString(undefined, {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'EUR',
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
series: chartSeries,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
<p>institution-publications works!</p>
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-institution-publications',
|
||||||
|
imports: [],
|
||||||
|
templateUrl: './institution-publications.component.html',
|
||||||
|
styleUrl: './institution-publications.component.scss',
|
||||||
|
})
|
||||||
|
export class InstitutionPublicationsComponent {}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
<div class="content">
|
||||||
|
<h1>Passende Institutionen finden</h1>
|
||||||
|
|
||||||
|
<mat-divider />
|
||||||
|
|
||||||
|
<div class="search-and-sorting">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<mat-label>Suche nach Namen</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
type="search"
|
||||||
|
[debounceTime]="300"
|
||||||
|
[(debouncedValue)]="urlSearchTerm"
|
||||||
|
(debouncedValueChange)="handleSearchTermChange($event)" />
|
||||||
|
<mat-icon matPrefix>search</mat-icon>
|
||||||
|
<button matIconButton matSuffix (click)="clearSearchTerm()">
|
||||||
|
<mat-icon>clear</mat-icon>
|
||||||
|
</button>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div class="sorting">
|
||||||
|
<select (change)="handleSortFieldChange($event)" [value]="urlSortBy()">
|
||||||
|
<option value="relevance">Relevanz</option>
|
||||||
|
<option value="name">Name</option>
|
||||||
|
<option value="works_count">Anzahl Publikationen</option>
|
||||||
|
<option value="citations_count">Anzahl Zitationen</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select
|
||||||
|
(change)="handleSortOrderChange($event)"
|
||||||
|
[value]="urlSortingOrder()">
|
||||||
|
<option value="desc">Absteigend</option>
|
||||||
|
<option value="asc">Aufsteigend</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-divider />
|
||||||
|
|
||||||
|
@let institutionPageValue = institutionPage();
|
||||||
|
|
||||||
|
@if (
|
||||||
|
institutionPageValue.elements && institutionPageValue.elements.length > 0
|
||||||
|
) {
|
||||||
|
<div class="cards">
|
||||||
|
@for (institution of institutionPageValue.elements; track $index) {
|
||||||
|
@let institutionId = extractInstitutionId(institution);
|
||||||
|
<mat-card
|
||||||
|
class="card"
|
||||||
|
appearance="outlined"
|
||||||
|
[routerLink]="
|
||||||
|
institution.id
|
||||||
|
? ['/institution', institution.id.split('/').pop() ?? '']
|
||||||
|
: null
|
||||||
|
">
|
||||||
|
<mat-card-header>
|
||||||
|
<mat-card-title>{{ getDisplayName(institution) }}</mat-card-title>
|
||||||
|
<mat-card-subtitle
|
||||||
|
>{{ institution.geo?.city }},
|
||||||
|
{{ institution.geo?.country }}</mat-card-subtitle
|
||||||
|
>
|
||||||
|
</mat-card-header>
|
||||||
|
|
||||||
|
<mat-card-content class="card-content">
|
||||||
|
<mat-divider />
|
||||||
|
<div class="card-metadata">
|
||||||
|
<span>Publikationen: {{ institution.works_count }}</span>
|
||||||
|
<span>Zitationen: {{ institution.cited_by_count }}</span>
|
||||||
|
</div>
|
||||||
|
<mat-divider />
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-footer>
|
||||||
|
<mat-card-actions>
|
||||||
|
<a
|
||||||
|
mat-button
|
||||||
|
[routerLink]="['/institution', institutionId, 'overview']"
|
||||||
|
(click)="$event.stopPropagation()">
|
||||||
|
<mat-icon>info</mat-icon>
|
||||||
|
Übersicht
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
mat-button
|
||||||
|
[routerLink]="['/institution', institutionId, 'publications']"
|
||||||
|
(click)="$event.stopPropagation()">
|
||||||
|
<mat-icon>article</mat-icon>
|
||||||
|
Publikationen
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
mat-button
|
||||||
|
[routerLink]="['/institution', institutionId, 'projects']"
|
||||||
|
(click)="$event.stopPropagation()">
|
||||||
|
<mat-icon>work</mat-icon>
|
||||||
|
Projekte
|
||||||
|
</a>
|
||||||
|
</mat-card-actions>
|
||||||
|
</mat-card-footer>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="no-results">
|
||||||
|
<p>Keine passenden Institutionen gefunden.</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<mat-divider />
|
||||||
|
|
||||||
|
<mat-paginator
|
||||||
|
[length]="institutionPageValue.total"
|
||||||
|
[pageSize]="institutionPageValue.size"
|
||||||
|
[pageSizeOptions]="[10, 20, 50]"
|
||||||
|
[pageIndex]="institutionPageValue.page"
|
||||||
|
(page)="handlePageChange($event)">
|
||||||
|
</mat-paginator>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sorting {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sorting select {
|
||||||
|
padding: 0.75rem;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sorting select:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cards {
|
||||||
|
display: grid;
|
||||||
|
gap: 1.5rem;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.cards {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.cards {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-paginator {
|
||||||
|
background-color: var(--sg-background);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 0.5rem;
|
||||||
|
background-color: var(--sg-background);
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-metadata {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--sg-text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-card-actions {
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-card-actions a {
|
||||||
|
width: 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-results {
|
||||||
|
text-align: center;
|
||||||
|
padding: 2rem;
|
||||||
|
color: var(--sg-text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-and-sorting {
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
import { Component, effect, input, signal } from '@angular/core';
|
||||||
|
import { Institution, InstitutionPage } from '../../api';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { DebounceDirective } from '../../directives/debounce.directive';
|
||||||
|
import { MatPaginator, PageEvent } from '@angular/material/paginator';
|
||||||
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-institutions',
|
||||||
|
imports: [
|
||||||
|
MatButtonModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatIconModule,
|
||||||
|
DebounceDirective,
|
||||||
|
MatPaginator,
|
||||||
|
MatDividerModule,
|
||||||
|
RouterModule,
|
||||||
|
],
|
||||||
|
templateUrl: './institutions.component.html',
|
||||||
|
styleUrl: './institutions.component.scss',
|
||||||
|
})
|
||||||
|
export class InstitutionsComponent {
|
||||||
|
institutionPage = input.required<InstitutionPage>();
|
||||||
|
|
||||||
|
urlSearchTerm = signal<string>('');
|
||||||
|
urlSortBy = signal<string>('relevance');
|
||||||
|
urlSortingOrder = signal<string>('desc');
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly activatedRoute: ActivatedRoute,
|
||||||
|
private readonly router: Router,
|
||||||
|
) {
|
||||||
|
this.activatedRoute.queryParams
|
||||||
|
.pipe(takeUntilDestroyed())
|
||||||
|
.subscribe((params) => {
|
||||||
|
this.urlSearchTerm.set(params['search'] || '');
|
||||||
|
this.urlSortBy.set(params['sort_by'] || 'relevance');
|
||||||
|
this.urlSortingOrder.set(params['sorting_order'] || 'desc');
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
const searchTerm = this.urlSearchTerm();
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { search: searchTerm },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSearchTermChange(newTerm: string): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { search: newTerm },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
clearSearchTerm(): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { search: null },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handlePageChange(event: PageEvent): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { page: event.pageIndex, size: event.pageSize },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
extractInstitutionId(institution: Institution): string {
|
||||||
|
return institution.id?.split('/').pop() ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSortFieldChange(event: Event): void {
|
||||||
|
const selectElement = event.target as HTMLSelectElement;
|
||||||
|
const sortField = selectElement.value;
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { sort_by: sortField },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSortOrderChange(event: Event): void {
|
||||||
|
const selectElement = event.target as HTMLSelectElement;
|
||||||
|
const sortOrder = selectElement.value;
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { sorting_order: sortOrder },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getDisplayName(institution: Institution): string {
|
||||||
|
const primary = institution.display_name?.trim();
|
||||||
|
if (primary && primary.length > 0) return primary;
|
||||||
|
|
||||||
|
const alt = institution.display_name_alternatives?.[0]?.trim();
|
||||||
|
if (alt && alt.length > 0) return alt;
|
||||||
|
|
||||||
|
return 'Unbekannte Institution';
|
||||||
|
}
|
||||||
|
}
|
||||||
+269
@@ -0,0 +1,269 @@
|
|||||||
|
@if (loading) {
|
||||||
|
<div class="state state-loading" aria-live="polite">
|
||||||
|
<mat-spinner diameter="36"></mat-spinner>
|
||||||
|
<span>Verbindungen zu Unternehmen werden geladen ...</span>
|
||||||
|
</div>
|
||||||
|
} @else if (error) {
|
||||||
|
<div class="state state-error">
|
||||||
|
Verbindungen zu Unternehmen konnten nicht geladen werden.
|
||||||
|
</div>
|
||||||
|
} @else if (data && !data.is_ude_author) {
|
||||||
|
<section class="empty-state">
|
||||||
|
<h2>Keine Unternehmenssuche verfügbar</h2>
|
||||||
|
<p>Für diese Person wird aktuell keine Suche nach Unternehmen angezeigt.</p>
|
||||||
|
</section>
|
||||||
|
} @else if (data && connections.length === 0) {
|
||||||
|
<section class="empty-state">
|
||||||
|
<h2>Keine Treffer im Handelsregister</h2>
|
||||||
|
<p>
|
||||||
|
Für diese Person wurden keine passenden Treffer im Handelsregister
|
||||||
|
gefunden.
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
} @else if (data) {
|
||||||
|
<section class="company-connections">
|
||||||
|
<header class="page-header">
|
||||||
|
<h2>Mögliche Verbindungen zu Unternehmen</h2>
|
||||||
|
<p>
|
||||||
|
{{ getResultCountLabel() }} für
|
||||||
|
<strong>{{ data.display_name }}</strong>
|
||||||
|
</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
@if (data.common_name_warning) {
|
||||||
|
<div class="warning-box">
|
||||||
|
Für diesen Namen gibt es mehrere Treffer im Handelsregister. Die
|
||||||
|
Ergebnisse sollten besonders vorsichtig interpretiert werden.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="main-layout">
|
||||||
|
<section class="graph-column">
|
||||||
|
@if (graphOptions) {
|
||||||
|
<mat-card appearance="outlined" class="graph-card">
|
||||||
|
<div class="graph-stage">
|
||||||
|
<button
|
||||||
|
mat-icon-button
|
||||||
|
type="button"
|
||||||
|
class="graph-related-persons-button"
|
||||||
|
#relatedPersonsTooltip="matTooltip"
|
||||||
|
(click)="toggleRelatedPersons(relatedPersonsTooltip)"
|
||||||
|
[matTooltip]="
|
||||||
|
showRelatedPersons
|
||||||
|
? 'Weitere Registerpersonen ausblenden'
|
||||||
|
: 'Weitere Registerpersonen anzeigen'
|
||||||
|
"
|
||||||
|
matTooltipPosition="left"
|
||||||
|
[attr.aria-label]="
|
||||||
|
showRelatedPersons
|
||||||
|
? 'Weitere Registerpersonen ausblenden'
|
||||||
|
: 'Weitere Registerpersonen anzeigen'
|
||||||
|
">
|
||||||
|
<mat-icon class="graph-related-persons-icon">
|
||||||
|
{{ showRelatedPersons ? 'no_accounts' : 'account_circle' }}
|
||||||
|
</mat-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="graph"
|
||||||
|
echarts
|
||||||
|
[options]="graphOptions"
|
||||||
|
[autoResize]="true"
|
||||||
|
(wheel)="onGraphWheel($event)"
|
||||||
|
(chartClick)="onGraphClick($event)"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (roleLegendItems.length > 0) {
|
||||||
|
<div class="role-legend" aria-label="Legende der Rollen">
|
||||||
|
@for (item of roleLegendItems; track item.role) {
|
||||||
|
<span class="role-legend-item">
|
||||||
|
<span
|
||||||
|
class="role-legend-line"
|
||||||
|
[style.background]="item.color"></span>
|
||||||
|
<span class="role-legend-text">{{ item.role }}</span>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (connections.length > 10) {
|
||||||
|
<p class="graph-note">
|
||||||
|
Der Graph zeigt die ersten 10 Unternehmen. Die vollständige
|
||||||
|
Liste ist rechts sichtbar.
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
|
||||||
|
<p class="disclaimer">
|
||||||
|
{{ disclaimer }}
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="list-column">
|
||||||
|
<mat-card appearance="outlined" class="connection-list">
|
||||||
|
<div class="list-header">
|
||||||
|
<span>Unternehmen</span>
|
||||||
|
<span>Rolle</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="list-scroll">
|
||||||
|
@for (connection of connections; track getCompanyKey(connection)) {
|
||||||
|
@let officer = getPrimaryOfficer(connection);
|
||||||
|
@let companyKey = getCompanyKey(connection);
|
||||||
|
@let relatedOfficers = getRelatedOfficers(connection);
|
||||||
|
|
||||||
|
<div class="connection-item">
|
||||||
|
<div
|
||||||
|
#connectionRow
|
||||||
|
class="connection-row"
|
||||||
|
[attr.data-company-key]="companyKey"
|
||||||
|
[class.selected]="companyKey === selectedCompanyKey"
|
||||||
|
[class.removed]="connection.company_status === 'removed'"
|
||||||
|
(click)="selectCompany(connection)">
|
||||||
|
<span
|
||||||
|
class="company-name"
|
||||||
|
[title]="connection.company_name || ''">
|
||||||
|
{{ connection.company_name || 'Unbekanntes Unternehmen' }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="role-value"
|
||||||
|
[style.border-color]="getRoleColor(officer?.position)"
|
||||||
|
[title]="officer?.position || ''">
|
||||||
|
{{ officer?.position || '—' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (companyKey === selectedCompanyKey) {
|
||||||
|
<div
|
||||||
|
class="connection-detail"
|
||||||
|
(click)="$event.stopPropagation()">
|
||||||
|
<div class="detail-grid">
|
||||||
|
<div class="detail-field">
|
||||||
|
<span class="detail-label">Register</span>
|
||||||
|
<span class="detail-value">
|
||||||
|
{{ getCompanyRegisterLabel(connection) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="detail-field">
|
||||||
|
<span class="detail-label">Amtsgericht</span>
|
||||||
|
<span class="detail-value">
|
||||||
|
{{ getRegistrarLabel(connection) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="detail-field detail-field--address">
|
||||||
|
<span class="detail-label">Adresse</span>
|
||||||
|
<span class="detail-value">
|
||||||
|
{{ getCompanyAddressLabel(connection) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="detail-field">
|
||||||
|
<span class="detail-label">Unternehmensstatus</span>
|
||||||
|
<span
|
||||||
|
class="detail-value detail-status"
|
||||||
|
[class.detail-status--active]="
|
||||||
|
connection.company_status === 'currently registered'
|
||||||
|
"
|
||||||
|
[class.detail-status--removed]="
|
||||||
|
connection.company_status === 'removed'
|
||||||
|
">
|
||||||
|
{{ getCompanyStatusLabel(connection.company_status) }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="detail-field detail-field--wide">
|
||||||
|
<span class="detail-label">Gegenstand</span>
|
||||||
|
<span class="detail-value">
|
||||||
|
{{ getGegenstandLabel() }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (relatedOfficers.length > 0) {
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="officers-toggle"
|
||||||
|
(click)="toggleCompanyOfficers(connection, $event)">
|
||||||
|
<span>
|
||||||
|
Weitere Registerpersonen ({{
|
||||||
|
relatedOfficers.length
|
||||||
|
}})
|
||||||
|
</span>
|
||||||
|
<mat-icon>
|
||||||
|
{{
|
||||||
|
isCompanyOfficersExpanded(connection)
|
||||||
|
? 'expand_less'
|
||||||
|
: 'expand_more'
|
||||||
|
}}
|
||||||
|
</mat-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
@if (isCompanyOfficersExpanded(connection)) {
|
||||||
|
<div class="related-officers">
|
||||||
|
@for (
|
||||||
|
relatedOfficer of relatedOfficers;
|
||||||
|
track relatedOfficer.name
|
||||||
|
) {
|
||||||
|
<div class="related-officer">
|
||||||
|
<span
|
||||||
|
class="officer-name"
|
||||||
|
[title]="relatedOfficer.name || ''">
|
||||||
|
{{ relatedOfficer.name }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="officer-role"
|
||||||
|
[style.border-color]="
|
||||||
|
getRoleColor(relatedOfficer.position)
|
||||||
|
"
|
||||||
|
[title]="relatedOfficer.position || ''">
|
||||||
|
{{ relatedOfficer.position || '—' }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
@if (relatedOfficer.name) {
|
||||||
|
<a
|
||||||
|
mat-icon-button
|
||||||
|
color="primary"
|
||||||
|
class="officer-open-link"
|
||||||
|
[routerLink]="['/persons']"
|
||||||
|
[queryParams]="
|
||||||
|
getPersonSearchQueryParams(
|
||||||
|
relatedOfficer.name
|
||||||
|
)
|
||||||
|
"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
[attr.aria-label]="
|
||||||
|
'Suche nach ' +
|
||||||
|
relatedOfficer.name +
|
||||||
|
' öffnen'
|
||||||
|
"
|
||||||
|
[title]="
|
||||||
|
'Suche nach ' +
|
||||||
|
relatedOfficer.name +
|
||||||
|
' öffnen'
|
||||||
|
">
|
||||||
|
<mat-icon>open_in_new</mat-icon>
|
||||||
|
</a>
|
||||||
|
} @else {
|
||||||
|
<span class="officer-open-placeholder"></span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</mat-card>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
}
|
||||||
+505
@@ -0,0 +1,505 @@
|
|||||||
|
$marked-color: #5470c6;
|
||||||
|
$related-person-color: #4f8df5;
|
||||||
|
$timeline-purple: #7255d9;
|
||||||
|
$timeline-purple-bg: #f6f0ff;
|
||||||
|
|
||||||
|
$timeline-orange-bg: #fff7e8;
|
||||||
|
$timeline-orange-border: #ffd796;
|
||||||
|
$timeline-orange-text: #c67500;
|
||||||
|
|
||||||
|
$card-border: #dbe5f6;
|
||||||
|
$text-main: #07163d;
|
||||||
|
$text-muted: #64718f;
|
||||||
|
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-connections {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 20px 28px 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header {
|
||||||
|
h2 {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
color: $text-main;
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.state {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 14px;
|
||||||
|
min-height: 220px;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.state-error {
|
||||||
|
color: #b42318;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
margin: 14px 28px;
|
||||||
|
padding: 18px 22px;
|
||||||
|
border: 1px solid $card-border;
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
margin: 0 0 6px;
|
||||||
|
color: $text-main;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning-box {
|
||||||
|
padding: 12px 14px;
|
||||||
|
border: 1px solid $timeline-orange-border;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: $timeline-orange-bg;
|
||||||
|
color: $timeline-orange-text;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-layout {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||||
|
gap: 18px;
|
||||||
|
height: 680px;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-column,
|
||||||
|
.list-column {
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-card,
|
||||||
|
.connection-list {
|
||||||
|
border-radius: 16px;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-card {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-stage {
|
||||||
|
position: relative;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-related-persons-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
right: 12px;
|
||||||
|
z-index: 2;
|
||||||
|
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
background: transparent;
|
||||||
|
color: $related-person-color;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-related-persons-button:hover {
|
||||||
|
background: rgba(84, 112, 198, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-related-persons-icon {
|
||||||
|
width: 51px;
|
||||||
|
height: 51px;
|
||||||
|
|
||||||
|
font-size: 51px;
|
||||||
|
line-height: 51px;
|
||||||
|
font-variation-settings:
|
||||||
|
'FILL' 1,
|
||||||
|
'wght' 400,
|
||||||
|
'GRAD' 0,
|
||||||
|
'opsz' 48;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 0;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
touch-action: none;
|
||||||
|
user-select: none;
|
||||||
|
cursor: grab;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph:active {
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-legend {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px 18px;
|
||||||
|
padding: 10px 18px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-legend-item {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
min-width: 0;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-legend-line {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
display: inline-block;
|
||||||
|
width: 24px;
|
||||||
|
height: 3px;
|
||||||
|
border-radius: 999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-legend-text {
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 260px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-note {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin: 0;
|
||||||
|
padding: 4px 18px 16px;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.35;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.disclaimer {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin: 14px 0 0;
|
||||||
|
padding: 12px 14px;
|
||||||
|
border-left: 3px solid $timeline-purple;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: $timeline-purple-bg;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-list {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header,
|
||||||
|
.connection-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
|
||||||
|
gap: clamp(10px, 1vw, 18px);
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-bottom: 1px solid $card-border;
|
||||||
|
background: #fbfdff;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header span,
|
||||||
|
.connection-row span {
|
||||||
|
min-width: 0;
|
||||||
|
justify-self: start;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-scroll {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-item {
|
||||||
|
border-bottom: 1px solid #edf2fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-row {
|
||||||
|
padding: 14px 16px;
|
||||||
|
color: $text-main;
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f8fbff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
background: #f0f6ff;
|
||||||
|
box-shadow: inset 3px 0 0 $marked-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.removed {
|
||||||
|
color: $text-muted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-name,
|
||||||
|
.role-value,
|
||||||
|
.detail-value,
|
||||||
|
.officer-name,
|
||||||
|
.officer-role {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-name {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.role-value {
|
||||||
|
width: auto;
|
||||||
|
padding-left: 8px;
|
||||||
|
border-left: 3px solid;
|
||||||
|
color: $text-main;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-detail {
|
||||||
|
padding: 0 16px 16px;
|
||||||
|
background: #f8fbff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
|
gap: 10px 18px;
|
||||||
|
padding: 14px 0 4px;
|
||||||
|
border-top: 1px solid #e5edf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-field {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-field--wide {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-field--address .detail-value,
|
||||||
|
.detail-field--wide .detail-value {
|
||||||
|
overflow: visible;
|
||||||
|
text-overflow: unset;
|
||||||
|
white-space: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-value {
|
||||||
|
color: $text-main;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-value.detail-status {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
background: transparent;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 700;
|
||||||
|
line-height: 1.35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-value.detail-status--active {
|
||||||
|
color: #218354;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-value.detail-status--removed {
|
||||||
|
color: #6b7280;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officers-toggle {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
margin-top: 14px;
|
||||||
|
padding: 12px 0 0;
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid #e5edf8;
|
||||||
|
background: transparent;
|
||||||
|
color: $text-muted;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: left;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officers-toggle mat-icon {
|
||||||
|
color: $text-muted;
|
||||||
|
}
|
||||||
|
|
||||||
|
.related-officers {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
margin: 8px 0 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.related-officer {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) 40px;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
color: $text-main;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officer-name {
|
||||||
|
color: $text-main;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officer-role {
|
||||||
|
padding-left: 10px;
|
||||||
|
border-left: 4px solid #8a95b3;
|
||||||
|
color: $text-main;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officer-open-link {
|
||||||
|
justify-self: center;
|
||||||
|
color: $marked-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officer-open-placeholder {
|
||||||
|
display: block;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 1450px) {
|
||||||
|
.main-layout {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-card {
|
||||||
|
height: 520px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-list {
|
||||||
|
height: 520px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 760px) {
|
||||||
|
.company-connections {
|
||||||
|
padding: 18px 16px 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
margin: 14px 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-card {
|
||||||
|
height: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-header {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-row {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.related-officer {
|
||||||
|
grid-template-columns: minmax(0, 1fr) 40px;
|
||||||
|
gap: 6px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officer-role {
|
||||||
|
grid-column: 1 / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.officer-open-link,
|
||||||
|
.officer-open-placeholder {
|
||||||
|
grid-column: 2 / 3;
|
||||||
|
grid-row: 1 / 3;
|
||||||
|
align-self: center;
|
||||||
|
justify-self: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
+702
@@ -0,0 +1,702 @@
|
|||||||
|
import { CommonModule, LocationStrategy } from '@angular/common';
|
||||||
|
import {
|
||||||
|
Component,
|
||||||
|
ElementRef,
|
||||||
|
OnInit,
|
||||||
|
QueryList,
|
||||||
|
ViewChildren,
|
||||||
|
inject,
|
||||||
|
} from '@angular/core';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
|
import { EChartsOption } from 'echarts';
|
||||||
|
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||||
|
|
||||||
|
import {
|
||||||
|
CompanyConnection,
|
||||||
|
CompanyConnectionsResponse,
|
||||||
|
CompanyConnectionsService,
|
||||||
|
MatchedOfficer,
|
||||||
|
} from '../../api';
|
||||||
|
|
||||||
|
interface RoleLegendItem {
|
||||||
|
role: string;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-person-company-connections',
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MatProgressSpinnerModule,
|
||||||
|
NgxEchartsDirective,
|
||||||
|
MatButtonModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatTooltipModule,
|
||||||
|
MatTooltip,
|
||||||
|
RouterModule,
|
||||||
|
],
|
||||||
|
templateUrl: './person-company-connections.component.html',
|
||||||
|
styleUrl: './person-company-connections.component.scss',
|
||||||
|
})
|
||||||
|
export class PersonCompanyConnectionsComponent implements OnInit {
|
||||||
|
private readonly route = inject(ActivatedRoute);
|
||||||
|
private readonly router = inject(Router);
|
||||||
|
private readonly locationStrategy = inject(LocationStrategy);
|
||||||
|
private readonly companyConnectionsApi = inject(CompanyConnectionsService);
|
||||||
|
|
||||||
|
private readonly graphCompanyLimit = 10;
|
||||||
|
|
||||||
|
private readonly personCategoryIndex = 0;
|
||||||
|
private readonly activeCompanyCategoryIndex = 1;
|
||||||
|
private readonly removedCompanyCategoryIndex = 2;
|
||||||
|
private readonly registerPersonCategoryIndex = 3;
|
||||||
|
|
||||||
|
private readonly personCategoryName = 'Person';
|
||||||
|
private readonly activeCompanyCategoryName = 'Aktives Unternehmen';
|
||||||
|
private readonly removedCompanyCategoryName = 'Gelöschtes Unternehmen';
|
||||||
|
private readonly registerPersonCategoryName = 'Registerperson';
|
||||||
|
|
||||||
|
private readonly authorColor = '#7255d9';
|
||||||
|
private readonly companyActiveColor = '#39a96b';
|
||||||
|
private readonly companyRemovedColor = '#8a95b3';
|
||||||
|
private readonly relatedPersonColor = '#4f8df5';
|
||||||
|
private readonly fallbackRoleColor = '#8a95b3';
|
||||||
|
|
||||||
|
private readonly personIconSymbol = this.createAccountCircleSymbol(
|
||||||
|
this.authorColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
private readonly registerPersonIconSymbol = this.createAccountCircleSymbol(
|
||||||
|
this.relatedPersonColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
private readonly activeCompanyIconSymbol = this.createApartmentSymbol(
|
||||||
|
this.companyActiveColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
private readonly removedCompanyIconSymbol = this.createApartmentSymbol(
|
||||||
|
this.companyRemovedColor,
|
||||||
|
);
|
||||||
|
|
||||||
|
private readonly roleColors: Record<string, string> = {
|
||||||
|
Geschäftsführer: '#2678e8',
|
||||||
|
Prokurist: '#39a96b',
|
||||||
|
'Persönlich haftender Gesellschafter': '#7255d9',
|
||||||
|
Liquidator: '#f59e0b',
|
||||||
|
Inhaber: '#e0527c',
|
||||||
|
Vorstand: '#0f766e',
|
||||||
|
};
|
||||||
|
|
||||||
|
readonly disclaimer =
|
||||||
|
'Die angezeigten Verbindungen basieren nur auf einem Namensabgleich und können gleichnamige Personen enthalten.';
|
||||||
|
|
||||||
|
loading = true;
|
||||||
|
error = false;
|
||||||
|
data: CompanyConnectionsResponse | null = null;
|
||||||
|
|
||||||
|
graphOptions: EChartsOption | null = null;
|
||||||
|
roleLegendItems: RoleLegendItem[] = [];
|
||||||
|
|
||||||
|
selectedCompanyKey: string | null = null;
|
||||||
|
expandedOfficersCompanyKey: string | null = null;
|
||||||
|
showRelatedPersons = false;
|
||||||
|
|
||||||
|
@ViewChildren('connectionRow', { read: ElementRef })
|
||||||
|
private connectionRows!: QueryList<ElementRef<HTMLElement>>;
|
||||||
|
|
||||||
|
get connections(): CompanyConnection[] {
|
||||||
|
return this.data?.connections ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.parent?.paramMap.subscribe((params) => {
|
||||||
|
const authorId = params.get('id');
|
||||||
|
|
||||||
|
if (!authorId) {
|
||||||
|
this.loading = false;
|
||||||
|
this.error = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loadCompanyConnections(authorId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getPrimaryOfficer(connection: CompanyConnection): MatchedOfficer | null {
|
||||||
|
return connection.matched_officers?.[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
getRelatedOfficers(connection: CompanyConnection): MatchedOfficer[] {
|
||||||
|
const displayName = this.data?.display_name?.trim();
|
||||||
|
|
||||||
|
return (connection.officers ?? []).filter((officer) => {
|
||||||
|
const officerName = officer.name?.trim();
|
||||||
|
|
||||||
|
if (!officerName) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (officer.is_matched_person) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return officerName !== displayName;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getCompanyStatusLabel(status?: string | null): string {
|
||||||
|
if (status === 'currently registered') {
|
||||||
|
return 'Aktiv';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status === 'removed') {
|
||||||
|
return 'Gelöscht';
|
||||||
|
}
|
||||||
|
|
||||||
|
return status || 'Unbekannt';
|
||||||
|
}
|
||||||
|
|
||||||
|
getCompanyKey(connection: CompanyConnection): string {
|
||||||
|
return (
|
||||||
|
connection.company_number ||
|
||||||
|
`${connection.company_name}-${connection.register_art}-${connection.register_nummer}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCompanyRegisterLabel(connection: CompanyConnection): string {
|
||||||
|
const parts = [connection.register_art, connection.register_nummer].filter(
|
||||||
|
Boolean,
|
||||||
|
);
|
||||||
|
|
||||||
|
return parts.length > 0 ? parts.join(' ') : '—';
|
||||||
|
}
|
||||||
|
|
||||||
|
getRegistrarLabel(connection: CompanyConnection): string {
|
||||||
|
return connection.registrar || '—';
|
||||||
|
}
|
||||||
|
|
||||||
|
getCompanyAddressLabel(connection: CompanyConnection): string {
|
||||||
|
return connection.registered_address || connection.registered_office || '—';
|
||||||
|
}
|
||||||
|
|
||||||
|
getGegenstandLabel(): string {
|
||||||
|
return 'Noch nicht verfügbar.';
|
||||||
|
}
|
||||||
|
|
||||||
|
getResultCountLabel(): string {
|
||||||
|
if (!this.data) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const companyCount = this.data.company_count ?? this.connections.length;
|
||||||
|
|
||||||
|
if (companyCount === 1) {
|
||||||
|
return '1 Treffer';
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${companyCount} Treffer`;
|
||||||
|
}
|
||||||
|
|
||||||
|
getRoleColor(role?: string | null): string {
|
||||||
|
if (!role) {
|
||||||
|
return this.fallbackRoleColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.roleColors[role] ?? this.fallbackRoleColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
isCompanySelected(connection: CompanyConnection): boolean {
|
||||||
|
return this.selectedCompanyKey === this.getCompanyKey(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
isCompanyOfficersExpanded(connection: CompanyConnection): boolean {
|
||||||
|
return this.expandedOfficersCompanyKey === this.getCompanyKey(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectCompany(connection: CompanyConnection): void {
|
||||||
|
const companyKey = this.getCompanyKey(connection);
|
||||||
|
|
||||||
|
if (this.selectedCompanyKey === companyKey) {
|
||||||
|
this.selectedCompanyKey = null;
|
||||||
|
this.expandedOfficersCompanyKey = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectedCompanyKey = companyKey;
|
||||||
|
this.expandedOfficersCompanyKey = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleCompanyOfficers(connection: CompanyConnection, event: Event): void {
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
const companyKey = this.getCompanyKey(connection);
|
||||||
|
|
||||||
|
if (this.expandedOfficersCompanyKey === companyKey) {
|
||||||
|
this.expandedOfficersCompanyKey = null;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.expandedOfficersCompanyKey = companyKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
onGraphClick(event: any): void {
|
||||||
|
if (event.dataType !== 'node') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.data?.category === this.personCategoryIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isCompanyNodeCategory(event.data?.category)) {
|
||||||
|
this.selectedCompanyKey = event.data.id;
|
||||||
|
this.expandedOfficersCompanyKey = null;
|
||||||
|
this.scrollSelectedCompanyIntoView();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.data?.category === this.registerPersonCategoryIndex) {
|
||||||
|
this.openPersonSearchInNewTab(event.data.searchName || event.data.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onGraphWheel(event: WheelEvent): void {
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
private isCompanyNodeCategory(category: unknown): boolean {
|
||||||
|
return (
|
||||||
|
category === this.activeCompanyCategoryIndex ||
|
||||||
|
category === this.removedCompanyCategoryIndex
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleRelatedPersons(tooltip?: MatTooltip): void {
|
||||||
|
this.showRelatedPersons = !this.showRelatedPersons;
|
||||||
|
this.refreshGraph();
|
||||||
|
|
||||||
|
tooltip?.hide(0);
|
||||||
|
|
||||||
|
window.setTimeout(() => {
|
||||||
|
tooltip?.show(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadCompanyConnections(authorId: string): void {
|
||||||
|
this.loading = true;
|
||||||
|
this.error = false;
|
||||||
|
this.data = null;
|
||||||
|
this.graphOptions = null;
|
||||||
|
this.roleLegendItems = [];
|
||||||
|
this.selectedCompanyKey = null;
|
||||||
|
this.expandedOfficersCompanyKey = null;
|
||||||
|
this.showRelatedPersons = false;
|
||||||
|
|
||||||
|
this.companyConnectionsApi
|
||||||
|
.getCompanyConnectionsByAuthor(authorId)
|
||||||
|
.subscribe({
|
||||||
|
next: (response) => {
|
||||||
|
this.data = response;
|
||||||
|
this.graphOptions = this.createGraphOptions(response);
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
error: (error) => {
|
||||||
|
console.error('Failed to load company connections:', error);
|
||||||
|
this.error = true;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private refreshGraph(): void {
|
||||||
|
if (!this.data) {
|
||||||
|
this.graphOptions = null;
|
||||||
|
this.roleLegendItems = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.graphOptions = this.createGraphOptions(this.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private createGraphOptions(
|
||||||
|
response: CompanyConnectionsResponse,
|
||||||
|
): EChartsOption | null {
|
||||||
|
const connections = response.connections ?? [];
|
||||||
|
|
||||||
|
if (!response.is_ude_author || connections.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const graphConnections = connections.slice(0, this.graphCompanyLimit);
|
||||||
|
|
||||||
|
this.roleLegendItems = this.createRoleLegendItems(graphConnections);
|
||||||
|
|
||||||
|
const personNodeId = `author-${response.author_id}`;
|
||||||
|
|
||||||
|
const nodes: any[] = [
|
||||||
|
{
|
||||||
|
id: personNodeId,
|
||||||
|
name: response.display_name || 'Person',
|
||||||
|
category: this.personCategoryIndex,
|
||||||
|
symbol: this.personIconSymbol,
|
||||||
|
symbolSize: 42,
|
||||||
|
symbolKeepAspect: true,
|
||||||
|
itemStyle: {
|
||||||
|
color: this.authorColor,
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'bottom',
|
||||||
|
fontWeight: 700,
|
||||||
|
color: '#07163d',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const links: any[] = [];
|
||||||
|
|
||||||
|
for (const connection of graphConnections) {
|
||||||
|
const companyKey = this.getCompanyKey(connection);
|
||||||
|
const isRemoved = connection.company_status === 'removed';
|
||||||
|
|
||||||
|
nodes.push({
|
||||||
|
id: companyKey,
|
||||||
|
name: connection.company_name || 'Unbekanntes Unternehmen',
|
||||||
|
category: isRemoved
|
||||||
|
? this.removedCompanyCategoryIndex
|
||||||
|
: this.activeCompanyCategoryIndex,
|
||||||
|
symbol: isRemoved
|
||||||
|
? this.removedCompanyIconSymbol
|
||||||
|
: this.activeCompanyIconSymbol,
|
||||||
|
symbolSize: 44,
|
||||||
|
symbolKeepAspect: true,
|
||||||
|
itemStyle: {
|
||||||
|
color: isRemoved ? this.companyRemovedColor : this.companyActiveColor,
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'bottom',
|
||||||
|
color: '#07163d',
|
||||||
|
width: 125,
|
||||||
|
overflow: 'truncate',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const officer = this.getPrimaryOfficer(connection);
|
||||||
|
const role = officer?.position || 'Unbekannte Rolle';
|
||||||
|
const color = this.getRoleColor(officer?.position);
|
||||||
|
|
||||||
|
links.push({
|
||||||
|
source: personNodeId,
|
||||||
|
target: companyKey,
|
||||||
|
value: role,
|
||||||
|
lineStyle: {
|
||||||
|
color,
|
||||||
|
width: 2.4,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (this.showRelatedPersons) {
|
||||||
|
const relatedOfficers = this.getRelatedOfficers(connection);
|
||||||
|
|
||||||
|
relatedOfficers.forEach((relatedOfficer, index) => {
|
||||||
|
const relatedOfficerId = `officer-${companyKey}-${index}`;
|
||||||
|
const relatedRole = relatedOfficer.position || 'Unbekannte Rolle';
|
||||||
|
|
||||||
|
nodes.push({
|
||||||
|
id: relatedOfficerId,
|
||||||
|
name: relatedOfficer.name || 'Registerperson',
|
||||||
|
searchName: relatedOfficer.name,
|
||||||
|
role: relatedRole,
|
||||||
|
category: this.registerPersonCategoryIndex,
|
||||||
|
symbol: this.registerPersonIconSymbol,
|
||||||
|
symbolSize: 30,
|
||||||
|
symbolKeepAspect: true,
|
||||||
|
itemStyle: {
|
||||||
|
color: this.relatedPersonColor,
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
show: true,
|
||||||
|
position: 'bottom',
|
||||||
|
color: '#07163d',
|
||||||
|
width: 110,
|
||||||
|
overflow: 'truncate',
|
||||||
|
fontSize: 11,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
links.push({
|
||||||
|
source: companyKey,
|
||||||
|
target: relatedOfficerId,
|
||||||
|
value: relatedRole,
|
||||||
|
lineStyle: {
|
||||||
|
color: this.getRoleColor(relatedOfficer.position),
|
||||||
|
width: 1.8,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const graphSeries: any = {
|
||||||
|
type: 'graph',
|
||||||
|
layout: 'force',
|
||||||
|
roam: true,
|
||||||
|
roamTrigger: 'global',
|
||||||
|
animation: false,
|
||||||
|
top: 34,
|
||||||
|
left: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 64,
|
||||||
|
data: nodes,
|
||||||
|
links,
|
||||||
|
categories: this.createGraphCategories(),
|
||||||
|
force: {
|
||||||
|
repulsion: this.showRelatedPersons ? 760 : 620,
|
||||||
|
edgeLength: this.showRelatedPersons ? 145 : 170,
|
||||||
|
gravity: 0.08,
|
||||||
|
},
|
||||||
|
lineStyle: {
|
||||||
|
curveness: 0.05,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
edgeSymbol: ['none', 'none'],
|
||||||
|
emphasis: {
|
||||||
|
focus: 'adjacency',
|
||||||
|
lineStyle: {
|
||||||
|
width: 3.5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
legend: {
|
||||||
|
data: this.createNodeLegendData(graphConnections),
|
||||||
|
bottom: 8,
|
||||||
|
left: 'center',
|
||||||
|
orient: 'horizontal',
|
||||||
|
itemGap: 18,
|
||||||
|
itemWidth: 20,
|
||||||
|
itemHeight: 20,
|
||||||
|
selectedMode: false,
|
||||||
|
textStyle: {
|
||||||
|
color: '#3f4659',
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: 500,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'item',
|
||||||
|
formatter: (params: any) => {
|
||||||
|
if (params.dataType === 'node') {
|
||||||
|
if (params.data?.category === this.registerPersonCategoryIndex) {
|
||||||
|
return params.data?.role
|
||||||
|
? `${params.data.name}<br/>Rolle: ${params.data.role}`
|
||||||
|
: params.data?.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return params.data?.name ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (params.dataType === 'edge') {
|
||||||
|
return params.data?.value
|
||||||
|
? `Rolle: ${params.data.value}`
|
||||||
|
: 'Verbindung';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
series: [graphSeries],
|
||||||
|
} as EChartsOption;
|
||||||
|
}
|
||||||
|
|
||||||
|
private createGraphCategories(): any[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: this.personCategoryName,
|
||||||
|
symbol: this.personIconSymbol,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: this.activeCompanyCategoryName,
|
||||||
|
symbol: this.activeCompanyIconSymbol,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: this.removedCompanyCategoryName,
|
||||||
|
symbol: this.removedCompanyIconSymbol,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: this.registerPersonCategoryName,
|
||||||
|
symbol: this.registerPersonIconSymbol,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private createNodeLegendData(connections: CompanyConnection[]): any[] {
|
||||||
|
const hasActiveCompany = connections.some(
|
||||||
|
(connection) => connection.company_status !== 'removed',
|
||||||
|
);
|
||||||
|
const hasRemovedCompany = connections.some(
|
||||||
|
(connection) => connection.company_status === 'removed',
|
||||||
|
);
|
||||||
|
|
||||||
|
const legendData = [
|
||||||
|
{
|
||||||
|
name: this.personCategoryName,
|
||||||
|
icon: this.personIconSymbol,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
if (hasActiveCompany) {
|
||||||
|
legendData.push({
|
||||||
|
name: this.activeCompanyCategoryName,
|
||||||
|
icon: this.activeCompanyIconSymbol,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasRemovedCompany) {
|
||||||
|
legendData.push({
|
||||||
|
name: this.removedCompanyCategoryName,
|
||||||
|
icon: this.removedCompanyIconSymbol,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.showRelatedPersons) {
|
||||||
|
legendData.push({
|
||||||
|
name: this.registerPersonCategoryName,
|
||||||
|
icon: this.registerPersonIconSymbol,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return legendData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private createRoleLegendItems(
|
||||||
|
connections: CompanyConnection[],
|
||||||
|
): RoleLegendItem[] {
|
||||||
|
const usedRoles = new Set<string>();
|
||||||
|
|
||||||
|
for (const connection of connections) {
|
||||||
|
const role = this.getPrimaryOfficer(connection)?.position;
|
||||||
|
|
||||||
|
if (role) {
|
||||||
|
usedRoles.add(role);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.showRelatedPersons) {
|
||||||
|
for (const officer of this.getRelatedOfficers(connection)) {
|
||||||
|
if (officer.position) {
|
||||||
|
usedRoles.add(officer.position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [...usedRoles]
|
||||||
|
.sort((a, b) => a.localeCompare(b))
|
||||||
|
.map((role) => ({
|
||||||
|
role,
|
||||||
|
color: this.getRoleColor(role),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
openPersonSearchInNewTab(name?: string | null): void {
|
||||||
|
const url = this.createPersonSearchUrl(name);
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.open(url, '_blank', 'noopener,noreferrer');
|
||||||
|
}
|
||||||
|
|
||||||
|
private createPersonSearchUrl(name?: string | null): string | null {
|
||||||
|
const query = name?.trim();
|
||||||
|
|
||||||
|
if (!query) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const urlTree = this.router.createUrlTree(['/persons'], {
|
||||||
|
queryParams: this.getPersonSearchQueryParams(query),
|
||||||
|
});
|
||||||
|
|
||||||
|
const internalUrl = this.router.serializeUrl(urlTree);
|
||||||
|
|
||||||
|
return this.locationStrategy.prepareExternalUrl(internalUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
getPersonSearchQueryParams(name?: string | null): {
|
||||||
|
query: string;
|
||||||
|
page: number;
|
||||||
|
} {
|
||||||
|
return {
|
||||||
|
query: name?.trim() ?? '',
|
||||||
|
page: 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private scrollSelectedCompanyIntoView(): void {
|
||||||
|
window.setTimeout(() => {
|
||||||
|
if (!this.selectedCompanyKey) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedRow = this.connectionRows.find((row) => {
|
||||||
|
return (
|
||||||
|
row.nativeElement.dataset['companyKey'] === this.selectedCompanyKey
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
selectedRow?.nativeElement.scrollIntoView({
|
||||||
|
block: 'nearest',
|
||||||
|
behavior: 'smooth',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private createAccountCircleSymbol(color: string): string {
|
||||||
|
const backgroundPath =
|
||||||
|
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z';
|
||||||
|
|
||||||
|
const foregroundPath =
|
||||||
|
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z';
|
||||||
|
|
||||||
|
const svg = `
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path d="${backgroundPath}" fill="#fff"/>
|
||||||
|
<path d="${foregroundPath}" fill="${color}"/>
|
||||||
|
</svg>
|
||||||
|
`;
|
||||||
|
|
||||||
|
return this.toSvgImageSymbol(svg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private createApartmentSymbol(color: string): string {
|
||||||
|
const backgroundPath = 'M17 11V3H7v4H3v14h18V11h-4z';
|
||||||
|
|
||||||
|
const foregroundPath =
|
||||||
|
'M17 11V3H7v4H3v14h18V11h-4zM7 19H5v-2h2v2zm0-4H5v-2h2v2zm0-4H5V9h2v2zm4 8H9v-2h2v2zm0-4H9v-2h2v2zm0-4H9V9h2v2zm0-4H9V5h2v2zm4 12h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V9h2v2zm0-4h-2V5h2v2zm4 12h-2v-2h2v2zm0-4h-2v-2h2v2z';
|
||||||
|
|
||||||
|
const svg = `
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
||||||
|
<path d="${backgroundPath}" fill="#fff"/>
|
||||||
|
<path d="${foregroundPath}" fill="${color}"/>
|
||||||
|
</svg>
|
||||||
|
`;
|
||||||
|
|
||||||
|
return this.toSvgImageSymbol(svg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private toSvgImageSymbol(svg: string): string {
|
||||||
|
return `image://data:image/svg+xml;utf8,${encodeURIComponent(svg.trim())}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
@if (loading) {
|
||||||
|
<p class="message">Lade Patente...</p>
|
||||||
|
} @else if (error) {
|
||||||
|
<p class="message">Fehler beim Laden der Patente.</p>
|
||||||
|
} @else if (patents.length === 0) {
|
||||||
|
<p class="message">Keine Patente gefunden.</p>
|
||||||
|
} @else {
|
||||||
|
<div class="patents-container">
|
||||||
|
<div class="patents-summary">
|
||||||
|
<p class="summary-line">
|
||||||
|
<span class="summary-value">{{ filteredPatents.length }}</span>
|
||||||
|
<span class="summary-label"> Patente</span>
|
||||||
|
</p>
|
||||||
|
<p class="summary-line">
|
||||||
|
<span class="summary-value">{{ getEpoCount() }}</span>
|
||||||
|
<span class="summary-label"> EPO</span>
|
||||||
|
</p>
|
||||||
|
<p class="summary-line">
|
||||||
|
<span class="summary-value">{{ getUsptoCount() }}</span>
|
||||||
|
<span class="summary-label"> USPTO</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (showDetail && selectedPatent) {
|
||||||
|
<button class="back-btn" (click)="showDetail = false">
|
||||||
|
← Zurück zu den Patenten
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="patents-content">
|
||||||
|
@if (showDetail && selectedPatent) {
|
||||||
|
<div class="patent-full-detail">
|
||||||
|
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
|
||||||
|
|
||||||
|
@if (selectedPatent.abstract) {
|
||||||
|
<div class="detail-section">
|
||||||
|
<h4>Abstract</h4>
|
||||||
|
<p>{{ selectedPatent.abstract }}</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="detail-section">
|
||||||
|
<h4>Erfinder</h4>
|
||||||
|
<ul class="tag-list">
|
||||||
|
@for (inventor of selectedPatent.inventors; track inventor) {
|
||||||
|
<li class="tag">{{ inventor }}</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (selectedPatent.assignees.length > 0) {
|
||||||
|
<div class="detail-section">
|
||||||
|
<h4>Anmelder</h4>
|
||||||
|
<ul class="tag-list">
|
||||||
|
@for (assignee of selectedPatent.assignees; track assignee) {
|
||||||
|
<li class="tag">{{ assignee }}</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (selectedPatent.ipc.length > 0) {
|
||||||
|
<div class="detail-section">
|
||||||
|
<h4>Klassifikation (IPC)</h4>
|
||||||
|
<ul class="tag-list tag-list--compact">
|
||||||
|
@for (ipc of selectedPatent.ipc; track ipc) {
|
||||||
|
<li class="tag">{{ ipc }}</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="patents-list" [class.hidden]="showDetail">
|
||||||
|
<div class="patents-list-toolbar">
|
||||||
|
<label class="sort-control">
|
||||||
|
<span>Filter nach Quelle:</span>
|
||||||
|
<select [value]="activeFilter" (change)="setFilter($any($event.target).value)">
|
||||||
|
<option value="all">Alle</option>
|
||||||
|
<option value="EPO">EPO</option>
|
||||||
|
<option value="USPTO">USPTO</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<label class="sort-control">
|
||||||
|
<span>Sortieren nach:</span>
|
||||||
|
<select [value]="sortMode" (change)="setSortMode($any($event.target).value)">
|
||||||
|
<option value="date">Datum</option>
|
||||||
|
<option value="title">Titel</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Patent</th>
|
||||||
|
<th>Quelle</th>
|
||||||
|
<th>Jahr</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (patent of getPagedPatents(); track patent.patent_id) {
|
||||||
|
<tr
|
||||||
|
[class.selected]="selectedPatent === patent"
|
||||||
|
(click)="selectPatent(patent)">
|
||||||
|
<td class="patent-title">{{ patent.title ?? patent.patent_id }}</td>
|
||||||
|
<td>
|
||||||
|
<span class="source-badge source-badge--{{ patent.source.toLowerCase() }}">
|
||||||
|
{{ patent.source }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>{{ patent.publication_year ?? '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
@if (hasPagination()) {
|
||||||
|
<div class="pagination">
|
||||||
|
<button [disabled]="selectedPage === 1" (click)="setPage(selectedPage - 1)">Zurück</button>
|
||||||
|
<span>Seite {{ selectedPage }} von {{ getPageCount() }}</span>
|
||||||
|
<button [disabled]="selectedPage === getPageCount()" (click)="setPage(selectedPage + 1)">Weiter</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (selectedPatent) {
|
||||||
|
<div class="patent-detail">
|
||||||
|
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
|
||||||
|
<div class="detail-stats">
|
||||||
|
<div class="stat stat--clickable" (click)="openDetail()">
|
||||||
|
<span class="stat-label">Quelle</span>
|
||||||
|
<span class="stat-value">
|
||||||
|
<span class="source-badge source-badge--{{ selectedPatent.source.toLowerCase() }}">
|
||||||
|
{{ selectedPatent.source }}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat">
|
||||||
|
<span class="stat-label">Patent-Nr.</span>
|
||||||
|
<span class="stat-value">{{ selectedPatent.patent_id }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="stat">
|
||||||
|
<span class="stat-label">Datum</span>
|
||||||
|
<span class="stat-value">{{ formatDate(selectedPatent.publication_date) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="patent-detail empty">
|
||||||
|
<p>Klicke auf ein Patent für Details.</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@@ -0,0 +1,304 @@
|
|||||||
|
.message {
|
||||||
|
padding: 16px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patents-container {
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patents-summary {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
|
||||||
|
.summary-line {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-label {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-value {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort-control {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
width: fit-content;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border-radius: 20px;
|
||||||
|
background: #f2f2f2;
|
||||||
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
border: 0;
|
||||||
|
background: transparent;
|
||||||
|
color: #111827;
|
||||||
|
font: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.patents-content {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patents-list {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
&.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patents-list-toolbar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
|
||||||
|
th {
|
||||||
|
text-align: left;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 2px solid #e0e0e0;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
background: #f0f0f0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-bottom: 1px solid #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patent-title {
|
||||||
|
color: #333;
|
||||||
|
font-weight: 500;
|
||||||
|
max-width: 400px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 700;
|
||||||
|
|
||||||
|
&--epo {
|
||||||
|
background: #effaf3;
|
||||||
|
color: #24834f;
|
||||||
|
border: 1px solid #bdebcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--uspto {
|
||||||
|
background: #f0f6ff;
|
||||||
|
color: #0b63ce;
|
||||||
|
border: 1px solid #bdd4ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.patent-detail {
|
||||||
|
width: 440px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
background: #fafafa;
|
||||||
|
|
||||||
|
&.empty {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
color: #999;
|
||||||
|
min-height: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 16px 0;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-stats {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
.stat {
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.stat-label {
|
||||||
|
display: block;
|
||||||
|
font-size: 11px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.03em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
display: block;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat--clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s, background 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #0b63ce;
|
||||||
|
background: #f0f6ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.patent-full-detail {
|
||||||
|
flex: 1;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 20px;
|
||||||
|
background: #fafafa;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0 0 16px 0;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #333;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4 {
|
||||||
|
margin: 16px 0 8px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #555;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #444;
|
||||||
|
line-height: 1.6;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-btn {
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
color: #333;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 400;
|
||||||
|
padding: 0;
|
||||||
|
align-self: flex-start; // NEU
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-section {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
|
||||||
|
&--compact .tag {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
padding: 3px 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag {
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: #f0f6ff;
|
||||||
|
border: 1px solid #dbeafe;
|
||||||
|
color: #1e40af;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 12px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
padding: 4px 10px;
|
||||||
|
border: 1px solid #d0d0d0;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: white;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { PatentsService, PatentEntry } from '../../api/api/patents.service';
|
||||||
|
|
||||||
|
type SortMode = 'date' | 'title';
|
||||||
|
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-person-patents',
|
||||||
|
imports: [CommonModule],
|
||||||
|
templateUrl: './person-patents.component.html',
|
||||||
|
styleUrl: './person-patents.component.scss',
|
||||||
|
})
|
||||||
|
export class PersonPatentsComponent implements OnInit {
|
||||||
|
private route = inject(ActivatedRoute);
|
||||||
|
private router = inject(Router);
|
||||||
|
private patentsApi = inject(PatentsService);
|
||||||
|
|
||||||
|
patents: PatentEntry[] = [];
|
||||||
|
filteredPatents: PatentEntry[] = [];
|
||||||
|
authorName: string | null = null;
|
||||||
|
selectedPatent: PatentEntry | null = null;
|
||||||
|
showDetail = false;
|
||||||
|
|
||||||
|
loading = true;
|
||||||
|
error = false;
|
||||||
|
|
||||||
|
activeFilter: SourceFilter = 'all';
|
||||||
|
sortMode: SortMode = 'date';
|
||||||
|
|
||||||
|
selectedPage = 1;
|
||||||
|
readonly pageSize = 10;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.parent?.paramMap.subscribe((params) => {
|
||||||
|
const authorId = params.get('id') ?? '';
|
||||||
|
|
||||||
|
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||||
|
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||||
|
|
||||||
|
if (this.isValidFilter(filterFromUrl)) {
|
||||||
|
this.activeFilter = filterFromUrl;
|
||||||
|
}
|
||||||
|
if (this.isValidSortMode(sortFromUrl)) {
|
||||||
|
this.sortMode = sortFromUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (authorId) {
|
||||||
|
this.patentsApi.getPatentsByAuthor(authorId, 'body').subscribe({
|
||||||
|
next: (result) => {
|
||||||
|
this.patents = result.patents ?? [];
|
||||||
|
this.authorName = result.author_name ?? null;
|
||||||
|
this.applyFilter();
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.error = true;
|
||||||
|
this.loading = false;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setFilter(filter: SourceFilter): void {
|
||||||
|
this.activeFilter = filter;
|
||||||
|
this.selectedPage = 1;
|
||||||
|
this.selectedPatent = null;
|
||||||
|
this.showDetail = false;
|
||||||
|
this.applyFilter();
|
||||||
|
this.updateQueryParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
setSortMode(sortMode: SortMode): void {
|
||||||
|
this.sortMode = sortMode;
|
||||||
|
this.applyFilter();
|
||||||
|
this.updateQueryParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectPatent(patent: PatentEntry): void {
|
||||||
|
this.selectedPatent = patent;
|
||||||
|
this.showDetail = false;
|
||||||
|
this.updateQueryParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
openDetail(): void {
|
||||||
|
this.showDetail = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyFilter(): void {
|
||||||
|
let patents = this.patents;
|
||||||
|
|
||||||
|
if (this.activeFilter !== 'all') {
|
||||||
|
patents = patents.filter((p) => p.source === this.activeFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.filteredPatents = this.sortPatents(patents);
|
||||||
|
}
|
||||||
|
|
||||||
|
private sortPatents(patents: PatentEntry[]): PatentEntry[] {
|
||||||
|
return [...patents].sort((a, b) => {
|
||||||
|
if (this.sortMode === 'date') {
|
||||||
|
return (b.publication_date ?? '').localeCompare(a.publication_date ?? '');
|
||||||
|
}
|
||||||
|
return (a.title ?? '').localeCompare(b.title ?? '', 'de', { sensitivity: 'base' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateQueryParams(): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
relativeTo: this.route,
|
||||||
|
queryParams: {
|
||||||
|
filter: this.activeFilter,
|
||||||
|
sortBy: this.sortMode,
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
replaceUrl: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private isValidFilter(value: string | null): value is SourceFilter {
|
||||||
|
return value === 'all' || value === 'EPO' || value === 'USPTO';
|
||||||
|
}
|
||||||
|
|
||||||
|
private isValidSortMode(value: string | null): value is SortMode {
|
||||||
|
return value === 'date' || value === 'title';
|
||||||
|
}
|
||||||
|
|
||||||
|
getPagedPatents(): PatentEntry[] {
|
||||||
|
const start = (this.selectedPage - 1) * this.pageSize;
|
||||||
|
return this.filteredPatents.slice(start, start + this.pageSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
getPageCount(): number {
|
||||||
|
return Math.max(1, Math.ceil(this.filteredPatents.length / this.pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
hasPagination(): boolean {
|
||||||
|
return this.getPageCount() > 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
setPage(page: number): void {
|
||||||
|
this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount());
|
||||||
|
this.updateQueryParams();
|
||||||
|
}
|
||||||
|
|
||||||
|
formatDate(date: string | null): string {
|
||||||
|
if (!date) return '-';
|
||||||
|
const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
|
||||||
|
return new Intl.DateTimeFormat('de-DE').format(new Date(d));
|
||||||
|
}
|
||||||
|
|
||||||
|
getEpoCount(): number {
|
||||||
|
return this.patents.filter((p) => p.source === 'EPO').length;
|
||||||
|
}
|
||||||
|
|
||||||
|
getUsptoCount(): number {
|
||||||
|
return this.patents.filter((p) => p.source === 'USPTO').length;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,391 @@
|
|||||||
|
<div class="detail-page">
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span>Bund Projekte</span>
|
||||||
|
<mat-icon>chevron_right</mat-icon>
|
||||||
|
<span>Projektdetails</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (bundProject) {
|
||||||
|
<div class="project-hero">
|
||||||
|
<div class="hero-content">
|
||||||
|
<div class="eyebrow">
|
||||||
|
<span class="project-badge">Bund Projekt</span>
|
||||||
|
<span class="project-id"
|
||||||
|
>ID: {{ bundProject.funding_reference }}</span
|
||||||
|
>
|
||||||
|
<!-- @if (isNewProject()) {
|
||||||
|
<span class="new-badge">Neu</span>
|
||||||
|
} -->
|
||||||
|
</div>
|
||||||
|
<h1>{{ bundProject.title || 'Ohne Titel' }}</h1>
|
||||||
|
@if (bundProject.funding_reference) {
|
||||||
|
<p class="project-reference">
|
||||||
|
<strong>{{ bundProject.funding_type }}</strong>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
<div class="hero-actions">
|
||||||
|
<!-- @if (bundProject.project_agency) {
|
||||||
|
<div class="agency-info" (click)="searchForAgency(bundProject.project_agency)">
|
||||||
|
<mat-icon>account_balance</mat-icon>
|
||||||
|
<span>{{ bundProject.project_agency_fullname || bundProject.project_agency }}</span>
|
||||||
|
</div>
|
||||||
|
} -->
|
||||||
|
<!-- @if (bundProject.funding_type) {
|
||||||
|
<div class="funding-type-info" (click)="searchForFundingType(bundProject.funding_type)">
|
||||||
|
<mat-icon>category</mat-icon>
|
||||||
|
<span>{{ bundProject.funding_type }}</span>
|
||||||
|
</div>
|
||||||
|
} -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="metrics-grid">
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>calendar_today</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ getStartDate() || 'N/A' }}</strong>
|
||||||
|
<span>Startdatum</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>event_busy</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{
|
||||||
|
getFundingStatus(getEndDate())
|
||||||
|
}}</strong>
|
||||||
|
<span>Enddatum</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@if (bundProject.funding_amount) {
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>paid</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ getFundingAmountDisplay() }}</strong>
|
||||||
|
<span>Fördersumme</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.funding_profile) {
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>assignment</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ bundProject.funding_profile }}</strong>
|
||||||
|
<span>Förderprofil</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (bundProject.description) {
|
||||||
|
<mat-card appearance="outlined" class="card description-card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>description</mat-icon>
|
||||||
|
<h2>Beschreibung</h2>
|
||||||
|
</div>
|
||||||
|
<p class="description-text">{{ bundProject.description }}</p>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="content-grid">
|
||||||
|
<main class="main-content">
|
||||||
|
<!-- Beteiligte Personen -->
|
||||||
|
@if (getAssociatedPersons().length > 0) {
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>people</mat-icon>
|
||||||
|
<h2>Beteiligte Personen</h2>
|
||||||
|
<span class="count-badge">{{
|
||||||
|
getAssociatedPersons().length
|
||||||
|
}}</span>
|
||||||
|
</div>
|
||||||
|
<div class="person-grid">
|
||||||
|
@for (person of getAssociatedPersons(); track person) {
|
||||||
|
<div class="person-item" (click)="searchForPersonName(person)">
|
||||||
|
<div class="avatar">{{ getInitials(person) }}</div>
|
||||||
|
<div class="person-name">{{ person }}</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- Beteiligte Institutionen -->
|
||||||
|
@if (getInstitutions().length > 0) {
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>business</mat-icon>
|
||||||
|
<h2>Beteiligte Institutionen</h2>
|
||||||
|
<span class="count-badge">{{ getInstitutions().length }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="institution-grid">
|
||||||
|
@for (institution of getInstitutions(); track institution) {
|
||||||
|
<div
|
||||||
|
class="institution-item"
|
||||||
|
(click)="searchForInstitutionName(institution)">
|
||||||
|
<mat-icon>apartment</mat-icon>
|
||||||
|
<span>{{ institution }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- Joint Project Information
|
||||||
|
@if (bundProject.joint_project) {
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>groups</mat-icon>
|
||||||
|
<h2>Gemeinschaftsprojekt</h2>
|
||||||
|
</div>
|
||||||
|
<div class="joint-project-content">
|
||||||
|
<mat-icon>link</mat-icon>
|
||||||
|
<span>{{ bundProject.joint_project }}</span>
|
||||||
|
</div>
|
||||||
|
</mat-card>
|
||||||
|
} -->
|
||||||
|
<!-- Organisatorische Details -->
|
||||||
|
@if (
|
||||||
|
bundProject.executing_agency ||
|
||||||
|
bundProject.funding_recipient ||
|
||||||
|
bundProject.project_agency ||
|
||||||
|
bundProject.department ||
|
||||||
|
bundProject.division
|
||||||
|
) {
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>organization</mat-icon>
|
||||||
|
<h2>Organisation</h2>
|
||||||
|
</div>
|
||||||
|
<dl class="details-list">
|
||||||
|
@if (bundProject.executing_agency) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Ausführende Stelle</dt>
|
||||||
|
<dd>
|
||||||
|
{{ bundProject.executing_agency }}
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.funding_recipient) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Förderempfänger</dt>
|
||||||
|
<dd>{{ bundProject.funding_recipient }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.project_agency) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Projektagentur</dt>
|
||||||
|
<dd>
|
||||||
|
{{
|
||||||
|
bundProject.project_agency_fullname ||
|
||||||
|
bundProject.project_agency
|
||||||
|
}}
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.department) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Abteilung</dt>
|
||||||
|
<dd>
|
||||||
|
{{
|
||||||
|
bundProject.department_fullname || bundProject.department
|
||||||
|
}}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.division) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Division</dt>
|
||||||
|
<dd>{{ bundProject.division }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- Standort -->
|
||||||
|
@if (
|
||||||
|
bundProject.location ||
|
||||||
|
bundProject.municipality ||
|
||||||
|
bundProject.state ||
|
||||||
|
bundProject.country
|
||||||
|
) {
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>location_on</mat-icon>
|
||||||
|
<h2>Standort</h2>
|
||||||
|
</div>
|
||||||
|
<dl class="details-list">
|
||||||
|
@if (bundProject.location) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Standort</dt>
|
||||||
|
<dd>
|
||||||
|
{{ bundProject.location }}
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.municipality) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Gemeinde</dt>
|
||||||
|
<dd>{{ bundProject.municipality }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.state) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Bundesland</dt>
|
||||||
|
<dd>
|
||||||
|
{{ bundProject.state }}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.country) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Land</dt>
|
||||||
|
<dd>{{ bundProject.country }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.municipality_code) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Gemeindeschlüssel</dt>
|
||||||
|
<dd>{{ bundProject.municipality_code }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- Zusätzliche Informationen -->
|
||||||
|
@if (
|
||||||
|
bundProject.performance_plan_code ||
|
||||||
|
bundProject.performance_plan_fullname ||
|
||||||
|
bundProject.publication_date ||
|
||||||
|
bundProject.record_date
|
||||||
|
) {
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>more_info</mat-icon>
|
||||||
|
<h2>Weitere Informationen</h2>
|
||||||
|
</div>
|
||||||
|
<dl class="details-list">
|
||||||
|
@if (bundProject.performance_plan_code) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Leistungsplancode</dt>
|
||||||
|
<dd>{{ bundProject.performance_plan_code }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.performance_plan_fullname) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Leistungsplan</dt>
|
||||||
|
<dd>{{ bundProject.performance_plan_fullname }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.publication_date) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Veröffentlichungsdatum</dt>
|
||||||
|
<dd>{{ bundProject.publication_date }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.record_date) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Datensatzdatum</dt>
|
||||||
|
<dd>{{ bundProject.record_date }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<aside class="sidebar">
|
||||||
|
<!-- Projektdetails -->
|
||||||
|
<mat-card appearance="outlined" class="card details-card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>info</mat-icon>
|
||||||
|
<h2>Projektdetails</h2>
|
||||||
|
</div>
|
||||||
|
<dl class="details-list">
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Projekt ID</dt>
|
||||||
|
<dd>{{ bundProject.funding_reference || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="detail-row">
|
||||||
|
<dt>Titel</dt>
|
||||||
|
<dd>{{ bundProject.title || 'N/A' }}</dd>
|
||||||
|
</div> -->
|
||||||
|
<!-- @if (bundProject.funding_reference) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Förderreferenz</dt>
|
||||||
|
<dd>{{ bundProject.funding_reference }}</dd>
|
||||||
|
</div>
|
||||||
|
} -->
|
||||||
|
@if (bundProject.funding_type) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Förderart</dt>
|
||||||
|
<dd>
|
||||||
|
{{ bundProject.funding_type }}
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.funding_profile) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Förderprofil</dt>
|
||||||
|
<dd>{{ bundProject.funding_profile }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.funding_amount) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Fördersumme</dt>
|
||||||
|
<dd>{{ getFundingAmountDisplay() }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.funding_amount) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Agency</dt>
|
||||||
|
<dd>
|
||||||
|
{{
|
||||||
|
bundProject.project_agency_fullname ||
|
||||||
|
bundProject.project_agency
|
||||||
|
}}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- <div class="detail-row">
|
||||||
|
<dt>Startdatum</dt>
|
||||||
|
<dd>{{ getStartDate() || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Enddatum</dt>
|
||||||
|
<dd>{{ getFundingStatus(getEndDate()) }}</dd>
|
||||||
|
</div> -->
|
||||||
|
@if (getDuration()) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Laufzeit</dt>
|
||||||
|
<dd>{{ getDuration() }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (bundProject.joint_project) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Gemeinschaftsprojekt</dt>
|
||||||
|
<dd>{{ bundProject.joint_project }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
|
</mat-card>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="error-container">
|
||||||
|
<div class="error-state">
|
||||||
|
<mat-icon>error_outline</mat-icon>
|
||||||
|
<p>Bund Projekt nicht gefunden.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,527 @@
|
|||||||
|
// Complete SCSS with all styles including clickable elements
|
||||||
|
|
||||||
|
.detail-page {
|
||||||
|
padding: 28px 32px 42px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 18px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: #fff;
|
||||||
|
color: var(--sg-text);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link:hover {
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-color: #b8c5d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link mat-icon {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb mat-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb span:last-child {
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-hero {
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-md);
|
||||||
|
padding: 28px 32px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-content {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.eyebrow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 12px;
|
||||||
|
background: #e8edf5;
|
||||||
|
color: var(--sg-text);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-id {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.new-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 10px;
|
||||||
|
background: #27ae60;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
font-size: 26px;
|
||||||
|
line-height: 1.3;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-reference {
|
||||||
|
margin: 0 0 16px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agency-info,
|
||||||
|
.funding-type-info {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px 16px;
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agency-info:hover,
|
||||||
|
.funding-type-info:hover {
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-color: #b8c5d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agency-info mat-icon,
|
||||||
|
.funding-type-info mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metrics-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
padding-top: 20px;
|
||||||
|
border-top: 1px solid #d9e2f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-item mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-content strong {
|
||||||
|
font-size: 15px;
|
||||||
|
color: var(--sg-text);
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-content span {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
border-color: #d9e2f0 !important;
|
||||||
|
border-radius: var(--sg-radius-md) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card ::ng-deep .mat-mdc-card-content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 16px 20px 12px;
|
||||||
|
border-bottom: 1px solid #f0f2f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.count-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
padding: 0 8px;
|
||||||
|
margin-left: auto;
|
||||||
|
background: #e8edf5;
|
||||||
|
border-radius: 12px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description-text {
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 2fr 1fr;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
border-color: #b8c5d6;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #e8edf5;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-name {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: #fff;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--sg-text);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-item:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
border-color: #b8c5d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-item mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
font-size: 20px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.joint-project-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.joint-project-content mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
font-size: 24px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 140px 1fr;
|
||||||
|
gap: 24px;
|
||||||
|
padding: 8px 0;
|
||||||
|
border-bottom: 1px solid #f0f2f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dt {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dd {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 13px;
|
||||||
|
word-break: break-word;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dd.clickable {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dd.clickable:hover {
|
||||||
|
color: var(--sg-primary, #0066cc);
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dd.clickable:hover .search-icon {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-icon {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
font-size: 16px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dd:hover .search-icon {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state mat-icon {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
font-size: 48px;
|
||||||
|
color: #e74c3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clickable external link styling
|
||||||
|
.external-link {
|
||||||
|
color: var(--sg-primary, #0066cc);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.external-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
.content-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.detail-page {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-hero {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metrics-grid {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.eyebrow {
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.metrics-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-actions {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.agency-info,
|
||||||
|
.funding-type-info {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { BundProjectDetails } from '../../../api/model/bundProjectDetails';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-bund-details',
|
||||||
|
standalone: true,
|
||||||
|
imports: [CommonModule, MatCardModule, MatIconModule],
|
||||||
|
templateUrl: './bund-details.component.html',
|
||||||
|
styleUrl: './bund-details.component.scss',
|
||||||
|
})
|
||||||
|
export class BundDetailsComponent implements OnInit {
|
||||||
|
private route = inject(ActivatedRoute);
|
||||||
|
bundProject: BundProjectDetails | undefined;
|
||||||
|
|
||||||
|
constructor(private router: Router) {}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.data.subscribe(({ bundSingleProject }) => {
|
||||||
|
console.log('Bund Project:', bundSingleProject);
|
||||||
|
this.bundProject = bundSingleProject;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getInitials(name: string | null | undefined): string {
|
||||||
|
if (!name) return '';
|
||||||
|
const parts = name.trim().split(/\s+/);
|
||||||
|
if (parts.length > 1) {
|
||||||
|
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
||||||
|
}
|
||||||
|
return parts[0][0].toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
getFundingStatus(fundingEndDate: string | null | undefined): string {
|
||||||
|
if (!fundingEndDate) return 'N/A';
|
||||||
|
if (fundingEndDate === '2999') return 'laufend';
|
||||||
|
const year = parseInt(fundingEndDate, 10);
|
||||||
|
if (isNaN(year)) return fundingEndDate;
|
||||||
|
return year >= new Date().getFullYear()
|
||||||
|
? `${fundingEndDate} (laufend)`
|
||||||
|
: `${fundingEndDate} (abgeschlossen)`;
|
||||||
|
}
|
||||||
|
|
||||||
|
formatCurrency(amount: number | null | undefined): string {
|
||||||
|
if (amount === null || amount === undefined) return 'N/A';
|
||||||
|
|
||||||
|
// Format as Euro with thousands separators
|
||||||
|
return new Intl.NumberFormat('de-DE', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'EUR',
|
||||||
|
minimumFractionDigits: 0,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
}).format(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
searchForPersonName(personName: string): void {
|
||||||
|
this.router.navigate(['/persons'], {
|
||||||
|
queryParams: {
|
||||||
|
query: personName,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
searchForInstitutionName(institutionName: string): void {
|
||||||
|
this.router.navigate(['/institutions'], {
|
||||||
|
queryParams: {
|
||||||
|
search: institutionName,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// searchForLocation(location: string): void {
|
||||||
|
// this.router.navigate(['/bund-projects'], {
|
||||||
|
// queryParams: {
|
||||||
|
// location: location
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// searchForState(state: string): void {
|
||||||
|
// this.router.navigate(['/bund-projects'], {
|
||||||
|
// queryParams: {
|
||||||
|
// state: state
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// searchForFundingType(fundingType: string): void {
|
||||||
|
// this.router.navigate(['/bund-projects'], {
|
||||||
|
// queryParams: {
|
||||||
|
// fundingType: fundingType
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// searchForAgency(agency: string): void {
|
||||||
|
// this.router.navigate(['/bund-projects'], {
|
||||||
|
// queryParams: {
|
||||||
|
// agency: agency
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
private formatGermanDate(dateString: string): string {
|
||||||
|
if (!dateString) return '';
|
||||||
|
|
||||||
|
return new Intl.DateTimeFormat('de-DE', {
|
||||||
|
day: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
}).format(new Date(dateString));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* All associated persons as a simple list.
|
||||||
|
*/
|
||||||
|
getAssociatedPersons(): string[] {
|
||||||
|
return this.bundProject?.associated_persons || [];
|
||||||
|
}
|
||||||
|
getStartDate(): string {
|
||||||
|
return this.formatGermanDate(this.bundProject?.funding_start_date ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
getEndDate(): string {
|
||||||
|
return this.formatGermanDate(this.bundProject?.funding_end_date ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
getDuration(): string {
|
||||||
|
const start = this.bundProject?.funding_start_date;
|
||||||
|
const end = this.bundProject?.funding_end_date;
|
||||||
|
|
||||||
|
if (!start || !end) return '';
|
||||||
|
|
||||||
|
return `von ${this.formatGermanDate(start)} bis ${this.formatGermanDate(end)}`;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* All institutions as a simple list.
|
||||||
|
*/
|
||||||
|
getInstitutions(): string[] {
|
||||||
|
return this.bundProject?.institutions || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if project is new
|
||||||
|
*/
|
||||||
|
isNewProject(): boolean {
|
||||||
|
return this.bundProject?.is_new === true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get display name for funding amount
|
||||||
|
*/
|
||||||
|
getFundingAmountDisplay(): string {
|
||||||
|
if (!this.bundProject?.funding_amount) return 'N/A';
|
||||||
|
return this.formatCurrency(this.bundProject.funding_amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
goBack(): void {
|
||||||
|
window.history.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
<div class="detail-page">
|
||||||
|
<div class="page-header">
|
||||||
|
<div class="breadcrumb">
|
||||||
|
<span>DFG Projekte</span>
|
||||||
|
<mat-icon>chevron_right</mat-icon>
|
||||||
|
<span>Projektdetails</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (dfgProject) {
|
||||||
|
<div class="project-hero">
|
||||||
|
<div class="hero-content">
|
||||||
|
<div class="eyebrow">
|
||||||
|
<span class="project-badge">DFG Projekt</span>
|
||||||
|
<span class="project-id">ID: {{ dfgProject.id }}</span>
|
||||||
|
</div>
|
||||||
|
<h1>{{ dfgProject.title }}</h1>
|
||||||
|
@if (dfgProject.project_identifier) {
|
||||||
|
<p class="project-identifier">
|
||||||
|
<strong>{{ dfgProject.project_identifier.split('-')[0] }}</strong>
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
<div class="hero-actions">
|
||||||
|
@if (dfgProject.link) {
|
||||||
|
<a [href]="dfgProject.link" target="_blank" class="primary-action">
|
||||||
|
<mat-icon>open_in_new</mat-icon>
|
||||||
|
<span>Zum Projekt</span>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
@if (dfgProject.website) {
|
||||||
|
<a
|
||||||
|
[href]="dfgProject.website"
|
||||||
|
target="_blank"
|
||||||
|
class="secondary-action">
|
||||||
|
<mat-icon>language</mat-icon>
|
||||||
|
<span>Webseite</span>
|
||||||
|
</a>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="metrics-grid">
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>calendar_today</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ dfgProject.funding_start_date || 'N/A' }}</strong>
|
||||||
|
<span>Fördersbeginn</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>event_busy</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ getFundingStatus(dfgProject.funding_end_date) }}</strong>
|
||||||
|
<span>Fördersende</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- @if (dfgProject.subject_area) {
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>category</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ dfgProject.subject_area }}</strong>
|
||||||
|
<span>Fachliche Zuordnung</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
} -->
|
||||||
|
@if (dfgProject.dfg_procedure) {
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>gavel</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ dfgProject.dfg_procedure }}</strong>
|
||||||
|
<span>DFG Verfahren</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<!-- @if (dfgProject.funding_type) {
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>paid</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ dfgProject.funding_type }}</strong>
|
||||||
|
<span>Förderung</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
} -->
|
||||||
|
@if (dfgProject.international_reference) {
|
||||||
|
<div class="metric-item">
|
||||||
|
<mat-icon>public</mat-icon>
|
||||||
|
<div class="metric-content">
|
||||||
|
<strong>{{ dfgProject.international_reference }}</strong>
|
||||||
|
<span>Internationaler Bezug</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (dfgProject.description) {
|
||||||
|
<mat-card appearance="outlined" class="card description-card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>description</mat-icon>
|
||||||
|
<h2>Beschreibung</h2>
|
||||||
|
</div>
|
||||||
|
<p class="description-text">{{ dfgProject.description }}</p>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="content-grid">
|
||||||
|
<main class="main-content">
|
||||||
|
<!-- Beteiligte Personen -->
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>people</mat-icon>
|
||||||
|
<h2>Beteiligte Personen</h2>
|
||||||
|
<span class="count-badge">{{ getAssociatedPersons().length }}</span>
|
||||||
|
</div>
|
||||||
|
@if (getAssociatedPersons().length > 0) {
|
||||||
|
<div class="person-grid">
|
||||||
|
@for (person of getAssociatedPersons(); track person) {
|
||||||
|
<div (click)="searchForPersonName(person)" class="person-item">
|
||||||
|
<div class="avatar">{{ getInitials(person) }}</div>
|
||||||
|
<div class="person-name">{{ person }}</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="empty-state">Keine Personen gefunden.</div>
|
||||||
|
}
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
<!-- Beteiligte Institutionen -->
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>business</mat-icon>
|
||||||
|
<h2>Beteiligte Institutionen</h2>
|
||||||
|
<span class="count-badge">{{ getInstitutions().length }}</span>
|
||||||
|
</div>
|
||||||
|
@if (getInstitutions().length > 0) {
|
||||||
|
<div class="institution-grid">
|
||||||
|
@for (institution of getInstitutions(); track institution) {
|
||||||
|
<div (click)="searchForInstitutionName(institution)" class="institution-item">
|
||||||
|
<mat-icon>apartment</mat-icon>
|
||||||
|
<span>{{ institution }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="empty-state">Keine Institutionen gefunden.</div>
|
||||||
|
}
|
||||||
|
</mat-card>
|
||||||
|
<!-- Teilprojekt -->
|
||||||
|
<!-- @if (dfgProject.subproject_of) {
|
||||||
|
<mat-card appearance="outlined" class="card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>account_tree</mat-icon>
|
||||||
|
<h2>Teilprojekt</h2>
|
||||||
|
</div>
|
||||||
|
<dl class="details-list">
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Teilprojekt zu</dt>
|
||||||
|
<dd>{{ dfgProject.subproject_of }}</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</mat-card>
|
||||||
|
} -->
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<aside class="sidebar">
|
||||||
|
<!-- Projektdetails -->
|
||||||
|
<mat-card appearance="outlined" class="card details-card">
|
||||||
|
<div class="section-header">
|
||||||
|
<mat-icon>info</mat-icon>
|
||||||
|
<h2>Projektdetails</h2>
|
||||||
|
</div>
|
||||||
|
<dl class="details-list">
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Projekt ID</dt>
|
||||||
|
<dd>{{ dfgProject.id || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Titel</dt>
|
||||||
|
<dd>{{ dfgProject.title || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Projektkennung</dt>
|
||||||
|
<dd>{{ dfgProject.project_identifier || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Fachliche Zuordnung</dt>
|
||||||
|
<dd>{{ dfgProject.subject_area || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>DFG-Verfahren</dt>
|
||||||
|
<dd>{{ dfgProject.dfg_procedure || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="detail-row">
|
||||||
|
<dt>Förderung</dt>
|
||||||
|
<dd>{{ dfgProject.funding_type || 'N/A' }}</dd>
|
||||||
|
</div> -->
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Fördersbeginn</dt>
|
||||||
|
<dd>{{ dfgProject.funding_start_date || 'N/A' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Fördersende</dt>
|
||||||
|
<dd>{{ getFundingStatus(dfgProject.funding_end_date) }}</dd>
|
||||||
|
</div>
|
||||||
|
@if (dfgProject.subproject_of ) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Teilprojekt von</dt>
|
||||||
|
<dd>{{ dfgProject.subproject_of }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (dfgProject.international_reference) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Internationaler Bezug</dt>
|
||||||
|
<dd>{{ dfgProject.international_reference }}</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (dfgProject.website) {
|
||||||
|
<div class="detail-row">
|
||||||
|
<dt>Webseite</dt>
|
||||||
|
<dd>
|
||||||
|
<a
|
||||||
|
[href]="dfgProject.website"
|
||||||
|
target="_blank"
|
||||||
|
class="external-link"
|
||||||
|
>{{ dfgProject.website }}</a
|
||||||
|
>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
|
</mat-card>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="error-container">
|
||||||
|
<div class="error-state">
|
||||||
|
<mat-icon>error_outline</mat-icon>
|
||||||
|
<p>DFG Projekt nicht gefunden.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,467 @@
|
|||||||
|
.detail-page {
|
||||||
|
padding: 28px 32px 42px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 18px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 8px 16px;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: #fff;
|
||||||
|
color: var(--sg-text);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link:hover {
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-color: #b8c5d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-link mat-icon {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb mat-icon {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumb span:last-child {
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-hero {
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-md);
|
||||||
|
padding: 28px 32px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-content {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.eyebrow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 12px;
|
||||||
|
background: #e8edf5;
|
||||||
|
color: var(--sg-text);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-id {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
margin: 0 0 8px;
|
||||||
|
font-size: 26px;
|
||||||
|
line-height: 1.3;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-identifier {
|
||||||
|
margin: 0 0 16px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action,
|
||||||
|
.secondary-action {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action {
|
||||||
|
background: var(--sg-primary, #0066cc);
|
||||||
|
color: #fff;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action:hover {
|
||||||
|
background: var(--sg-primary-dark, #0052a3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-action {
|
||||||
|
background: #fff;
|
||||||
|
color: var(--sg-text);
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.secondary-action:hover {
|
||||||
|
background: #f5f7fa;
|
||||||
|
border-color: #b8c5d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action mat-icon,
|
||||||
|
.secondary-action mat-icon {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metrics-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
padding-top: 20px;
|
||||||
|
border-top: 1px solid #d9e2f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-item mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-content strong {
|
||||||
|
font-size: 15px;
|
||||||
|
color: var(--sg-text);
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metric-content span {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
border-color: #d9e2f0 !important;
|
||||||
|
border-radius: var(--sg-radius-md) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card ::ng-deep .mat-mdc-card-content {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 16px 20px 12px;
|
||||||
|
border-bottom: 1px solid #f0f2f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.count-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
padding: 0 8px;
|
||||||
|
margin-left: auto;
|
||||||
|
background: #e8edf5;
|
||||||
|
border-radius: 12px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description-text {
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 2fr 1fr;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: #fff;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-item:hover {
|
||||||
|
cursor:pointer;
|
||||||
|
background: #f8fafc;
|
||||||
|
border-color: #b8c5d6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #e8edf5;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-name {
|
||||||
|
cursor:pointer;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-grid {
|
||||||
|
cursor:pointer;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid #d9e2f0;
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
background: #fff;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--sg-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.institution-item mat-icon {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
font-size: 20px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.details-list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 140px 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 8px 0;
|
||||||
|
border-bottom: 1px solid #f0f2f5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dt {
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row dd {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--sg-text);
|
||||||
|
font-size: 13px;
|
||||||
|
word-break: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
.external-link {
|
||||||
|
color: var(--sg-primary, #0066cc);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.external-link:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
padding: 20px;
|
||||||
|
text-align: center;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-container {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
color: var(--sg-text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state mat-icon {
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
font-size: 48px;
|
||||||
|
color: #e74c3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-state p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
.content-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.detail-page {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-hero {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.metrics-grid {
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-row {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.person-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.metrics-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-actions {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action,
|
||||||
|
.secondary-action {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { DfgProjectDetails } from '../../../api';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
@Component({
|
||||||
|
selector: 'app-dfg-details',
|
||||||
|
standalone: true,
|
||||||
|
imports: [CommonModule, MatCardModule, MatIconModule],
|
||||||
|
templateUrl: './dfg-details.component.html',
|
||||||
|
styleUrl: './dfg-details.component.scss',
|
||||||
|
})
|
||||||
|
export class DfgDetailsComponent implements OnInit {
|
||||||
|
private route = inject(ActivatedRoute);
|
||||||
|
dfgProject: DfgProjectDetails | undefined;
|
||||||
|
|
||||||
|
constructor (private router:Router){}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.data.subscribe(({ dfgSingleProject }) => {
|
||||||
|
console.log('DFG Project:', dfgSingleProject);
|
||||||
|
this.dfgProject = dfgSingleProject;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getInitials(name: string | null | undefined): string {
|
||||||
|
if (!name) return '';
|
||||||
|
const parts = name.trim().split(/\s+/);
|
||||||
|
if (parts.length > 1) {
|
||||||
|
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
||||||
|
}
|
||||||
|
return parts[0][0].toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
getFundingStatus(fundingEndDate: string | null | undefined): string {
|
||||||
|
if (!fundingEndDate) return 'N/A';
|
||||||
|
if (fundingEndDate === '2999') return 'laufend';
|
||||||
|
const year = parseInt(fundingEndDate, 10);
|
||||||
|
if (isNaN(year)) return fundingEndDate;
|
||||||
|
return year >= new Date().getFullYear()
|
||||||
|
? `${fundingEndDate} (laufend)`
|
||||||
|
: `${fundingEndDate} (abgeschlossen)`;
|
||||||
|
}
|
||||||
|
searchForPersonName(personName: string): void {
|
||||||
|
this.router.navigate(['/persons'], {
|
||||||
|
queryParams: {
|
||||||
|
query: personName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
searchForInstitutionName(institutionName: string): void {
|
||||||
|
this.router.navigate(['/institutions'], {
|
||||||
|
queryParams: {
|
||||||
|
search: institutionName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* All associated persons as a simple list (no role grouping).
|
||||||
|
*/
|
||||||
|
getAssociatedPersons(): string[] {
|
||||||
|
return this.dfgProject?.associated_persons || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All institutions as a simple list.
|
||||||
|
*/
|
||||||
|
getInstitutions(): string[] {
|
||||||
|
return this.dfgProject?.institutions || [];
|
||||||
|
}
|
||||||
|
|
||||||
|
goBack(): void {
|
||||||
|
window.history.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
<div class="content">
|
||||||
|
<h1>Passende Projekte finden</h1>
|
||||||
|
|
||||||
|
<mat-divider />
|
||||||
|
|
||||||
|
<div style="padding: 0 1rem">
|
||||||
|
<mat-form-field style="width: 100%">
|
||||||
|
<mat-label>Suche nach Namen</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
type="search"
|
||||||
|
[debounceTime]="300"
|
||||||
|
[(debouncedValue)]="urlSearchTerm"
|
||||||
|
(debouncedValueChange)="handleSearchTermChange($event)" />
|
||||||
|
<mat-icon matPrefix>search</mat-icon>
|
||||||
|
<button matIconButton matSuffix (click)="clearSearchTerm()">
|
||||||
|
<mat-icon>clear</mat-icon>
|
||||||
|
</button>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style="
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
">
|
||||||
|
<mat-chip-listbox
|
||||||
|
[value]="urlChips()"
|
||||||
|
(change)="handleChipBoxChange($event)"
|
||||||
|
multiple>
|
||||||
|
<mat-chip-option value="eu">EU</mat-chip-option>
|
||||||
|
<mat-chip-option value="bund">BUND</mat-chip-option>
|
||||||
|
<mat-chip-option value="dfg">DFG</mat-chip-option>
|
||||||
|
</mat-chip-listbox>
|
||||||
|
|
||||||
|
<div class="sorting">
|
||||||
|
<select (change)="handleSortFieldChange($event)" [value]="urlSortBy()">
|
||||||
|
<option value="title">Name</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select
|
||||||
|
(change)="handleSortOrderChange($event)"
|
||||||
|
[value]="urlSortingOrder()">
|
||||||
|
<option value="desc">Absteigend</option>
|
||||||
|
<option value="asc">Aufsteigend</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-divider />
|
||||||
|
|
||||||
|
@let fundingProjectPageValue = fundingProjectPage();
|
||||||
|
|
||||||
|
@if (
|
||||||
|
fundingProjectPageValue.elements &&
|
||||||
|
fundingProjectPageValue.elements.length > 0
|
||||||
|
) {
|
||||||
|
<div class="cards">
|
||||||
|
@for (fundingProject of fundingProjectPageValue.elements; track $index) {
|
||||||
|
<mat-card
|
||||||
|
class="card"
|
||||||
|
appearance="outlined"
|
||||||
|
[routerLink]="getDetaiLink(fundingProject)">
|
||||||
|
<mat-card-header>
|
||||||
|
<mat-card-title>{{ fundingProject.title }}</mat-card-title>
|
||||||
|
<mat-card-subtitle>{{
|
||||||
|
fundingProject.type | uppercase
|
||||||
|
}}</mat-card-subtitle>
|
||||||
|
</mat-card-header>
|
||||||
|
|
||||||
|
<mat-card-content class="card-content">
|
||||||
|
<mat-divider />
|
||||||
|
<div class="card-metadata">
|
||||||
|
<span
|
||||||
|
>Von {{ fundingProject.start_date | date }} bis
|
||||||
|
{{ fundingProject.end_date | date }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<mat-divider />
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-footer>
|
||||||
|
<mat-card-actions>
|
||||||
|
<a
|
||||||
|
mat-button
|
||||||
|
[routerLink]="getDetaiLink(fundingProject)"
|
||||||
|
(click)="$event.stopPropagation()">
|
||||||
|
<mat-icon>info</mat-icon>
|
||||||
|
Übersicht
|
||||||
|
</a>
|
||||||
|
</mat-card-actions>
|
||||||
|
</mat-card-footer>
|
||||||
|
</mat-card>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<div class="no-results">
|
||||||
|
<p>Keine passenden Projekte gefunden.</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<mat-divider />
|
||||||
|
|
||||||
|
<mat-paginator
|
||||||
|
[length]="fundingProjectPageValue.total"
|
||||||
|
[pageSize]="fundingProjectPageValue.size"
|
||||||
|
[pageSizeOptions]="[10, 20, 50]"
|
||||||
|
[pageIndex]="fundingProjectPageValue.page"
|
||||||
|
(page)="handlePageChange($event)">
|
||||||
|
</mat-paginator>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
.content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sorting {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sorting select {
|
||||||
|
padding: 0.75rem;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sorting select:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cards {
|
||||||
|
display: grid;
|
||||||
|
gap: 1.5rem;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
padding: 0 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.cards {
|
||||||
|
grid-template-columns: repeat(2, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
.cards {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-paginator {
|
||||||
|
background-color: var(--sg-background);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
padding: 0.5rem;
|
||||||
|
background-color: var(--sg-background);
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-metadata {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--sg-text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-card-actions {
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-card-actions a {
|
||||||
|
width: 100%;
|
||||||
|
text-decoration: none;
|
||||||
|
border: 1px solid var(--sg-border);
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-results {
|
||||||
|
text-align: center;
|
||||||
|
padding: 2rem;
|
||||||
|
color: var(--sg-text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-mdc-standard-chip {
|
||||||
|
border-radius: var(--sg-radius-sm);
|
||||||
|
}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
import { Component, effect, input, signal } from '@angular/core';
|
||||||
|
import { FundingProject, FundingProjectPage, ProjectType } from '../../api';
|
||||||
|
import { MatDividerModule } from '@angular/material/divider';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { DebounceDirective } from '../../directives/debounce.directive';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
|
import { MatPaginator, PageEvent } from '@angular/material/paginator';
|
||||||
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { DatePipe, UpperCasePipe } from '@angular/common';
|
||||||
|
import { MatChipListboxChange, MatChipsModule } from '@angular/material/chips';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-projects',
|
||||||
|
imports: [
|
||||||
|
MatDividerModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
DebounceDirective,
|
||||||
|
MatIconModule,
|
||||||
|
MatCardModule,
|
||||||
|
RouterModule,
|
||||||
|
MatPaginator,
|
||||||
|
MatInputModule,
|
||||||
|
MatButtonModule,
|
||||||
|
UpperCasePipe,
|
||||||
|
DatePipe,
|
||||||
|
MatChipsModule,
|
||||||
|
],
|
||||||
|
templateUrl: './projects.component.html',
|
||||||
|
styleUrl: './projects.component.scss',
|
||||||
|
})
|
||||||
|
export class ProjectsComponent {
|
||||||
|
fundingProjectPage = input.required<FundingProjectPage>();
|
||||||
|
|
||||||
|
urlSearchTerm = signal<string>('');
|
||||||
|
urlSortBy = signal<string>('relevance');
|
||||||
|
urlSortingOrder = signal<string>('desc');
|
||||||
|
urlChips = signal<ProjectType[]>(['eu', 'bund', 'dfg']);
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly activatedRoute: ActivatedRoute,
|
||||||
|
private readonly router: Router,
|
||||||
|
) {
|
||||||
|
this.activatedRoute.queryParams
|
||||||
|
.pipe(takeUntilDestroyed())
|
||||||
|
.subscribe((params) => {
|
||||||
|
this.urlSearchTerm.set(params['search'] || '');
|
||||||
|
this.urlSortBy.set(params['sort_by'] || 'relevance');
|
||||||
|
this.urlSortingOrder.set(params['sorting_order'] || 'desc');
|
||||||
|
this.urlChips.set(
|
||||||
|
(params['selected_project_types'] || 'eu,bund,dfg').split(','),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
effect(() => {
|
||||||
|
const searchTerm = this.urlSearchTerm();
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { search: searchTerm },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSearchTermChange(newTerm: string): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { search: newTerm },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
clearSearchTerm(): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { search: null },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handlePageChange(event: PageEvent): void {
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { page: event.pageIndex, size: event.pageSize },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSortFieldChange(event: Event): void {
|
||||||
|
const selectElement = event.target as HTMLSelectElement;
|
||||||
|
const sortField = selectElement.value;
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { sort_by: sortField },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSortOrderChange(event: Event): void {
|
||||||
|
const selectElement = event.target as HTMLSelectElement;
|
||||||
|
const sortOrder = selectElement.value;
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: { sorting_order: sortOrder },
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleChipBoxChange(change: MatChipListboxChange): void {
|
||||||
|
const selectedValues = change.value as string[];
|
||||||
|
|
||||||
|
this.router.navigate([], {
|
||||||
|
queryParams: {
|
||||||
|
selected_project_types: selectedValues.length
|
||||||
|
? selectedValues.join(',')
|
||||||
|
: null,
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getDetaiLink(fundingProject: FundingProject): string | null {
|
||||||
|
if (fundingProject.type === 'bund') {
|
||||||
|
return '/projects/bund/' + fundingProject.id;
|
||||||
|
} else if (fundingProject.type === 'dfg') {
|
||||||
|
return '/projects/dfg/' + fundingProject.id;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import {
|
||||||
|
BundProjectPage,
|
||||||
|
ProjectsService,
|
||||||
|
ProjectsSortBy,
|
||||||
|
SortDirection,
|
||||||
|
} from '../api';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
|
||||||
|
export const bundProjectPageResolver: ResolveFn<BundProjectPage> = (
|
||||||
|
route,
|
||||||
|
state,
|
||||||
|
) => {
|
||||||
|
console.log('bundProjectPageResolver called with route:', route);
|
||||||
|
const page = route.queryParamMap.get('page') ?? '0';
|
||||||
|
const size = route.queryParamMap.get('size') ?? '10';
|
||||||
|
let institutionId = route.paramMap.get('institutionId');
|
||||||
|
if (!institutionId) {
|
||||||
|
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sortBy = (route.queryParamMap.get('sort_by') ??
|
||||||
|
'title') as ProjectsSortBy;
|
||||||
|
const sortDirection = (route.queryParamMap.get('sort_direction') ??
|
||||||
|
'asc') as SortDirection;
|
||||||
|
|
||||||
|
const search = route.queryParamMap.get('search');
|
||||||
|
|
||||||
|
return inject(ProjectsService).searchBundProjects({
|
||||||
|
project_type: 'bund',
|
||||||
|
page: Number(page),
|
||||||
|
size: Number(size),
|
||||||
|
raw_oa_institution_id: institutionId,
|
||||||
|
query: search,
|
||||||
|
sort_by: sortBy,
|
||||||
|
sort_direction: sortDirection,
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { InstitutionFunderSummary, ProjectsService } from '../api';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
|
||||||
|
export const bundProjectsFundingResolver: ResolveFn<
|
||||||
|
InstitutionFunderSummary
|
||||||
|
> = (route, state) => {
|
||||||
|
let institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
||||||
|
if (!institutionId) {
|
||||||
|
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
||||||
|
}
|
||||||
|
return inject(ProjectsService).getInstitutionBundProjectsFundingOverTime(
|
||||||
|
institutionId!,
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { ProjectsService } from '../api/api/projects.service';
|
||||||
|
import { BundProjectDetails } from '../api/model/bundProjectDetails';
|
||||||
|
|
||||||
|
export const bundSingleProjectResolver: ResolveFn<BundProjectDetails> = (
|
||||||
|
route,
|
||||||
|
state,
|
||||||
|
) => {
|
||||||
|
const projectsService = inject(ProjectsService);
|
||||||
|
const projectId = route.paramMap.get('id');
|
||||||
|
if (!projectId) {
|
||||||
|
throw new Error('BUND Project ID is required');
|
||||||
|
}
|
||||||
|
return projectsService.getSingleBundProject(projectId);
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { CordisEuProjectPage, ProjectsService } from '../api';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
|
||||||
|
export const cordisEuProjectPageResolver: ResolveFn<CordisEuProjectPage> = (
|
||||||
|
route,
|
||||||
|
state,
|
||||||
|
) => {
|
||||||
|
const page = route.queryParamMap.get('page') ?? '1';
|
||||||
|
const size = route.queryParamMap.get('size') ?? '10';
|
||||||
|
let institutionId = route.paramMap.get('institutionId');
|
||||||
|
if (!institutionId) {
|
||||||
|
institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const sortBy = route.queryParamMap.get('sort_by') ?? 'title';
|
||||||
|
const sortDirection = route.queryParamMap.get('sort_direction') ?? 'asc';
|
||||||
|
const search = route.queryParamMap.get('search');
|
||||||
|
|
||||||
|
return inject(ProjectsService).searchCordisEuProjects({
|
||||||
|
project_type: 'eu',
|
||||||
|
page: Number(page),
|
||||||
|
size: Number(size),
|
||||||
|
raw_oa_institution_id: institutionId,
|
||||||
|
query: search,
|
||||||
|
sort_by: sortBy as 'title' | 'funding_start' | 'funding_end',
|
||||||
|
sort_direction: sortDirection as 'asc' | 'desc',
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { InstitutionFunderSummary, ProjectsService } from '../api';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
|
||||||
|
export const cordisEuProjectsFundingResolver: ResolveFn<
|
||||||
|
InstitutionFunderSummary
|
||||||
|
> = (route, state) => {
|
||||||
|
let institutionId = route.parent?.paramMap.get('institutionId') ?? null;
|
||||||
|
if (!institutionId) {
|
||||||
|
throw new Error(
|
||||||
|
'Institution ID is required to resolve Cordis EU projects funding',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return inject(ProjectsService).getInstitutionCordisEuProjectsFundingOverTime(
|
||||||
|
institutionId,
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { ProjectsService } from '../api/api/projects.service';
|
||||||
|
import { DfgProjectDetails } from '../api';
|
||||||
|
|
||||||
|
export const dfgSingleProjectResolver: ResolveFn<DfgProjectDetails> = (
|
||||||
|
route,
|
||||||
|
state,
|
||||||
|
) => {
|
||||||
|
const projectsService = inject(ProjectsService);
|
||||||
|
const projectId = route.paramMap.get('id');
|
||||||
|
if (!projectId) {
|
||||||
|
throw new Error('DFG Project ID is required');
|
||||||
|
}
|
||||||
|
return projectsService.getSingleDfgProject(projectId);
|
||||||
|
};
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import {
|
||||||
|
FundingProjectPage,
|
||||||
|
ProjectsService,
|
||||||
|
ProjectsSortBy,
|
||||||
|
ProjectType,
|
||||||
|
SortDirection,
|
||||||
|
} from '../api';
|
||||||
|
import { inject } from '@angular/core';
|
||||||
|
|
||||||
|
export const fundingProjectPageResolver: ResolveFn<FundingProjectPage> = (
|
||||||
|
route,
|
||||||
|
state,
|
||||||
|
) => {
|
||||||
|
const page = Number(route.queryParamMap.get('page') || '0');
|
||||||
|
const size = Number(route.queryParamMap.get('size') || '10');
|
||||||
|
const sortBy = (route.queryParamMap.get('sort_by') ??
|
||||||
|
'title') as ProjectsSortBy;
|
||||||
|
const sortOrder = (route.queryParamMap.get('sorting_order') ??
|
||||||
|
'asc') as SortDirection;
|
||||||
|
const title = route.queryParamMap.get('search') ?? undefined;
|
||||||
|
const selectedProjectTypes = route.queryParamMap.get('selected_project_types')
|
||||||
|
? new Set(
|
||||||
|
route.queryParamMap
|
||||||
|
.get('selected_project_types')!
|
||||||
|
.split(',') as ProjectType[],
|
||||||
|
)
|
||||||
|
: undefined;
|
||||||
|
return inject(ProjectsService).searchProjects(
|
||||||
|
page,
|
||||||
|
size,
|
||||||
|
selectedProjectTypes,
|
||||||
|
title,
|
||||||
|
sortBy,
|
||||||
|
sortOrder,
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { inject } from '@angular/core';
|
||||||
|
import { ResolveFn } from '@angular/router';
|
||||||
|
import { InstitutionPage, InstitutionsService } from '../api';
|
||||||
|
|
||||||
|
export const institutionsResolver: ResolveFn<InstitutionPage> = (
|
||||||
|
route,
|
||||||
|
state,
|
||||||
|
) => {
|
||||||
|
const queryParamMap = route.queryParamMap;
|
||||||
|
const query = queryParamMap.get('search') ?? '';
|
||||||
|
const page = Number(queryParamMap.get('page') ?? '0');
|
||||||
|
const pageSize = Number(queryParamMap.get('size') ?? '10');
|
||||||
|
const sortBy = (queryParamMap.get('sort_by') ?? 'works_count') as
|
||||||
|
| 'relevance'
|
||||||
|
| 'name'
|
||||||
|
| 'works_count'
|
||||||
|
| 'citations_count';
|
||||||
|
const sortOrder = (queryParamMap.get('sorting_order') ?? 'desc') as
|
||||||
|
| 'asc'
|
||||||
|
| 'desc';
|
||||||
|
|
||||||
|
return inject(InstitutionsService).searchInstitutionsByName(
|
||||||
|
query,
|
||||||
|
page,
|
||||||
|
pageSize,
|
||||||
|
sortBy,
|
||||||
|
sortOrder,
|
||||||
|
);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user