diff --git a/service/src/main/inse/dashboard/model.py b/service/src/main/inse/dashboard/model.py
index e6ee4b3d..eae2251a 100644
--- a/service/src/main/inse/dashboard/model.py
+++ b/service/src/main/inse/dashboard/model.py
@@ -42,6 +42,11 @@ class DfgProjectStatusStatistics(BaseModel):
completed: int
+class DfgProjectKeyword(BaseModel):
+ name: str
+ project_count: int
+
+
class DfgProjectTopic(BaseModel):
id: str
name: str
@@ -49,6 +54,7 @@ class DfgProjectTopic(BaseModel):
field: str | None = None
domain: str | None = None
project_count: int
+ keywords: list[DfgProjectKeyword]
class DfgProjectTopics(BaseModel):
diff --git a/service/src/main/inse/dashboard/service.py b/service/src/main/inse/dashboard/service.py
index ac7d5f50..d2056d48 100644
--- a/service/src/main/inse/dashboard/service.py
+++ b/service/src/main/inse/dashboard/service.py
@@ -35,6 +35,7 @@ from .institute_helper import get_openalex_institution
from .model import (
BmbfProjectStatusStatistics,
DashboardStatistics,
+ DfgProjectKeyword,
DashboardStatisticValue,
DfgProjectStatusStatistics,
DfgProjectTopic,
@@ -660,6 +661,12 @@ async def get_dashboard_dfg_topics(
from_year=from_year,
to_year=to_year,
)
+ print(
+ "Dashboard DFG project topics "
+ f"for institution {normalized_id}: "
+ f"{len(project_ids)} project IDs={project_ids}",
+ flush=True,
+ )
topics: dict[str, dict[str, Any]] = {}
matched_project_ids: set[str] = set()
@@ -667,7 +674,7 @@ async def get_dashboard_dfg_topics(
async for hit in elasticsearch.scan(
index=str(ESIndex.PROJECTS_DFG_OPENALEX_TOPICS),
query={"terms": {"project_id": project_ids}},
- source=["project_id", "topic_matches"],
+ source=["project_id", "keyword", "topic_matches"],
page_size=1000,
cluster=ESCluster.INSE,
):
@@ -675,6 +682,7 @@ async def get_dashboard_dfg_topics(
project_id = str(source.get("project_id") or "")
if not project_id:
continue
+ keyword = str(source.get("keyword") or "").strip()
matched_project_ids.add(project_id)
for match in source.get("topic_matches", []):
topic_id = str(match.get("topic_id") or "")
@@ -689,9 +697,12 @@ async def get_dashboard_dfg_topics(
"field": match.get("field"),
"domain": match.get("domain"),
"project_ids": set(),
+ "keywords": {},
},
)
topic["project_ids"].add(project_id)
+ if keyword:
+ topic["keywords"].setdefault(keyword, set()).add(project_id)
topic_list = [
DfgProjectTopic(
@@ -701,6 +712,16 @@ async def get_dashboard_dfg_topics(
field=topic["field"],
domain=topic["domain"],
project_count=len(topic["project_ids"]),
+ keywords=sorted(
+ [
+ DfgProjectKeyword(
+ name=keyword,
+ project_count=len(keyword_project_ids),
+ )
+ for keyword, keyword_project_ids in topic["keywords"].items()
+ ],
+ key=lambda entry: (-entry.project_count, entry.name),
+ ),
)
for topic in topics.values()
]
diff --git a/webapp/src/app/modules/dashboard/dashboard-statistics.service.ts b/webapp/src/app/modules/dashboard/dashboard-statistics.service.ts
index 94fcbaa3..6f406f0b 100644
--- a/webapp/src/app/modules/dashboard/dashboard-statistics.service.ts
+++ b/webapp/src/app/modules/dashboard/dashboard-statistics.service.ts
@@ -59,6 +59,12 @@ export interface DfgProjectTopic {
field?: string | null;
domain?: string | null;
project_count: number;
+ keywords: DfgProjectKeyword[];
+}
+
+export interface DfgProjectKeyword {
+ name: string;
+ project_count: number;
}
export interface DfgProjectTopics {
diff --git a/webapp/src/app/modules/dashboard/dashboard.component.html b/webapp/src/app/modules/dashboard/dashboard.component.html
index 0c8b4d39..7cf8b2bc 100644
--- a/webapp/src/app/modules/dashboard/dashboard.component.html
+++ b/webapp/src/app/modules/dashboard/dashboard.component.html
@@ -280,8 +280,8 @@
DFG-Projekt-Topics
- Verteilung der gematchten Topics aus den DFG-Projekten Ihrer
- Organisation.
+ Gematchte DFG-Projekte nach Field, Subfield und Topic. Ein Klick
+ auf ein Topic zeigt die zugehörigen Keywords.
@if (dfgProjectTopics) {
@@ -302,11 +302,17 @@
} @else if (dfgTopicsError) {
- Das DFG-Topic-Diagramm konnte nicht geladen werden.
+ Die DFG-Topic-Treemap konnte nicht geladen werden.
} @else {
-
+
+
}
}
diff --git a/webapp/src/app/modules/dashboard/dashboard.component.ts b/webapp/src/app/modules/dashboard/dashboard.component.ts
index 41fd6d82..cb9982c5 100644
--- a/webapp/src/app/modules/dashboard/dashboard.component.ts
+++ b/webapp/src/app/modules/dashboard/dashboard.component.ts
@@ -4,7 +4,6 @@ import { MatIconModule } from '@angular/material/icon';
import { Observable, finalize } from 'rxjs';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { MatDialog } from '@angular/material/dialog';
-import { DfgTopicDonutComponent } from './dfg-topic-donut/dfg-topic-donut.component';
import { EuProjectStatusChartComponent } from './eu-project-status-chart/eu-project-status-chart.component';
import { YearRangeSliderComponent } from '../../shared/ui/year-range-slider/year-range-slider.component';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
@@ -24,6 +23,7 @@ import {
DashboardStatistics,
DashboardStatisticsService,
DfgProjectStatusStatistics,
+ DfgProjectTopic,
DfgProjectTopics,
EuProjectStatusStatistics,
TopAuthor,
@@ -58,7 +58,6 @@ type DashboardPeriodMode =
MatIconModule,
RouterLink,
LoadingComponent,
- DfgTopicDonutComponent,
EuProjectStatusChartComponent,
TopicTreemapComponent,
YearRangeSliderComponent,
@@ -94,6 +93,7 @@ export class DashboardComponent implements OnInit {
topicTreemapLoading = false;
topicTreemapError = false;
dfgProjectTopics?: DfgProjectTopics;
+ dfgTopicTreemap?: TopicTreemapData;
dfgTopicsLoading = false;
dfgTopicsError = false;
euProjectStatuses?: EuProjectStatusStatistics;
@@ -111,6 +111,7 @@ export class DashboardComponent implements OnInit {
dashboardFromYear = this.topicTreemapMaxYear - 4;
dashboardToYear = this.topicTreemapMaxYear;
selectedTopicTreemapNode?: string;
+ selectedDfgTopicTreemapNode?: string;
private topicTreemapReloadQueued = false;
private topicTreemapRequestId = 0;
@@ -216,6 +217,61 @@ export class DashboardComponent implements OnInit {
return (this.dfgProjectTopics?.topics.length ?? 0) > 0;
}
+ private buildDfgTopicTreemapData(
+ projectTopics: DfgProjectTopics,
+ ): TopicTreemapData {
+ const fields = new Map<
+ string,
+ Map
+ >();
+ for (const topic of projectTopics.topics) {
+ const fieldName = topic.field?.trim() || 'Ohne Field';
+ const subfieldName = topic.subfield?.trim() || 'Ohne Subfield';
+ const subfields =
+ fields.get(fieldName) ??
+ new Map();
+ const subfield = subfields.get(subfieldName) ?? { topics: [] };
+ subfield.topics.push(topic);
+ subfields.set(subfieldName, subfield);
+ fields.set(fieldName, subfields);
+ }
+
+ return {
+ institution_id: projectTopics.institution_id,
+ organization_name: projectTopics.organization_name,
+ years: [],
+ fields: [...fields.entries()].map(([fieldName, subfields]) => {
+ const mappedSubfields = [...subfields.entries()].map(
+ ([subfieldName, group]) => ({
+ id: `${fieldName}::${subfieldName}`,
+ name: subfieldName,
+ total: group.topics.reduce(
+ (sum, topic) => sum + topic.project_count,
+ 0,
+ ),
+ values: [],
+ topics: group.topics.map((topic) => ({
+ id: topic.id,
+ name: topic.name,
+ total: topic.project_count,
+ values: [],
+ })),
+ }),
+ );
+ return {
+ id: fieldName,
+ name: fieldName,
+ total: mappedSubfields.reduce(
+ (sum, subfield) => sum + subfield.total,
+ 0,
+ ),
+ values: [],
+ subfields: mappedSubfields,
+ };
+ }),
+ };
+ }
+
setDashboardPeriodMode(mode: DashboardPeriodMode): void {
if (mode === this.dashboardPeriodMode) return;
this.dashboardPeriodMode = mode;
@@ -294,6 +350,34 @@ export class DashboardComponent implements OnInit {
this.updateDashboardPeriodUrl();
}
+ onDfgTopicTreemapNodeChange(nodeId: string | undefined): void {
+ this.selectedDfgTopicTreemapNode = nodeId;
+ }
+
+ onDfgTopicTreemapTopicSelect(topic: TopicTreemapTopicSelect): void {
+ const dfgTopic = this.dfgProjectTopics?.topics.find(
+ (entry) => entry.id === topic.topicId,
+ );
+ if (!dfgTopic) return;
+
+ this.dialog.open(
+ TopicWordCloudDialogComponent,
+ {
+ width: '85vw',
+ maxWidth: '92vw',
+ data: {
+ ...topic,
+ source: 'dfg',
+ words: dfgTopic.keywords.map((keyword) => ({
+ id: keyword.name,
+ name: keyword.name,
+ count: keyword.project_count,
+ })),
+ },
+ },
+ );
+ }
+
onTopicTreemapTopicSelect(topic: TopicTreemapTopicSelect): void {
const period = this.selectedPeriodBounds();
this.dialog.open(
@@ -460,6 +544,7 @@ export class DashboardComponent implements OnInit {
.subscribe({
next: (topics) => {
this.dfgProjectTopics = topics;
+ this.dfgTopicTreemap = this.buildDfgTopicTreemapData(topics);
},
error: () => {
this.dfgTopicsError = true;
diff --git a/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.html b/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.html
index 1433163c..08946dda 100644
--- a/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.html
+++ b/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.html
@@ -2,8 +2,18 @@
Topic Insights
-
Keyword Wordcloud
-
Die wichtigsten Begriffe zum ausgewählten Forschungsthema
+
+ {{
+ data.source === 'dfg' ? 'DFG-Keyword Wordcloud' : 'Keyword Wordcloud'
+ }}
+
+
+ {{
+ data.source === 'dfg'
+ ? 'Keywords der DFG-Projekte zum ausgewählten Topic'
+ : 'Die wichtigsten Begriffe zum ausgewählten Forschungsthema'
+ }}
+
diff --git a/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.ts b/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.ts
index 7299e35c..6639bbf4 100644
--- a/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.ts
+++ b/webapp/src/app/modules/dashboard/topic-wordcloud-dialog/topic-wordcloud-dialog.component.ts
@@ -22,6 +22,8 @@ export interface TopicWordCloudDialogData {
subfieldName?: string;
fromYear?: number;
toYear?: number;
+ words?: TopicWordCloudWord[];
+ source?: 'publications' | 'dfg';
}
interface DisplayWord extends TopicWordCloudWord {
@@ -70,6 +72,11 @@ export class TopicWordCloudDialogComponent {
];
constructor() {
+ if (this.data.words) {
+ this.words = this.buildWords(this.data.words);
+ this.loading = false;
+ return;
+ }
this.statisticsService
.getTopicWordCloud(
this.data.topicId,
diff --git a/webapp/src/app/shared/ui/topic-treemap/topic-treemap.component.ts b/webapp/src/app/shared/ui/topic-treemap/topic-treemap.component.ts
index 799d4b41..88b24648 100644
--- a/webapp/src/app/shared/ui/topic-treemap/topic-treemap.component.ts
+++ b/webapp/src/app/shared/ui/topic-treemap/topic-treemap.component.ts
@@ -44,6 +44,8 @@ export class TopicTreemapComponent implements OnChanges {
@Input() data?: TopicTreemapData;
@Input() loading = false;
@Input() selectedNodeId?: string;
+ @Input() countLabel = 'Publikationen';
+ @Input() showCountInTooltip = true;
@Output() selectedNodeIdChange = new EventEmitter();
@Output() topicSelect = new EventEmitter();
@@ -232,10 +234,14 @@ export class TopicTreemapComponent implements OnChanges {
: ''
}
${name}
-
- ${this.formatCount(count)}
- Publikationen
-
+ ${
+ this.showCountInTooltip
+ ? `
+ ${this.formatCount(count)}
+ ${this.escapeHtml(this.countLabel)}
+
`
+ : ''
+ }
Klicken, um diesen Bereich zu vergrößern