feature/keywords-analysis #261

Merged
genja merged 9 commits from feature/keywords-analysis into dev 2026-08-03 20:57:25 +02:00
22 changed files with 440 additions and 215 deletions
@@ -170,25 +170,6 @@ class DfgProjectPublicationSummary(BaseModel):
)
class DfgProjectSubjectArea(BaseModel):
"""A single subject-area classification entry (DFG 'Fachsystematik')."""
model_config = ConfigDict(populate_by_name=True)
fach: str | None = None
fachgebiet: str | None = None
fachkollegium: str | None = None
wissenschaftsbereich: str | None = None
@classmethod
def from_inner(cls, f: DFGProjectFachgebieteInner) -> "DfgProjectSubjectArea":
return cls(
fach=f.fach,
fachgebiet=f.fachgebiet,
fachkollegium=f.fachkollegium,
wissenschaftsbereich=f.wissenschaftsbereich,
)
class DfgProjectDetails(BaseModel):
"""
@@ -253,7 +234,7 @@ class DfgProjectDetails(BaseModel):
subject_area_de: str | None = Field(default=None, description="Subject area, summary text (German)")
subject_area_en: str | None = Field(default=None, description="Subject area, summary text (English)")
subject_classifications: list[DfgProjectSubjectArea] = Field(
subject_classifications: list[DFGProjectFachgebieteInner] = Field(
default_factory=list,
description="Detailed DFG subject-area classification entries (Fachsystematik)",
)
@@ -319,7 +300,7 @@ class DfgProjectDetails(BaseModel):
DfgProjectPublicationSummary.from_inner(p) for p in (project.publications or [])
]
subject_classifications = [
DfgProjectSubjectArea.from_inner(f) for f in (project.fachgebiete or [])
DFGProjectFachgebieteInner.from_dict(f) for f in (project.subject_classifications or [])
]
# De-duplicated flat views, order-preserving
@@ -383,8 +364,6 @@ class DfgProjectDetails(BaseModel):
@classmethod
def from_dict(cls, obj: dict) -> "DfgProjectDetails":
"""Convenience constructor from a raw dict (e.g. a JSON API response body)."""
obj = cls._sanitize_raw_project_dict(obj)
return cls.from_dfg_project(DFGProject.from_dict(obj))
@staticmethod
@@ -49,7 +49,6 @@ class DFGProject(BaseModel):
equipment_group: StrictStr | None = None
equipment_name: StrictStr | None = None
external_link: StrictStr | None = None
fachgebiete: list[DFGProjectFachgebieteInner] | None = None
fetched_at: datetime | None = None
final_report_abstract_de: StrictStr | None = None
final_report_abstract_en: StrictStr | None = None
@@ -81,7 +80,7 @@ class DFGProject(BaseModel):
publications: list[DFGProjectPublicationsInner] | None = None
subject_area_de: StrictStr | None = None
subject_area_en: StrictStr | None = None
subject_classifications: DFGProjectFachgebieteInner | None = None
subject_classifications: list[DFGProjectFachgebieteInner] | None = None
subproject_order: list[StrictStr] | None = None
subprojects: list[DFGProjectSubprojectsInner] | None = None
template_type: StrictStr | None = None
@@ -90,7 +89,7 @@ class DFGProject(BaseModel):
website_html_de: StrictStr | None = None
website_html_en: StrictStr | None = None
topics: list[Topic] | None = None
__properties: ClassVar[list[str]] = ["abstract_de", "abstract_en", "equipment_group", "equipment_name", "external_link", "fachgebiete", "fetched_at", "final_report_abstract_de", "final_report_abstract_en", "funding_end", "funding_period_de", "funding_period_en", "funding_start", "funding_type_de", "funding_type_en", "funding_type_key", "funding_type_sort", "id", "institution_roles_order", "institutions", "international_relation_de", "international_relation_en", "is_transfer_project", "link", "page_url", "parent_project_id", "parent_title_de", "parent_title_en", "person_roles_order", "persons", "project", "project_id", "project_identifier_de", "project_identifier_en", "publications", "subject_area_de", "subject_area_en", "subject_classifications", "subproject_order", "subprojects", "template_type", "title_de", "title_en", "website_html_de", "website_html_en"]
__properties: ClassVar[list[str]] = ["abstract_de", "abstract_en", "equipment_group", "equipment_name", "external_link","fetched_at", "final_report_abstract_de", "final_report_abstract_en", "funding_end", "funding_period_de", "funding_period_en", "funding_start", "funding_type_de", "funding_type_en", "funding_type_key", "funding_type_sort", "id", "institution_roles_order", "institutions", "international_relation_de", "international_relation_en", "is_transfer_project", "link", "page_url", "parent_project_id", "parent_title_de", "parent_title_en", "person_roles_order", "persons", "project", "project_id", "project_identifier_de", "project_identifier_en", "publications", "subject_area_de", "subject_area_en", "subject_classifications", "subproject_order", "subprojects", "template_type", "title_de", "title_en", "website_html_de", "website_html_en"]
model_config = ConfigDict(
validate_by_name=True,
@@ -131,13 +130,6 @@ class DFGProject(BaseModel):
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in fachgebiete (list)
_items = []
if self.fachgebiete:
for _item_fachgebiete in self.fachgebiete:
if _item_fachgebiete:
_items.append(_item_fachgebiete.to_dict())
_dict['fachgebiete'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in institutions (list)
_items = []
if self.institutions:
@@ -164,7 +156,7 @@ class DFGProject(BaseModel):
_dict['publications'] = _items
# override the default output from pydantic by calling `to_dict()` of subject_classifications
if self.subject_classifications:
_dict['subject_classifications'] = self.subject_classifications.to_dict()
_dict['subject_classifications'] = [f.to_dict() for f in self.subject_classifications]
# override the default output from pydantic by calling `to_dict()` of each item in subprojects (list)
_items = []
if self.subprojects:
@@ -191,14 +183,12 @@ class DFGProject(BaseModel):
key=lambda t: t.get("rank") if t.get("rank") is not None else float("inf"),
)
topics = [cls._topic_from_match(t) for t in sorted_topics_raw]
_obj = cls.model_validate({
"abstract_de": obj.get("abstract_de"),
"abstract_en": obj.get("abstract_en"),
"equipment_group": obj.get("equipment_group"),
"equipment_name": obj.get("equipment_name"),
"external_link": obj.get("external_link"),
"fachgebiete": [DFGProjectFachgebieteInner.from_dict(_item) for _item in obj["fachgebiete"]] if obj.get("fachgebiete") is not None else None,
"fetched_at": obj.get("fetched_at"),
"final_report_abstract_de": obj.get("final_report_abstract_de"),
"final_report_abstract_en": obj.get("final_report_abstract_en"),
@@ -230,7 +220,7 @@ class DFGProject(BaseModel):
"publications": [DFGProjectPublicationsInner.from_dict(_item) for _item in obj["publications"]] if obj.get("publications") is not None else None,
"subject_area_de": obj.get("subject_area_de"),
"subject_area_en": obj.get("subject_area_en"),
"subject_classifications": DFGProjectFachgebieteInner.from_dict(obj["subject_classifications"]) if obj.get("subject_classifications") is not None else None,
"subject_classifications": [DFGProjectFachgebieteInner.from_dict(f) for f in (obj.get("subject_classifications") or [])],
"subproject_order": obj.get("subproject_order"),
"subprojects": [DFGProjectSubprojectsInner.from_dict(_item) for _item in obj["subprojects"]] if obj.get("subprojects") is not None else None,
"template_type": obj.get("template_type"),
@@ -654,12 +654,128 @@ async def get_dfg_project_by_id(project_id: str) -> DfgProjectDetails | None:
)
hits = response.get("hits", {}).get("hits", [])
if hits:
hit = hits[0]
hit["_source"]["topics"] = topic_lookup.get(project_id, [])
details = DfgProjectDetails.from_elastic_hit(hit=hit)
return details
return None
if not hits:
return None
hit = hits[0]
source = hit["_source"]
source["topics"] = topic_lookup.get(project_id, [])
persons = source.get("persons", [])
# --- Enrich persons with institute/root info (mirrors search_dfg_projects) ---
person_ids = {
person["person_id"]
for person in persons
if isinstance(person, dict) and person.get("person_id") is not None
}
person_lookup = await get_person_institutes(person_ids=list(person_ids))
institutions: dict[str, dict] = {}
for person in persons:
person_id = person.get("person_id")
institute = person_lookup.get(person_id)
if not institute:
continue
person["root_id"] = institute.get("root_id")
person["institute_id"] = institute.get("institute_id")
person["root_name_de"] = institute.get("root_name_de")
person["root_name_en"] = institute.get("root_name_en")
person["institute_name_de"] = institute.get("institute_name_de")
person["institute_name_en"] = institute.get("institute_name_en")
person["address_country_de"] = institute.get("address_country_de")
person["address_country_en"] = institute.get("address_country_en")
if institute.get("institute_id") is not None:
institutions[f"institute:{institute['institute_id']}"] = {
"institute_id": institute["institute_id"],
"institute_name_de": institute.get("institute_name_de"),
"institute_name_en": institute.get("institute_name_en"),
}
if institute.get("root_id") is not None:
institutions[f"root:{institute['root_id']}"] = {
"institute_id": institute["root_id"],
"institute_name_de": institute.get("root_name_de"),
"institute_name_en": institute.get("root_name_en"),
}
source["institutions"] = list(institutions.values())
return DfgProjectDetails.from_elastic_hit(hit=hit)
async def get_dfg_project_by_id(project_id: str) -> DfgProjectDetails | None:
"""Fetches the details of a single DFG project based on its project ID.
Args:
project_id (str): The project ID to fetch.
Returns:
Optional[DfgProjectDetails]: The project details or None if not found.
"""
topic_lookup = await get_openalex_topics_for_dfg_projects(project_ids=[project_id])
query = {"ids": {"values": [project_id]}}
response = await elasticsearch.search(
index=ESIndex.DFG_PROJECTS,
query=query,
size=1,
)
hits = response.get("hits", {}).get("hits", [])
if not hits:
return None
hit = hits[0]
source = hit["_source"]
source["topics"] = topic_lookup.get(project_id, [])
persons = source.get("persons", [])
#Enrich persons with institute/root info
person_ids = {
person["person_id"]
for person in persons
if isinstance(person, dict) and person.get("person_id") is not None
}
person_lookup = await get_person_institutes(person_ids=list(person_ids))
institutions: dict[str, dict] = {}
for person in persons:
person_id = person.get("person_id")
institute = person_lookup.get(person_id)
if not institute:
continue
person["root_id"] = institute.get("root_id")
person["institute_id"] = institute.get("institute_id")
person["root_name_de"] = institute.get("root_name_de")
person["root_name_en"] = institute.get("root_name_en")
person["institute_name_de"] = institute.get("institute_name_de")
person["institute_name_en"] = institute.get("institute_name_en")
person["address_country_de"] = institute.get("address_country_de")
person["address_country_en"] = institute.get("address_country_en")
if institute.get("institute_id") is not None:
institutions[f"institute:{institute['institute_id']}"] = {
"institute_id": institute["institute_id"],
"institute_name_de": institute.get("institute_name_de"),
"institute_name_en": institute.get("institute_name_en"),
}
if institute.get("root_id") is not None:
institutions[f"root:{institute['root_id']}"] = {
"institute_id": institute["root_id"],
"institute_name_de": institute.get("root_name_de"),
"institute_name_en": institute.get("root_name_en"),
}
source["institutions"] = list(institutions.values())
return DfgProjectDetails.from_elastic_hit(hit=hit)
#BUND
+1 -1
View File
@@ -103,11 +103,11 @@ model/dfgPersonSummary.ts
model/dfgPersonSummaryPage.ts
model/dfgProjectDetails.ts
model/dfgProjectInstitutionRole.ts
model/dfgProjectKeyword.ts
model/dfgProjectPage.ts
model/dfgProjectPersonRole.ts
model/dfgProjectPublicationSummary.ts
model/dfgProjectStatusStatistics.ts
model/dfgProjectSubjectArea.ts
model/dfgProjectSubprojectSummary.ts
model/dfgProjectSummary.ts
model/dfgProjectTopic.ts
@@ -10,7 +10,7 @@
import { DfgProjectPersonRole } from './dfgProjectPersonRole';
import { DfgProjectSubprojectSummary } from './dfgProjectSubprojectSummary';
import { DfgProjectInstitutionRole } from './dfgProjectInstitutionRole';
import { DfgProjectSubjectArea } from './dfgProjectSubjectArea';
import { DFGProjectFachgebieteInner } from './dFGProjectFachgebieteInner';
import { Topic } from './topic';
import { DfgProjectPublicationSummary } from './dfgProjectPublicationSummary';
@@ -49,7 +49,7 @@ export interface DfgProjectDetails {
/**
* Detailed DFG subject-area classification entries (Fachsystematik)
*/
subject_classifications?: Array<DfgProjectSubjectArea>;
subject_classifications?: Array<DFGProjectFachgebieteInner>;
international_relation_de?: string | null;
international_relation_en?: string | null;
/**
@@ -0,0 +1,16 @@
/**
* 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 DfgProjectKeyword {
name: string;
project_count: number;
}
@@ -1,21 +0,0 @@
/**
* 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.
*/
/**
* A single subject-area classification entry (DFG \'Fachsystematik\').
*/
export interface DfgProjectSubjectArea {
fach?: string | null;
fachgebiet?: string | null;
fachkollegium?: string | null;
wissenschaftsbereich?: string | null;
}
@@ -7,6 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { DfgProjectKeyword } from './dfgProjectKeyword';
export interface DfgProjectTopic {
@@ -16,5 +17,6 @@ export interface DfgProjectTopic {
field?: string | null;
domain?: string | null;
project_count: number;
keywords: Array<DfgProjectKeyword>;
}
+1 -1
View File
@@ -68,11 +68,11 @@ export * from './dfgPersonSummary';
export * from './dfgPersonSummaryPage';
export * from './dfgProjectDetails';
export * from './dfgProjectInstitutionRole';
export * from './dfgProjectKeyword';
export * from './dfgProjectPage';
export * from './dfgProjectPersonRole';
export * from './dfgProjectPublicationSummary';
export * from './dfgProjectStatusStatistics';
export * from './dfgProjectSubjectArea';
export * from './dfgProjectSubprojectSummary';
export * from './dfgProjectSummary';
export * from './dfgProjectTopic';
@@ -8,6 +8,11 @@
<a
matTabLink
[routerLink]="[route.path]"
[queryParams]="{
authorId: null,
institutionId: null,
agency: null,
}"
queryParamsHandling="merge"
routerLinkActive
#rla="routerLinkActive"
@@ -51,7 +56,9 @@
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
" />
<app-info-card
[description]="'Durchschnittliche jährliche Förderung durch die Europäische Union'"
[description]="
'Durchschnittliche jährliche Förderung durch die Europäische Union'
"
[value]="
(euAverageAnnualFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
@@ -9,6 +9,11 @@
<a
matTabLink
[routerLink]="[route.path]"
[queryParams]="{
authorId: null,
institutionId: null,
agency: null,
}"
queryParamsHandling="merge"
routerLinkActive
#rla="routerLinkActive"
@@ -4,6 +4,11 @@
<a
matTabLink
[routerLink]="[route.path]"
[queryParams]="{
authorId: null,
institutionId: null,
agency: null,
}"
queryParamsHandling="merge"
routerLinkActive
#rla="routerLinkActive"
@@ -139,41 +139,6 @@
</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 ||
@@ -183,14 +148,18 @@
) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>organization</mat-icon>
<h2>Organisation</h2>
<mat-icon>business</mat-icon>
<h2>Beteiligte Institution</h2>
</div>
<dl class="details-list">
@if (bundProject.executing_agency) {
<div class="detail-row">
<dt>Ausführende Stelle</dt>
<dd>
<dd
class="clickable"
(click)="
searchForInstitutionName(bundProject.executing_agency)
">
{{ bundProject.executing_agency }}
</dd>
</div>
@@ -198,13 +167,26 @@
@if (bundProject.funding_recipient) {
<div class="detail-row">
<dt>Förderempfänger</dt>
<dd>{{ bundProject.funding_recipient }}</dd>
<dd
class="clickable"
(click)="
searchForInstitutionName(bundProject.funding_recipient)
">
{{ bundProject.funding_recipient }}
</dd>
</div>
}
@if (bundProject.project_agency) {
<div class="detail-row">
<dt>Projektagentur</dt>
<dd>
<dd
class="clickable"
(click)="
searchForInstitutionName(
bundProject.project_agency_fullname ||
bundProject.project_agency
)
">
{{
bundProject.project_agency_fullname ||
bundProject.project_agency
@@ -215,7 +197,14 @@
@if (bundProject.department) {
<div class="detail-row">
<dt>Abteilung</dt>
<dd>
<dd
class="clickable"
(click)="
searchForInstitutionName(
bundProject.department_fullname ||
bundProject.department
)
">
{{
bundProject.department_fullname || bundProject.department
}}
@@ -225,7 +214,11 @@
@if (bundProject.division) {
<div class="detail-row">
<dt>Division</dt>
<dd>{{ bundProject.division }}</dd>
<dd
class="clickable"
(click)="searchForInstitutionName(bundProject.division)">
{{ bundProject.division }}
</dd>
</div>
}
</dl>
@@ -5,6 +5,11 @@ import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { BundProjectDetails } from '../../../api/model/bundProjectDetails';
import { ProjectOaTopicsComponent } from '../../../shared/ui/project-oa-topics/project-oa-topics.component';
export interface InstitutionEntry {
label: string;
value: string;
}
@Component({
selector: 'app-bund-details',
standalone: true,
@@ -57,45 +62,48 @@ export class BundDetailsComponent implements OnInit {
});
}
searchForInstitutionName(institutionName: string): void {
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
getInstitutions(): InstitutionEntry[] {
const bp = this.bundProject;
if (!bp) return [];
const institutions: InstitutionEntry[] = [];
if (bp.executing_agency) {
institutions.push({
label: 'Ausführende Stelle',
value: bp.executing_agency,
});
}
if (bp.funding_recipient) {
institutions.push({
label: 'Förderempfänger',
value: bp.funding_recipient,
});
}
if (bp.project_agency) {
institutions.push({
label: 'Projektagentur',
value: bp.project_agency_fullname || bp.project_agency,
});
}
if (bp.department) {
institutions.push({
label: 'Abteilung',
value: bp.department_fullname || bp.department,
});
}
if (bp.division) {
institutions.push({ label: 'Division', value: bp.division });
}
return institutions;
}
// 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
// }
// });
// }
searchForInstitutionName(institutionName: string): void {
this.router.navigate(['/institutions'], {
queryParams: { search: institutionName },
});
}
/**
* All associated persons as a simple list.
*/
@@ -103,13 +111,6 @@ export class BundDetailsComponent implements OnInit {
return this.bundProject?.associated_persons || [];
}
/**
* All institutions as a simple list.
*/
getInstitutions(): string[] {
return this.bundProject?.institutions || [];
}
/**
* Check if project is new
*/
@@ -77,15 +77,6 @@
<span>Status</span>
</div>
</div>
@if (getSubjectArea()) {
<div class="metric-item">
<mat-icon>category</mat-icon>
<div class="metric-content">
<strong>{{ getSubjectArea() }}</strong>
<span>Fachliche Zuordnung</span>
</div>
</div>
}
@if (dfgProject.dfg_procedure) {
<div class="metric-item">
<mat-icon>gavel</mat-icon>
@@ -137,7 +128,49 @@
<p class="description-text">{{ getFinalReportAbstract() }}</p>
</mat-card>
}
<!-- OpenAlex Topics -->
@if (dfgProject.topics && dfgProject.topics.length > 0) {
<app-project-oa-topics
[topics]="dfgProject.topics"></app-project-oa-topics>
}
<!-- Fachsystematik -->
@if (getSubjectClassifications().length > 0) {
<mat-card appearance="outlined" class="card">
<div class="section-header">
<mat-icon>category</mat-icon>
<h2>Fachsystematik</h2>
<span class="count-badge">{{
getSubjectClassifications().length
}}</span>
</div>
<div class="classification-list">
@for (entry of getSubjectClassifications(); track $index) {
<div class="classification-path">
@for (
segment of getClassificationParentSegments(entry);
track $index
) {
<span class="classification-segment">{{ segment }}</span>
<mat-icon class="classification-separator"
>chevron_right</mat-icon
>
}
<div class="classification-leaf-group">
@for (
leaf of getClassificationLeafSegments(entry);
track $index
) {
<span
class="classification-segment classification-segment--leaf">
{{ leaf }}
</span>
}
</div>
</div>
}
</div>
</mat-card>
}
<!-- Beteiligte Personen -->
<mat-card appearance="outlined" class="card">
<div class="section-header">
@@ -175,11 +208,6 @@
<div class="empty-state">Keine Personen gefunden.</div>
}
</mat-card>
<!-- OpenAlex Topics -->
@if (dfgProject.topics && dfgProject.topics.length > 0) {
<app-project-oa-topics
[topics]="dfgProject.topics"></app-project-oa-topics>
}
<!-- Beteiligte Institutionen -->
<mat-card appearance="outlined" class="card">
@@ -336,18 +364,7 @@
<dt>Fachliche Zuordnung</dt>
<dd>{{ getSubjectArea() || 'N/A' }}</dd>
</div>
@if (getSubjectClassifications().length > 0) {
<div class="detail-row">
<dt>Fachsystematik</dt>
<dd>
@for (entry of getSubjectClassifications(); track $index) {
<div class="classification-path">
{{ formatSubjectClassification(entry) }}
</div>
}
</dd>
</div>
}
<div class="detail-row">
<dt>DFG-Verfahren</dt>
<dd>{{ dfgProject.dfg_procedure || 'N/A' }}</dd>
@@ -154,7 +154,7 @@ h1 {
.metrics-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 16px;
padding-top: 20px;
border-top: 1px solid var(--sg-border);
@@ -473,10 +473,54 @@ h1 {
color: var(--sg-text-muted);
}
.classification-list {
display: flex;
flex-direction: column;
gap: 10px;
padding: 16px 20px 20px;
}
.classification-path {
font-size: 13px;
color: var(--sg-text);
line-height: 1.5;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 4px 2px;
padding: 10px 12px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: var(--sg-surface);
}
.classification-segment {
font-size: 12px;
line-height: 1.3;
padding: 3px 10px;
border-radius: 10px;
background: var(--sg-surface-soft);
color: var(--sg-text-muted);
white-space: nowrap;
&--leaf {
background: var(--sg-primary-soft);
color: var(--sg-text);
font-weight: 500;
white-space: normal;
}
}
.classification-leaf-group {
display: flex;
flex-wrap: wrap;
gap: 4px;
}
.classification-separator {
width: 16px;
height: 16px;
font-size: 16px;
color: var(--sg-text-muted);
flex-shrink: 0;
opacity: 0.5;
}
.website-html {
@@ -8,13 +8,9 @@ import { DfgProjectPublicationSummary } from '../../../api/model/dfgProjectPubli
import { DfgProjectSubprojectSummary } from '../../../api/model/dfgProjectSubprojectSummary';
import { DfgProjectInstitutionRole } from '../../../api/model/dfgProjectInstitutionRole';
import { DfgProjectPersonRole } from '../../../api/model/dfgProjectPersonRole';
import { DfgProjectSubjectArea } from '../../../api/model/dfgProjectSubjectArea';
import { DFGProjectFachgebieteInner } from '../../../api/model/dFGProjectFachgebieteInner';
import { ProjectOaTopicsComponent } from '../../../shared/ui/project-oa-topics/project-oa-topics.component';
import { Topic } from '../../../api';
import {
topicHierarchyColor,
TopicHierarchyColorInput,
} from '../../../resolvers/utils/topic-colors';
@Component({
selector: 'app-dfg-details',
standalone: true,
@@ -159,22 +155,26 @@ export class DfgDetailsComponent implements OnInit {
);
}
// --- Subject classification (DFG Fachsystematik) ---
//(DFG Fachsystematik)
getSubjectClassifications(): DfgProjectSubjectArea[] {
getSubjectClassifications(): DFGProjectFachgebieteInner[] {
return this.dfgProject?.subject_classifications ?? [];
}
/** Renders one classification entry as a breadcrumb-like path. */
formatSubjectClassification(entry: DfgProjectSubjectArea): string {
getClassificationParentSegments(entry: DFGProjectFachgebieteInner): string[] {
return [
entry.wissenschaftsbereich,
entry.fachkollegium,
entry.fachgebiet,
entry.fach,
]
.filter((part) => !!part)
.join(' › ');
].filter((part): part is string => !!part);
}
getClassificationLeafSegments(entry: DFGProjectFachgebieteInner): string[] {
if (!entry.fach) return [];
return entry.fach
.split(',')
.map((s) => s.trim())
.filter((s) => !!s);
}
// --- Subprojects & publications ---
@@ -24,7 +24,7 @@
<ng-template #actionsTmp let-element>
<a
[routerLink]="['/projects/bund', element.funding_code]"
[routerLink]="['/projects/bund', getDetailId(element.funding_code)]"
target="_blank"
mat-icon-button
color="primary">
@@ -154,7 +154,10 @@ export class BundProjectTableComponent implements OnInit {
},
];
}
getDetailId(funding_code: string): string | null {
const encodedId = encodeURIComponent(funding_code);
return encodedId;
}
sortNames(names: string[] | undefined): string[] {
return [...(names ?? [])].sort((a, b) => a.localeCompare(b));
}
@@ -27,17 +27,41 @@
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
<ng-template #detailRowTmp let-element>
<div class="classification-container">
@for (classification of element.subject_classifications; track $index) {
<p>
{{ classification.wissenschaftsbereich || '-' }}
→ {{ classification.fachkollegium || '-' }} →
{{ classification.fachgebiet || '-' }} →
{{ classification.fach || '-' }}
</p>
<ng-template #detailRowTmp let-project>
@let classifications = getProjectClassifications(project);
@let isClassificationsExpanded = isProjectClassificationsExpanded(project);
@let visibleClassifications =
isClassificationsExpanded ? classifications : classifications.slice(0, 3);
<div
class="classification-tags"
aria-label="Fachsystematik"
style="padding: 0.5rem 0.5rem">
@for (classification of visibleClassifications; track $index) {
<span
class="publication-institution-tag classification-tag"
[matTooltip]="getClassificationTooltipText(classification)"
matTooltipPosition="above"
[attr.aria-label]="getClassificationTooltipText(classification)">
<mat-icon class="institution-icon">category</mat-icon>
<span class="institution-name">{{
getClassificationFullChain(classification)
}}</span>
</span>
} @empty {
<span>-</span>
<span class="empty-text">-</span>
}
@if (classifications.length > 3) {
<button
type="button"
class="publication-institution-more"
[attr.aria-expanded]="isClassificationsExpanded"
(click)="toggleProjectClassificationsExpansion(project)">
{{
isClassificationsExpanded
? 'weniger'
: '+' + (classifications.length - 3)
}}
</button>
}
</div>
</ng-template>
@@ -130,6 +130,7 @@
.topic-chips,
.institution-tags,
.classification-tags,
.author-tags {
display: flex;
flex-wrap: wrap;
@@ -163,8 +164,16 @@
// Classification container
// ------------------------
.classification-container {
max-width: 200px;
.classification-tag {
max-width: 280px;
cursor: default; // not clickable/filterable, unlike author/institution tags
.institution-name {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
// ------------------------
@@ -124,7 +124,7 @@ export class DfgProjectTableComponent implements OnInit {
},
{
id: 'professional_classification',
header: 'Fachliche Zuordnung',
header: 'Fachsystematik',
type: 'display',
cellTemplate: this.detailRowTmp(),
},
@@ -360,4 +360,39 @@ export class DfgProjectTableComponent implements OnInit {
return this.expandedProjectTopicsId.includes(project.id);
}
expandedProjectClassificationsId: string[] = [];
//classifications
getProjectClassifications(project: DfgProjectSummary): any[] {
return project.subject_classifications ?? [];
}
isProjectClassificationsExpanded(project: DfgProjectSummary): boolean {
if (!project.id) return false;
return this.expandedProjectClassificationsId.includes(project.id);
}
toggleProjectClassificationsExpansion(project: DfgProjectSummary): void {
if (!project.id) return;
if (this.expandedProjectClassificationsId.includes(project.id)) {
this.expandedProjectClassificationsId =
this.expandedProjectClassificationsId.filter((id) => id !== project.id);
} else {
this.expandedProjectClassificationsId.push(project.id);
}
}
getClassificationFullChain(classification: any): string {
return [
classification.wissenschaftsbereich || '-',
classification.fachkollegium || '-',
classification.fachgebiet || '-',
classification.fach || '-',
].join(' → ');
}
getClassificationTooltipText(classification: any): string {
return this.getClassificationFullChain(classification);
}
}