From a4a24b77b9d939feac0855d3f3598ea8eb4d7e2a Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 3 Aug 2026 19:24:12 +0200 Subject: [PATCH 1/8] added cleaning author and institution filters on tab change for project types --- .../institution-projects.component.html | 9 ++++++++- .../projects-results/projects-results.component.html | 5 +++++ .../person-projects/person-projects.component.html | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/webapp/src/app/modules/institution-projects/institution-projects.component.html b/webapp/src/app/modules/institution-projects/institution-projects.component.html index 3edabc81..05d8acf3 100644 --- a/webapp/src/app/modules/institution-projects/institution-projects.component.html +++ b/webapp/src/app/modules/institution-projects/institution-projects.component.html @@ -8,6 +8,11 @@ Date: Mon, 3 Aug 2026 19:25:09 +0200 Subject: [PATCH 2/8] updated view for BUND institution on the detail page --- .../bund-details/bund-details.component.html | 77 ++++++++-------- .../bund-details/bund-details.component.ts | 89 ++++++++++--------- 2 files changed, 80 insertions(+), 86 deletions(-) diff --git a/webapp/src/app/modules/projects/bund-details/bund-details.component.html b/webapp/src/app/modules/projects/bund-details/bund-details.component.html index 345101a3..bd7488e6 100644 --- a/webapp/src/app/modules/projects/bund-details/bund-details.component.html +++ b/webapp/src/app/modules/projects/bund-details/bund-details.component.html @@ -139,41 +139,6 @@ } - - @if (getInstitutions().length > 0) { - -
- business -

Beteiligte Institutionen

- {{ getInstitutions().length }} -
-
- @for (institution of getInstitutions(); track institution) { -
- apartment - {{ institution }} -
- } -
-
- } - - - @if ( bundProject.executing_agency || bundProject.funding_recipient || @@ -183,14 +148,18 @@ ) {
- organization -

Organisation

+ business +

Beteiligte Institution

@if (bundProject.executing_agency) {
Ausführende Stelle
-
+
{{ bundProject.executing_agency }}
@@ -198,13 +167,26 @@ @if (bundProject.funding_recipient) {
Förderempfänger
-
{{ bundProject.funding_recipient }}
+
+ {{ bundProject.funding_recipient }} +
} @if (bundProject.project_agency) {
Projektagentur
-
+
{{ bundProject.project_agency_fullname || bundProject.project_agency @@ -215,7 +197,14 @@ @if (bundProject.department) {
Abteilung
-
+
{{ bundProject.department_fullname || bundProject.department }} @@ -225,7 +214,11 @@ @if (bundProject.division) {
Division
-
{{ bundProject.division }}
+
+ {{ bundProject.division }} +
}
diff --git a/webapp/src/app/modules/projects/bund-details/bund-details.component.ts b/webapp/src/app/modules/projects/bund-details/bund-details.component.ts index 697a7bfe..6a78d422 100644 --- a/webapp/src/app/modules/projects/bund-details/bund-details.component.ts +++ b/webapp/src/app/modules/projects/bund-details/bund-details.component.ts @@ -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 */ -- 2.56.1 From 61aeb5bf865c7d2461551d2f8c0485c809bc2a51 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 3 Aug 2026 19:25:41 +0200 Subject: [PATCH 3/8] fixed nav error caused by BUND ids --- .../ui/bund-project-table/bund-project-table.component.html | 2 +- .../ui/bund-project-table/bund-project-table.component.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html index a86e7f0f..b078bd8d 100644 --- a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html +++ b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.html @@ -24,7 +24,7 @@
diff --git a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts index daeeb614..f5a333e5 100644 --- a/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts +++ b/webapp/src/app/shared/ui/bund-project-table/bund-project-table.component.ts @@ -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)); } -- 2.56.1 From 8cab4ffb42b7112e4f8e46fb87986aa74e842e5f Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 3 Aug 2026 19:26:03 +0200 Subject: [PATCH 4/8] adjusted Fachsystematik column name --- .../shared/ui/dfg-project-table/dfg-project-table.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts index 2b331607..cc8a9015 100644 --- a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts +++ b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts @@ -124,7 +124,7 @@ export class DfgProjectTableComponent implements OnInit { }, { id: 'professional_classification', - header: 'Fachliche Zuordnung', + header: 'Fachsystematik', type: 'display', cellTemplate: this.detailRowTmp(), }, -- 2.56.1 From 9d875b39359d28fdc8ce08c1f8ef5f13a6f7ce39 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 3 Aug 2026 19:26:25 +0200 Subject: [PATCH 5/8] dfg details page minor view adjustments --- .../projects/dfg-details/dfg-details.component.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html index e5ad3ea2..6ef2dc3b 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html @@ -137,7 +137,11 @@

{{ getFinalReportAbstract() }}

} - + + @if (dfgProject.topics && dfgProject.topics.length > 0) { + + }
@@ -175,11 +179,6 @@
Keine Personen gefunden.
} - - @if (dfgProject.topics && dfgProject.topics.length > 0) { - - } -- 2.56.1 From e5f9d8cfdf3bb2e8a005e7e66dd8e94efa9b47b3 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 3 Aug 2026 20:28:39 +0200 Subject: [PATCH 6/8] adjusted view for subject classifications --- .../dfg-details/dfg-details.component.html | 60 ++++++++++++------- .../dfg-details/dfg-details.component.scss | 52 ++++++++++++++-- .../dfg-details/dfg-details.component.ts | 28 ++++----- .../dfg-project-table.component.html | 44 ++++++++++---- .../dfg-project-table.component.scss | 13 +++- .../dfg-project-table.component.ts | 35 +++++++++++ 6 files changed, 181 insertions(+), 51 deletions(-) diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html index 6ef2dc3b..c9b6c1e9 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.html @@ -77,15 +77,6 @@ Status
- @if (getSubjectArea()) { -
- category -
- {{ getSubjectArea() }} - Fachliche Zuordnung -
-
- } @if (dfgProject.dfg_procedure) {
gavel @@ -142,6 +133,44 @@ } + + @if (getSubjectClassifications().length > 0) { + +
+ category +

Fachsystematik

+ {{ + getSubjectClassifications().length + }} +
+
+ @for (entry of getSubjectClassifications(); track $index) { +
+ @for ( + segment of getClassificationParentSegments(entry); + track $index + ) { + {{ segment }} + chevron_right + } +
+ @for ( + leaf of getClassificationLeafSegments(entry); + track $index + ) { + + {{ leaf }} + + } +
+
+ } +
+
+ }
@@ -335,18 +364,7 @@
Fachliche Zuordnung
{{ getSubjectArea() || 'N/A' }}
- @if (getSubjectClassifications().length > 0) { -
-
Fachsystematik
-
- @for (entry of getSubjectClassifications(); track $index) { -
- {{ formatSubjectClassification(entry) }} -
- } -
-
- } +
DFG-Verfahren
{{ dfgProject.dfg_procedure || 'N/A' }}
diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss index 80885471..68d5ae71 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.scss @@ -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 { diff --git a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts index add0ec44..7b72ac75 100644 --- a/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts +++ b/webapp/src/app/modules/projects/dfg-details/dfg-details.component.ts @@ -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 --- diff --git a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html index 607824ed..9c86010c 100644 --- a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html +++ b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html @@ -27,17 +27,41 @@ open_in_new
- -
- @for (classification of element.subject_classifications; track $index) { -

- {{ classification.wissenschaftsbereich || '-' }} - → {{ classification.fachkollegium || '-' }} → - {{ classification.fachgebiet || '-' }} → - {{ classification.fach || '-' }} -

+ + @let classifications = getProjectClassifications(project); + @let isClassificationsExpanded = isProjectClassificationsExpanded(project); + @let visibleClassifications = + isClassificationsExpanded ? classifications : classifications.slice(0, 3); +
+ @for (classification of visibleClassifications; track $index) { + + category + {{ + getClassificationFullChain(classification) + }} + } @empty { - - + - + } + @if (classifications.length > 3) { + }
diff --git a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.scss b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.scss index 5fbc4c11..82987ff1 100644 --- a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.scss +++ b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.scss @@ -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; + } } // ------------------------ diff --git a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts index cc8a9015..baa2ae18 100644 --- a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts +++ b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.ts @@ -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); + } } -- 2.56.1 From 32a38b46fe786fc28d1cb01399f9eb79dcf3390b Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 3 Aug 2026 20:29:47 +0200 Subject: [PATCH 7/8] unified fachgebiete and subject_classifications. Added subject classifications to dfg detail project page --- .../main/inse/models/dfg_project_details.py | 25 +--- .../projects_dfg_v2/project/dfg_project.py | 18 +-- .../inse/projects/projects_search_client.py | 128 +++++++++++++++++- 3 files changed, 128 insertions(+), 43 deletions(-) diff --git a/service/src/main/inse/models/dfg_project_details.py b/service/src/main/inse/models/dfg_project_details.py index fe914373..a5a704f9 100644 --- a/service/src/main/inse/models/dfg_project_details.py +++ b/service/src/main/inse/models/dfg_project_details.py @@ -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 diff --git a/service/src/main/inse/models/projects_dfg_v2/project/dfg_project.py b/service/src/main/inse/models/projects_dfg_v2/project/dfg_project.py index 8ae70f97..8d874a7e 100644 --- a/service/src/main/inse/models/projects_dfg_v2/project/dfg_project.py +++ b/service/src/main/inse/models/projects_dfg_v2/project/dfg_project.py @@ -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"), diff --git a/service/src/main/inse/projects/projects_search_client.py b/service/src/main/inse/projects/projects_search_client.py index b6b0a041..72c9194a 100644 --- a/service/src/main/inse/projects/projects_search_client.py +++ b/service/src/main/inse/projects/projects_search_client.py @@ -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 -- 2.56.1 From fd0bc89771ce8f4868bef17b0dfd8703da79a412 Mon Sep 17 00:00:00 2001 From: genja Date: Mon, 3 Aug 2026 20:29:57 +0200 Subject: [PATCH 8/8] regenerated models and services --- webapp/src/app/api/.openapi-generator/FILES | 2 +- webapp/src/app/api/model/dfgProjectDetails.ts | 4 ++-- webapp/src/app/api/model/dfgProjectKeyword.ts | 16 ++++++++++++++ .../app/api/model/dfgProjectSubjectArea.ts | 21 ------------------- webapp/src/app/api/model/dfgProjectTopic.ts | 2 ++ webapp/src/app/api/model/models.ts | 2 +- 6 files changed, 22 insertions(+), 25 deletions(-) create mode 100644 webapp/src/app/api/model/dfgProjectKeyword.ts delete mode 100644 webapp/src/app/api/model/dfgProjectSubjectArea.ts diff --git a/webapp/src/app/api/.openapi-generator/FILES b/webapp/src/app/api/.openapi-generator/FILES index e751f4aa..3c0e087f 100644 --- a/webapp/src/app/api/.openapi-generator/FILES +++ b/webapp/src/app/api/.openapi-generator/FILES @@ -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 diff --git a/webapp/src/app/api/model/dfgProjectDetails.ts b/webapp/src/app/api/model/dfgProjectDetails.ts index 7d58d592..07bcced0 100644 --- a/webapp/src/app/api/model/dfgProjectDetails.ts +++ b/webapp/src/app/api/model/dfgProjectDetails.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; + subject_classifications?: Array; international_relation_de?: string | null; international_relation_en?: string | null; /** diff --git a/webapp/src/app/api/model/dfgProjectKeyword.ts b/webapp/src/app/api/model/dfgProjectKeyword.ts new file mode 100644 index 00000000..2e898f1c --- /dev/null +++ b/webapp/src/app/api/model/dfgProjectKeyword.ts @@ -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; +} + diff --git a/webapp/src/app/api/model/dfgProjectSubjectArea.ts b/webapp/src/app/api/model/dfgProjectSubjectArea.ts deleted file mode 100644 index c46f610d..00000000 --- a/webapp/src/app/api/model/dfgProjectSubjectArea.ts +++ /dev/null @@ -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; -} - diff --git a/webapp/src/app/api/model/dfgProjectTopic.ts b/webapp/src/app/api/model/dfgProjectTopic.ts index baaff946..4b99c034 100644 --- a/webapp/src/app/api/model/dfgProjectTopic.ts +++ b/webapp/src/app/api/model/dfgProjectTopic.ts @@ -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; } diff --git a/webapp/src/app/api/model/models.ts b/webapp/src/app/api/model/models.ts index c16ec742..afed834d 100644 --- a/webapp/src/app/api/model/models.ts +++ b/webapp/src/app/api/model/models.ts @@ -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'; -- 2.56.1