feature/dfg-details #152

Merged
genja merged 24 commits from feature/dfg-details into dev 2026-06-19 11:39:48 +02:00
51 changed files with 3788 additions and 106 deletions
@@ -208,55 +208,37 @@ class InstitutionsSearchClient:
if query_text:
stripped = query_text.strip()
must.append(
{
"bool": {
"should": [
# Fast prefix matching via search_as_you_type shingles
{
"multi_match": {
"query": stripped,
"type": "bool_prefix",
"fields": [
"display_name.search",
"display_name.search._2gram",
"display_name.search._3gram",
"display_name_alternatives.search",
"display_name_alternatives.search._2gram",
],
"boost": 2,
}
},
# Exact acronym match — high confidence signal
{
"term": {
"display_name_acronyms.keyword": {
"value": stripped.upper(),
"boost": 10,
}
}
},
# Fuzzy fallback for typos (only worth it for longer input)
*(
[
{
"match": {
"display_name": {
"query": stripped,
"fuzziness": "AUTO",
"boost": 1,
}
}
}
]
if len(stripped) >= 4
else []
),
],
"minimum_should_match": 1,
must.append({
"bool": {
"should": [
{
"wildcard": {
"display_name.keyword": {
"value": f"*{stripped}*",
"boost": 2
}
}
},
{
"wildcard": {
"display_name_alternatives.keyword": {
"value": f"*{stripped}*",
"boost": 2
}
}
},
{
"wildcard": {
"display_name_acronyms.keyword": {
"value": f"*{stripped.upper()}*",
"boost": 10
}
}
}
}
)
],
"minimum_should_match": 1
}
})
filter_queries = []
+22 -22
View File
@@ -81,28 +81,6 @@ async def search_institutions_by_name(
)
@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(
"/autocomplete",
operation_id="autocompleteInstitutions",
@@ -142,6 +120,28 @@ async def autocomplete_institutions(
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(
"",
+4 -3
View File
@@ -16,15 +16,15 @@ from inse.collaboration_network.router import router as collaboration_network_ro
from inse.company_connections.service import router as company_connections_router
from inse.exceptions import NotFoundException
from inse.funders.service import router as funders_service_router
from inse.institutions.router import router as institutions_router
from inse.projects.router import router as projects_router
from inse.university_ranking.router import router as university_ranking_router
# caching
from inse.middleware.etag_cache import ETagCacheMiddleware
from inse.persons.service import router as persons_service_router
from inse.projects.router import router as projects_router
from inse.topics.service import router as topics_service_router
from inse.works.service import router as works_service_router
from inse.institutions.router import router as institutions_router
from . import config
from .account.service import router as account_router
from .service import router as service_router
@@ -51,6 +51,7 @@ app.include_router(funders_service_router)
app.include_router(company_connections_router)
app.include_router(service_router)
app.include_router(account_router)
app.include_router(university_ranking_router)
app.include_router(projects_router)
app.add_middleware(
@@ -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,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)
@@ -33,7 +33,7 @@ class Institution(BaseModel):
"""
A university, research organization, or other affiliation
""" # noqa: E501
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this institution.")
id: Optional[StrictStr] = Field(default=None, description="The OpenAlex ID for this institution.", json_schema_extra={"examples": ["https://openalex.org/I27837315"]})
ror: Optional[StrictStr] = Field(default=None, description="The ROR ID for this institution. This is the Canonical External ID for institutions.")
display_name: Optional[StrictStr] = Field(default=None, description="The primary name of the institution.")
country_code: Optional[StrictStr] = Field(default=None, description="ISO two-letter country code where this institution is located.")
@@ -55,20 +55,13 @@ class Institution(BaseModel):
updated_date: Optional[datetime] = Field(default=None, description="When this institution was last updated (ISO 8601 datetime).")
__properties: ClassVar[List[str]] = ["id", "ror", "display_name", "country_code", "type", "homepage_url", "image_url", "image_thumbnail_url", "display_name_acronyms", "display_name_alternatives", "works_count", "cited_by_count", "summary_stats", "geo", "lineage", "ids", "counts_by_year", "works_api_url", "created_date", "updated_date"]
@field_validator('created_date', mode='before')
@classmethod
def normalize_created_date(cls, v: Any) -> Any:
if isinstance(v, str) and len(v) > 10:
return v[:10]
return v
@field_validator('type')
def type_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
return value
if value not in set(['education','funder', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']):
if value not in set(['education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other']):
raise ValueError("must be one of enum values ('education', 'healthcare', 'company', 'archive', 'nonprofit', 'government', 'facility', 'other')")
return value
@@ -161,3 +154,5 @@ class Institution(BaseModel):
"updated_date": obj.get("updated_date")
})
return _obj
@@ -17,6 +17,8 @@ from inse.projects.model import (
SortDirection,
)
from inse.models.eu_project import EuProject
from inse.models.dfg_project_details import DfgProjectDetails
from inse.models.bund_project_details import BundProjectDetails
from inse.models.cordis_eu_project import CordisEuProject
@@ -243,6 +245,47 @@ class BundProjectsSearchClient(ProjectsSearchClient):
response = await self.make_search_request(query)
return self.response_to_bund_project_page(response, page, size)
async def get_bund_projects_by_institution_name(
self,
institution_names: List[str],
page: int,
size: int,
sort_by: str = "topic",
sort_direction: str = "asc",
) -> BundProjectPage:
query = self.bund_projects_query(
page=page,
size=size,
institution_names=institution_names,
sort_by=sort_by,
sort_direction=sort_direction,
)
response = await self.make_search_request(query)
return self.response_to_bund_project_page(response, page, size)
async def get_bund_project_by_id(self, project_id: str) -> Optional[BundProjectDetails]:
query= {
"query": {
"term": {
"Förderkennzeichen.keyword": {
"value": project_id
}
}
},
"_source":True
}
response = await self.make_search_request(query)
hits = response.get("hits", {}).get("hits", [])
if hits:
hit = hits[0]
print(hit)
details = BundProjectDetails.from_elastic_hit(hit=hit)
return details
return None
class EuProjectsSearchClient(ProjectsSearchClient):
def __init__(self):
@@ -753,3 +796,18 @@ class DfgProjectsSearchClient(ProjectsSearchClient):
)
response = await self.make_search_request(query)
return self.response_to_dfg_project_page(response, page, size)
async def get_dfg_project_by_id(self, project_id: str) -> Optional[DfgProjectDetails]:
query = {
"query": {"ids": {"values": [project_id]}},
"_source": True
}
response = await self.make_search_request(query)
hits = response.get("hits", {}).get("hits", [])
if hits:
hit = hits[0]
details = DfgProjectDetails.from_elastic_hit(hit=hit)
return details
return None
+55 -1
View File
@@ -2,7 +2,7 @@ from functools import lru_cache
import logging
from typing import Annotated, Optional
from fastapi import APIRouter, Body, Depends, Query, status
from fastapi import APIRouter, Body, Depends,Path, Query, status
from inse.projects.model import (
BundProjectPage,
@@ -11,6 +11,8 @@ from inse.projects.model import (
InstitutionFunderSummary,
ProjectsFilteringProperties,
)
from inse.models.dfg_project_details import DfgProjectDetails
from inse.models.bund_project_details import BundProjectDetails
from inse.tags import Tags
from inse.projects import service as projects_service
from inse.projects.projects_search_client import (
@@ -76,6 +78,58 @@ async def search_bund_projects(
)
@router.get(
"/dfg/{id}",
summary="Get a single DFG project.",
description="Returns a single DFG project based on its ID.",
operation_id="getSingleDfgProject",
responses={
status.HTTP_200_OK: {
"description": "Successful Response",
"model": DfgProjectDetails,
},
status.HTTP_404_NOT_FOUND: {"description": "Project not found"},
},
response_model_by_alias=False,
)
async def get_single_dfg_project(
dfg_search_client: Annotated[
DfgProjectsSearchClient, Depends(get_dfg_search_client)
],
id: Annotated[str, Path(description="The ID of the DFG project to retrieve.")],
) -> DfgProjectDetails:
logger.debug(f"Received request to get single DFG project for id={id}")
return await projects_service.get_single_dfg_project(
dfg_search_client=dfg_search_client,
project_id=id,
)
@router.get(
"/bund/{id}",
summary="Get a single BUND project.",
description="Returns a single BUND project based on its ID.",
operation_id="getSingleBundProject",
responses={
status.HTTP_200_OK: {
"description": "Successful Response",
"model": BundProjectDetails,
},
status.HTTP_404_NOT_FOUND: {"description": "Project not found"},
},
response_model_by_alias=False,
)
async def get_single_bund_project(
bund_search_client: Annotated[
BundProjectsSearchClient, Depends(get_bund_search_client)
],
id: Annotated[str, Path(description="The ID of the BUND project to retrieve.")],
) -> BundProjectDetails:
logger.debug(f"Received request to get single BUND project for id={id}")
return await projects_service.get_single_bund_project(
bund_search_client=bund_search_client,
project_id=id,
)
@router.get(
"/institution/bund/funding-over-time",
summary="Get funding over time for bund projects.",
+26
View File
@@ -16,6 +16,8 @@ from inse.projects.model import (
ProjectType,
ProjectsFilteringProperties,
)
from inse.models.dfg_project_details import DfgProjectDetails
from inse.models.bund_project_details import BundProjectDetails
from inse.institutions.institutions_search_client import (
InstitutionsSearchClient,
)
@@ -326,3 +328,27 @@ def _calculate_funding_over_time(
funding_per_year=sorted_funding_per_year,
annual_average_over_period=annual_average_over_period,
)
async def get_single_dfg_project(
dfg_search_client: DfgProjectsSearchClient,
project_id: str,
) -> DfgProjectDetails:
logger.debug(f"Fetching single DFG project for id={project_id}")
project = await dfg_search_client.get_dfg_project_by_id(project_id)
if not project:
raise NotFoundException(f"DFG project with id {project_id} not found")
return project
async def get_single_bund_project(
bund_search_client: BundProjectsSearchClient,
project_id: str,
) -> BundProjectDetails:
logger.debug(f"Fetching single BUND project for id={project_id}")
project = await bund_search_client.get_bund_project_by_id(project_id)
if not project:
raise NotFoundException(f"BUND project with id {project_id} not found")
return project
@@ -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)
@@ -39,6 +39,7 @@ model/autocompleteResponseResultsInner.ts
model/award.ts
model/bodyCreateUser.ts
model/bundProject.ts
model/bundProjectDetails.ts
model/bundProjectPage.ts
model/careerMetrics.ts
model/collaborationNetwork.ts
@@ -55,6 +56,7 @@ model/dehydratedAuthor.ts
model/dehydratedFunder.ts
model/dehydratedInstitution.ts
model/dehydratedSource.ts
model/dfgProjectDetails.ts
model/dfgProjectPage.ts
model/dfgProjectSummary.ts
model/filterInformation.ts
@@ -92,6 +94,7 @@ model/projectsSortBy.ts
model/publicationDetailByFunder.ts
model/publicationIdsByAuthorPosition.ts
model/publicationsByAuthorResponse.ts
model/rankingResponse.ts
model/score.ts
model/sortDirection.ts
model/topic.ts
@@ -104,6 +107,8 @@ model/topics.ts
model/topicsByTime.ts
model/topicsByYear.ts
model/topicsListResponse.ts
model/universityRanking.ts
model/universityTopicData.ts
model/user.ts
model/validationError.ts
model/validationErrorLocInner.ts
@@ -127,6 +132,7 @@ model/workTopicInformation.ts
model/workTopicSubfield.ts
model/worksFilterProperties.ts
model/worksListResponse.ts
model/yearlyData.ts
param.ts
provide-api.ts
variables.ts
+69 -4
View File
@@ -17,15 +17,17 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { AutocompleteResponse } from '../model/autocompleteResponse';
import { AutocompleteResponse } from '../model/autocomplete-response';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { Institution } from '../model/institution';
// @ts-ignore
import { InstitutionPage } from '../model/institutionPage';
import { InstitutionPage } from '../model/institution-page';
// @ts-ignore
import { InstitutionsListResponse } from '../model/institutionsListResponse';
import { InstitutionsListResponse } from '../model/institutions-list-response';
// @ts-ignore
import { RankingResponse } from '../model/ranking-response';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
@@ -168,6 +170,69 @@ export class InstitutionsService extends BaseService {
);
}
/**
* Returns data for the University Ranking Dashboard.
* @endpoint get /api/inse-service/university-rankings
* @param topic Research topic (e.g., \&#39;Artificial Intelligence\&#39;)
* @param metric Metric to rank by
* @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 getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<RankingResponse>;
public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<RankingResponse>>;
public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<RankingResponse>>;
public getRankingsApiInseServiceUniversityRankingsGet(topic: 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology', metric?: 'publications' | 'citations', observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (topic === null || topic === undefined) {
throw new Error('Required parameter topic was null or undefined when calling getRankingsApiInseServiceUniversityRankingsGet.');
}
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>topic, 'topic');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>metric, 'metric');
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/university-rankings`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<RankingResponse>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Returns a list of OpenAlex institutions.
* @endpoint get /api/inse-service/institutions
+116
View File
@@ -16,11 +16,15 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { BundProjectDetails } from '../model/bundProjectDetails';
// @ts-ignore
import { BundProjectPage } from '../model/bundProjectPage';
// @ts-ignore
import { CordisEuProjectPage } from '../model/cordisEuProjectPage';
// @ts-ignore
import { DfgProjectDetails } from '../model/dfgProjectDetails';
// @ts-ignore
import { DfgProjectPage } from '../model/dfgProjectPage';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
@@ -243,6 +247,118 @@ export class ProjectsService extends BaseService {
);
}
/**
* Get a single BUND project.
* Returns a single BUND project based on its ID.
* @endpoint get /api/projects/bund/{id}
* @param id The ID of the BUND project to retrieve.
* @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 getSingleBundProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<BundProjectDetails>;
public getSingleBundProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<BundProjectDetails>>;
public getSingleBundProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<BundProjectDetails>>;
public getSingleBundProject(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getSingleBundProject.');
}
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/projects/bund/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<BundProjectDetails>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Get a single DFG project.
* Returns a single DFG project based on its ID.
* @endpoint get /api/projects/dfg/{id}
* @param id The ID of the DFG project to retrieve.
* @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 getSingleDfgProject(id: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<DfgProjectDetails>;
public getSingleDfgProject(id: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<DfgProjectDetails>>;
public getSingleDfgProject(id: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<DfgProjectDetails>>;
public getSingleDfgProject(id: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getSingleDfgProject.');
}
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/projects/dfg/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<DfgProjectDetails>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
/**
* Get bund projects.
* Returns a page of bund projects based on the provided pagination parameters and optional institution filter.
+20
View File
@@ -0,0 +1,20 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
* Nested object for international co-applicants.
*/
export interface Auslaend {
' Mitantragstellerin'?: string | null;
' Mitantragstellerinnen'?: string | null;
' Mitantragstellerinnen / ausländische Mitantragsteller'?: string | null;
}
@@ -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,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;
}
+5
View File
@@ -34,6 +34,7 @@ export * from './dehydratedAuthor';
export * from './dehydratedFunder';
export * from './dehydratedInstitution';
export * from './dehydratedSource';
export * from './dfgProjectDetails';
export * from './dfgProjectPage';
export * from './dfgProjectSummary';
export * from './filterInformation';
@@ -70,6 +71,7 @@ export * from './projectsSortBy';
export * from './publicationDetailByFunder';
export * from './publicationIdsByAuthorPosition';
export * from './publicationsByAuthorResponse';
export * from './rankingResponse';
export * from './score';
export * from './sortDirection';
export * from './topic';
@@ -82,6 +84,8 @@ export * from './topics';
export * from './topicsByTime';
export * from './topicsByYear';
export * from './topicsListResponse';
export * from './universityRanking';
export * from './universityTopicData';
export * from './user';
export * from './validationError';
export * from './validationErrorLocInner';
@@ -105,3 +109,4 @@ export * from './workTopicInformation';
export * from './workTopicSubfield';
export * from './worksFilterProperties';
export * from './worksListResponse';
export * from './yearlyData';
+98
View File
@@ -0,0 +1,98 @@
/**
* 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 { Auslaend } from './auslaend';
import { Stellvertr } from './stellvertr';
/**
* Main document model for the projects_dfg_all index.
*/
export interface ProjectDfg {
'Antragstellende Institution'?: string | null;
Antragsteller?: string | null;
Antragstellerin?: string | null;
Antragstellerinnen?: string | null;
'Antragstellerinnen / Antragsteller'?: string | null;
Anwendungspartner?: string | null;
'Beteiligte Einrichtung'?: string | null;
'Beteiligte Hochschule'?: string | null;
'Beteiligte Institution'?: string | null;
'Beteiligte Person'?: string | null;
'Beteiligte Personen'?: string | null;
'Co-Sprecher'?: string | null;
'Co-Sprecherinnen / Co-Sprecher'?: string | null;
'DFG-Verfahren'?: string | null;
'Ehemalige Antragsteller'?: string | null;
'Ehemalige Antragstellerin'?: string | null;
'Ehemalige Antragstellerinnen'?: string | null;
'Ehemalige Antragstellerinnen / Ehemalige Antragsteller'?: string | null;
'Ehemaliger Antragsteller'?: string | null;
'Fachliche Zuordnung'?: string | null;
'Förderung'?: string | null;
Gastgeber?: string | null;
Gastgeberin?: string | null;
Gastgeberinnen?: string | null;
'Gastgeberinnen / Gastgeber'?: string | null;
'Gerätegruppe'?: string | null;
'Großgeräte'?: string | null;
'IGK-Partnerinstitution'?: string | null;
'Internationaler Bezug'?: string | null;
Kooperationspartner?: string | null;
Kooperationspartnerin?: string | null;
Kooperationspartnerinnen?: string | null;
'Kooperationspartnerinnen / Kooperationspartner'?: string | null;
Leiter?: string | null;
Leiterin?: string | null;
Leiterinnen?: string | null;
'Leiterinnen / Leiter'?: string | null;
'Mitantragstellende Institution'?: string | null;
Mitantragsteller?: string | null;
Mitantragstellerin?: string | null;
Mitantragstellerinnen?: string | null;
'Mitantragstellerinnen / Mitantragsteller'?: string | null;
Mitverantwortlich?: string | null;
'Mitverantwortlich(e)'?: string | null;
Mitverantwortliche?: string | null;
Partnerorganisation?: string | null;
Projektkennung?: string | null;
Sprecher?: string | null;
'Sprecher (IGK-Partner)'?: string | null;
Sprecherin?: string | null;
'Sprecherin (IGK-Partner)'?: string | null;
Sprecherinnen?: string | null;
'Sprecherinnen (IGK-Partner) / Sprecher (IGK-Partner)'?: string | null;
'Sprecherinnen / Sprecher'?: string | null;
'Teilprojekt zu'?: string | null;
Teilprojektleiter?: string | null;
Teilprojektleiterin?: string | null;
Teilprojektleiterinnen?: string | null;
'Teilprojektleiterinnen / Teilprojektleiter'?: string | null;
Unternehmen?: string | null;
Webseite?: string | null;
'ausländ'?: Auslaend | null;
'ausländische Mitantragsteller'?: string | null;
'ausländischer Mitantragsteller'?: string | null;
'beteiligte Wissenschaftler'?: string | null;
'beteiligte Wissenschaftlerin'?: string | null;
'beteiligte Wissenschaftlerinnen'?: string | null;
'beteiligte Wissenschaftlerinnen / beteiligte Wissenschaftler'?: string | null;
'beteiligter Wissenschaftler'?: string | null;
description?: string | null;
funding_end?: string | null;
funding_start?: string | null;
id?: string | null;
link?: string | null;
path?: string | null;
person_creater_address?: string | null;
person_creater_name?: string | null;
stellvertr?: Stellvertr | null;
title?: string | null;
}
@@ -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>;
}
+21
View File
@@ -0,0 +1,21 @@
/**
* 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 { StellvertrSprecherinnen } from './stellvertrSprecherinnen';
/**
* Nested object for deputy speakers.
*/
export interface Stellvertr {
' Sprecher'?: string | null;
' Sprecherin'?: string | null;
' Sprecherinnen / stellvertr'?: StellvertrSprecherinnen | null;
}
@@ -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.
*/
/**
* Deeply nested object within stellvertr.
*/
export interface StellvertrSprecherinnen {
' Sprecher'?: 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.
*/
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 = {
Artificial_Intelligence: 'Artificial Intelligence',
Quantum_Computing: 'Quantum Computing',
Renewable_Energy: 'Renewable Energy',
Biotechnology: 'Biotechnology'
} as const;
export type TopicEnum = typeof TopicEnum[keyof typeof TopicEnum];
}
+17
View File
@@ -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;
}
+26
View File
@@ -9,6 +9,8 @@ import { bundProjectPageResolver } from './resolvers/bund-project-page.resolver'
import { dfgProjectsResolver } from './resolvers/dfg-projects.resolver';
import { institutionsResolver } from './resolvers/institutions.resolver';
import { bundProjectsFundingResolver } from './resolvers/bund-projects-funding.resolver';
import { dfgSingleProjectResolver } from './resolvers/dfg-single-project-resolver';
import { bundSingleProjectResolver } from './resolvers/bund-single-project-resolver';
import { cordisEuProjectPageResolver } from './resolvers/cordis-eu-project-page.resolver';
import { cordisEuProjectsFundingResolver } from './resolvers/cordis-eu-projects-funding.resolver';
@@ -87,6 +89,30 @@ export const routes: Routes = [
(mod) => mod.PublicationDetailComponent,
),
},
{
path: 'projects/dfg/:id',
canActivate: [userGuard],
pathMatch: 'full',
loadComponent: () =>
import('./modules/person-projects/dfg-details/dfg-details.component').then(
(mod) => mod.DfgDetailsComponent,
),
resolve: {
dfgSingleProject: dfgSingleProjectResolver,
},
},
{
path: 'projects/bund/:id',
canActivate: [userGuard],
pathMatch: 'full',
loadComponent: () =>
import('./modules/person-projects/bund-details/bund-details.component').then(
(mod) => mod.BundDetailsComponent,
),
resolve: {
bundSingleProject: bundSingleProjectResolver,
},
},
{
path: 'person/:id',
canActivate: [userGuard],
@@ -0,0 +1,28 @@
<div class="dashboard-wrapper">
<header class="dashboard-header">
<h2>University Performance Dashboard</h2>
<div class="controls">
<select (change)="onTopicChange($any($event.target).value)">
@for (t of topics; track t){
<option [value]="t">{{t}}</option>
}
</select>
<div class="toggle-group">
<button [class.active]="metric === 'publications'" (click)="setMetric('publications')">Publications</button>
<button [class.active]="metric === 'citations'" (click)="setMetric('citations')">Citations</button>
</div>
</div>
</header>
<div class="content-grid">
<section class="chart-section">
<app-university-line-chart [data]="rawDataSource" [metric]="metric"></app-university-line-chart>
</section>
<aside class="table-section">
<app-university-ranking-table [rankings]="computedRankings" [loading]="isLoading"></app-university-ranking-table>
</aside>
</div>
</div>
@@ -0,0 +1,73 @@
// src/app/modules/university-ranking/dashboard.component.scss
.dashboard-wrapper {
padding: 2rem;
font-family: 'Inter', sans-serif;
color: #333;
.dashboard-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
border-bottom: 1px solid #eee;
padding-bottom: 1rem;
}
.content-grid {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 2rem;
@media (max-width: 1024px) {
grid-template-columns: 1fr;
}
}
.controls {
display: flex;
gap: 1rem;
select {
padding: 0.5rem;
border-radius: 4px;
border: 1px solid #ccc;
}
.toggle-group {
button {
padding: 0.5rem 1rem;
border: 1px solid #0056b3;
background: white;
color: #0056b3;
cursor: pointer;
&:first-child { border-radius: 4px 0 0 4px; }
&:last-child { border-radius: 0 4px 4px 0; }
&.active { background: #0056b3; color: white; }
}
}
}
}
// Table styling
.ranking-table {
width: 100%;
border-collapse: collapse;
font-size: 0.9rem;
th, td {
padding: 0.75rem;
text-align: left;
border-bottom: 1px solid #f0f0f0;
}
.top-tier { background-color: #f8fbff; font-weight: 600; }
.positive { color: #28a745; }
.negative { color: #dc3545; }
.mover-badge { margin-left: 4px; font-size: 0.8rem; }
.trend-col {
font-weight: bold;
&[data-trend="up"] { color: #28a745; }
&[data-trend="down"] { color: #dc3545; }
}
}
@@ -1,10 +1,53 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { UniversityRankingService } from '../university-ranking/services/uni-ranking-service';
import {UniversityLineChartComponent} from '../university-ranking/uni-line-chart/uni-line-chart.component';
import { UniversityRankingTableComponent } from '../university-ranking/uni-ranking-table/uni-ranking-table.component';
import { UniversityTopicData, UniversityRanking } from '../../api';
export type ResearchTopic = 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology';
export type DashboardMetric = 'publications' | 'citations';
@Component({
selector: 'app-dashboard',
imports: [],
selector: 'dashboard',
imports: [UniversityLineChartComponent,UniversityRankingTableComponent],
templateUrl: './dashboard.component.html',
styleUrl: './dashboard.component.scss',
standalone: true,
})
export class DashboardComponent {}
export class DashboardComponent implements OnInit {
topics: ResearchTopic[] = ['Artificial Intelligence', 'Quantum Computing', 'Renewable Energy', 'Biotechnology'];
selectedTopic: ResearchTopic = 'Artificial Intelligence';
metric: DashboardMetric = 'publications';
rawDataSource: UniversityTopicData[] = [];
computedRankings: UniversityRanking[] = [];
isLoading = false;
constructor(private dataService: UniversityRankingService) {}
ngOnInit() {
this.loadData();
}
onTopicChange(topic: ResearchTopic) {
this.selectedTopic = topic;
this.loadData(); // Re-fetch as rankings depend on the topic
}
setMetric(metric: DashboardMetric) {
this.metric = metric;
this.loadData(); // Re-fetch as ranking order changes based on metric
}
private loadData() {
this.isLoading = true;
this.dataService.getRankingData(this.selectedTopic, this.metric).subscribe(response => {
// Map backend snake_case properties to frontend camelCase if necessary,
// though OpenAPI Generator usually handles this.
console.log(response);
this.rawDataSource = (response.timeseries as any) || [];
this.computedRankings = (response.rankings as any) || [];
this.isLoading = false;
});
}
}
@@ -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();
}
}
@@ -26,7 +26,10 @@
[detailTemplate]="dfgProjectDetailRowTmp"
[activeSortKey]="urlSortKey()"
[sortDirection]="urlSortDirection()"
(sortChange)="handleSortChange($event)" />
(sortChange)="handleSortChange($event)"
[navigatePrefix]="'projects/dfg/'"
[navigateField]="'id'"/>
</mat-tab>
</mat-tab-group>
<mat-paginator
@@ -0,0 +1,20 @@
// src/app/modules/university-ranking/services/university-data.service.ts
import { inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { InstitutionsService, RankingResponse } from '../../../api';
export type ResearchTopic = 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology';
export type DashboardMetric = 'publications' | 'citations';
@Injectable({ providedIn: 'root' })
export class UniversityRankingService {
private apiService = inject(InstitutionsService);
/**
* Fetches ranking and timeseries data directly from the backend.
* Calculations for growth and trends are now handled server-side.
*/
getRankingData(topic: ResearchTopic, metric: DashboardMetric): Observable<RankingResponse> {
return this.apiService.getRankingsApiInseServiceUniversityRankingsGet(topic, metric);
}
}
@@ -0,0 +1,6 @@
<div
echarts
[options]="chartOption"
[merge]="mergeOption"
class="chart-container">
</div>
@@ -0,0 +1 @@
.chart-container { height: 500px; width: 100%; }
@@ -0,0 +1,57 @@
// src/app/modules/university-ranking/components/line-chart/university-line-chart.component.ts
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { EChartsOption } from 'echarts';
import { NgxEchartsDirective} from 'ngx-echarts';
import { UniversityTopicData, YearlyData } from '../../../api';
export type ResearchTopic = 'Artificial Intelligence' | 'Quantum Computing' | 'Renewable Energy' | 'Biotechnology';
export type DashboardMetric = 'publications' | 'citations';
@Component({
selector: 'app-university-line-chart',
templateUrl: './uni-line-chart.component.html',
styleUrl: './uni-line-chart.component.scss',
imports: [NgxEchartsDirective],
standalone: true,
})
export class UniversityLineChartComponent implements OnChanges {
@Input() data: UniversityTopicData[] = [];
@Input() metric: DashboardMetric = 'publications';
chartOption: EChartsOption = {
title: { text: 'Research Output Over Time', left: 'center', textStyle: { fontWeight: 'lighter' } },
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
legend: { bottom: 0 },
grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
xAxis: { type: 'category', boundaryGap: false, data: [] },
yAxis: { type: 'value', name: 'Volume' },
dataZoom: [{ type: 'slider', show: true, bottom: 40 }],
series: []
};
mergeOption: EChartsOption = {};
ngOnChanges(changes: SimpleChanges): void {
if (this.data.length > 0) {
this.updateChart();
console.log("CHANGES!")
}
}
private updateChart() {
const years = this.data[0].yearly_data.map(d => d.year);
const series = this.data.map(uni => ({
name: uni.university,
type: 'line',
smooth: true,
emphasis: { focus: 'series' },
animationDuration: 2000,
data: uni.yearly_data.map(d => d[this.metric])
}));
this.mergeOption = {
xAxis: { data: years.map(String) },
series: series as any
};
}
}
@@ -0,0 +1,42 @@
<div class="ranking-card">
<h4>Topic Rankings</h4>
@if (loading) {
<div class="skeleton-loader">Loading rankings...</div>
} @else{
<table class="ranking-table">
<thead>
<tr>
<th>Rank</th>
<th>University</th>
<th>Latest</th>
<th>5Y Growth</th>
<th>Trend</th>
</tr>
</thead>
<tbody>
@for (row of rankings; track $index) {
<tr [class.top-tier]="row.rank <= 3">
<td>#{{ row.rank }}</td>
<td>
{{ row.university }}
@if (row.is_top_mover) {
<span class="mover-badge" title="Top mover last 3 years"
>🔥</span
>
}
</td>
<td>{{ row.publications | number }}</td>
<td
[class.positive]="row.growth_rate > 0"
[class.negative]="row.growth_rate < 0">
{{ row.growth_rate | number: '1.0-1' }}%
</td>
<td class="trend-col" [attr.data-trend]="row.trend">
{{ getTrendIcon(row.trend) }}
</td>
</tr>
}
</tbody>
</table>
}
</div>
@@ -0,0 +1,22 @@
// src/app/modules/university-ranking/components/ranking-table/university-ranking-table.component.ts
import { Component, Input } from '@angular/core';
import { UniversityRanking } from '../../../api';
import { DecimalPipe } from '@angular/common';
@Component({
selector: 'app-university-ranking-table',
templateUrl: './uni-ranking-table.component.html',
styleUrls: ['./uni-ranking-table.component.scss'],
imports:[DecimalPipe],
})
export class UniversityRankingTableComponent {
@Input() rankings: UniversityRanking[] = [];
@Input() loading: boolean = false;
getTrendIcon(trend: string): string {
if (trend === 'up') return '↑';
if (trend === 'down') return '↓';
return '→';
}
}
@@ -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,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);
};
+1 -5
View File
@@ -6,11 +6,7 @@ export const personResolver: ResolveFn<AuthorsListResponse> = (
route,
state,
) => {
const parseQueryParamArray = (val: any): string[] => {
if (!val) return [];
if (Array.isArray(val)) return val;
return [val];
};
const PERSON_INCLUDE_TAGS =
'topics_full,topic_share,summary_stats,ids,last_known_institutions,' +
'sources,counts_by_year,works_api_url,dates,cited_by_count_boost';
@@ -59,6 +59,12 @@
icon="person"
[size]="200"
[diameter]="200" />
} @else if (resolverState.isResolvingFromOutside('/projects/')){
<app-loading
text="Projektdaten werden geladen..."
icon="article"
[size]="200"
[diameter]="200" />
} @else {
<ng-content></ng-content>
}
@@ -49,12 +49,19 @@
<tr
mat-header-row
*matHeaderRowDef="displayedColumns(); sticky: stickyHeader()"></tr>
<tr
mat-row
*matRowDef="let row; columns: displayedColumns()"
class="element-row"
(click)="toggleRow(row)"></tr>
@if (navigatePrefix() || navigateField()){
<tr
mat-row
*matRowDef="let row; columns: displayedColumns()"
class="element-row"
(click)="navigateToDataField(row)"></tr>
} @else {
<tr
mat-row
*matRowDef="let row; columns: displayedColumns()"
class="element-row"
(click)="toggleRow(row)"></tr>
}
<tr
mat-row
@@ -17,6 +17,7 @@ import {
SortDirection,
} from '@angular/material/sort';
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
import { Router } from '@angular/router';
export interface BaseColumn<T> {
id: string;
@@ -57,7 +58,8 @@ export class DataTableComponent<T> implements AfterViewInit {
activeSortKey = input<string>('');
sortDirection = input<SortDirection>('');
navigatePrefix=input<string>('');
navigateField=input<string>('');
sortChange = output<Sort>();
displayedColumns = computed(() => this.columns().map((col) => col.id));
@@ -65,7 +67,7 @@ export class DataTableComponent<T> implements AfterViewInit {
sort = viewChild.required(MatSort);
constructor() {
constructor(private router:Router) {
effect(() => {
const currentData = this.data();
@@ -110,6 +112,16 @@ export class DataTableComponent<T> implements AfterViewInit {
this.sortChange.emit(sort);
}
navigateToDataField(row: any): void {
if (!this.navigatePrefix() || !this.navigateField()) {
return;
}
const value = row[this.navigateField()];
if (value != null) {
this.router.navigate([this.navigatePrefix(), value]);
}
}
toggleRow(row: T): void {
if (!this.detailTemplate()) return;
this.expandedElement.update((current) => (current === row ? null : row));